设计出库口入库流程
托盘、周转箱分区存放
This commit is contained in:
1 parent
70e6866e20
commit
a6168a75bf
7 files changed
+99
-53
No files matched your search
@@ -12,10 +12,12 @@ namespace HHWMS.Web.Controllers
|
||||
public partial class ReceiptInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
private readonly WTMContext _context;
|
||||
|
||||
public ReceiptInController(IUnitWork unitWork)
|
||||
public ReceiptInController(IUnitWork unitWork, WTMContext wtmContext)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
_context = wtmContext;
|
||||
}
|
||||
|
||||
#region Index
|
||||
@@ -29,8 +31,12 @@ namespace HHWMS.Web.Controllers
|
||||
#endregion Index
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult TaskIn(string containerCode, bool inv)
|
||||
public ActionResult TaskIn(string containerCode, bool inv, bool agv)
|
||||
{
|
||||
if (Wtm == null)
|
||||
{
|
||||
Wtm = _context;
|
||||
}
|
||||
// 判断containerCode是否为空
|
||||
if (string.IsNullOrEmpty(containerCode))
|
||||
{
|
||||
@@ -45,17 +51,17 @@ namespace HHWMS.Web.Controllers
|
||||
// 如果 container的库位不为空,或者islock为true,则返回错误信息
|
||||
if (!string.IsNullOrEmpty(container.LocationCode) || container.IsLock == ContainerLockEnum.任务锁)
|
||||
{
|
||||
return JsonMore(null, 500, $"容器 {containerCode} 已被占用!");
|
||||
return JsonMore(null, 500, $"容器 {containerCode} 已被锁定或已在库内!");
|
||||
}
|
||||
|
||||
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
|
||||
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
|
||||
// _unitWork.Update(container);
|
||||
|
||||
//查找仓位
|
||||
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位)
|
||||
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位
|
||||
&& u.Type == container.Type)
|
||||
.OrderBy(x => x.Layer)
|
||||
.ThenBy(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
@@ -67,7 +73,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
location.Status = LocationStatus.任务锁;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
|
||||
location.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
|
||||
_unitWork.Update(location);
|
||||
|
||||
if (inv) //有货
|
||||
@@ -95,7 +101,7 @@ namespace HHWMS.Web.Controllers
|
||||
FromLocation = "",
|
||||
ToLocation = location.Code,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS",
|
||||
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitWork.Add(task);
|
||||
@@ -108,21 +114,37 @@ namespace HHWMS.Web.Controllers
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
try
|
||||
{
|
||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||
.Result.Data;
|
||||
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Update(task);
|
||||
|
||||
if (agv)
|
||||
{
|
||||
// 调用AGV接口
|
||||
var task_id = Wtm.ConfigInfo.AppSettings
|
||||
.FirstOrDefault(x => x.Key == "OutIn").Value;
|
||||
var res2 = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do", HttpMethodEnum.POST, new
|
||||
{
|
||||
task_id = task_id
|
||||
});
|
||||
}
|
||||
return JsonMore(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user