From b833415dbf5e3a41157f8d5acbfd06e035266162 Mon Sep 17 00:00:00 2001 From: zgf Date: Wed, 22 Nov 2023 03:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E6=96=99=E5=87=BA1=E4=B8=AA=E7=9B=98?= =?UTF-8?q?=E6=96=99=E7=9B=92=E5=AF=B9=E5=A4=9A=E6=AC=A1=E6=96=99=E5=A1=94?= =?UTF-8?q?=20=E6=95=A3=E6=96=99=E5=87=BA=E5=BA=93=E6=89=AB=E6=8F=8F=20?= =?UTF-8?q?=E7=AB=99=E5=8F=B0=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HHWMS.Web/Areas/Api/IWCSController.cs | 4 +- .../Shipment/Controllers/ShipOutController.cs | 23 +-- .../Areas/Shipment/Views/ShipOut/Index.cshtml | 2 +- .../System/Controllers/jobs/SendWmsJob.cs | 136 +++++++++--------- HHWMS.Web/appsettings.json | 16 +-- 5 files changed, 88 insertions(+), 93 deletions(-) diff --git a/HHWMS.Web/Areas/Api/IWCSController.cs b/HHWMS.Web/Areas/Api/IWCSController.cs index a758020..b16d668 100644 --- a/HHWMS.Web/Areas/Api/IWCSController.cs +++ b/HHWMS.Web/Areas/Api/IWCSController.cs @@ -204,7 +204,9 @@ namespace HHWMS.Web .Include(x => x.TaskDetails).FirstOrDefault(); if (plrTask != null) { - var details = plrTask.TaskDetails.Where(x => !string.IsNullOrEmpty(x.ContainerCode) && x.ContainerCode.Equals(task.ContainerCode)); + var details = plrTask.TaskDetails.Where(x => !string.IsNullOrEmpty(x.ContainerCode) + && x.ContainerCode.Equals(task.ContainerCode) + && !string.IsNullOrEmpty(x.ToLocation)); foreach (var detail in details) { detail.Status = TaskStatusEnum.待下发; diff --git a/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs b/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs index bb31e47..7626351 100644 --- a/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs +++ b/HHWMS.Web/Areas/Shipment/Controllers/ShipOutController.cs @@ -41,33 +41,22 @@ public class ShipOutController : BaseController Location box = new Location(); if (code.Contains("C")) { - box = _unitWork.FindSingle(x => x.ContainerCode.Equals(code) && x.Type == LocationTypeEnum.散料库站台); + box = _unitWork.FindSingle(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.散料库站台); } else if (code.Contains("L")) { - box = _unitWork.FindSingle(x => x.Code.Equals(code)); + box = _unitWork.FindSingle(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.料塔); } // 判断箱号是否合理 if (box != null) { - if (box.Type == LocationTypeEnum.散料库站台 || box.Type == LocationTypeEnum.料塔) - { - var inv = _unitWork.Find(x => x.LocationCode.Equals(code)); - if (code.Contains("C")) - { - inv = _unitWork.Find(x => x.ContainerCode.Equals(code)); - } - return JsonMore(inv); - } - else - { - return JsonMore(null, 500, $"{code}不在站台!"); - } - + var inv = _unitWork.Find(x => x.LocationCode.Equals(code)); + return JsonMore(inv); + } else { - return JsonMore(null, 500, $"{code}不正确!"); + return JsonMore(null, 500, $"站台信息 {code} 不正确,请检查后重新扫描!"); } } diff --git a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml index 6884cdb..685a29e 100644 --- a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml +++ b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml @@ -92,7 +92,7 @@ }, type: "", taskType: [ - { label: "散料箱", value: "slbox" }, + { label: "散料站台", value: "slbox" }, { label: "料塔周转箱", value: "lt" }, { label: "唯一码", value: "uniqueCode" }, ], diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs index a7d5283..1e40fb1 100644 --- a/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs +++ b/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs @@ -96,9 +96,9 @@ namespace HHWMS.Web var taskUniques = _unitwork.Find(x => x.Status > TaskStatusEnum.新建) .Select(x => x.UniqueCode).ToList(); var taskInvs = _unitwork.Find(x => taskUniques.Contains(x.UniqueCode)).ToList(); - shiInventorys.Except(lockInvs); - shiInventorys.DistinctBy(x => x.UniqueCode); - var inventoryList = shiInventorys.GroupBy(x => x.ContainerCode) + var newList = shiInventorys.Except(taskInvs).ToList(); + newList = newList.DistinctBy(x => x.UniqueCode).ToList(); + var inventoryList = newList.GroupBy(x => x.ContainerCode) .ToList(); //散料库 @@ -176,9 +176,11 @@ namespace HHWMS.Web var gLoc = _unitwork.Find(x => x.ContainerCode == item.Key && x.Row == location.Row && x.Type.Equals(LocationTypeEnum.堆垛机工位)).FirstOrDefault(); - if (gLoc != null) + var cTask = _unitwork.Find(x => x.ContainerCode == item.Key + && x.TaskType == TaskTypeEnum.盘料盒出库).FirstOrDefault(); + if (gLoc != null || cTask != null) { - //盘料箱已在堆垛机工位,直接生成盘料出库任务 + //盘料箱已在堆垛机工位,或者有此料箱的出库任务,直接生成盘料出库任务 } else { @@ -197,6 +199,7 @@ namespace HHWMS.Web ContainerCode = item.Key, FromLocation = location.ContainerCode, ToLocation = gLoc.Code, + Station = "1", Status = TaskStatusEnum.待下发, Priority = 0, CreateTime = DateTime.Now, @@ -212,79 +215,73 @@ namespace HHWMS.Web var tLoc = _unitwork.Find(x => string.IsNullOrEmpty(x.ContainerCode) && x.Row == row && x.Type.Equals(LocationTypeEnum.料塔)) - .FirstOrDefault(); + .FirstOrDefault(); - //查询料塔是否为空 - if (tLoc == null) + //判断是否存在此托盘的出库任务 + var containerTask = _unitwork.Find(x => x.Status < TaskStatusEnum.已下发 + && x.ContainerCode == item.Key + && x.TaskType == TaskTypeEnum.盘料出库) + .Include(x => x.TaskDetails) + .FirstOrDefault(); + if (containerTask != null) { - //判断是否存在此托盘的出库任务 - var containerTask = _unitwork.Find(x => x.Status < TaskStatusEnum.已下发 - && x.ContainerCode == item.Key - && x.TaskType == TaskTypeEnum.盘料出库) - .Include(x => x.TaskDetails) - .FirstOrDefault(); - if (containerTask != null) + tLoc = _unitwork.Find(x => x.Code == containerTask.ToLocation + && x.Type.Equals(LocationTypeEnum.料塔)) + .FirstOrDefault(); + foreach (var inventory in item) { - tLoc = _unitwork.Find(x => x.Code == containerTask.ToLocation - && x.Type.Equals(LocationTypeEnum.料塔)) - .FirstOrDefault(); - foreach (var inventory in item) + if (tLoc.Height < tLoc.Length) { - if (tLoc.Height < tLoc.Length) + // 库存不在已建任务明细中,新增任务明细 + if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode))) { - // 库存不在已建任务明细中,新增任务明细 - if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode))) + containerTask.TaskDetails.Add(new TaskDetail { - containerTask.TaskDetails.Add(new TaskDetail - { - UniqueCode = inventory.UniqueCode, - Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}", - FromLocation = inventory.Lot, - ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(), - Status = TaskStatusEnum.待下发, - ContainerCode = inventory.ContainerCode, - CreateTime = DateTime.Now - }); - tLoc.Height += 1; - } - //存在 - else - { - foreach (var i in containerTask.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建)) - { - i.Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}"; - i.ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(); - i.Status = TaskStatusEnum.待下发; - tLoc.Height += 1; - } - } - containerTask.Status = TaskStatusEnum.待下发; + UniqueCode = inventory.UniqueCode, + Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}", + FromLocation = inventory.Lot, + ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(), + Status = TaskStatusEnum.待下发, + ContainerCode = inventory.ContainerCode, + CreateTime = DateTime.Now + }); + tLoc.Height += 1; } + //存在 else { - // 库存不在已建任务明细中,新增任务明细 - if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode))) - { - containerTask.TaskDetails.Add(new TaskDetail - { - UniqueCode = inventory.UniqueCode, - FromLocation = inventory.Lot, - Status = TaskStatusEnum.新建, - ContainerCode = inventory.ContainerCode, - CreateTime = DateTime.Now - }); - } + var i = containerTask.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建 + && x.UniqueCode == inventory.UniqueCode) + .FirstOrDefault(); + + i.Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}"; + i.ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(); + i.Status = TaskStatusEnum.待下发; + tLoc.Height += 1; + } + } + else + { + // 库存不在已建任务明细中,新增任务明细 + if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode))) + { + containerTask.TaskDetails.Add(new TaskDetail + { + UniqueCode = inventory.UniqueCode, + FromLocation = inventory.Lot, + Status = TaskStatusEnum.新建, + ContainerCode = inventory.ContainerCode, + CreateTime = DateTime.Now + }); } } - _unitwork.Update(tLoc); - _unitwork.Update(containerTask); - } - else - { - continue; } + containerTask.Status = TaskStatusEnum.待下发; + tLoc.ContainerCode = tLoc.Code; + _unitwork.Update(tLoc); + _unitwork.Update(containerTask); } - else if (tLoc != null) + else { task.ZoneCode = ZoneCodeEnum.盘料库; task.TaskNo = _unitwork.GetSerialNumber("pout", 4); @@ -316,7 +313,14 @@ namespace HHWMS.Web } else { - break; + task.TaskDetails.Add(new TaskDetail + { + UniqueCode = inventory.UniqueCode, + FromLocation = inventory.Lot, + Status = TaskStatusEnum.新建, + ContainerCode = inventory.ContainerCode, + CreateTime = DateTime.Now + }); } } _unitwork.Add(task); diff --git a/HHWMS.Web/appsettings.json b/HHWMS.Web/appsettings.json index f9c90cb..170fe01 100644 --- a/HHWMS.Web/appsettings.json +++ b/HHWMS.Web/appsettings.json @@ -27,21 +27,21 @@ // "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;", // "DBType": "mysql" //} - //{ - // "Key": "default", - // "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True", - // "DbContext": "DataContext", - // "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle - //} { "Key": "default", - "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True", + "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True", "DbContext": "DataContext", "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle } + //{ + // "Key": "default", + // "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True", + // "DbContext": "DataContext", + // "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle + //} ], "CookiePre": "HHWMS", //cookie前缀 - "IsQuickDebug": false, //是否启用debug模式 + "IsQuickDebug": true, //是否启用debug模式 "EnableTenant": false, //是否启动多租户 "SyncDb": true, //是否自动同步数据库 "EncryptKey": "", //加密密钥