修改
This commit is contained in:
1 parent
523dee5e38
commit
f9bf7be066
12 files changed
+635
-42
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using HHWMS.Web.Models;
|
||||
@@ -334,9 +335,10 @@ namespace HHWMS.Web.Controllers
|
||||
|
||||
if (task != null)
|
||||
{
|
||||
if (task.Status > TaskStatusEnum.已下发)
|
||||
var isSend = 0;
|
||||
if (task.Status >= TaskStatusEnum.已下发)
|
||||
{
|
||||
return FFResult().Alert($"此任务未下发,无需取消!");
|
||||
isSend = 1;
|
||||
}
|
||||
// 判断任务 是否能取消
|
||||
if (task.TaskType.Equals(TaskTypeEnum.盘料入库) || task.TaskType.Equals(TaskTypeEnum.盘料出库))
|
||||
@@ -350,10 +352,100 @@ namespace HHWMS.Web.Controllers
|
||||
};
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
var res = new ApiJsonResult<dynamic>();
|
||||
if (isSend == 1)
|
||||
{
|
||||
res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Success = true;
|
||||
}
|
||||
if ((bool)res?.Success)
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
//盘料盒出库任务删除,连带删除盘料入库和盘料出库任务
|
||||
if (task.TaskType.Equals(TaskTypeEnum.盘料盒出库))
|
||||
{
|
||||
//库位恢复原位
|
||||
List<Location> locations = _unitwork.Find<Location>(x => x.Code == task.FromLocation || x.Code == task.ToLocation).ToList();
|
||||
foreach (var location in locations)
|
||||
{
|
||||
//原仓位数据还原为在仓位的初始状态
|
||||
if (location.Code == task.ContainerCode)
|
||||
{
|
||||
location.ContainerCode = task.ContainerCode;
|
||||
location.Status = LocationStatus.有货;
|
||||
}
|
||||
else
|
||||
{
|
||||
location.ContainerCode = "";
|
||||
location.Status = LocationStatus.空仓位;
|
||||
}
|
||||
_unitwork.Update(location);
|
||||
}
|
||||
//物料恢复原位
|
||||
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode).ToList();
|
||||
foreach (var inventorie in inventories)
|
||||
{
|
||||
inventorie.LocationCode = task.ContainerCode;
|
||||
inventorie.TaskStatus = InventoryTaskStatus.无任务;
|
||||
_unitwork.Update(inventorie);
|
||||
}
|
||||
//删除任务
|
||||
_unitwork.Delete(task);
|
||||
//删除盘料入库任务和库存
|
||||
TaskHeader taskHeader = _unitwork.Find<TaskHeader>(x => x.ContainerCode == task.ContainerCode
|
||||
&& (x.TaskType.Equals(TaskTypeEnum.盘料入库) || x.TaskType.Equals(TaskTypeEnum.盘料出库))).FirstOrDefault();
|
||||
if (taskHeader != null && taskHeader.TaskType.Equals(TaskTypeEnum.盘料入库))
|
||||
{
|
||||
List<Inventory> inventories1 = _unitwork.Find<Inventory>(x => x.ContainerCode == taskHeader.FromLocation
|
||||
&& x.TaskStatus == InventoryTaskStatus.任务中).ToList();
|
||||
foreach (var inventorie1 in inventories1)
|
||||
{
|
||||
_unitwork.Delete(inventorie1);
|
||||
}
|
||||
_unitwork.Delete(taskHeader);
|
||||
|
||||
}
|
||||
//删除盘料出库任务
|
||||
else if (taskHeader != null && taskHeader.TaskType.Equals(TaskTypeEnum.盘料出库))
|
||||
{
|
||||
_unitwork.Delete(taskHeader);
|
||||
}
|
||||
}
|
||||
//盘料盒入库任务删除,托盘恢复原位
|
||||
else if (task.TaskType.Equals(TaskTypeEnum.盘料盒入库))
|
||||
{
|
||||
// 删除任务,处理数据
|
||||
List<Location> locations = _unitwork.Find<Location>(x => x.ContainerCode == task.ContainerCode).ToList();
|
||||
foreach (var location in locations)
|
||||
{
|
||||
//原仓位数据还原为在仓位的初始状态
|
||||
if (location.Code == task.ContainerCode)
|
||||
{
|
||||
location.ContainerCode = task.ContainerCode;
|
||||
location.Status = LocationStatus.有货;
|
||||
}
|
||||
else
|
||||
{
|
||||
location.ContainerCode = "";
|
||||
location.Status = LocationStatus.空仓位;
|
||||
}
|
||||
_unitwork.Update(location);
|
||||
}
|
||||
List<Inventory> inventories = _unitwork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode).ToList();
|
||||
foreach (var inventorie in inventories)
|
||||
{
|
||||
inventorie.LocationCode = task.ContainerCode;
|
||||
inventorie.TaskStatus = InventoryTaskStatus.无任务;
|
||||
_unitwork.Update(inventorie);
|
||||
}
|
||||
_unitwork.Delete(task);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().Alert($"操作失败,{res.Msg}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in new issue
Block a user