From 820d9d065bbd0d03f2ceee343ba471636e13423c Mon Sep 17 00:00:00 2001 From: zgf Date: Sat, 12 Aug 2023 20:54:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HHWMS.Web/Areas/Api/IWCSController.cs | 4 +- .../ViewModels/LocationVMs/LocationListVM.cs | 10 +- .../ViewModels/LocationVMs/LocationVM.cs | 5 + .../Configs/Views/Location/Details.cshtml | 5 +- .../Areas/Configs/Views/Location/Index.cshtml | 4 +- .../InventoryTransactionImportVM.cs | 2 +- .../InventoryTransactionListVM.cs | 6 +- .../InventoryTransactionSearcher.cs | 2 +- .../InventoryVMs/InventoryImportVM.cs | 2 +- .../InventoryVMs/InventoryListVM.cs | 42 +++++- .../InventoryVMs/InventorySearcher.cs | 2 + .../Inventory/Views/Inventory/Create.cshtml | 2 +- .../Inventory/Views/Inventory/Delete.cshtml | 2 +- .../Inventory/Views/Inventory/Details.cshtml | 2 +- .../Inventory/Views/Inventory/Edit.cshtml | 2 +- .../Views/InventoryTransaction/Create.cshtml | 2 +- .../Views/InventoryTransaction/Delete.cshtml | 2 +- .../Views/InventoryTransaction/Details.cshtml | 2 +- .../Views/InventoryTransaction/Edit.cshtml | 2 +- .../Views/InventoryTransaction/Index.cshtml | 2 +- .../System/Controllers/jobs/SendWcsJob.cs | 18 ++- .../Controllers/TaskHeaderController.cs | 126 +++++++++++++++--- .../TaskHeaderVMs/TaskHeaderListVM.cs | 4 +- HHWMS.Web/Models/Inventory/Inventory.cs | 2 +- .../Models/Inventory/InventoryTransaction.cs | 2 +- .../Models/Request/Request/Proto_8357.cs | 50 ++++++- HHWMS.Web/appsettings.json | 4 +- 27 files changed, 249 insertions(+), 59 deletions(-) diff --git a/HHWMS.Web/Areas/Api/IWCSController.cs b/HHWMS.Web/Areas/Api/IWCSController.cs index b91b170..ccad7cc 100644 --- a/HHWMS.Web/Areas/Api/IWCSController.cs +++ b/HHWMS.Web/Areas/Api/IWCSController.cs @@ -86,7 +86,7 @@ namespace HHWMS.Web Batch = detail.Batch, Lot = detail.Lot, ContainerCode = task.ContainerCode, - LocaionCode = task.ToLocation, + LocationCode = task.ToLocation, Qty = detail.Qty, TaskStatus = InventoryTaskStatus.无任务 }; @@ -102,7 +102,7 @@ namespace HHWMS.Web Batch = detail.Batch, Lot = detail.Lot, ContainerCode = task.ContainerCode, - LocaionCode = task.ToLocation, + LocationCode = task.ToLocation, Qty = detail.Qty, }; _unitwork.Add(invTran); diff --git a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs index 58d0383..2b5aaf9 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationListVM.cs @@ -62,13 +62,13 @@ namespace HHWMS.Web this.MakeGridHeader(x => x.Row), this.MakeGridHeader(x => x.Line), this.MakeGridHeader(x => x.Layer), - this.MakeGridHeader(x => x.RoadWay), + this.MakeGridHeader(x => x.RoadWay).SetHide(), this.MakeGridHeader(x => x.ContainerCode), this.MakeGridHeader(x => x.IsStop), - this.MakeGridHeader(x => x.Length), - this.MakeGridHeader(x => x.Width), - this.MakeGridHeader(x => x.Height), - this.MakeGridHeader(x => x.ContiguousCode), + this.MakeGridHeader(x => x.Length).SetHide(), + this.MakeGridHeader(x => x.Width).SetHide(), + this.MakeGridHeader(x => x.Height).SetHide(), + this.MakeGridHeader(x => x.ContiguousCode).SetHide(), this.MakeGridHeaderAction(width: 200) }; } diff --git a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs index b172300..de514ee 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs @@ -9,6 +9,8 @@ namespace HHWMS.Web { public partial class LocationVM : BaseCRUDVM { + public InventoryListVM Inventorys { get; set; } = new InventoryListVM(); + [Display(Name = "Location.BeginLine", Description = "起始列")] [Required(ErrorMessage = "Validate.{0}required")] public short BeginLine { get; set; } @@ -34,6 +36,9 @@ namespace HHWMS.Web protected override void InitVM() { + Inventorys.CopyContext(this); + Inventorys.Searcher.LocationCode = Entity.Code; + _unitWork = new UnitWork(Wtm); var CurrentCulture = Wtm.CurrentCulture; var dictDatas = DC.Set().ToList(); diff --git a/HHWMS.Web/Areas/Configs/Views/Location/Details.cshtml b/HHWMS.Web/Areas/Configs/Views/Location/Details.cshtml index 54cb231..a11e20c 100644 --- a/HHWMS.Web/Areas/Configs/Views/Location/Details.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Location/Details.cshtml @@ -1,4 +1,4 @@ -@model HHWMS.Web.LocationVM +@model HHWMS.Web.LocationVM @inject IStringLocalizer Localizer; @@ -18,6 +18,9 @@ + + + diff --git a/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml b/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml index 9c6a3ea..71c1780 100644 --- a/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Location/Index.cshtml @@ -3,6 +3,7 @@ + @@ -11,9 +12,8 @@ - - +@**@ diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionImportVM.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionImportVM.cs index b6c4892..d3649ab 100644 --- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionImportVM.cs +++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionImportVM.cs @@ -16,7 +16,7 @@ namespace HHWMS.Web public ExcelPropety ContainerCode_Excel = ExcelPropety.CreateProperty(x => x.ContainerCode); [Display(Name = "Container.LocationCode")] - public ExcelPropety LocaionCode_Excel = ExcelPropety.CreateProperty(x => x.LocaionCode); + public ExcelPropety LocationCode_Excel = ExcelPropety.CreateProperty(x => x.LocationCode); [Display(Name = "Inventory.MaterialCode")] public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty(x => x.MaterialCode); diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionListVM.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionListVM.cs index 84b36f1..a17c810 100644 --- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionListVM.cs +++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionListVM.cs @@ -29,7 +29,7 @@ namespace HHWMS.Web this.MakeGridHeader(x => x.ZoneCode), this.MakeGridHeader(x => x.Type), this.MakeGridHeader(x => x.ContainerCode), - this.MakeGridHeader(x => x.LocaionCode), + this.MakeGridHeader(x => x.LocationCode), this.MakeGridHeader(x => x.MaterialCode), this.MakeGridHeader(x => x.MaterialType), this.MakeGridHeader(x => x.MaterialName), @@ -57,7 +57,7 @@ namespace HHWMS.Web .CheckContain(Searcher.ZoneCode, x => x.ZoneCode) .CheckContain(Searcher.Type, x => x.Type) .CheckContain(Searcher.ContainerCode, x => x.ContainerCode) - .CheckContain(Searcher.LocaionCode, x => x.LocaionCode) + .CheckContain(Searcher.LocationCode, x => x.LocationCode) .CheckContain(Searcher.MaterialCode, x => x.MaterialCode) .CheckContain(Searcher.MaterialType, x => x.MaterialType) .CheckContain(Searcher.MaterialName, x => x.MaterialName) @@ -75,7 +75,7 @@ namespace HHWMS.Web ZoneCode = x.ZoneCode, Type = x.Type, ContainerCode = x.ContainerCode, - LocaionCode = x.LocaionCode, + LocationCode = x.LocationCode, MaterialCode = x.MaterialCode, MaterialType = x.MaterialType, MaterialName = x.MaterialName, diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionSearcher.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionSearcher.cs index 66c4d63..53c293c 100644 --- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionSearcher.cs +++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryTransactionVMs/InventoryTransactionSearcher.cs @@ -19,7 +19,7 @@ namespace HHWMS.Web [Display(Name = "Task.ContainerCode")] public String ContainerCode { get; set; } [Display(Name = "Container.LocationCode")] - public String LocaionCode { get; set; } + public String LocationCode { get; set; } [Display(Name = "Inventory.MaterialCode")] public String MaterialCode { get; set; } [Display(Name = "Inventory.MaterialType")] diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryImportVM.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryImportVM.cs index 8efc56e..a0225f5 100644 --- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryImportVM.cs +++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryImportVM.cs @@ -13,7 +13,7 @@ namespace HHWMS.Web public ExcelPropety ContainerCode_Excel = ExcelPropety.CreateProperty(x => x.ContainerCode); [Display(Name = "Container.LocationCode")] - public ExcelPropety LocaionCode_Excel = ExcelPropety.CreateProperty(x => x.LocaionCode); + public ExcelPropety LocationCode_Excel = ExcelPropety.CreateProperty(x => x.LocationCode); [Display(Name = "Inventory.MaterialCode")] public ExcelPropety MaterialCode_Excel = ExcelPropety.CreateProperty(x => x.MaterialCode); diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryListVM.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryListVM.cs index b2dba43..f5ac4d4 100644 --- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryListVM.cs +++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryListVM.cs @@ -10,7 +10,9 @@ namespace HHWMS.Web { protected override List InitGridAction() { - return new List + if (SearcherMode == ListVMSearchModeEnum.MasterDetail) + { + return new List { this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"inventory", dialogWidth: 800), this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "inventory", dialogWidth: 800), @@ -21,14 +23,24 @@ namespace HHWMS.Web this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "inventory", dialogWidth: 800), this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "inventory"), }; + } + else + { + return new List + { + this.MakeStandardAction("Inventory", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "inventory", dialogWidth: 800), + }; + } } protected override IEnumerable> InitGridHeader() { - return new List>{ + if (SearcherMode == ListVMSearchModeEnum.MasterDetail) + { + return new List>{ this.MakeGridHeader(x => x.ZoneCode), this.MakeGridHeader(x => x.ContainerCode), - this.MakeGridHeader(x => x.LocaionCode), + this.MakeGridHeader(x => x.LocationCode), this.MakeGridHeader(x => x.MaterialCode), this.MakeGridHeader(x => x.MaterialType), this.MakeGridHeader(x => x.MaterialName), @@ -49,12 +61,34 @@ namespace HHWMS.Web this.MakeGridHeader(x => x.TaskStatus), this.MakeGridHeaderAction(width: 200) }; + } + else + { + return new List>{ + this.MakeGridHeader(x => x.ZoneCode), + this.MakeGridHeader(x => x.ContainerCode), + this.MakeGridHeader(x => x.LocationCode), + this.MakeGridHeader(x => x.MaterialCode), + this.MakeGridHeader(x => x.MaterialType), + this.MakeGridHeader(x => x.MaterialName), + this.MakeGridHeader(x => x.MaterialSpec), + this.MakeGridHeader(x => x.MaterialUnit), + this.MakeGridHeader(x => x.Batch), + this.MakeGridHeader(x => x.CompanyCode), + this.MakeGridHeader(x => x.TaskQty), + this.MakeGridHeader(x => x.Qty), + this.MakeGridHeader(x => x.Status), + this.MakeGridHeader(x => x.TaskStatus), + this.MakeGridHeaderAction(width: 50) + }; + } } public override IOrderedQueryable GetSearchQuery() { var query = DC.Set() .CheckContain(Searcher.ZoneCode, x => x.ZoneCode) + .CheckContain(Searcher.LocationCode, x => x.LocationCode) .CheckContain(Searcher.MaterialCode, x => x.MaterialCode) .CheckContain(Searcher.MaterialType, x => x.MaterialType) .CheckContain(Searcher.MaterialName, x => x.MaterialName) @@ -70,7 +104,7 @@ namespace HHWMS.Web ID = x.ID, ZoneCode = x.ZoneCode, ContainerCode = x.ContainerCode, - LocaionCode = x.LocaionCode, + LocationCode = x.LocationCode, MaterialCode = x.MaterialCode, MaterialType = x.MaterialType, MaterialName = x.MaterialName, diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs index 944bebf..a126026 100644 --- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs +++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs @@ -14,6 +14,8 @@ namespace HHWMS.Web { [Display(Name = "Task.ZoneCode")] public String ZoneCode { get; set; } + [Display(Name = "Inventory.LocationCode")] + public String LocationCode { get; set; } [Display(Name = "Inventory.MaterialCode")] public String MaterialCode { get; set; } [Display(Name = "Inventory.MaterialType")] diff --git a/HHWMS.Web/Areas/Inventory/Views/Inventory/Create.cshtml b/HHWMS.Web/Areas/Inventory/Views/Inventory/Create.cshtml index f36ba98..410c485 100644 --- a/HHWMS.Web/Areas/Inventory/Views/Inventory/Create.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/Inventory/Create.cshtml @@ -5,7 +5,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/Inventory/Delete.cshtml b/HHWMS.Web/Areas/Inventory/Views/Inventory/Delete.cshtml index 5a9b7b4..411b453 100644 --- a/HHWMS.Web/Areas/Inventory/Views/Inventory/Delete.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/Inventory/Delete.cshtml @@ -6,7 +6,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/Inventory/Details.cshtml b/HHWMS.Web/Areas/Inventory/Views/Inventory/Details.cshtml index 4b5e10a..0cd0adb 100644 --- a/HHWMS.Web/Areas/Inventory/Views/Inventory/Details.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/Inventory/Details.cshtml @@ -5,7 +5,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/Inventory/Edit.cshtml b/HHWMS.Web/Areas/Inventory/Views/Inventory/Edit.cshtml index b2eb1b6..ab869b7 100644 --- a/HHWMS.Web/Areas/Inventory/Views/Inventory/Edit.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/Inventory/Edit.cshtml @@ -5,7 +5,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Create.cshtml b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Create.cshtml index fedd750..e4229d0 100644 --- a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Create.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Create.cshtml @@ -6,7 +6,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Delete.cshtml b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Delete.cshtml index 9468dd9..aa75cb8 100644 --- a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Delete.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Delete.cshtml @@ -7,7 +7,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Details.cshtml b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Details.cshtml index ec0028c..e1b2c8f 100644 --- a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Details.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Details.cshtml @@ -6,7 +6,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Edit.cshtml b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Edit.cshtml index bf834dd..79059b8 100644 --- a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Edit.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Edit.cshtml @@ -6,7 +6,7 @@ - + diff --git a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Index.cshtml b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Index.cshtml index 4b6c523..1a8ab56 100644 --- a/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Index.cshtml +++ b/HHWMS.Web/Areas/Inventory/Views/InventoryTransaction/Index.cshtml @@ -6,7 +6,7 @@ - + diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs index e40ea7b..a6d9d52 100644 --- a/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs +++ b/HHWMS.Web/Areas/System/Controllers/jobs/SendWcsJob.cs @@ -25,8 +25,14 @@ namespace HHWMS.Web var _unitwork = new UnitWork(Wtm); var taskList = _unitwork.Find(x => x.Status == TaskStatusEnum.新建).Take(10); + var begin = new Location(); + var end = new Location(); + var locationCodeList = taskList.Select(x => x.FromLocation).Union(taskList.Select(x => x.ToLocation)).ToList(); + var locationList = _unitwork.Find(x => locationCodeList.Contains(x.Code)).ToList(); ; foreach (var task in taskList) { + begin = locationList.FirstOrDefault(x => x.Code.Equals(task.FromLocation)); + end = locationList.FirstOrDefault(x => x.Code.Equals(task.ToLocation)); var taskInfo = new TaskInfo { TaskId = task.TaskNo, @@ -34,15 +40,15 @@ namespace HHWMS.Web ObjId = task.ContainerCode, StartPos = new CoordPos { - X = int.Parse(task.FromLocation.Split("-")[2]), - Y = int.Parse(task.FromLocation.Split("-")[1]), - Z = int.Parse(task.FromLocation.Split("-")[3]) + X = begin.Line, + Y = begin.Row, + Z = begin.Layer }, EndPos = new CoordPos { - X = int.Parse(task.ToLocation.Split("-")[2]), - Y = int.Parse(task.ToLocation.Split("-")[1]), - Z = int.Parse(task.ToLocation.Split("-")[3]) + X = end.Line, + Y = end.Row, + Z = end.Layer } }; } diff --git a/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs b/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs index 70c4cf9..9f40756 100644 --- a/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs +++ b/HHWMS.Web/Areas/TaskManage/Controllers/TaskHeaderController.cs @@ -1,10 +1,13 @@ +using System; +using System.Linq; +using System.Security.Cryptography; +using HHWMS.Web.Models; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using System; +using Microsoft.EntityFrameworkCore; using WalkingTec.Mvvm.Core; -using WalkingTec.Mvvm.Mvc; using WalkingTec.Mvvm.Core.Extensions; -using HHWMS.Web; +using WalkingTec.Mvvm.Mvc; namespace HHWMS.Web.Controllers { @@ -12,7 +15,15 @@ namespace HHWMS.Web.Controllers [ActionDescription("任务主表")] public partial class TaskHeaderController : BaseController { + private readonly IUnitWork _unitwork; + + public TaskHeaderController(IUnitWork unitwork) + { + _unitwork = unitwork; + } + #region Search + [ActionDescription("Sys.Search")] public ActionResult Index() { @@ -36,9 +47,10 @@ namespace HHWMS.Web.Controllers } } - #endregion + #endregion Search #region Create + [ActionDescription("Sys.Create")] public ActionResult Create() { @@ -68,9 +80,11 @@ namespace HHWMS.Web.Controllers } } } - #endregion + + #endregion Create #region Edit + [ActionDescription("Sys.Edit")] public ActionResult Edit(string id) { @@ -101,9 +115,11 @@ namespace HHWMS.Web.Controllers } } } - #endregion + + #endregion Edit #region Delete + [ActionDescription("Sys.Delete")] public ActionResult Delete(string id) { @@ -126,18 +142,22 @@ namespace HHWMS.Web.Controllers return FFResult().CloseDialog().RefreshGrid(); } } - #endregion + + #endregion Delete #region Details + [ActionDescription("Sys.Details")] public ActionResult Details(string id) { var vm = Wtm.CreateVM(id); return PartialView(vm); } - #endregion + + #endregion Details #region BatchEdit + [HttpPost] [ActionDescription("Sys.BatchEdit")] public ActionResult BatchEdit(string[] IDs) @@ -152,16 +172,18 @@ namespace HHWMS.Web.Controllers { if (!ModelState.IsValid || !vm.DoBatchEdit()) { - return PartialView("BatchEdit",vm); + return PartialView("BatchEdit", vm); } else { return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]); } } - #endregion + + #endregion BatchEdit #region BatchDelete + [HttpPost] [ActionDescription("Sys.BatchDelete")] public ActionResult BatchDelete(string[] IDs) @@ -176,17 +198,19 @@ namespace HHWMS.Web.Controllers { if (!ModelState.IsValid || !vm.DoBatchDelete()) { - return PartialView("BatchDelete",vm); + return PartialView("BatchDelete", vm); } else { return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]); } } - #endregion + + #endregion BatchDelete #region Import - [ActionDescription("Sys.Import")] + + [ActionDescription("Sys.Import")] public ActionResult Import() { var vm = Wtm.CreateVM(); @@ -206,16 +230,88 @@ namespace HHWMS.Web.Controllers return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]); } } - #endregion + + #endregion Import #region Export + [ActionDescription("Sys.Export")] [HttpPost] public IActionResult ExportExcel(TaskHeaderListVM vm) { return vm.GetExportData(); } - #endregion + #endregion Export + + #region 任务下发 + + [ActionDescription("TaskHeader.Assign")] + public ActionResult Assign(string id) + { + var task = _unitwork.Find(x => x.ID == int.Parse(id)).Include(x => x.TaskDetails).FirstOrDefault(); + if(task == null) + return FFResult().RefreshGrid().Alert($"操作失败,此任务不存在!"); + var taskInfo = new TaskInfo(); + var beginlocation = _unitwork.FindSingle(x => x.Code.Equals(task.FromLocation)); + var endLocation = _unitwork.FindSingle(x => x.Code.Equals(task.ToLocation)); + var start = new CoordPos(); + var end = new CoordPos(); + if ((int)task.TaskType == 3 || (int)task.TaskType == 4) + { + // 盘料起点终点 与普通任务起点终点不一样,编码未在location中保存 + var taskdel = task.TaskDetails.FirstOrDefault(x => x.Status.Equals(TaskStatusEnum.新建)); + start.X = int.Parse(taskdel.Batch.Split("-")[0]); + start.Y = int.Parse(taskdel.Batch.Split("-")[1]); + start.Z = int.Parse(taskdel.Batch.Split("-")[2]); + + end.X = int.Parse(taskdel.Lot.Split("-")[0]); + end.Y = int.Parse(taskdel.Lot.Split("-")[1]); + end.Z = int.Parse(taskdel.Lot.Split("-")[2]); + + taskInfo.TaskId = taskdel.TaskHeader.TaskNo; + taskInfo.TaskType = (int)task.TaskType; + taskInfo.ObjId = taskdel.ContainerCode; + taskInfo.StartType = int.Parse(task.Station); + taskInfo.StartPos = start; + taskInfo.EndType = int.Parse(task.Station); + taskInfo.EndPos = end; + } + else + { + start.X = beginlocation.Line; + start.Y = beginlocation.Row; + start.Z = beginlocation.Layer; + + end.X = endLocation.Line; + end.Y = endLocation.Row; + end.Z = endLocation.Layer; + + taskInfo.TaskId = task.TaskNo; + taskInfo.TaskType = (int)task.TaskType; + taskInfo.ObjId = task.ContainerCode; + taskInfo.StartType = int.Parse(task.Station); + taskInfo.StartPos = start; + taskInfo.EndType = int.Parse(task.Station); + taskInfo.EndPos = end; + } + + var res = Wtm.CallAPI>("WCS", "TaskAssign", HttpMethodEnum.POST, taskInfo).Result.Data; + try + { + if ((bool)res?.Success) + { + // 删除已回传MES的任务 + //_unitwork.Delete(item); + } + } + catch (Exception ex) + { + return FFResult().Alert($"操作失败,{ex.Message}"); + } + return FFResult().RefreshGrid(); + } + + #endregion 任务下发 } } diff --git a/HHWMS.Web/Areas/TaskManage/ViewModels/TaskHeaderVMs/TaskHeaderListVM.cs b/HHWMS.Web/Areas/TaskManage/ViewModels/TaskHeaderVMs/TaskHeaderListVM.cs index 76b8b0f..cf0537d 100644 --- a/HHWMS.Web/Areas/TaskManage/ViewModels/TaskHeaderVMs/TaskHeaderListVM.cs +++ b/HHWMS.Web/Areas/TaskManage/ViewModels/TaskHeaderVMs/TaskHeaderListVM.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -25,6 +25,8 @@ namespace HHWMS.Web this.MakeStandardAction("TaskHeader", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "taskManage", dialogWidth: 800), this.MakeStandardAction("TaskHeader", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "taskManage", dialogWidth: 800), this.MakeStandardAction("TaskHeader", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "taskManage"), + this.MakeAction("TaskHeader","Assign",Localizer["TaskHeader.Assign"],"",paraType: GridActionParameterTypesEnum.SingleId,areaName: "taskManage") + .SetShowDialog(false), }; } diff --git a/HHWMS.Web/Models/Inventory/Inventory.cs b/HHWMS.Web/Models/Inventory/Inventory.cs index 41a9166..adfb022 100644 --- a/HHWMS.Web/Models/Inventory/Inventory.cs +++ b/HHWMS.Web/Models/Inventory/Inventory.cs @@ -23,7 +23,7 @@ namespace HHWMS.Web.Models [Display(Name = "Container.LocationCode", Description = "库位编码")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] - public string LocaionCode { get; set; } + public string LocationCode { get; set; } [Display(Name = "Inventory.MaterialCode", Description = "物料编码")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] diff --git a/HHWMS.Web/Models/Inventory/InventoryTransaction.cs b/HHWMS.Web/Models/Inventory/InventoryTransaction.cs index dfee217..5e84dc9 100644 --- a/HHWMS.Web/Models/Inventory/InventoryTransaction.cs +++ b/HHWMS.Web/Models/Inventory/InventoryTransaction.cs @@ -27,7 +27,7 @@ namespace HHWMS.Web.Models [Display(Name = "Container.LocationCode", Description = "库位编码")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] - public string LocaionCode { get; set; } + public string LocationCode { get; set; } [Display(Name = "Inventory.MaterialCode", Description = "物料编码")] [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")] diff --git a/HHWMS.Web/Models/Request/Request/Proto_8357.cs b/HHWMS.Web/Models/Request/Request/Proto_8357.cs index 827b81b..9fb2b1f 100644 --- a/HHWMS.Web/Models/Request/Request/Proto_8357.cs +++ b/HHWMS.Web/Models/Request/Request/Proto_8357.cs @@ -4,12 +4,39 @@ namespace HHWMS.Web.Models { public class TaskInfo { + /// + /// 任务号 + /// public string TaskId { get; set; } + + /// + /// 状态类型,1:料盒入库 2:料盒出库 3:料盘入库 4:料盘出库 99:任务删除 + /// public int TaskType { get; set; } + + /// + /// 料盒号或者料盘号 取决于任务类型 + /// public string ObjId { get; set; } + + /// + /// 起点 + /// public CoordPos StartPos { get; set; } + + /// + /// 起点类型 1:小料塔 2:大料塔 3:小料盒 4:大料盒 + /// public int StartType { get; set; } + + /// + /// 终点 + /// public CoordPos EndPos { get; set; } + + /// + /// 终点类型 1:小料塔 2:大料塔 3:小料盒 4:大料盒 + /// public int EndType { get; set; } } @@ -22,10 +49,25 @@ namespace HHWMS.Web.Models public class TaskResponse { - public string taskId { get; set; } - public int taskType { get; set; } - public string objId { get; set; } - public int resut { get; set; } + /// + /// 任务号 + /// + public string TaskId { get; set; } + + /// + /// 状态类型,1:料盒入库 2:料盒出库 3:料盘入库 4:料盘出库 + /// + public int TaskType { get; set; } + + /// + /// 料盒号或者料盘号 取决于任务类型 + /// + public string ObjId { get; set; } + + /// + /// 响应结果 100:任务完成, 99:任务失败 + /// + public int Resut { get; set; } } /* diff --git a/HHWMS.Web/appsettings.json b/HHWMS.Web/appsettings.json index ec885f7..53450bc 100644 --- a/HHWMS.Web/appsettings.json +++ b/HHWMS.Web/appsettings.json @@ -104,8 +104,8 @@ "github2": { "Address": "https://api.github.com" }, - "mainhost": { - // "Address": "https://localhost:5001" + "WCS": { + "Address": "http://localhost:5003/api/IWMS/" } }, "AppSettings": {