feat(入库流程): 实现完整的入库流程逻辑
1. 在IUnitWork接口和实现中添加Save方法用于保存更改 2. 完善WCS任务状态处理逻辑,区分线边库和成品库的不同处理流程 3. 实现入库控制器SubmitReceipt方法,包含库位分配、任务创建、库存记录等完整流程 4. 修改LocationTypeEnum枚举值定义,将L改为C表示成品库位 5. 优化库位查询逻辑,增加高度和类型过滤条件 6. 修改容器类型从枚举改为静态类定义 7. 修复LocationController中库位编码生成格式 8. 在WcsRequest中添加LocationType字段用于库位类型区分
This commit is contained in:
1 parent
2b01cc7584
commit
42c26b2800
9 files changed
+322
-32
No files matched your search
@@ -6,6 +6,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
namespace HHWMS.Web
|
||||
@@ -45,6 +46,8 @@ namespace HHWMS.Web
|
||||
|
||||
}
|
||||
|
||||
#region base
|
||||
|
||||
public override void DoAdd()
|
||||
{
|
||||
base.DoAdd();
|
||||
@@ -59,7 +62,8 @@ namespace HHWMS.Web
|
||||
{
|
||||
base.DoDelete();
|
||||
}
|
||||
|
||||
#endregion base
|
||||
|
||||
/// <summary>
|
||||
/// 查找单伸位巷道的空仓位
|
||||
/// </summary>
|
||||
@@ -67,10 +71,12 @@ namespace HHWMS.Web
|
||||
{
|
||||
var locations = DC.Set<Location>()
|
||||
.Where(l => l.RoadWay == roadway
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& l.RowFlag == 0) // 单伸位只查找外仓位
|
||||
&& !l.IsStop
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& l.RowFlag == 0) // 单伸位只查找外仓位
|
||||
.OrderBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
return locations?.Code;
|
||||
@@ -79,20 +85,25 @@ namespace HHWMS.Web
|
||||
/// <summary>
|
||||
/// 查找双伸位巷道的空仓位
|
||||
/// </summary>
|
||||
private string GetEmptyLocationByDouble(int roadway)
|
||||
private string GetEmptyLocationByDouble(int roadway,LocationTypeEnum locationType, decimal? height = 0)
|
||||
{
|
||||
// 一次性获取所需的所有数据,避免多次查询数据库
|
||||
var locationPairs = DC.Set<Location>()
|
||||
.Where(l => l.RoadWay == roadway)
|
||||
.Where(l => l.RoadWay == roadway
|
||||
&& l.Type == locationType
|
||||
&& !l.IsStop
|
||||
&& l.Height >= height)
|
||||
.Select(l => new
|
||||
{
|
||||
l.Code,
|
||||
l.ContiguousCode,
|
||||
l.Status,
|
||||
l.RowFlag,
|
||||
l.Height,
|
||||
l.Layer,
|
||||
l.Line
|
||||
})
|
||||
.AsNoTracking()
|
||||
.ToDictionary(l => l.Code);
|
||||
|
||||
// 1. 优先查找里外仓位都为空的里仓位
|
||||
@@ -101,7 +112,8 @@ namespace HHWMS.Web
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var outer)
|
||||
&& outer.Status == LocationStatusEnum.Empty)
|
||||
.OrderBy(l => l.Layer)
|
||||
.OrderBy(l => l.Height)
|
||||
.ThenBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.FirstOrDefault();
|
||||
|
||||
@@ -116,7 +128,8 @@ namespace HHWMS.Web
|
||||
&& l.Status == LocationStatusEnum.Empty
|
||||
&& locationPairs.TryGetValue(l.ContiguousCode, out var inner)
|
||||
&& inner.Status == LocationStatusEnum.Some)
|
||||
.OrderBy(l => l.Layer)
|
||||
.OrderBy(l => l.Height)
|
||||
.ThenBy(l => l.Layer)
|
||||
.ThenBy(l => l.Line)
|
||||
.FirstOrDefault();
|
||||
|
||||
@@ -148,13 +161,13 @@ namespace HHWMS.Web
|
||||
locationCode = GetEmptyLocationBySingle(request.RoadWay.Value);
|
||||
break;
|
||||
case 4: // 双伸位
|
||||
locationCode = GetEmptyLocationByDouble(request.RoadWay.Value);
|
||||
locationCode = GetEmptyLocationByDouble(request.RoadWay.Value, request.LocationType, request.Height);
|
||||
break;
|
||||
default:
|
||||
return ResponseResult<dynamic>.Error("未知的巷道类型");
|
||||
}
|
||||
|
||||
if (locationCode == null)
|
||||
if (string.IsNullOrWhiteSpace(locationCode))
|
||||
{
|
||||
return ResponseResult<dynamic>.Error("未找到可用的空仓位");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user