From 975da83f1ef2098bf97d85c256e80632e157be6f Mon Sep 17 00:00:00 2001 From: xxyy <cathay_xy@163.com> Date: 星期三, 12 二月 2025 11:57:12 +0800 Subject: [PATCH] 优化库存任务管理与出库任务处理 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs | 71 +++++++++++++++++++---- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs | 8 ++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 15 +---- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs | 4 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 47 +++++++++------ Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx | 4 Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue | 26 ++++---- 7 files changed, 114 insertions(+), 61 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs index c0ed7d7..02b3e99 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs @@ -1,12 +1,9 @@ 锘縰sing AutoMapper; using HslCommunication; using Mapster; -using Microsoft.AspNetCore.Components.Routing; using Newtonsoft.Json; -using Oracle.ManagedDataAccess.Types; using SqlSugar; using System.Diagnostics.CodeAnalysis; -using System.Threading.Tasks; using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_BasicInfoService; using WIDESEAWCS_Common; @@ -21,13 +18,9 @@ using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; -using WIDESEAWCS_QuartzJob; -using WIDESEAWCS_QuartzJob.DeviceBase; using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; -using WIDESEAWCS_TaskInfo_HtyRepository; -using WIDESEAWCS_TaskInfoRepository; namespace WIDESEAWCS_TaskInfoService { @@ -515,13 +508,11 @@ _taskHtyRepository.AddData(task_Hty); } - if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) { content = StackCraneTaskCompleted(task.TaskNum); return content; } - } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) { @@ -577,7 +568,6 @@ content = StackCraneTaskCompleted(task.TaskNum); return content; } - task.ModifyDate = DateTime.Now; task.Modifier = "System"; @@ -893,6 +883,7 @@ } return wcsBasez + address; } + #region 閲嶅啓鏂规硶 public override WebResponseContent DeleteData(object[] key) @@ -906,7 +897,7 @@ } return base.DeleteData(key); } - - #endregion + + #endregion 閲嶅啓鏂规硶 } } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx b/Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx index 925a93e..8570eb5 100644 --- a/Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx +++ b/Code Management/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Dt_BillGroupStock.jsx @@ -127,8 +127,8 @@ //淇敼棰滆壊 if (column.field == 'roadwayNo') { column.formatter = (row) => { - console.log("馃殌 ~ this.columns.forEach ~ row:", row) - return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' + // return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' + return row?.locationInfo?.roadwayNo } } //鏍煎紡鍖栨棩鏈� diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue index 6b9ec40..0f033c5 100644 --- a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue +++ b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_BillGroupStock.vue @@ -34,7 +34,7 @@ [ { "title": "鎵樼洏鏉$爜", "field": "palletCode", type: "text" }, { "title": "鐢熶骇浜х嚎", "field": "productionLine", type: "text" }, - { "title": "搴斿嚭搴撴椂闂�", "field": "outboundTime", type: "datetime"}, + { "title": "搴斿嚭搴撴椂闂�", "field": "outboundTime", type: "datetime" }, // { "title": "缁勭洏绫诲瀷", "field": "groupType", type: "select", dataKey: "GroupType", data: [] }, ] ]); @@ -42,29 +42,31 @@ const searchFormOptions = ref([ [ { "title": "鎵樼洏鏉$爜", "field": "palletCode", type: "text" }, - { "title": "鐢熶骇浜х嚎", "field": "productionLine", type: "text" }, + { "title": "鐢熶骇浜х嚎", "field": "productionLine", type: "select", dataKey: "ProductionLine", data: [] }, { "title": "搴撳尯", "field": "areaCode", type: "select", dataKey: "AreaType", data: [] }, { "title": "搴撳瓨绫诲瀷", "field": "isFull", type: "select", dataKey: "isFull", data: [] }, - ],[ + ], [ { "title": "搴撲綅鍙�", "field": "locationCode", type: "text" }, - // { "title": "宸烽亾", "field": "roadwayNo", type: "text" }, + { "title": "宸烽亾", "field": "roadwayNo", type: "text" }, + { "title": "璐т綅鐘舵��", "field": "locationStatus", type: "select", dataKey: "LocationState", data: [] }, + { "title": "鍑哄簱鏃堕棿", "field": "outboundTime", type: "datetime"}, ] ]); const columns = ref( [{ field: 'id', title: '搴撳瓨ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' }, - { field: 'locationCode', title: '搴撲綅', type: 'string', width: 100, align: 'left', }, + { field: 'locationCode', title: '搴撲綅', type: 'string', width: 100, align: 'left', }, { field: 'palletCode', title: '鎵樼洏鏉$爜', type: 'string', width: 110, align: 'left', }, - { field: 'isFull', title: '搴撳瓨绫诲瀷', type: 'bool', width: 80, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '绌虹洏'},{ key: true, value: '瀹炵洏'}] }, }, - { field: 'linedProcessFeedbackTime', title: '宸ヨ壓寮�濮嬫椂闂�', type: 'string', width: 110, align: 'left',}, - { field: 'roadwayNo', title: '宸烽亾', type: 'string', width: 60, align: 'left', sort: true }, + { field: 'isFull', title: '搴撳瓨绫诲瀷', type: 'bool', width: 80, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '绌虹洏' }, { key: true, value: '瀹炵洏' }] }, }, + { field: 'linedProcessFeedbackTime', title: '宸ヨ壓寮�濮嬫椂闂�', type: 'string', width: 110, align: 'left', }, + { field: 'roadwayNo', title: '宸烽亾', type: 'string', width: 60, align: 'left', sort: true }, { field: 'locationStatus', title: '璐т綅鐘舵��', type: 'int', width: 60, align: 'left', bind: { key: "LocationState", data: [] } }, { field: 'specialParameterDuration', title: '宸ヨ壓鏃堕暱', type: 'string', width: 60, align: 'left', sort: true }, - { field: 'outboundTime', title: '搴斿嚭搴撴椂闂�', type: 'string', width: 110, align: 'left', sort: true }, - { field: 'productionLine', title: '鐢熶骇浜х嚎', type: 'string', width: 60, align: 'left', }, + { field: 'outboundTime', title: '搴斿嚭搴撴椂闂�', type: 'string', width: 110, align: 'left', sort: true }, + { field: 'productionLine', title: '鐢熶骇浜х嚎', type: 'string', width: 60, align: 'left', bind: { key: "ProductionLine", data: [] } }, { field: 'areaCode', title: '搴撳尯', type: 'string', width: 60, align: 'left', bind: { key: "AreaType", data: [] } }, - { field: 'remark', title: '鐢佃姱鏁伴噺', type: 'string', width: 60, align: 'left', }, + { field: 'remark', title: '鐢佃姱鏁伴噺', type: 'string', width: 60, align: 'left', }, { field: 'creater', title: '鍒涘缓浜�', type: 'string', sort: true, width: 110, align: 'left', hidden: true }, - { field: 'createDate', title: '鍒涘缓鏃堕棿', type: 'datetime', sort: true, width: 150, align: 'left', }, + { field: 'createDate', title: '鍒涘缓鏃堕棿', type: 'datetime', sort: true, width: 150, align: 'left', }, { field: 'modifier', title: '鏈�鍚庝慨鏀逛汉', type: 'string', sort: true, width: 100, hidden: true, align: 'left' }, // { field: 'modifyDate', title: '鏈�鍚庝慨鏀规椂闂�', type: 'datetime', sort: true, width: 150, align: 'left', sort: true }, ] diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs index ba178bf..aa0da5e 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs @@ -31,7 +31,7 @@ public ISqlSugarClient Db => BaseDal.Db; private PropertyInfo[] _propertyInfo { get; set; } = null; - private PropertyInfo[] TProperties + public PropertyInfo[] TProperties { get { @@ -172,7 +172,7 @@ /// <param name="pageData"></param> /// <param name="propertyInfo"></param> /// <returns></returns> - private Dictionary<string, OrderByType> GetPageDataSort(PageDataOptions pageData, PropertyInfo[] propertyInfo) + public Dictionary<string, OrderByType> GetPageDataSort(PageDataOptions pageData, PropertyInfo[] propertyInfo) { if (!string.IsNullOrEmpty(pageData.Sort)) { diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs index 5ab2700..08ecdc5 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoService.cs @@ -1,7 +1,11 @@ -锘� +锘縰sing AngleSharp.Dom; using Mapster; -using WIDESEA_Core.HttpContextUser; -using WIDESEA_Core.Seed; +using Masuit.Tools; +using SqlSugar; +using System.Collections.Generic; +using System.Drawing.Printing; +using System.Linq.Expressions; +using WIDESEA_Core; namespace WIDESEA_StorageBasicService; @@ -18,15 +22,59 @@ /// <returns></returns> public override PageGridData<DtStockInfo> GetPageData(PageDataOptions options) { - var data = base.GetPageData(options); - foreach (var item in data.Rows) + string wheres = ValidatePageOptions(options); + //鑾峰彇鎺掑簭瀛楁 + Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); + List<OrderByModel> orderByModels = new List<OrderByModel>(); + foreach (var item in orderbyDic) { - if (item.IsFull) - item.Remark = item.StockInfoDetails.Count().ToString(); - else - item.Remark = "0"; + OrderByModel orderByModel = new() + { + FieldName = item.Key, + OrderByType = item.Value + }; + orderByModels.Add(orderByModel); } - return data; + + + int totalCount = 0; + List<SearchParameters> searchParametersList = new List<SearchParameters>(); + if (!string.IsNullOrEmpty(options.Wheres)) + { + try + { + searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); + options.Filter = searchParametersList; + } + catch { } + } + + Expression<Func<DtStockInfo, bool>> locationStatus = null; + Expression<Func<DtStockInfo, bool>> roadwayNo = null; + foreach (var item in searchParametersList) + { + if (item.Name.Contains("locationStatus")) + { + locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value); + } + else if (item.Name.Contains("roadwayNo")) + { + roadwayNo = x => x.LocationInfo.RoadwayNo.Contains(item.Value); + } + } + + var data = BaseDal.Db.Queryable<DtStockInfo>().IncludesAllFirstLayer().WhereIF(!wheres.IsNullOrEmpty(), wheres).WhereIF(locationStatus != null, locationStatus).WhereIF(roadwayNo != null, roadwayNo).OrderBy(orderByModels).ToPageList(options.Page, options.Rows, ref totalCount); + new PageGridData<DtStockInfo>(totalCount, data); + return new PageGridData<DtStockInfo>(totalCount, data); + //var data = base.GetPageData(options); + //foreach (var item in data.Rows) + //{ + // if (item.IsFull) + // item.Remark = item.StockInfoDetails.Count().ToString(); + // else + // item.Remark = "0"; + //} + //return data; } /// <summary> @@ -38,7 +86,6 @@ { try { - List<DtStockInfo_Hty> stockInfos = new List<DtStockInfo_Hty>(); List<DtLocationInfo> locationInfos = new List<DtLocationInfo>(); foreach (var item in keys) @@ -66,7 +113,7 @@ } // 鏍规嵁浼犲叆搴撳瓨绫诲瀷鑾峰彇涓嶅悓宸烽亾鐨勫簱瀛� - public async Task<Dictionary<string, int>> GetLocationByStockType(bool stockType,string areaCode) + public async Task<Dictionary<string, int>> GetLocationByStockType(bool stockType, string areaCode) { var stockInfos = await BaseDal.Db.Queryable<DtStockInfo>().Where(x => x.IsFull == stockType && x.AreaCode == areaCode) .Includes(x => x.LocationInfo).ToListAsync(); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs index 7e35a13..48f30ad 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs @@ -1,18 +1,10 @@ -锘縰sing Castle.Components.DictionaryAdapter.Xml; -using log4net.Core; -using Masuit.Tools; -using System.CodeDom; -using System.Threading.Tasks; -using WIDESEA_Common; +锘縰sing Masuit.Tools; using WIDESEA_Common.CustomModels; //using WIDESEA_Common.CustomModels; -using WIDESEA_Core.BaseRepository; using WIDESEA_Core.Const; using WIDESEA_DTO.MOM; using WIDESEA_DTO.WMS; -using WIDESEA_StorageTaskRepository; -using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob.Models; @@ -123,7 +115,6 @@ { throw new Exception(ex.Message); } - } /// <summary> @@ -407,7 +398,7 @@ ////// 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴� ////var processResponse = await GetProcessResponseAsync(process, input.Position); var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing); - #endregion + #endregion 鍏ュ簱浠诲姟 } var task = new Dt_Task @@ -439,11 +430,12 @@ return task; } - #endregion 鍏ュ簱浠诲姟 + #endregion 璇锋眰浠诲姟鍏ュ簱 #region 搴撲綅鍒嗛厤 #region 鑾峰彇璐т綅 + /// <summary> /// /// </summary> @@ -477,9 +469,11 @@ return null; } } + #endregion 鑾峰彇璐т綅 #region 寮傚父鍙e叆搴撹幏鍙栧簱浣� + private async Task<DtLocationInfo> RequestLocationByAbnormal(RequestTaskDto requestTask, bool isCheckRequest = false) { try @@ -507,7 +501,8 @@ return null; } } - #endregion + + #endregion 寮傚父鍙e叆搴撹幏鍙栧簱浣� #endregion 搴撲綅鍒嗛厤 @@ -530,6 +525,7 @@ #endregion 璇锋眰浠诲姟鍏ュ簱 #region 鍒涘缓绌烘鍑哄簱浠诲姟 + public async Task<Dt_Task> CreateEmptyOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager) { try @@ -571,6 +567,7 @@ throw new Exception(ex.Message); } } + #endregion #region 鐩存帴鍑哄簱浠诲姟瀹屾垚 @@ -594,11 +591,13 @@ return content.Error(ex.Message); } } + #endregion #region 寮傚父鍙d换鍔℃娴� + /// <summary> - /// 寮傚父鎺掑嚭鍙e叆搴撴牎楠� 鎵�鏈夊紓甯镐氦缁橶CS鍋氬師鍦板潃NG澶勭悊 + /// 寮傚父鎺掑嚭鍙e叆搴撴牎楠� 鎵�鏈夊紓甯镐氦缁橶CS鍋氬師鍦板潃NG澶勭悊 /// </summary> /// <param name="input"></param> /// <param name="stationManager"></param> @@ -622,7 +621,7 @@ // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺� WebResponseContent content = await GetTrayCellStatusAsync(trayCells); // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖content - if (!content.Status) //鑾峰彇鏁寸洏鐢佃姱鏁版嵁锛� 濡傚紓甯� 浣跨敤绌烘绫诲瀷鍏ュ簱 + if (!content.Status) //鑾峰彇鏁寸洏鐢佃姱鏁版嵁锛� 濡傚紓甯� 浣跨敤绌烘绫诲瀷鍏ュ簱 { ConsoleHelper.WriteErrorLine(content.Message); throw new Exception("MOM鏁寸洏鐢佃姱灞炴�ц幏鍙栧紓甯�"); @@ -735,9 +734,11 @@ throw new Exception(ex.Message); } } + #endregion #region 绉诲簱浠诲姟浜嬪姟 + private async Task<bool> ExecuteTransaction(DtStockInfo stock, Dt_Task_Hty taskHty, DtLocationInfo fromLocation, DtLocationInfo toLocation, int taskId) { _unitOfWorkManage.BeginTran(); @@ -780,6 +781,7 @@ #endregion MyRegion #region 妫�娴嬮珮娓╁簱鏄惁鏈夊彲鍑哄簱搴撳瓨 + public WebResponseContent StockCheckingAsync() { WebResponseContent webResponseContent = new WebResponseContent(); @@ -864,6 +866,7 @@ #endregion 妫�娴嬮珮娓╁簱鏄惁鏈夊彲鍑哄簱搴撳瓨 #region 甯告俯琛ョ┖鎵樼洏鑷冲垎瀹� + public async Task<WebResponseContent> GetFROutTrayToCW(RequestTaskDto taskDTO) { WebResponseContent content = new WebResponseContent(); @@ -927,7 +930,6 @@ ConsoleHelper.WriteColorLine(station.Roadway, ConsoleColor.Magenta); var stackers = station.Roadway.Split(',').ToList(); - var devices = SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() .Where(x => x.DeviceStatus == "1") .Where(x => stackers.Contains(x.DeviceCode)) @@ -953,6 +955,13 @@ #endregion + #region 甯告俯3鍑哄簱鑷冲寘瑁� + + /// <summary> + /// 甯告俯3鍑哄簱鑷冲寘瑁� + /// </summary> + /// <param name="json"></param> + /// <returns></returns> public async Task<WebResponseContent> RequestOutTaskToBZAsync(RequestTaskDto json) { WebResponseContent content = new WebResponseContent(); @@ -1014,9 +1023,10 @@ } } - + #endregion #region 鐏鍑哄簱 + public WebResponseContent EmergencyTask(object obj) { WebResponseContent content = new WebResponseContent(); @@ -1062,7 +1072,6 @@ { throw new Exception("宸叉坊鍔犵伀璀﹀嚭搴撲换鍔�"); } - int taskNum = BaseDal.GetTaskNo().Result; Dt_Task task = new Dt_Task @@ -1126,7 +1135,6 @@ LogFactory.GetLog("DTS鐏鍑哄簱").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("DTS鐏鍑哄簱").Info(true, obj.ToJsonString()); return content.OK(); - } catch (Exception ex) { @@ -1135,5 +1143,6 @@ return content.Error(ex.Message); } } + #endregion } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs index 771d001..ccb8f83 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs @@ -1,4 +1,5 @@ 锘縰sing Masuit.Tools; +using SqlSugar; using WIDESEA_Core.Const; using WIDESEA_DTO.MOM; using WIDESEA_DTO.WMS; @@ -70,8 +71,11 @@ } // TODO 鍒ゆ柇鍦ㄩ�旀暟閲� - var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count; - if (count <= 10) + + var needBarcode = await SqlSugarHelper.DbWCS.Queryable<dt_needBarcode>().FirstAsync(x => x.productLine == input.ProductionLine); + var needCount = needBarcode.inLineNum; + //var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count; + if (needCount < 2) { // 閫佽嚦鍖呰 List<string> strings = stationManagers.Where(x => x.stationType == 0).Select(x => x.Roadway).ToList(); -- Gitblit v1.9.3