From 2097bffabb6f59e094ce96d88b2277fcd5d80598 Mon Sep 17 00:00:00 2001 From: zgf Date: Wed, 23 Aug 2023 04:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=A3=E6=96=99=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HHWMS.Web/Areas/Api/IWCSController.cs | 8 +- .../Controllers/ReceiptSLInController.cs | 106 +++-- .../Receipt/Views/ReceiptSLIn/Index.cshtml | 418 +++++++++--------- .../System/Controllers/jobs/SendWcsJob.cs | 8 +- HHWMS.Web/Models/Enum/WMSEnum.cs | 87 +++- HHWMS.Web/Models/Receipt/ReceiptDetail.cs | 8 +- 6 files changed, 388 insertions(+), 247 deletions(-) diff --git a/HHWMS.Web/Areas/Api/IWCSController.cs b/HHWMS.Web/Areas/Api/IWCSController.cs index 7eaffa6..042ed3c 100644 --- a/HHWMS.Web/Areas/Api/IWCSController.cs +++ b/HHWMS.Web/Areas/Api/IWCSController.cs @@ -154,7 +154,7 @@ namespace HHWMS.Web var taskfromlocatioin = _unitwork.FindSingle(x => x.Code.Equals(task.FromLocation)); switch (task.TaskType) { - case TaskTypeEnum.料盒入库: + case TaskTypeEnum.盘料盒入库: // 更新库位 // 起始库位为空 // 目标库位为有货 @@ -163,7 +163,7 @@ namespace HHWMS.Web // 测试 创建料盒出库任务 newTask.ZoneCode = "L"; newTask.TaskNo = _unitwork.GetSerialNumber("out", 4); - newTask.TaskType = TaskTypeEnum.料盒出库; + newTask.TaskType = TaskTypeEnum.盘料盒出库; newTask.ContainerCode = task.FromLocation; newTask.FromLocation = task.ToLocation; newTask.ToLocation = task.FromLocation; @@ -171,7 +171,7 @@ namespace HHWMS.Web //newTask.Station = task.Station; _unitwork.Add(newTask); break; - case TaskTypeEnum.料盒出库: + case TaskTypeEnum.盘料盒出库: // 更新库位 // 起始库位为空 // 目标库位为有货 @@ -218,7 +218,7 @@ namespace HHWMS.Web var fromL = _unitwork.FindSingle(x => x.Row.Equals(tasktolocatioin.Row) && x.Type == "G1"); newTask.ZoneCode = "L"; newTask.TaskNo = _unitwork.GetSerialNumber("in", 4); - newTask.TaskType = TaskTypeEnum.料盒入库; + newTask.TaskType = TaskTypeEnum.盘料盒入库; newTask.ContainerCode = fromL.Code; newTask.FromLocation = fromL.Code; newTask.ToLocation = "L01-01-19-01"; diff --git a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptSLInController.cs b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptSLInController.cs index 31f5ce3..83da42a 100644 --- a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptSLInController.cs +++ b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptSLInController.cs @@ -1,35 +1,91 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using System; +using System.Linq; +using HHWMS.Web.Models; +using Microsoft.AspNetCore.Mvc; using WalkingTec.Mvvm.Core; using WalkingTec.Mvvm.Mvc; -using WalkingTec.Mvvm.Core.Extensions; -using HHWMS.Web; -using HHWMS.Web.Models; -using Microsoft.EntityFrameworkCore; -using System.Linq; -using Newtonsoft.Json; -using System.Collections.Generic; -namespace HHWMS.Web.Controllers +namespace HHWMS.Web.Controllers; + +[Area("receipt")] +[ActionDescription("散料操作")] +public class ReceiptSLInController : BaseController { - [Area("receipt")] - [ActionDescription("散料操作")] - public partial class ReceiptSLInController : BaseController + private readonly IUnitWork _unitWork; + + public ReceiptSLInController(IUnitWork unitWork) { - private readonly IUnitWork _unitwork; - public ReceiptSLInController(IUnitWork unitwork) - { - _unitwork = unitwork; - } - #region Search - [ActionDescription("Sys.Search")] - public ActionResult Index() - { - return PartialView("Index"); - } + _unitWork = unitWork; + } - #endregion + #region Search + [ActionDescription("Sys.Search")] + public ActionResult Index() + { + return PartialView("Index"); + } + #endregion + + [HttpPost] + public ActionResult CallBox() + { + // 查询站台占用 + var stations = _unitWork.Find(x => (x.Code == StationCode.散料库左抽屉 + || x.Code == StationCode.散料库右抽屉) + && x.Status != LocationStatus.任务锁).ToList(); + if (stations.Count == 0) return JsonMore(null, 500, "无可用站台!"); + + // 查找没任务的仓位,分两边查,那边站台能用 查哪边 + var box = _unitWork.Find(x => (x.ZoneCode == ZoneCodeEnum.散料库) + & (x.Status != LocationStatus.任务锁) + && x.Status != LocationStatus.满货 + && x.Status != LocationStatus.空仓位 + && x.Row == stations.First().Row).FirstOrDefault(); + if (box == null && stations.Count == 2) + box = _unitWork.Find(x => (x.ZoneCode == ZoneCodeEnum.散料库) + & (x.Status != LocationStatus.任务锁) + && x.Status != LocationStatus.满货 + && x.Status != LocationStatus.空仓位 + && x.Row == stations.Last().Row).FirstOrDefault(); + + if (box == null) return JsonMore(null, 500, "库内没有可用散料箱!"); + + var toLocation = box.Row == 1 ? StationCode.散料库右抽屉 : StationCode.散料库左抽屉; + // 创建任务 + var task = new TaskHeader + { + ZoneCode = ZoneCodeEnum.散料库, + TaskNo = _unitWork.GetSerialNumber("SOut"), + TaskType = TaskTypeEnum.散料盒出库, + ContainerCode = box.ContainerCode, + FromLocation = box.Code, + ToLocation = toLocation, + Status = TaskStatusEnum.新建, + CreateTime = DateTime.Now, + CreateBy = Wtm.LoginUserInfo.ITCode + }; + _unitWork.Add(task); + return JsonMore(null); + } + + /// + /// 扫描唯一码,并验证,返回入库单明细 + /// + /// + /// + [HttpPost] + public ActionResult ScanUniqueCode(string uniqueCode) + { + var receiptDetail = _unitWork.FindSingle(x => x.UniqueCode.Equals(uniqueCode)); + if (receiptDetail != null) + { + if (receiptDetail.Status == ReceiptStatusEnum.收完) + { + return JsonMore(null, 500, $"{uniqueCode}已绑定,无需重新绑定!"); + } + return JsonMore(receiptDetail); + } + return JsonMore(null, 500, $"{uniqueCode}不存在!"); } } diff --git a/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml b/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml index be4947f..c47490c 100644 --- a/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml +++ b/HHWMS.Web/Areas/Receipt/Views/ReceiptSLIn/Index.cshtml @@ -1,133 +1,158 @@ - - - - - - - - - - + + + + + + + + + + + + + 呼叫料盒 + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 绑定 - 重置 - - - - + + 绑定 + 重置 + + + diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs index 708ddfc..f8e4b80 100644 --- a/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs +++ b/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs @@ -42,6 +42,10 @@ namespace HHWMS.Web { task.ErrorMsg += ex.Message; } + if(task.TaskDetails.Count(x => x.Status == TaskStatusEnum.新建) == 0) + { + task.Status = TaskStatusEnum.已下发; + } _unitwork.Update(task); } @@ -79,8 +83,8 @@ namespace HHWMS.Web // 根据不同任务类型 创建任务 switch (task.TaskType) { - case TaskTypeEnum.料盒入库: - case TaskTypeEnum.料盒出库: + case TaskTypeEnum.盘料盒入库: + case TaskTypeEnum.盘料盒出库: var taskInfo = new TaskInfo(); taskInfo.TaskType = (int)task.TaskType; taskInfo.TaskId = task.TaskNo; diff --git a/HHWMS.Web/Models/Enum/WMSEnum.cs b/HHWMS.Web/Models/Enum/WMSEnum.cs index e0e8205..97c66d8 100644 --- a/HHWMS.Web/Models/Enum/WMSEnum.cs +++ b/HHWMS.Web/Models/Enum/WMSEnum.cs @@ -29,13 +29,13 @@ namespace HHWMS.Web.Models /// 入库任务 /// [Display(Name = "TaskType.In")] - 料盒入库 = 1, + 盘料盒入库 = 1, /// /// 出库任务 /// [Display(Name = "TaskType.Out")] - 料盒出库 = 2, + 盘料盒出库 = 2, /// /// 盘料入库 @@ -47,7 +47,19 @@ namespace HHWMS.Web.Models /// 盘料出库 /// [Display(Name = "TaskType.POut")] - 盘料出库 = 4 + 盘料出库 = 4, + + /// + /// 散料入库 + /// + [Display(Name = "TaskType.SIn")] + 散料盒入库 = 5, + + /// + /// 散料出库 + /// + [Display(Name = "TaskType.SOut")] + 散料盒出库 = 6 } /// @@ -145,6 +157,11 @@ namespace HHWMS.Web.Models /// public const string 有货 = "some"; + /// + /// 满货 = "full"; + /// + public const string 满货 = "full"; + /// /// 空容器 = "emptyContainer" /// @@ -257,6 +274,70 @@ namespace HHWMS.Web.Models } + /// + /// 区域 + /// + public static class ZoneCodeEnum + { + /// + /// 盘料库 = "L"; + /// + public const string 盘料库 = "L"; + + /// + /// 散料库 = "C"; + /// + public const string 散料库 = "C"; + + } + + /// + /// 站台类型 + /// + public static class StationCode + { + /// + /// 散料库左抽屉 = "C02-02-18-02"; + /// + public const string 散料库左抽屉 = "C02-02-18-02"; + + /// + /// 散料库右抽屉 = "C02-01-18-02"; + /// + public const string 散料库右抽屉 = "C02-01-18-02"; + + /// + /// 盘料库左工位 = "L01-02-34-02"; + /// + public const string 盘料库左工位 = "L01-02-34-02"; + + /// + /// 盘料库右工位 = "L01-01-34-02"; + /// + public const string 盘料库右工位 = "L01-01-34-02"; + + /// + /// 左料塔 = "L01"; + /// + public const string 左料塔 = "L01"; + + /// + /// 右料塔 = "L02"; + /// + public const string 右料塔 = "L02"; + + /// + /// 左料塔工位 = "L01-01"; + /// + public const string 左料塔工位 = "L01-01"; + + /// + /// 右料塔工位 = "L01-02"; + /// + public const string 右料塔工位 = "L01-02"; + + } + /// /// 料塔类型 /// diff --git a/HHWMS.Web/Models/Receipt/ReceiptDetail.cs b/HHWMS.Web/Models/Receipt/ReceiptDetail.cs index 62956b0..e3c2a0d 100644 --- a/HHWMS.Web/Models/Receipt/ReceiptDetail.cs +++ b/HHWMS.Web/Models/Receipt/ReceiptDetail.cs @@ -26,6 +26,10 @@ namespace HHWMS.Web.Models [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] public string MaterialCode { get; set; } + [Display(Name = "Inventory.UniqueCode", Description = "唯一编码")] + [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] + public string UniqueCode { get; set; } + [Display(Name = "Inventory.MaterialType", Description = "物料类型")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] public string MaterialType { get; set; } @@ -65,11 +69,11 @@ namespace HHWMS.Web.Models [Display(Name = "Receipt.CompletedQty", Description = "完成数量")] [Column(TypeName = "decimal(12,4)")] - public decimal? CompletedQty { get; set; } + public decimal? CompletedQty { get; set; } = Decimal.Zero; [Display(Name = "Inventory.Qty", Description = "数量")] [Column(TypeName = "decimal(12,4)")] - public decimal? Qty { get; set; } + public decimal? Qty { get; set; } = Decimal.Zero; [Display(Name = "Inventory.Status", Description = "物料状态")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]