diff --git a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml index bb7958e..6884cdb 100644 --- a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml +++ b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml @@ -7,7 +7,8 @@ + @@change="select" + > (x => x.Type.Equals(LocationTypeEnum.堆垛机工位) - && x.Status != LocationStatus.任务锁); + + var station = new Location(); if (task.FromLocation == "L01") { + // L01 优先从左边入 station = _unitwork.Find(x => x.Type.Equals(LocationTypeEnum.堆垛机工位) - && x.Status != LocationStatus.任务锁).OrderByDescending(x => x.Row).FirstOrDefault(); + && x.Status != LocationStatus.任务锁) + .OrderByDescending(x => x.Row) + .FirstOrDefault(); + } + else + { + // L02 只能入右边 row=1 + station = _unitwork.FindSingle(x => x.Type.Equals(LocationTypeEnum.堆垛机工位) + &&x.Row == 1 + && x.Status != LocationStatus.任务锁); } if (station != null && count > 0) { - var container = _unitwork.Find(x => x.Row == station.Row && x.Type == LocationTypeEnum.盘料库位 - && (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) && x.Length == Length && !x.IsStop) + var container = _unitwork.Find(x => x.Row == station.Row + && x.Type == LocationTypeEnum.盘料库位 + && (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) + && x.Length == Length && !x.IsStop) .OrderByDescending(x => x.Length - x.Width).FirstOrDefault(); if (Length == 23 && container == null && station.Row == 3) { station = _unitwork.Find(x => x.Type.Equals(LocationTypeEnum.堆垛机工位) - && x.Status != LocationStatus.任务锁 && x.Row == 1).FirstOrDefault(); + && x.Status != LocationStatus.任务锁 + && x.Row == 1) + .FirstOrDefault(); - container = _unitwork.Find(x => x.Row == station.Row && x.Type == LocationTypeEnum.盘料库位 - && (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) && x.Length == Length && !x.IsStop) - .OrderByDescending(x => x.Length - x.Width).FirstOrDefault(); + container = _unitwork.Find(x => x.Row == station.Row + && x.Type == LocationTypeEnum.盘料库位 + && (x.Status == LocationStatus.有货 || x.Status == LocationStatus.空容器) + && x.Length == Length + && !x.IsStop) + .OrderByDescending(x => x.Length - x.Width) + .FirstOrDefault(); } if(station != null && container != null) diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs index 7a9abd9..1c3803c 100644 --- a/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs +++ b/HHWMS.Web/Areas/System/Controllers/jobs/SendWmsJob.cs @@ -193,53 +193,57 @@ namespace HHWMS.Web .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) - // { - // foreach (var inventory in item) - // { - // if (tLoc.Height < tLoc.Length) - // { - // var detail = 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; - // containerTask.Status = TaskStatusEnum.待下发; - // containerTask.TaskDetails.Add(detail); - // } - // else - // { - // break; - // } - // } - // _unitwork.Update(tLoc); - // _unitwork.Update(containerTask); - // } - // else - // { - // continue; - // } - //} - //else + 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) + { + tLoc = _unitwork.Find(x => x.Code == containerTask.ToLocation + && x.Type.Equals(LocationTypeEnum.料塔)) + .FirstOrDefault(); + foreach (var inventory in item) + { + if (tLoc.Height < tLoc.Length) + { + var detail = 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; + containerTask.Status = TaskStatusEnum.待下发; + containerTask.TaskDetails.Add(detail); + } + else + { + break; + } + } + _unitwork.Update(tLoc); + _unitwork.Update(containerTask); + } + else + { + continue; + } + } + else if (tLoc != null) { task.ZoneCode = ZoneCodeEnum.盘料库; task.TaskNo = _unitwork.GetSerialNumber("pout", 4); task.TaskType = TaskTypeEnum.盘料出库; - task.Status = TaskStatusEnum.新建; + task.Status = TaskStatusEnum.待下发; task.ContainerCode = item.Key; task.Priority = 100; task.FromLocation = _unitwork diff --git a/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs b/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs index 90fb9b6..3611e24 100644 --- a/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs +++ b/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs @@ -263,8 +263,9 @@ namespace HHWMS.Web.Controllers if (task.TaskType == TaskTypeEnum.盘料入库 || task.TaskType == TaskTypeEnum.盘料出库) { + return FFResult().Alert($"盘料操作无法手动执行"); // 盘料起点终点 与普通任务起点终点不一样,编码未在location中保存 - var taskdel = task.TaskDetails.FirstOrDefault(x => x.Status.Equals(TaskStatusEnum.新建)); + /*var taskdel = task.TaskDetails.FirstOrDefault(x => x.Status.Equals(TaskStatusEnum.新建)); start.X = beginlocation.Line; end.X = endLocation.Line; if (task.TaskType == TaskTypeEnum.盘料入库) @@ -289,7 +290,7 @@ namespace HHWMS.Web.Controllers taskInfo.StartType = int.Parse(task.Station); taskInfo.StartPos = start; taskInfo.EndType = int.Parse(task.Station); - taskInfo.EndPos = end; + taskInfo.EndPos = end;*/ } else { diff --git a/HHWMS.Web/MESToWMSService/WmsMesService.cs b/HHWMS.Web/MESToWMSService/WmsMesService.cs index 312f8fc..8645adf 100644 --- a/HHWMS.Web/MESToWMSService/WmsMesService.cs +++ b/HHWMS.Web/MESToWMSService/WmsMesService.cs @@ -87,6 +87,7 @@ namespace MESTOWMSService MaterialType = material?.MaterialType, MaterialUnit = material?.MaterialUnit, Batch = material?.Batch, + DividedQty = 0, Qty = material?.Qty, CompanyCode = item?.FACTORY, ManufactureDate = Convert.ToDateTime(item.MESDATE), diff --git a/HHWMS.Web/appsettings.json b/HHWMS.Web/appsettings.json index 64f4382..170fe01 100644 --- a/HHWMS.Web/appsettings.json +++ b/HHWMS.Web/appsettings.json @@ -27,18 +27,18 @@ // "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": true, //是否启用debug模式