添加库位监控
库存 库位 添加zone权限管控
This commit is contained in:
1 parent
b005422b01
commit
e90e0db019
43 files changed
+536
-479
No files matched your search
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using HHWMS.Web.Models;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public class LocationMonitor2DVM : BaseVM
|
||||
{
|
||||
public string Area { get; set; }
|
||||
public string Row { get; set; }
|
||||
|
||||
public class LocationGridItem
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public short Row { get; set; }
|
||||
public short Line { get; set; }
|
||||
public short Layer { get; set; }
|
||||
public LocationStatusEnum Status { get; set; }
|
||||
public string ContainerCode { get; set; }
|
||||
}
|
||||
|
||||
public IEnumerable<int> GetAreas()
|
||||
{
|
||||
return DC.Set<Location>()
|
||||
.Select(x => x.ZoneId)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<short> GetRows(int area)
|
||||
{
|
||||
return DC.Set<Location>()
|
||||
.Where(x => x.ZoneId == area)
|
||||
.Select(x => x.Row)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<dynamic> GetLocationsByAreaAndRow(int area, short row)
|
||||
{
|
||||
var result = DC.Set<Location>()
|
||||
.Where(x => x.ZoneId == area && x.Row == row)
|
||||
.OrderBy(x => x.Line)
|
||||
.Select(x => new
|
||||
{
|
||||
Code = x.Code,
|
||||
Row = x.Row,
|
||||
Line = x.Line,
|
||||
Layer = x.Layer,
|
||||
x.Status,
|
||||
Status1 = x.Status.GetEnumDisplayName(),
|
||||
ContainerCode = x.ContainerCode
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetEnumDisplayName(Enum enumValue)
|
||||
{
|
||||
var fieldInfo = enumValue.GetType().GetField(enumValue.ToString());
|
||||
var displayAttribute = fieldInfo.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault() as DisplayAttribute;
|
||||
|
||||
return displayAttribute?.Name ?? enumValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user