盘料库出入库流程测试修改,盘料库入库创建入库任务逻辑添加到绑定完成里面

This commit is contained in:
霍尔 committed 2023-09-14 08:49:36 +08:00
1 parent 1fa11ab235
commit 771c12040c
7 files changed
+128 -70

No files matched your search

@@ -10,6 +10,7 @@ using Microsoft.EntityFrameworkCore;
using System.Linq;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Reflection.Emit;
namespace HHWMS.Web.Controllers
{
@@ -63,10 +64,10 @@ namespace HHWMS.Web.Controllers
public ActionResult ScanBox(string boxCode)
{
// 判断任务重复
if (_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.盘料库) && x.ContainerCode.Equals(boxCode)))
if (_unitWork.IsExit<TaskHeader>(x => x.FromLocation == boxCode || x.ToLocation == boxCode))
{
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
};
}
// 判断箱号是否合理
var box = _unitWork.FindSingle<Location>(x => x.Code.Equals(boxCode));
if (box != null)
@@ -76,10 +77,10 @@ namespace HHWMS.Web.Controllers
box.ContainerCode = boxCode;
_unitWork.Update(box);
}
else
{
return JsonMore(null, 500, $"{boxCode}已经被其他任务占用,无法入库!");
}
//else
//{
// return JsonMore(null, 500, $"{boxCode}已经被其他任务占用,无法入库!");
//}
return JsonMore(null);
}
else
@@ -89,7 +90,7 @@ namespace HHWMS.Web.Controllers
}
/// <summary>
/// 入库盘料绑定操作
/// 入库盘料绑定并创建入库任务
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
@@ -126,10 +127,40 @@ namespace HHWMS.Web.Controllers
Qty = receipt.Qty,
Lot = item.Index.ToString(),
ContainerCode = item.BoxCode,
Status = "0",
TaskStatus = InventoryTaskStatus.任务中
};
_unitWork.Add(inventory);
}
var boxcode = data.First().BoxCode;
//创建入库任务
var invList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(boxcode))
.ToList();
if (invList.Count == 0)
{
return JsonMore(null, 500, $"站台{boxcode}没有绑定数据,请正确操作!");
}
var task = new TaskHeader
{
TaskNo = _unitWork.GetSerialNumber("pin", 4),
TaskType = TaskTypeEnum.盘料入库,
Status = TaskStatusEnum.待下发,
ZoneCode = ZoneCodeEnum.盘料库,
FromLocation = boxcode,
TaskDetails = new List<TaskDetail>(),
};
foreach (var item in invList)
{
var detail = new TaskDetail
{
UniqueCode = item.UniqueCode,
FromLocation = item.Lot,
Status = TaskStatusEnum.新建,
CreateTime = DateTime.Now
};
task.TaskDetails.Add(detail);
}
_unitWork.Add(task);
return JsonMore(null);
}