任务添加zoneid
添加物料打印 添加物料工序 添加库存出库 修改状态返回接口 wcs请求添加 重量和入口
This commit is contained in:
1 parent
42c26b2800
commit
b12ed2d5e5
54 files changed
+1442
-393
No files matched your search
@@ -14,7 +14,7 @@ namespace HHWMS.Web
|
||||
public partial class LocationVM : BaseCRUDVM<Location>
|
||||
{
|
||||
public List<ComboSelectListItem> AllLocationZones { get; set; }
|
||||
|
||||
|
||||
[Display(Name = "Location.BeginLine", Description = "起始列")]
|
||||
public short BeginLine { get; set; }
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace HHWMS.Web
|
||||
[Display(Name = "Location.RoadwayType", Description = "巷道类型")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public short RoadwayType { get; set; }
|
||||
|
||||
public List<ComboSelectListItem> RoadwayTypes { get; set; }
|
||||
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace HHWMS.Web
|
||||
protected override void InitVM()
|
||||
{
|
||||
AllLocationZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
|
||||
|
||||
|
||||
var currentCulture = Wtm.CurrentCulture;
|
||||
var dictData = DC.Set<SysDictData>().ToList();
|
||||
RoadwayTypes = dictData.Where(x => x.DictType == "RoadwayType").Select(x => new ComboSelectListItem
|
||||
@@ -43,13 +44,12 @@ namespace HHWMS.Web
|
||||
Text = currentCulture == "zh" ? x.DictLabel : x.DictLabelUs,
|
||||
Value = x.DictValue
|
||||
}).ToList();
|
||||
|
||||
}
|
||||
|
||||
#region base
|
||||
|
||||
|
||||
public override void DoAdd()
|
||||
{
|
||||
{
|
||||
base.DoAdd();
|
||||
}
|
||||
|
||||
@@ -62,18 +62,20 @@ namespace HHWMS.Web
|
||||
{
|
||||
base.DoDelete();
|
||||
}
|
||||
|
||||
#endregion base
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查找单伸位巷道的空仓位
|
||||
/// </summary>
|
||||
private string GetEmptyLocationBySingle(int? roadway)
|
||||
{
|
||||
var locations = DC.Set<Location>()
|
||||
.Where(l => l.RoadWay == roadway
|
||||
.Where(l => l.RoadWay == roadway
|
||||
&& !l.IsStop
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& l.RowFlag == 0) // 单伸位只查找外仓位
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& l.RowFlag == 0) // 单伸位只查找外仓位
|
||||
.OrderBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.AsNoTracking()
|
||||
@@ -85,7 +87,7 @@ namespace HHWMS.Web
|
||||
/// <summary>
|
||||
/// 查找双伸位巷道的空仓位
|
||||
/// </summary>
|
||||
private string GetEmptyLocationByDouble(int roadway,LocationTypeEnum locationType, decimal? height = 0)
|
||||
private string GetEmptyLocationByDouble(int roadway, LocationTypeEnum locationType, decimal? height = 0)
|
||||
{
|
||||
// 一次性获取所需的所有数据,避免多次查询数据库
|
||||
var locationPairs = DC.Set<Location>()
|
||||
@@ -93,11 +95,12 @@ namespace HHWMS.Web
|
||||
&& l.Type == locationType
|
||||
&& !l.IsStop
|
||||
&& l.Height >= height)
|
||||
.Select(l => new
|
||||
.Select(l => new
|
||||
{
|
||||
l.Code,
|
||||
l.ContiguousCode,
|
||||
l.Status,
|
||||
l.ContainerStatus,
|
||||
l.RowFlag,
|
||||
l.Height,
|
||||
l.Layer,
|
||||
@@ -108,10 +111,12 @@ namespace HHWMS.Web
|
||||
|
||||
// 1. 优先查找里外仓位都为空的里仓位
|
||||
var emptyInnerLocation = locationPairs.Values
|
||||
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
||||
&& outer.Status == LocationStatusEnum.Empty)
|
||||
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
||||
&& outer.Status == LocationStatusEnum.未锁
|
||||
&& outer.ContainerStatus == LocationStatus.空仓位)
|
||||
.OrderBy(l => l.Height)
|
||||
.ThenBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
@@ -124,10 +129,12 @@ namespace HHWMS.Web
|
||||
|
||||
// 2. 查找里仓位有货,外仓位为空的外仓位
|
||||
var availableOuterLocation = locationPairs.Values
|
||||
.Where(l => l.RowFlag == 0
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
|
||||
&& inner.Status == LocationStatusEnum.Some)
|
||||
.Where(l => l.RowFlag == 0
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
|
||||
&& inner.Status == LocationStatusEnum.未锁
|
||||
&& inner.ContainerStatus == LocationStatus.有货)
|
||||
.OrderBy(l => l.Height)
|
||||
.ThenBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
@@ -161,7 +168,8 @@ namespace HHWMS.Web
|
||||
locationCode = GetEmptyLocationBySingle(request.RoadWay.Value);
|
||||
break;
|
||||
case 4: // 双伸位
|
||||
locationCode = GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.Height);
|
||||
locationCode =
|
||||
GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.Height);
|
||||
break;
|
||||
default:
|
||||
return ResponseResult<dynamic>.Error("未知的巷道类型");
|
||||
@@ -175,6 +183,40 @@ namespace HHWMS.Web
|
||||
return ResponseResult<dynamic>.Success(new { LocationCode = locationCode });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线边库查找空仓位
|
||||
/// </summary>
|
||||
public string GetEmptyLocationFromXb(int beginLine, int endLine)
|
||||
{
|
||||
var location = DC.Set<Location>()
|
||||
.Where(l => l.Type == LocationTypeEnum.X
|
||||
&& !l.IsStop
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& l.RowFlag == 0
|
||||
&& (l.Line >= beginLine && l.Line <= endLine)) // 单伸位只查找外仓位
|
||||
.OrderBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
// 没查找合适的就找靠近的此区域的
|
||||
if (location == null)
|
||||
{
|
||||
location = DC.Set<Location>()
|
||||
.Where(l => l.Type == LocationTypeEnum.X
|
||||
&& !l.IsStop
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& l.RowFlag == 0) // 单伸位只查找外仓位
|
||||
.OrderBy(l => Math.Abs(l.Line - (endLine - beginLine) / 2))
|
||||
.ThenBy(l => l.Layer)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
return location?.Code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据巷道名称获取巷道类型
|
||||
/// </summary>
|
||||
@@ -204,10 +246,10 @@ namespace HHWMS.Web
|
||||
// 获取所有巷道配置
|
||||
var roadwayConfigs = DC.Set<SysDictData>()
|
||||
.Where(x => x.DictType == "RoadwayConfig")
|
||||
.Select(x => new
|
||||
{
|
||||
Roadway = x.DictLabel,
|
||||
Type = x.DictValue
|
||||
.Select(x => new
|
||||
{
|
||||
Roadway = x.DictLabel,
|
||||
Type = x.DictValue
|
||||
})
|
||||
.ToDictionary(x => x.Roadway, x => x.Type);
|
||||
|
||||
@@ -223,6 +265,7 @@ namespace HHWMS.Web
|
||||
l.Code,
|
||||
l.ContiguousCode,
|
||||
l.Status,
|
||||
l.ContainerStatus,
|
||||
l.RowFlag,
|
||||
l.Layer,
|
||||
l.Line,
|
||||
@@ -250,7 +293,9 @@ namespace HHWMS.Web
|
||||
{
|
||||
case "2": // 单伸位
|
||||
var singleLocations = roadwayLocations
|
||||
.Where(l => l.RowFlag == 0 && l.Status == LocationStatusEnum.Empty)
|
||||
.Where(l => l.RowFlag == 0
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位)
|
||||
.OrderBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.Select(l => new
|
||||
@@ -267,10 +312,12 @@ namespace HHWMS.Web
|
||||
case "4": // 双伸位
|
||||
// 1. 查找里外都为空的里仓位
|
||||
var emptyInnerLocations = roadwayLocations
|
||||
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& allLocations.TryGetValue(l.ContiguousCode, out var outer)
|
||||
&& outer.Status == LocationStatusEnum.Empty)
|
||||
.Where(l => l.RowFlag == RowFlagEnum.Inner
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& allLocations.TryGetValue(l.ContiguousCode, out var outer)
|
||||
&& outer.Status == LocationStatusEnum.未锁
|
||||
&& outer.ContainerStatus == LocationStatus.空仓位)
|
||||
.OrderBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.Select(l => new
|
||||
@@ -285,10 +332,12 @@ namespace HHWMS.Web
|
||||
|
||||
// 2. 查找里仓位有货,外仓位为空的外仓位
|
||||
var availableOuterLocations = roadwayLocations
|
||||
.Where(l => l.RowFlag == 0
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& allLocations.TryGetValue(l.ContiguousCode, out var inner)
|
||||
&& inner.Status == LocationStatusEnum.Some)
|
||||
.Where(l => l.RowFlag == 0
|
||||
&& l.Status == LocationStatusEnum.未锁
|
||||
&& l.ContainerStatus == LocationStatus.空仓位
|
||||
&& allLocations.TryGetValue(l.ContiguousCode, out var inner)
|
||||
&& inner.Status == LocationStatusEnum.未锁
|
||||
&& inner.ContainerStatus == LocationStatus.有货)
|
||||
.OrderBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.Select(l => new
|
||||
@@ -309,8 +358,8 @@ namespace HHWMS.Web
|
||||
return ResponseResult<dynamic>.Error("未找到可用的空仓位");
|
||||
}
|
||||
|
||||
return ResponseResult<dynamic>.Success(new
|
||||
{
|
||||
return ResponseResult<dynamic>.Success(new
|
||||
{
|
||||
Locations = availableLocations,
|
||||
Total = availableLocations.Count
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user