1. 添加你入库页面验证
2. 库存查询条件 3. 接口任务完成修改 4. 添加物料及物料工序的修改
This commit is contained in:
1 parent
13d3a96f0c
commit
713c3528ad
15 files changed
+281
-155
No files matched your search
@@ -380,134 +380,142 @@ namespace HHWMS.Web.Controllers
|
||||
[ActionDescription("TaskType.Out")]
|
||||
public ActionResult InvOut2(InventoryVM vm)
|
||||
{
|
||||
var id = vm.Entity.ID;
|
||||
// 校验参数
|
||||
if (string.IsNullOrWhiteSpace(vm.OutPort))
|
||||
try
|
||||
{
|
||||
return FFResult().Alert("出口必选,请选择后重试!");
|
||||
}
|
||||
// 校验库存
|
||||
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
|
||||
if (inv == null)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 校验容器
|
||||
var container = _unitWork.FindSingle<Container>(x => x.Code == inv.ContainerCode);
|
||||
if (container == null)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
var id = vm.Entity.ID;
|
||||
// 校验参数
|
||||
if (string.IsNullOrWhiteSpace(vm.OutPort))
|
||||
{
|
||||
return FFResult().Alert("出口必选,请选择后重试!");
|
||||
}
|
||||
|
||||
if (container.IsLock == ContainerLockEnum.任务锁)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 校验库位
|
||||
var location = _unitWork.FindSingle<Location>(x => x.Code == inv.LocationCode);
|
||||
if (location == null)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
// 校验库存
|
||||
var inv = _unitWork.FindSingle<Inventory>(x => x.ID == id);
|
||||
if (inv == null)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存不存在,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
if (location.Status == LocationStatusEnum.锁定)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 创建任务
|
||||
var task = new TaskHeader()
|
||||
{
|
||||
TaskNo = _unitWork.GetSerialNumber("Out", 6),
|
||||
ZoneId = inv.ZoneId,
|
||||
TaskType = TaskTypeEnum.出库,
|
||||
FromLocation = inv.LocationCode,
|
||||
ToLocation = vm.OutPort,
|
||||
ContainerCode = inv.ContainerCode,
|
||||
RoadWay = 2,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
|
||||
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||
var result = locationVm.SendWcsTask(task);
|
||||
if (result.Status)
|
||||
{
|
||||
// 更新库存
|
||||
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||
inv.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(inv);
|
||||
|
||||
// 更新容器
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(container);
|
||||
|
||||
// 更新库位
|
||||
location.Status = LocationStatusEnum.锁定;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(location);
|
||||
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().Message(result.Message?? "WCS任务下发失败").RefreshGrid();
|
||||
}
|
||||
// 6. 调用WCS接口下发任务
|
||||
|
||||
/*
|
||||
var wcsTaskModel = new WCSTaskModel
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation, // 入库任务起始位置为空
|
||||
ToLocation = task.ToLocation,
|
||||
};
|
||||
if (inv.TaskStatus == InventoryTaskStatusEnum.Locked)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存已被锁定!,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
//调用WCS任务下发接口
|
||||
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSCP", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
|
||||
|
||||
if (wcsResult != null && wcsResult.Success)
|
||||
{
|
||||
// WCS任务下发成功
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
_unitWork.Add(task);
|
||||
|
||||
// 更新库存
|
||||
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||
inv.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(inv);
|
||||
|
||||
// 更新容器
|
||||
// _unitWork.BatchUpdate<Container>(x => x.Code == task.ContainerCode, x => new Container()
|
||||
// {
|
||||
// IsLock = ContainerLockEnum.任务锁,
|
||||
// UpdateTime = DateTime.Now
|
||||
// });
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(container);
|
||||
|
||||
// 更新库位
|
||||
location.Status = LocationStatusEnum.锁定;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(location);
|
||||
|
||||
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
||||
// 校验容器
|
||||
var container = _unitWork.FindSingle<Container>(x => x.Code == inv.ContainerCode);
|
||||
if (container == null)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存的容器不存在,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
if (container.IsLock == ContainerLockEnum.任务锁)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("库存所在容器已被锁定!,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 校验库位
|
||||
var location = _unitWork.FindSingle<Location>(x => x.Code == inv.LocationCode);
|
||||
if (location == null)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("所选库存不在库内,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
if (location.Status == LocationStatusEnum.锁定)
|
||||
{
|
||||
return FFResult().CloseDialog().Alert("库存所在仓位已被锁定!,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 创建任务
|
||||
var task = new TaskHeader()
|
||||
{
|
||||
TaskNo = _unitWork.GetSerialNumber("Out", 6),
|
||||
ZoneId = inv.ZoneId,
|
||||
TaskType = TaskTypeEnum.出库,
|
||||
FromLocation = inv.LocationCode,
|
||||
ToLocation = vm.OutPort,
|
||||
ContainerCode = inv.ContainerCode,
|
||||
RoadWay = 2,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
|
||||
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||
var result = locationVm.SendWcsTask(task);
|
||||
if (result.Status)
|
||||
{
|
||||
// 更新库存
|
||||
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||
inv.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(inv);
|
||||
|
||||
// 更新容器
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(container);
|
||||
|
||||
// 更新库位
|
||||
location.Status = LocationStatusEnum.锁定;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(location);
|
||||
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
return FFResult().CloseDialog().Message(result.Message ?? "WCS任务下发失败").RefreshGrid();
|
||||
}
|
||||
// 6. 调用WCS接口下发任务
|
||||
|
||||
/*
|
||||
var wcsTaskModel = new WCSTaskModel
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation, // 入库任务起始位置为空
|
||||
ToLocation = task.ToLocation,
|
||||
};
|
||||
|
||||
//调用WCS任务下发接口
|
||||
var wcsResult = Wtm.CallAPI<WCSTaskResponse>("WCSCP", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
|
||||
|
||||
if (wcsResult != null && wcsResult.Success)
|
||||
{
|
||||
// WCS任务下发成功
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
_unitWork.Add(task);
|
||||
|
||||
// 更新库存
|
||||
inv.TaskStatus = InventoryTaskStatusEnum.Locked;
|
||||
inv.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(inv);
|
||||
|
||||
// 更新容器
|
||||
// _unitWork.BatchUpdate<Container>(x => x.Code == task.ContainerCode, x => new Container()
|
||||
// {
|
||||
// IsLock = ContainerLockEnum.任务锁,
|
||||
// UpdateTime = DateTime.Now
|
||||
// });
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(container);
|
||||
|
||||
// 更新库位
|
||||
location.Status = LocationStatusEnum.锁定;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(location);
|
||||
|
||||
return FFResult().CloseDialog().Message("出库任务创建成功").RefreshGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
// WCS任务下发失败
|
||||
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
|
||||
}*/
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
// WCS任务下发失败
|
||||
return FFResult().CloseDialog().Message(wcsResult?.Msg ?? "WCS任务下发失败").RefreshGrid();
|
||||
}*/
|
||||
|
||||
return FFResult().CloseDialog().Alert(ex.Message).RefreshGrid();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user