From a3e91357eef046aa939f15ee4e976f232427b7d0 Mon Sep 17 00:00:00 2001 From: zhougf Date: Wed, 29 May 2024 17:09:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B9=E5=99=A8=E5=87=BA=E5=BA=93=20?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E7=A6=81=E7=94=A8=20=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=20task=20station=3D1?= =?UTF-8?q?=E7=9A=84=E5=87=BA=E5=BA=93=E4=BB=BB=E5=8A=A1=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E4=B8=8B=E5=8F=91=E5=85=A5=E5=BA=93=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=92=8CAGv=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HHWMS.Web/Areas/Api/IWCSController.cs | 32 +++---- .../Controllers/ContainerController.cs | 85 +++++++++++++++++++ .../Configs/Controllers/LocationController.cs | 26 ++++++ .../ContainerVMs/ContainerListVM.cs | 2 + .../ViewModels/LocationVMs/LocationListVM.cs | 3 + .../Areas/Configs/Views/Location/Index.cshtml | 10 ++- .../Controllers/InventoryController.cs | 1 + .../Controllers/ReceiptInController.cs | 10 ++- .../Shipment/Controllers/ShipOutController.cs | 24 ++++-- HHWMS.Web/Resources/Program.zh.resx | 6 ++ 10 files changed, 166 insertions(+), 33 deletions(-) diff --git a/HHWMS.Web/Areas/Api/IWCSController.cs b/HHWMS.Web/Areas/Api/IWCSController.cs index 035b119..af66d30 100644 --- a/HHWMS.Web/Areas/Api/IWCSController.cs +++ b/HHWMS.Web/Areas/Api/IWCSController.cs @@ -149,30 +149,26 @@ namespace HHWMS.Web _unitWork.BatchDelete(inventoryList2); } - // 创建入库任务 - if (inventoryList2.Count == 0) + // 如果是出库页面创建的任务,则创建入库任务并联动AGV + if (task.Station == "1") { new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode, false, false); // 下发AGV到出库口的任务 - // 如果对接 执行下方任务,否则不执行 - var interfaceAgv = _unitWork.FindSingle(x => x.Prefix == "interfaceAGV")?.Value; - if (interfaceAgv == 1) + + var agv_task_id = Wtm.ConfigInfo.AppSettings.FirstOrDefault(x => x.Key == "OutIn").Value; + var postAgv = new { + task_id = agv_task_id, + }; - var agv_task_id = Wtm.ConfigInfo.AppSettings.FirstOrDefault(x => x.Key == "OutIn").Value; - var postAgv = new - { - task_id = agv_task_id, - }; - - var res = Wtm.CallAPI("ACS", "task_mould_do", - HttpMethodEnum.POST, postAgv); - // if (res.Result.Data.ack == 0) - // { - // - // } - } + var res = Wtm.CallAPI("ACS", "task_mould_do", + HttpMethodEnum.POST, postAgv); + // if (res.Result.Data.ack == 0) + // { + // + // } + } break; diff --git a/HHWMS.Web/Areas/Configs/Controllers/ContainerController.cs b/HHWMS.Web/Areas/Configs/Controllers/ContainerController.cs index f53854f..1b48497 100644 --- a/HHWMS.Web/Areas/Configs/Controllers/ContainerController.cs +++ b/HHWMS.Web/Areas/Configs/Controllers/ContainerController.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using HHWMS.Web.Models; @@ -290,5 +291,89 @@ namespace HHWMS.Web.Controllers return FFResult().CloseDialog().RefreshGrid(); } } + + [ActionDescription("Inventory.Out")] + public IActionResult Out(int id) + { + var container = _unitwork.FindById(id); + if (container == null) + { + return FFResult().RefreshGrid().Alert("选定容器不存在!请检查后再执行出库任务!"); + } + + if (string.IsNullOrEmpty(container.LocationCode)) + { + return FFResult().RefreshGrid().Alert("选定容器不在库位!请检查后再执行出库任务!"); + } + + if (_unitwork.IsExit(x => x.ContainerCode.Equals(container.Code))) + { + return FFResult().RefreshGrid().Alert("选定容器已存在任务!请检查后再执行出库任务!"); + } + var location = _unitwork.FindSingle(x => x.Code == container.LocationCode); + if (location != null) + { + location.Status = LocationStatus.任务锁; + location.UpdateTime = DateTime.Now; + location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS"; + _unitwork.Update(location); + + // 查找container,并更新状态 + // var container = _unitwork.FindSingle(x => x.Code == location.ContainerCode); + container.IsLock = ContainerLockEnum.任务锁; + container.UpdateTime = DateTime.Now; + container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS"; + _unitwork.Update(container); + + //创建出库任务 + var task = new TaskHeader + { + ZoneCode = ZoneCodeEnum.立库, + TaskNo = _unitwork.GetSerialNumber("Out"), + TaskType = TaskTypeEnum.立库出库, + ContainerCode = location.ContainerCode, + FromLocation = location.Code, + ToLocation = "", + Status = TaskStatusEnum.待下发, + CreateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS", + CreateTime = DateTime.Now + }; + _unitwork.Add(task); + + // 下发任务到wcs + var postData = new + { + TaskNo = task.TaskNo, + PalletNo = task.ContainerCode, + FromLocation = task.FromLocation, + ToLocation = task.ToLocation + }; + try + { + var res = Wtm.CallAPI>("WCS", "TaskAssign", HttpMethodEnum.POST, postData) + .Result.Data; + + if (res.Success) + { + task.Status = TaskStatusEnum.已下发; + } + else + { + task.ErrorMsg = res.Msg; + } + } + catch (Exception ex) + { + task.ErrorMsg = ex.Message; + } + task.UpdateTime = DateTime.Now; + task.UpdateBy = "WMS"; + _unitwork.Update(task); + + } + + return FFResult().RefreshGrid().Message("任务创建成功!"); + + } } } diff --git a/HHWMS.Web/Areas/Configs/Controllers/LocationController.cs b/HHWMS.Web/Areas/Configs/Controllers/LocationController.cs index 9b0b862..2a5b6c8 100644 --- a/HHWMS.Web/Areas/Configs/Controllers/LocationController.cs +++ b/HHWMS.Web/Areas/Configs/Controllers/LocationController.cs @@ -6,6 +6,7 @@ using WalkingTec.Mvvm.Mvc; using WalkingTec.Mvvm.Core.Extensions; using HHWMS.Web; using System.Collections.Generic; +using System.Linq; using HHWMS.Web.Models; namespace HHWMS.Web.Controllers @@ -287,5 +288,30 @@ namespace HHWMS.Web.Controllers return Ok(); } + [ActionDescription("Location.StopLocation")] + public ActionResult StopLocation(string[] ids) + { + _unitwork.BatchUpdate(x => ids.Contains(x.ID.ToString()), + x => new Location + { + IsStop = true, + UpdateBy = Wtm.LoginUserInfo.ITCode, + UpdateTime = DateTime.Now + }); + return FFResult().RefreshGrid().Message("库位禁用成功!"); + } + + [ActionDescription("Location.LiftLocation")] + public ActionResult LiftLocation(string[] ids) + { + _unitwork.BatchUpdate(x => ids.Contains(x.ID.ToString()), + x => new Location + { + IsStop = false, + UpdateBy = Wtm.LoginUserInfo.ITCode, + UpdateTime = DateTime.Now + }); + return FFResult().RefreshGrid().Message("库位解禁成功!"); + } } } diff --git a/HHWMS.Web/Areas/Configs/ViewModels/ContainerVMs/ContainerListVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/ContainerVMs/ContainerListVM.cs index a8b29d7..87d0dab 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/ContainerVMs/ContainerListVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/ContainerVMs/ContainerListVM.cs @@ -31,6 +31,8 @@ namespace HHWMS.Web this.MakeStandardAction("Container", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800), this.MakeStandardAction("Container", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"), this.MakeAction("Container","AddContainer",Localizer["Container.AddContainer"],Localizer["Container.AddContainer"],GridActionParameterTypesEnum.NoId,"configs"), + this.MakeAction("Container","Out",Localizer["Inventory.Out"],Localizer["Inventory.Out"],GridActionParameterTypesEnum.SingleId,"configs"), + this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs") .SetShowDialog(false).SetOnClickScript("print"), }; diff --git a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs index b69dc67..13b5115 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs @@ -33,6 +33,9 @@ namespace HHWMS.Web this.MakeStandardAction("Location", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800), this.MakeStandardAction("Location", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"), this.MakeAction("Location","AddLocation",Localizer["Location.AddLocation"],Localizer["Location.AddLocation"],GridActionParameterTypesEnum.NoId,"configs"), + this.MakeAction("Location","StopLocation",Localizer["Location.StopLocation"],Localizer["Location.StopLocation"],GridActionParameterTypesEnum.MultiIds,"configs"), + this.MakeAction("Location","LiftLocation",Localizer["Location.LiftLocation"],Localizer["Location.LiftLocation"],GridActionParameterTypesEnum.MultiIds,"configs"), + this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs") .SetShowDialog(false).SetOnClickScript("print"), diff --git a/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml b/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml index 0b53a0c..6878d13 100644 --- a/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml @@ -5,15 +5,17 @@ -@* + + + +@* - - *@ -@**@ + +*@ diff --git a/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs b/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs index ddc8690..bba8875 100644 --- a/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs +++ b/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs @@ -225,6 +225,7 @@ namespace HHWMS.Web.Controllers } #endregion + [ActionDescription("Inventory.Out")] public IActionResult Out(int id) { var inv = _unitwork.FindById(id); diff --git a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs index 8d8d577..4cb8a29 100644 --- a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs +++ b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs @@ -61,9 +61,10 @@ namespace HHWMS.Web.Controllers //查找仓位 var location = _unitWork.Find(u => u.Status == LocationStatus.空仓位 - && u.Type == container.Type) - .OrderBy(x => x.Layer) - .ThenBy(x => x.Line) + && u.Type == container.Type + && !u.IsStop) + .OrderByDescending(x => x.Layer) + .ThenByDescending(x => x.Line) .FirstOrDefault(); // 判断location是否为空 @@ -130,11 +131,12 @@ namespace HHWMS.Web.Controllers } catch (Exception ex) { + task.ErrorMsg = ex.Message; } - task.UpdateTime = DateTime.Now; task.UpdateBy = "WMS"; _unitWork.Update(task); + if (agv) { // 调用AGV接口 diff --git a/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs b/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs index 34553b5..b23a17b 100644 --- a/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs +++ b/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs @@ -55,6 +55,7 @@ public class ShipOutController : BaseController ContainerCode = location.ContainerCode, FromLocation = location.Code, ToLocation = "", + Station = "1", Status = TaskStatusEnum.待下发, CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS", CreateTime = DateTime.Now @@ -69,25 +70,34 @@ public class ShipOutController : BaseController FromLocation = task.FromLocation, ToLocation = task.ToLocation }; - var res = Wtm.CallAPI>("WCS", "TaskAssign", HttpMethodEnum.POST, postData) - .Result.Data; - if (res.Success) + try { - task.Status = TaskStatusEnum.已下发; + var res = Wtm.CallAPI>("WCS", "TaskAssign", HttpMethodEnum.POST, postData) + .Result.Data; + if (res.Success) + { + task.Status = TaskStatusEnum.已下发; + } + else + { + task.ErrorMsg = res.Msg; + } } - else + catch (Exception ex) { - task.ErrorMsg = res.Msg; + task.ErrorMsg = ex.Message; } + task.UpdateTime = DateTime.Now; task.UpdateBy = "WMS"; _unitWork.Update(task); + return JsonMore(null); } else { - return JsonMore(null, 500, "库内无可用容器!"); + return JsonMore(null, 500, "库内无可用空容器!"); } } diff --git a/HHWMS.Web/Resources/Program.zh.resx b/HHWMS.Web/Resources/Program.zh.resx index 2208aa1..628b75f 100644 --- a/HHWMS.Web/Resources/Program.zh.resx +++ b/HHWMS.Web/Resources/Program.zh.resx @@ -1152,6 +1152,12 @@ 添加库位 + + 禁用库位 + + + 解禁库位 + 起始列