单据明细点数
This commit is contained in:
1 parent
2459d4664a
commit
bdaaa0d5d9
7 files changed
+838
-73
No files matched your search
@@ -54,79 +54,127 @@ namespace HHWMS.Web
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult ReturnStatus(WcsRequest request)
|
||||
public IActionResult ReturnStatus(TaskResponse response)
|
||||
{
|
||||
/*// 参数判断
|
||||
if (request.State == null || request.PalletNo == null)
|
||||
var taskno = response.TaskId.Split("-")[0];
|
||||
//wcs 任务反馈
|
||||
var task = _unitwork.Find<TaskHeader>(x => x.TaskNo.Equals(taskno) && x.Status != TaskStatusEnum.完成).Include(x => x.TaskDetails).FirstOrDefault();
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
return ApiResultError(msg: $"传入参数不正确!");
|
||||
}
|
||||
var task = _unitwork.FindSingle<TaskHeader>(x => x.ContainerCode.Equals(request.PalletNo));
|
||||
if (task == null)
|
||||
{
|
||||
return ApiResultError(msg: $"未找到容器号{request.PalletNo}的任务!");
|
||||
}
|
||||
switch (task.TaskType)
|
||||
{
|
||||
case TaskTypeEnum.In:
|
||||
//1.更新库位状态(目的仓位有货)
|
||||
_unitwork.BatchUpdate<Location>(x => x.Code.Equals(task.ToLocation), x => new Location
|
||||
if (task.Status != TaskStatusEnum.完成 && response.Result == (int)TaskStatusEnum.完成)
|
||||
{
|
||||
var newTask = new TaskHeader
|
||||
{
|
||||
Status = LocationStatus.有货
|
||||
});
|
||||
//2.更新容器(旭东不需要)
|
||||
//3.根据任务明细,创建库存和库存交易
|
||||
var details = _unitwork.Find<TaskDetail>(x => x.TaskHeaderId.Equals(task.ID));
|
||||
foreach (var detail in details)
|
||||
TaskDetails = new List<TaskDetail>()
|
||||
};
|
||||
var tasktolocatioin = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.ToLocation));
|
||||
var taskfromlocatioin = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.FromLocation));
|
||||
switch (task.TaskType)
|
||||
{
|
||||
//创建库存
|
||||
var inventory = new Inventory
|
||||
{
|
||||
MaterialCode = detail.MaterialCode,
|
||||
MaterialName = detail.MaterialName,
|
||||
MaterialSpec = detail.MaterialSpec,
|
||||
MaterialUnit = detail.MaterialUnit,
|
||||
Batch = detail.Batch,
|
||||
Lot = detail.Lot,
|
||||
ContainerCode = task.ContainerCode,
|
||||
LocationCode = task.ToLocation,
|
||||
Qty = detail.Qty,
|
||||
TaskStatus = InventoryTaskStatus.无任务
|
||||
};
|
||||
_unitwork.Add(inventory);
|
||||
//创建库存交易
|
||||
var invTran = new InventoryTransaction
|
||||
{
|
||||
Type = InventoryTranType.入库,
|
||||
MaterialCode = detail.MaterialCode,
|
||||
MaterialName = detail.MaterialName,
|
||||
MaterialSpec = detail.MaterialSpec,
|
||||
MaterialUnit = detail.MaterialUnit,
|
||||
Batch = detail.Batch,
|
||||
Lot = detail.Lot,
|
||||
ContainerCode = task.ContainerCode,
|
||||
LocationCode = task.ToLocation,
|
||||
Qty = detail.Qty,
|
||||
};
|
||||
_unitwork.Add(invTran);
|
||||
case TaskTypeEnum.盘料盒入库:
|
||||
// 更新库位
|
||||
// 起始库位为空
|
||||
// 目标库位为有货
|
||||
// 更新库存
|
||||
task.Status = TaskStatusEnum.完成;
|
||||
|
||||
break;
|
||||
case TaskTypeEnum.盘料盒出库:
|
||||
// 更新库位
|
||||
// 起始库位为空
|
||||
// 目标库位为有货
|
||||
// 更新库存
|
||||
task.Status = TaskStatusEnum.完成;
|
||||
// 料盒出库是为了入,还是为了出 1是出,2是入
|
||||
/*if (task.Station == "1")
|
||||
{
|
||||
|
||||
}
|
||||
else if (task.Station == "2")
|
||||
{
|
||||
|
||||
}*/
|
||||
// 测试 创建盘料出库任务
|
||||
var locationList = _unitwork.Find<Location>(x => x.Row == tasktolocatioin.Row && "T,G2".Contains(x.Type)).ToList();
|
||||
newTask.ZoneCode = "L";
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("pout", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料出库;
|
||||
newTask.ContainerCode = "L02";
|
||||
newTask.FromLocation = locationList.First(x => x.Type.Equals("G2")).Code;
|
||||
newTask.ToLocation = "L02";
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
newTask.TaskDetails.Add(new TaskDetail
|
||||
{
|
||||
UniqueCode = $"{newTask.TaskNo}-{i}",
|
||||
FromLocation = i.ToString(),
|
||||
ToLocation = i.ToString(),
|
||||
Status = TaskStatusEnum.新建
|
||||
});
|
||||
}
|
||||
_unitwork.Add(newTask);
|
||||
break;
|
||||
case TaskTypeEnum.盘料入库:
|
||||
var ll = response.TaskId.Split("-")[1];
|
||||
task.TaskDetails.First(x => x.FromLocation == ll).Status = TaskStatusEnum.完成;
|
||||
// 查询料塔 是否还有已下发,未完成的盘料入库任务 有不操作,没有 创建料盒入库任务
|
||||
if (!task.TaskDetails.Any(x => x.Status < TaskStatusEnum.完成))
|
||||
{
|
||||
task.Status = TaskStatusEnum.完成;
|
||||
// 测试 创建料盒入库任务
|
||||
var fromL = _unitwork.FindSingle<Location>(x => x.Row.Equals(tasktolocatioin.Row) && x.Type == "G1");
|
||||
newTask.ZoneCode = "L";
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("in", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒入库;
|
||||
newTask.ContainerCode = fromL.Code;
|
||||
newTask.FromLocation = fromL.Code;
|
||||
newTask.ToLocation = "L01-02-01-01";
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
//newTask.Station = task.Station;
|
||||
_unitwork.Add(newTask);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case TaskTypeEnum.盘料出库:
|
||||
var lll = response.TaskId.Split("-")[1];
|
||||
task.TaskDetails.First(x => x.FromLocation == lll).Status = TaskStatusEnum.完成;
|
||||
// 查询工位 是否还有已下发,未完成的盘料出库任务 有不操作,没有 创建料盒入库任务
|
||||
if (!task.TaskDetails.Any(x => x.Status < TaskStatusEnum.完成))
|
||||
{
|
||||
task.Status = TaskStatusEnum.完成;
|
||||
// 测试 创建盘料入库任务
|
||||
var locationList1 = _unitwork.Find<Location>(x => x.Row == tasktolocatioin.Row && "T,G2".Contains(x.Type)).ToList();
|
||||
newTask.ZoneCode = "L";
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("pin", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料入库;
|
||||
newTask.ContainerCode = locationList1.First(x => x.Type.Equals("T")).Code;
|
||||
newTask.FromLocation = tasktolocatioin.Code;
|
||||
newTask.ToLocation = taskfromlocatioin.Code;
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
newTask.TaskDetails.Add(new TaskDetail
|
||||
{
|
||||
UniqueCode = $"{newTask.TaskNo}-{i}",
|
||||
FromLocation = i.ToString(),
|
||||
ToLocation = i.ToString(),
|
||||
Status = TaskStatusEnum.新建
|
||||
});
|
||||
}
|
||||
_unitwork.Add(newTask);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//4.调用MES接口,告诉MES物料入库
|
||||
break;
|
||||
|
||||
case TaskTypeEnum.Out:
|
||||
//1.更新库位状态(起始仓位为空)
|
||||
//2.更新容器(旭东不需要)
|
||||
//3.删除对应的库存信息,创建库存交易
|
||||
//4.调用MES接口,告诉MES物料出库
|
||||
break;
|
||||
|
||||
case TaskTypeEnum.Move:
|
||||
//1.更新库位状态(起始仓位为空,目的仓位有货)
|
||||
//2.更新容器(旭东不需要)
|
||||
//3.更新库存信息的库位
|
||||
break;
|
||||
_unitwork.Update(task);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return ApiResult();
|
||||
}
|
||||
|
||||
@@ -191,9 +239,9 @@ namespace HHWMS.Web
|
||||
newTask.ZoneCode = "L";
|
||||
newTask.TaskNo = _unitwork.GetSerialNumber("pout", 4);
|
||||
newTask.TaskType = TaskTypeEnum.盘料出库;
|
||||
newTask.ContainerCode = "L01";
|
||||
newTask.ContainerCode = "L02";
|
||||
newTask.FromLocation = locationList.First(x => x.Type.Equals("G2")).Code;
|
||||
newTask.ToLocation = "L01";
|
||||
newTask.ToLocation = "L02";
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
@@ -221,7 +269,7 @@ namespace HHWMS.Web
|
||||
newTask.TaskType = TaskTypeEnum.盘料盒入库;
|
||||
newTask.ContainerCode = fromL.Code;
|
||||
newTask.FromLocation = fromL.Code;
|
||||
newTask.ToLocation = "L01-01-19-01";
|
||||
newTask.ToLocation = "L01-02-01-01";
|
||||
newTask.Status = TaskStatusEnum.待下发;
|
||||
//newTask.Station = task.Station;
|
||||
_unitwork.Add(newTask);
|
||||
|
||||
Reference in new issue
Block a user