From cebd0800e9b5e1a1055a48d5e52f3f8a85e8d82c Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 13 一月 2025 20:59:26 +0800 Subject: [PATCH] 1 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs | 10 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 40 ++ 代码管理/WMS/WIDESEA_WMSClient/package.json | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 30 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 163 ++++++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs | 10 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b490258b-026c-4d98-a082-39d118a7d7ba.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs | 25 + 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs | 8 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs | 26 + 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 110 +++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs | 52 ++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs | 12 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/干膜仓/ConveyorLineJob_GM.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs | 3 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 52 ++ 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ddab6c09-d32a-4e10-9c68-7904d199b1b7.vsidx | 0 /dev/null | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/干膜仓/StackerCraneJob_GM.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/ConveyorLineJob_BC.cs | 234 +++++++----- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/StackerCraneJob_BC.cs | 38 + 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs | 10 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/StackerCraneJob_CSJ.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs | 2 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs | 11 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/RGVJob_BC.cs | 194 ++++++---- 27 files changed, 797 insertions(+), 247 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7304d95e-cf1e-4631-bf79-37f693467d29.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7304d95e-cf1e-4631-bf79-37f693467d29.vsidx" deleted file mode 100644 index dcf1d37..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7304d95e-cf1e-4631-bf79-37f693467d29.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9322c121-b454-4586-9898-3e1db55e94db.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9322c121-b454-4586-9898-3e1db55e94db.vsidx" deleted file mode 100644 index 24ac4be..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9322c121-b454-4586-9898-3e1db55e94db.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b490258b-026c-4d98-a082-39d118a7d7ba.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b490258b-026c-4d98-a082-39d118a7d7ba.vsidx" new file mode 100644 index 0000000..c06da44 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b490258b-026c-4d98-a082-39d118a7d7ba.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" deleted file mode 100644 index e69de29..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" +++ /dev/null diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" index d2f364f..a82f134 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" @@ -67,16 +67,22 @@ ProductionReturn = 550, /// <summary> + /// MES閫�鏂� + /// </summary> + [Description("MES閫�鏂�")] + MesMatReturn = 560, + + /// <summary> /// 绾胯竟浠撳叆搴� /// </summary> [Description("绾胯竟浠撳叆搴�")] - InboundXB = 560, + InboundXB = 580, /// <summary> /// 鏈哄彴鍏ュ簱 /// </summary> [Description("鏈哄彴鍏ュ簱")] - InboundJT = 570, + InboundJT = 590, /// <summary> /// 绌虹鍏ュ簱 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index 889d452..4a64daf 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -65,6 +65,21 @@ /// <returns></returns> WebResponseContent RequestWMSTask(string palletCode, string sourceAddress); + /// <summary> + /// + /// </summary> + /// <param name="palletCode"></param> + /// <param name="sourceAddress"></param> + /// <returns></returns> + WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress); + + /// <summary> + /// + /// </summary> + /// <param name="palletCode"></param> + /// <param name="sourceAddress"></param> + /// <param name="roadway"></param> + /// <returns></returns> WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string roadway); /// <summary> @@ -75,6 +90,20 @@ /// <returns></returns> string? RequestAssignLocation(int taskNum, string roadwayNo); + /// <summary> + /// + /// </summary> + /// <param name="taskNum"></param> + /// <param name="roadwayNo"></param> + /// <param name="heightType"></param> + /// <returns></returns> + string? RequestAssignLocationByHeight(int taskNum, string roadwayNo, int heightType); + + /// <summary> + /// + /// </summary> + /// <param name="taskNum"></param> + /// <returns></returns> WebResponseContent TaskCompleted(int taskNum); /// <summary> @@ -173,7 +202,7 @@ /// <param name="targetAddress">淇敼鍚庣殑鐩爣鍦板潃</param> /// <param name="currentAddress">淇敼鍚庣殑褰撳墠鍦板潃</param> /// <param name="nextAddress">淇敼鍚庣殑涓嬩竴鍦板潃</param> - void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = ""); + void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = ""); /// <summary> /// 璇锋眰鍒嗛厤宸烽亾 @@ -187,6 +216,15 @@ /// /// </summary> /// <param name="roadwayNos"></param> + /// <param name="taskNum"></param> + /// <param name="heightType"></param> + /// <returns></returns> + WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, int taskNum, int heightType); + + /// <summary> + /// + /// </summary> + /// <param name="roadwayNos"></param> /// <returns></returns> WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" index f20c07c..68cc2df 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" @@ -45,6 +45,15 @@ [ExporterHeader(DisplayName = "浠诲姟鍙�")] [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟鍙�")] public int TaskNum { get; set; } + + /// <summary> + /// 浠撳簱涓婚敭 + /// </summary> + [ImporterHeader(Name = "浠撳簱涓婚敭")] + [ExporterHeader(DisplayName = "浠撳簱涓婚敭")] + [SugarColumn(IsNullable = false, ColumnDescription = "浠撳簱涓婚敭")] + public int WarehouseId { get; set; } + /// <summary> /// AGV浠诲姟鍙� /// </summary> @@ -52,6 +61,7 @@ [ExporterHeader(DisplayName = "AGV浠诲姟鍙�")] [SugarColumn(IsNullable = true,Length =50, ColumnDescription = "AGV浠诲姟鍙�")] public string AgvTaskNum { get; set; } + /// <summary> /// 鎵樼洏缂栧彿 /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" index 08ad5c7..bfebe8b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" @@ -35,14 +35,18 @@ DbType = DbType.SqlServer }); - //List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); + List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); - //_dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); + _dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); - //_dbContext.Db.Insertable(warehouses).ExecuteCommand(); + _dbContext.Db.Insertable(warehouses).ExecuteCommand(); List<Dt_ApiInfo> apiInfos = _dbContext.Db.Queryable<Dt_ApiInfo>().ToList(); + List<Dt_WarehouseDevice> warehouseDevices = _dbContext.Db.Queryable<Dt_WarehouseDevice>().ToList(); + + _cacheService.AddOrUpdate(nameof(Dt_WarehouseDevice), warehouseDevices); + _cacheService.AddOrUpdate(nameof(apiInfos), apiInfos); } catch (Exception ex) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 7effdeb..0c1cc60 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -146,21 +146,19 @@ WebResponseContent content = new WebResponseContent(); try { - List<Dt_WarehouseDevice> warehouseDevices = Db.Queryable<Dt_WarehouseDevice>().ToList(); - + bool flag = false; List<Dt_Task> tasks = new List<Dt_Task>(); foreach (var item in taskDTOs) { if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) { + flag = true; continue; } Dt_Task task = _mapper.Map<Dt_Task>(item); task.Creater = "WMS"; task.TaskState = (int)TaskStatusEnum.New; task.CurrentAddress = item.SourceAddress; - - List<Dt_WarehouseDevice> wades = warehouseDevices.Where(x => x.WarehouseId == item.WarehouseId).ToList(); Dt_Router? router; @@ -195,6 +193,11 @@ task.NextAddress = router.NextPosi; task.DeviceCode = stationManger.StationDeviceCode; } + else if (item.TaskType == TaskTypeEnum.MesMatReturn.ObjToInt() && !router.IsEnd) + { + task.NextAddress = router.NextPosi; + task.DeviceCode = router.ChildPosi; + } else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) { task.NextAddress = router.NextPosi; @@ -221,7 +224,7 @@ if (dt_Routers != null && dt_Routers.Count > 0) { task.NextAddress = dt_Routers.FirstOrDefault().NextPosi; - task.DeviceCode = dt_Routers.FirstOrDefault().ChildPosiDeviceCode; + task.DeviceCode = dt_Routers.FirstOrDefault().ChildPosi; } else { @@ -274,7 +277,7 @@ _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "鎺ユ敹WMS浠诲姟"); - content = tasks.Count > 0 ? WebResponseContent.Instance.OK("鎴愬姛") : WebResponseContent.Instance.Error("澶辫触"); + content = (flag || tasks.Count > 0) ? WebResponseContent.Instance.OK("鎴愬姛") : WebResponseContent.Instance.Error("澶辫触"); } catch (Exception ex) { @@ -323,6 +326,35 @@ return content; } + public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress) + { + WebResponseContent content = new WebResponseContent(); + try + { + string address = AppSettings.Get("WMSApiAddress"); + if (string.IsNullOrEmpty(address)) + { + return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃"); + } + string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}"); + WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); + if (responseContent != null && responseContent.Status && responseContent.Data != null) + { + WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); + if (taskDTO != null) + { + content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); + } + } + + } + catch (Exception ex) + { + content = WebResponseContent.Instance.Error(ex.Message); + } + return content; + } + public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string roadway) { WebResponseContent content = new WebResponseContent(); @@ -352,6 +384,12 @@ return content; } + /// <summary> + /// 鍒嗛厤宸烽亾 + /// </summary> + /// <param name="taskNum"></param> + /// <param name="roadwayNos"></param> + /// <returns></returns> public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos) { WebResponseContent content = new WebResponseContent(); @@ -377,6 +415,43 @@ return content; } + /// <summary> + /// 鍒嗛厤宸烽亾 + /// </summary> + /// <param name="roadwayNos"></param> + /// <param name="taskNum"></param> + /// <param name="heightType"></param> + /// <returns></returns> + public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, int taskNum, int heightType) + { + WebResponseContent content = new WebResponseContent(); + try + { + string address = AppSettings.Get("WMSApiAddress"); + if (string.IsNullOrEmpty(address)) + { + return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃"); + } + string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}&heightType={heightType}", roadwayNos.Serialize()); + WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); + if (responseContent != null && responseContent.Status && responseContent.Data != null) + { + return responseContent; + } + + } + catch (Exception ex) + { + content = WebResponseContent.Instance.Error(ex.Message); + } + return content; + } + + /// <summary> + /// 鍒嗛厤宸烽亾 + /// </summary> + /// <param name="roadwayNos"></param> + /// <returns></returns> public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos) { WebResponseContent content = new WebResponseContent(); @@ -424,6 +499,29 @@ } /// <summary> + /// + /// </summary> + /// <param name="taskNum"></param> + /// <param name="roadwayNo"></param> + /// <param name="heightType"></param> + /// <returns></returns> + /// <exception cref="Exception"></exception> + public string? RequestAssignLocationByHeight(int taskNum, string roadwayNo, int heightType) + { + string address = AppSettings.Get("WMSApiAddress"); + if (string.IsNullOrEmpty(address)) throw new Exception("鏈壘鍒癢MSApi鍦板潃"); + string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocationByHeight?taskNum={taskNum}&roadwayNo={roadwayNo}&heightType={heightType}"); + + WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); + if (responseContent != null && responseContent.Status && responseContent.Data != null) + { + return responseContent.Data.ToString(); + } + + return ""; + } + + /// <summary> /// 鏍规嵁璁惧缂栧彿銆佷换鍔$被鍨嬪垎缁�(鍙��)鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鏂板鐨勪换鍔� /// </summary> /// <param name="deviceNo">璁惧缂栧彿</param> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs" index 11b1739..0ade787 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService_Operate.cs" @@ -24,7 +24,7 @@ /// <param name="targetAddress">淇敼鍚庣殑鐩爣鍦板潃</param> /// <param name="currentAddress">淇敼鍚庣殑褰撳墠鍦板潃</param> /// <param name="nextAddress">淇敼鍚庣殑涓嬩竴鍦板潃</param> - public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "") + public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "") { StringBuilder stringBuilder = new StringBuilder(App.User?.UserId == 0 ? $"绯荤粺鑷姩娴佺▼" : "浜哄伐鎵嬪姩娴佺▼"); if (task.DeviceCode != deviceCode && !string.IsNullOrEmpty(deviceCode)) @@ -51,6 +51,11 @@ { stringBuilder.Append($",涓嬩竴浣嶇疆鐢眥task.NextAddress}鍙樻洿涓簕nextAddress}"); task.NextAddress = nextAddress; + } + if (task.Roadway != roadwayNo && !string.IsNullOrEmpty(roadwayNo)) + { + stringBuilder.Append($",宸烽亾鍙风敱{task.Roadway}鍙樻洿涓簕roadwayNo}"); + task.Roadway = roadwayNo; } if (task.TaskState != taskStatus.ObjToInt()) { @@ -95,10 +100,8 @@ string address = AppSettings.Get("WMSApiAddress"); if (!string.IsNullOrEmpty(address)) { - //HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); + HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); } - - } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" index 887955e..39c30d6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" @@ -99,12 +99,12 @@ /// <summary> /// 棰勭暀 /// </summary> - public short Sapre1 { get; set; } + public short Spare1 { get; set; } /// <summary> /// 棰勭暀 /// </summary> - public short Sapre2 { get; set; } + public short Spare2 { get; set; } /// <summary> /// 浜や簰淇″彿 @@ -213,12 +213,12 @@ /// <summary> /// 棰勭暀 /// </summary> - public short Sapre1 { get; set; } + public short Spare1 { get; set; } /// <summary> /// 棰勭暀 /// </summary> - public short Sapre2 { get; set; } + public short Spare2 { get; set; } /// <summary> /// 浜や簰淇″彿 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs" index 94217b8..eb3feee 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs" @@ -84,10 +84,10 @@ } else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) { - Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode); + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); if (task != null) { - _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode); + _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode, deviceCode: task.Roadway, nextAddress: task.TargetAddress); } device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" index cf2235c..a520b73 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" @@ -148,7 +148,7 @@ task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt(); task.CurrentAddress = stationManger.StationCode; _taskRepository.UpdateData(task); - _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,锛屼换鍔$姸鎬佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�"); + _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,浠诲姟鐘舵�佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�"); //todo 瀹屾垚 } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) @@ -233,7 +233,7 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; + string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/ConveyorLineJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/ConveyorLineJob_BC.cs" index 8ac14fc..9c98f0c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/ConveyorLineJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/ConveyorLineJob_BC.cs" @@ -1,4 +1,6 @@ -锘縰sing Quartz; +锘縰sing Newtonsoft.Json; +using Quartz; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +11,7 @@ using WIDESEAWCS_Common.Helper; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; @@ -19,14 +22,16 @@ using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; +using WIDESEAWCS_TaskInfoService; using WIDESEAWCS_Tasks.ConveyorLineJob; +using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] public class ConveyorLineJob_BC : JobBase, IJob { - + private readonly ICacheService _cacheService; private readonly ITaskService _taskService; private readonly ITaskExecuteDetailService _taskExecuteDetailService; private readonly ITaskRepository _taskRepository; @@ -34,9 +39,11 @@ private readonly IRouterRepository _routerRepository; private readonly IRouterService _routerService; private readonly IRouterExtension _routerExtension; + private readonly List<Dt_WarehouseDevice> warehouseDevices; - public ConveyorLineJob_BC(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) + public ConveyorLineJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) { + _cacheService = cacheService; _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _taskRepository = taskRepository; @@ -44,6 +51,16 @@ _routerRepository = routerRepository; _routerService = routerService; _routerExtension = routerExtension; + + string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); + if (!string.IsNullOrEmpty(warehouseDevicesStr)) + { + warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); + } + else + { + warehouseDevices = new List<Dt_WarehouseDevice>(); + } } public Task Execute(IJobExecutionContext context) @@ -52,6 +69,12 @@ if (flag && value != null) { OtherDevice device = (OtherDevice)value; + Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == device.DeviceCode); + if (warehouseDevice == null) + { + WriteError(device.DeviceName, $"璇烽厤缃粨搴撹澶囦俊鎭�"); + return Task.CompletedTask; + } List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) @@ -78,18 +101,40 @@ if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) { + { + #region 鐢熸垚浠诲姟鍚庣粰杈撻�佺嚎鍚姩淇″彿 + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) /*&& x.DeviceCode == item.StationDeviceCode*/ && (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.WarehouseId == warehouseDevice.WarehouseId); + if (task != null && conveyorLineInfoWrite.Spare2 == 0) + { + List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); + WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations, task.TaskNum, conveyorLineInfoRead.Spare2); + if (responseContent.Status) + { + device.SetValue(W_ConveyorLineDB.Spare2, 1, item.StationCode); + _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: item.StationDeviceCode, roadwayNo: responseContent.Data.ToString() ?? ""); + } + } + #endregion + } + if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK) { if (conveyorLineInfoRead.TaskNum == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//閲囪喘鍏ュ簱 { - Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); + #region 浠诲姟鍙蜂负0锛屼笖鏈夋墭鐩樺彿锛屽垯鏄噰璐叆搴� + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()) && x.PalletCode == conveyorLineInfoRead.Barcode && x.WarehouseId == warehouseDevice.WarehouseId); if (task != null) { + device.SetValue(W_ConveyorLineDB.Spare2, 0, item.StationCode); + string currentAddress = task.CurrentAddress; string nextAddress = task.NextAddress; + string targetAddress = task.TargetAddress; + string deviceCode = task.DeviceCode; TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, task.Roadway, task.TaskType); - if (routers == null || routers.Count == 0) + Dt_Router? router = routers.FirstOrDefault(); + if (routers == null || routers.Count == 0 || router == null) { WriteError(item.StationName, $"鏈壘鍒板搴旇矾鐢变俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); continue; @@ -99,13 +144,24 @@ WriteError(item.StationName, $"璺敱淇℃伅閰嶇疆閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); continue; } - Dt_Router router = routers.FirstOrDefault(); + if (router.IsEnd) { - currentAddress = item.StackerCraneStationCode; - nextAddress = task.TargetAddress; - taskState = TaskStatusEnum.SC_Execute; - device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); + string? targetLoca = _taskService.RequestAssignLocationByHeight(task.TaskNum, task.Roadway, conveyorLineInfoRead.Spare2); + if (!string.IsNullOrEmpty(targetLoca)) + { + currentAddress = item.StackerCraneStationCode; + targetAddress = targetLoca; + nextAddress = targetLoca; + taskState = TaskStatusEnum.SC_Execute; + deviceCode = item.StackerCraneCode; + device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); + } + else + { + WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅澶辫触,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } } else { @@ -115,95 +171,65 @@ device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress); + _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress, deviceCode: deviceCode); } - else - { - List<Dt_Router> routers = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()); - - List<string> stations = routers.Select(x => x.NextPosi).ToList(); - - WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations); - if (responseContent.Status) - { - WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, responseContent.Data.ToString()); - if (content.Status) - { - task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); - if (task != null) - { - Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == item.StationCode); - if (router == null) - { - WriteError(item.StationName, $"鏈壘鍒板搴旇矾鐢变俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - continue; - } - string currentAddress = task.CurrentAddress; - string nextAddress = task.NextAddress; - TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; - - device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); - if (router.NextPosi != task.NextAddress) - { - currentAddress = item.StackerCraneStationCode; - nextAddress = task.TargetAddress; - taskState = TaskStatusEnum.SC_Execute; - device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); - } - else - { - device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); - } - - device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); - device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress); - //continue; - - //_taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); - - //device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - //device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); - //device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); - //device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); - //device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - } - } - } - } - + #endregion } else//鐢熶骇閫�搴� { - Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); // 甯︿换鍔″彿鏌ヨ浠诲姟 + #region 鐢熶骇閫�搴�,甯︿换鍔″彿鏌ヨ浠诲姟 + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.WarehouseId == warehouseDevice.WarehouseId); // 甯︿换鍔″彿鏌ヨ浠诲姟 if (task != null) { - Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == item.StationCode); - if (router == null) + List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); + WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations, task.TaskNum, conveyorLineInfoRead.Spare2); + if (responseContent.Status) { - WriteError(item.StationName, $"鏈壘鍒板搴旇矾鐢变俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - continue; + string currentAddress = task.CurrentAddress; + string nextAddress = task.NextAddress; + string targetAddress = task.TargetAddress; + TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; + List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, task.Roadway, task.TaskType); + Dt_Router? router = routers.FirstOrDefault(); + if (routers == null || routers.Count == 0 || router == null) + { + WriteError(item.StationName, $"鏈壘鍒板搴旇矾鐢变俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + if (routers.Count > 1) + { + WriteError(item.StationName, $"璺敱淇℃伅閰嶇疆閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + + if (router.IsEnd) + { + string? targetLoca = _taskService.RequestAssignLocationByHeight(task.TaskNum, task.Roadway, conveyorLineInfoRead.Spare2); + if (!string.IsNullOrEmpty(targetLoca)) + { + currentAddress = item.StackerCraneStationCode; + nextAddress = targetAddress; + taskState = TaskStatusEnum.SC_Execute; + targetAddress = targetLoca; + device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); + } + else + { + WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅澶辫触,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + } + else + { + device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); + } + device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); + device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); + device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); + device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); + _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress); } - - Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); - if (stationManger == null) - { - WriteError(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - continue; - } - - string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, router.NextPosi); - if (string.IsNullOrEmpty(locationCode)) - { - WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - continue; - } - - _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, targetAddress: locationCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: locationCode); - - device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); - device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); + #endregion } } } @@ -213,7 +239,7 @@ } else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum == 0)//鍑哄簱 { - Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()); + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.WarehouseId == warehouseDevice.WarehouseId); if (task != null) { _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); @@ -224,18 +250,18 @@ device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); } - else - { - task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && string.IsNullOrEmpty(x.DeviceCode) && x.TaskState == TaskStatusEnum.New.ObjToInt()); - if (task != null) - { - Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.CurrentAddress); - if (stationManger != null) - { - _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: task.TargetAddress); - } - } - } + //else + //{ + // task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && string.IsNullOrEmpty(x.DeviceCode) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.WarehouseId == warehouseDevice.WarehouseId); + // if (task != null) + // { + // Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.CurrentAddress); + // if (stationManger != null) + // { + // _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: task.TargetAddress); + // } + // } + //} } else if (!conveyorLineSignalRead.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" index b8d32e1..3c3ba6a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" @@ -1,5 +1,6 @@ 锘縰sing Microsoft.AspNetCore.Components.Routing; using Microsoft.IdentityModel.Tokens; +using Newtonsoft.Json; using Quartz; using System; using System.Collections.Generic; @@ -10,6 +11,7 @@ using WIDESEAWCS_Common.Helper; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; @@ -27,22 +29,34 @@ [DisallowConcurrentExecution] public class RGVJob_BC : JobBase, IJob { - + private readonly ICacheService _cacheService; private readonly ITaskService _taskService; private readonly ITaskExecuteDetailService _taskExecuteDetailService; private readonly ITaskRepository _taskRepository; private readonly IStationMangerRepository _stationMangerRepository; private readonly IRouterRepository _routerRepository; private readonly IRouterService _routerService; + private readonly List<Dt_WarehouseDevice> warehouseDevices; - public RGVJob_BC(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService) + public RGVJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService) { + _cacheService = cacheService; _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _taskRepository = taskRepository; _stationMangerRepository = stationMangerRepository; _routerRepository = routerRepository; _routerService = routerService; + + string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); + if (!string.IsNullOrEmpty(warehouseDevicesStr)) + { + warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); + } + else + { + warehouseDevices = new List<Dt_WarehouseDevice>(); + } } public Task Execute(IJobExecutionContext context) @@ -51,6 +65,14 @@ if (flag && value != null) { OtherDevice device = (OtherDevice)value; + + Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == device.DeviceCode); + if (warehouseDevice == null) + { + WriteError(device.DeviceName, $"璇烽厤缃粨搴撹澶囦俊鎭�"); + return Task.CompletedTask; + } + List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) @@ -79,86 +101,102 @@ { if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱 { - Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress)); - if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) + WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.Barcode, item.StationCode); + if (content.Status) { - Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); - if (stationManger == null) + Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); + if (task != null) { - WriteError(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - continue; - } - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi)); - Dt_Router? router = routers.FirstOrDefault(); - if (router == null) - { - WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType}瀵瑰簲鐨勮矾鐢变俊鎭�"); - } - else - { - if (routers.Count == 1) - { - task.Dispatchertime = DateTime.Now; - _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode); - - device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); - device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode); - device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); - device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - } - else - { - List<string> canInboundStations = new List<string>(); - List<string> stations = routers.Select(x => x.NextPosi).ToList(); - foreach (string station in stations) - { - Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station); - if (stationManger1 != null) - { - IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode); - if (device1 != null) - { - OtherDevice otherDevice = (OtherDevice)device1; - //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode); - //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt()) - { - canInboundStations.Add(stationManger1.Remark); - } - } - } - } - - WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations); - if (responseContent.Status) - { - List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType); - - Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault(); - if (routerTemp != null) - { - task.Dispatchertime = DateTime.Now; - task.Roadway = responseContent.Data.ToString() ?? task.Roadway; - _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode); - - device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); - device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode); - device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); - device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - } - else - { - WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType},璧风偣{item.StationCode},缁堢偣{responseContent.Data.ToString()}鐨勮矾鐢变俊鎭�"); - } - } - else - { - WriteError(device.DeviceName, responseContent.Message); - } - } + device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); + device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); + device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); + device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); + _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); } } + + #region + //Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress)); + //if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) + //{ + // Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); + // if (stationManger == null) + // { + // WriteError(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + // continue; + // } + // List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi)); + // Dt_Router? router = routers.FirstOrDefault(); + // if (router == null) + // { + // WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType}瀵瑰簲鐨勮矾鐢变俊鎭�"); + // } + // else + // { + // if (routers.Count == 1) + // { + // task.Dispatchertime = DateTime.Now; + // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode); + + // device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); + // device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode); + // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); + // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); + // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); + // } + // else + // { + // List<string> canInboundStations = new List<string>(); + // List<string> stations = routers.Select(x => x.NextPosi).ToList(); + // foreach (string station in stations) + // { + // Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station); + // if (stationManger1 != null) + // { + // IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode); + // if (device1 != null) + // { + // OtherDevice otherDevice = (OtherDevice)device1; + // //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode); + // //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt()) + // { + // canInboundStations.Add(stationManger1.Remark); + // } + // } + // } + // } + + // WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations); + // if (responseContent.Status) + // { + // List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType); + + // Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault(); + // if (routerTemp != null) + // { + // task.Dispatchertime = DateTime.Now; + // task.Roadway = responseContent.Data.ToString() ?? task.Roadway; + // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode); + + // device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); + // device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode); + // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); + // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); + // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); + // } + // else + // { + // WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType},璧风偣{item.StationCode},缁堢偣{responseContent.Data.ToString()}鐨勮矾鐢变俊鎭�"); + // } + // } + // else + // { + // WriteError(device.DeviceName, responseContent.Message); + // } + // } + // } + //} + #endregion } else if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//鍑哄簱 { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" index b206974..b688792 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" @@ -28,6 +28,7 @@ using WIDESEAWCS_TaskInfoService; using WIDESEAWCS_Tasks.ConveyorLineJob; using WIDESEAWCS_QuartzJob.Repository; +using Autofac.Core; namespace WIDESEAWCS_Tasks { @@ -42,6 +43,7 @@ private readonly IStationMangerRepository _stationMangerRepository; private readonly IRouterRepository _routerRepository; private List<Dt_ApiInfo> apiInfos; + private readonly List<Dt_WarehouseDevice> warehouseDevices; public StackerCraneJob_BC(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) { @@ -66,6 +68,17 @@ apiInfos = infos; } } + + + string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); + if (!string.IsNullOrEmpty(warehouseDevicesStr)) + { + warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); + } + else + { + warehouseDevices = new List<Dt_WarehouseDevice>(); + } } public Task Execute(IJobExecutionContext context) @@ -75,6 +88,13 @@ CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); if (commonStackerCrane != null) { + Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == commonStackerCrane.DeviceCode); + if (warehouseDevice == null) + { + WriteError(commonStackerCrane.DeviceName, $"璇烽厤缃粨搴撹澶囦俊鎭�"); + return Task.CompletedTask; + } + if (!commonStackerCrane.IsEventSubscribed) { commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢 @@ -234,15 +254,15 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; - if (string.IsNullOrEmpty(url)) - { - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); - WriteError(commonStackerCrane.DeviceCode, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); - _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); - return null; - } - HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo 璋冪敤WMS浠诲姟瀹屾垚鏂规硶 + //string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; + //if (string.IsNullOrEmpty(url)) + //{ + // _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); + // WriteError(commonStackerCrane.DeviceCode, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); + // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); + // return null; + //} + //HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo 璋冪敤WMS浠诲姟瀹屾垚鏂规硶 } return task; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" index cbe865d..80714d4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" @@ -222,7 +222,7 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; + string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛"); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/package.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/package.json" index a37c00f..e81efa4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/package.json" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/package.json" @@ -16,9 +16,11 @@ "core-js": "^3.6.5", "echarts": "^5.0.2", "element-plus": "^2.2.14", + "jsbarcode": "^3.11.6", "less": "^4.1.1", "qrcode": "^1.5.4", "vue": "^3.2.37", + "vue-barcode": "^1.3.0", "vue-draggable-next": "^2.0.1", "vue-qrcode": "^2.2.2", "vue-router": "^4.0.0-0", diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/2ad7410e-7b16-4692-8ca2-e7055946c8fa.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/2ad7410e-7b16-4692-8ca2-e7055946c8fa.vsidx" deleted file mode 100644 index 597a8a5..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/2ad7410e-7b16-4692-8ca2-e7055946c8fa.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ddab6c09-d32a-4e10-9c68-7904d199b1b7.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ddab6c09-d32a-4e10-9c68-7904d199b1b7.vsidx" new file mode 100644 index 0000000..38d0388 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ddab6c09-d32a-4e10-9c68-7904d199b1b7.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" deleted file mode 100644 index e69de29..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" +++ /dev/null diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs" index b93725a..77bf3d4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_BC.cs" @@ -29,7 +29,7 @@ /// 鎵樼洏绫诲瀷 /// </param> /// <returns></returns> - public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") + public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "", int heightType = 0) { lock (_locker_BC) { @@ -67,14 +67,33 @@ } } - //宸插畾涔夎揣浣嶇被鍨嬬殑璐т綅 - List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); //鏈畾涔夌被鍨嬬殑绌鸿揣浣� List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList(); List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList(); + if(heightType == 1) + { + undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x=>x.Layer <= 3).ToList(); + definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer <= 3).ToList(); + } + else if(heightType == 2) + { + undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 4).ToList(); + definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 4).ToList(); + } + else if (heightType == 3) + { + undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 5).ToList(); + definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 5).ToList(); + } + else + { + undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => false).ToList(); + definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => false).ToList(); + } + if (palletTypeInfo.LocaitonCount == 2) { if (roadwayNo != "SC01_BC") diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" index 2b083e1..6f3a453 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" @@ -26,7 +26,7 @@ public partial class LocationInfoService { - public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId) + public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId, string beRelocationCode = "", int heightType = 0) { Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); if (warehouse == null) @@ -51,11 +51,11 @@ return warehouse.WarehouseCode switch { - "HA57" => AssignLocation_BC(roadwayNo, palletType, palletTypeInfo), - "HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo), - "HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo), - "HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo), - "闃荤剨浠�" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo), + "HA57" => AssignLocation_BC(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType), + "HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo, beRelocationCode), + "HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo, beRelocationCode), + "HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo, beRelocationCode), + "闃荤剨浠�" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo, beRelocationCode), "HA153" => AssignLocation(roadwayNo), "HA71" => AssignLocation(roadwayNo), "HA60" => AssignLocation(roadwayNo), diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs" index fa3067a..65ea267 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs" @@ -53,6 +53,9 @@ [Description("鎷i�夊畬鎴�")] 鎷i�夊畬鎴� =14, + [Description("閫�搴�")] + MES閫�搴� = 21, + [Description("缁勭洏鎾ら攢")] 缁勭洏鎾ら攢 = 99, diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" index 5d120d5..94735f5 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" @@ -58,7 +58,7 @@ /// <param name="roadwayNo">宸烽亾鍙�</param> /// <param name="palletType">鎵樼洏绫诲瀷</param> /// <returns></returns> - Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId); + Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId, string beRelocationCode = "", int heightType = 0); /// <summary> /// 淇敼璐т綅鐘舵�佸強绫诲瀷 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" index 97fd35c..b8274e8 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" @@ -89,6 +89,14 @@ WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode); /// <summary> + /// 浠呯敵璇蜂换鍔★紝璁¦CS鏍规嵁璺敱纭畾涓嬩竴鍦板潃 + /// </summary> + /// <param name="stationCode"></param> + /// <param name="palletCode"></param> + /// <returns></returns> + WebResponseContent DeviceRequestInboundTask(string stationCode, string palletCode); + + /// <summary> /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 /// </summary> /// <param name="taskNum">浠诲姟鍙�</param> @@ -96,6 +104,15 @@ /// <param name="palletType">鎵樼洏绫诲瀷</param> /// <returns></returns> WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo); + + /// <summary> + /// + /// </summary> + /// <param name="taskNum"></param> + /// <param name="roadwayNo"></param> + /// <param name="heightType"></param> + /// <returns></returns> + WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType); /// <summary> /// @@ -198,6 +215,15 @@ MesResponseContent SubstrateBack(SubstrateBackModel model); /// <summary> + /// + /// </summary> + /// <param name="roadwayNos"></param> + /// <param name="taskNum"></param> + /// <param name="heightType"></param> + /// <returns></returns> + WebResponseContent AssignRoadway(List<string> roadwayNos, int taskNum, int heightType = 0); + + /// <summary> /// 鍒嗛厤宸烽亾 /// </summary> /// <param name="taskNum"></param> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" index b982e9b..9dcadff 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" @@ -20,6 +20,57 @@ /// <param name="taskNum">浠诲姟鍙�</param> /// <param name="roadwayNos">宸烽亾鍙�</param> /// <returns></returns> + public WebResponseContent AssignRoadway(List<string> roadwayNos, int taskNum, int heightType = 0) + { + try + { + if(heightType == 0 || heightType > 3) + { + return WebResponseContent.Instance.Error($"楂樺害閿欒"); + } + + Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); + } + + if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) + { + return WebResponseContent.Instance.OK(data: task.TargetAddress); + } + string roadwayNo = ""; + if (heightType == 1) + { + List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer <= 3).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); + roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; + } + else if (heightType == 2) + { + List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 4).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); + roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; + } + else if (heightType == 3) + { + List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 5).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); + roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; + } + + return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo) : WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤宸烽亾"); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + + /// <summary> + /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 + /// </summary> + /// <param name="taskNum">浠诲姟鍙�</param> + /// <param name="roadwayNos">宸烽亾鍙�</param> + /// <returns></returns> public WebResponseContent AssignRoadway(int taskNum, List<string> roadwayNos) { try @@ -51,7 +102,6 @@ /// <summary> /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> /// <param name="roadwayNos">宸烽亾鍙�</param> /// <returns></returns> public WebResponseContent AssignRoadway(List<string> roadwayNos) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" index 6000ca6..7fba9f9 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" @@ -455,27 +455,27 @@ OutboundQuantity = 0, SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0", StockQuantity = model.Quantity, - Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), + Status = StockStatusEmun.MES閫�搴�.ObjToInt(), Unit = model.Unit }; - Dt_Task task = new Dt_Task() - { - PalletCode = stockInfo.PalletCode, - CurrentAddress = "", - NextAddress = "", - PalletType = stockInfo.PalletType, - Roadway = "RGV01_BC", - SourceAddress = "RGV01_BC", - TargetAddress = "", - TaskStatus = TaskStatusEnum.New.ObjToInt(), - TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), - WarehouseId = warehouse.WarehouseId - }; + //Dt_Task task = new Dt_Task() + //{ + // PalletCode = stockInfo.PalletCode, + // CurrentAddress = "", + // NextAddress = "", + // PalletType = stockInfo.PalletType, + // Roadway = "RGV01_BC", + // SourceAddress = "RGV01_BC", + // TargetAddress = "", + // TaskStatus = TaskStatusEnum.New.ObjToInt(), + // TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), + // WarehouseId = warehouse.WarehouseId + //}; _unitOfWorkManage.BeginTran(); Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); - BaseDal.AddData(task); + //BaseDal.AddData(task); _unitOfWorkManage.CommitTran(); return MesResponseContent.Instance.OK(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 2b23564..a654e01 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -423,7 +423,7 @@ if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) { MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, mesOutboundOrders.FirstOrDefault().OrderQuantity); - UploadMesMaterialLotaAcept(model); + UploadMesMaterialLotaAcept(model); } return WebResponseContent.Instance.OK(); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index 054d654..03e3295 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -22,8 +22,7 @@ /// <summary> /// 鐢宠鍏ュ簱浠诲姟(PDA浣跨敤锛屼粎鎵樼洏缁戝畾鍏ュ簱绔欏彴锛屼笉鍒嗛厤璐т綅) /// </summary> - /// <param name="palletCode">鎵樼洏鍙�</param> - /// <param name="stationCode">绔欏彴鍙�</param> + /// <param name="saveModel"></param> /// <returns></returns> public WebResponseContent RequestInboundTask(SaveModel saveModel) { @@ -111,9 +110,13 @@ return WebResponseContent.Instance.Error(ex.Message); } } + /// <summary> /// 鍏ョ┖绠� /// </summary> + /// <param name="barcode"></param> + /// <param name="address"></param> + /// <param name="WarehouseId"></param> /// <returns></returns> public WebResponseContent InEmpty(string barcode, string address, int WarehouseId) { @@ -173,6 +176,15 @@ return WebResponseContent.Instance.Error(ex.Message); } } + + /// <summary> + /// + /// </summary> + /// <param name="qty"></param> + /// <param name="address"></param> + /// <param name="WarehouseId"></param> + /// <param name="barcode"></param> + /// <returns></returns> public WebResponseContent OutEmpty(int qty, string address, int WarehouseId, string barcode) { try @@ -216,6 +228,14 @@ return WebResponseContent.Instance.Error(ex.Message); } } + + /// <summary> + /// + /// </summary> + /// <param name="stationCode"></param> + /// <param name="roadwayNo"></param> + /// <param name="palletCode"></param> + /// <returns></returns> public WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode) { try @@ -223,6 +243,7 @@ Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); if (task != null) { + PushTasksToWCS(new List<Dt_Task> { task }); return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task)); } @@ -236,7 +257,7 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); } - if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt()) { return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); } @@ -266,9 +287,14 @@ PalletType = stockInfo.PalletType }; + if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) { stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + } + else if (stockInfo.StockStatus == StockStatusEmun.MES閫�搴�.ObjToInt()) + { + newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); } else if (stockInfo.StockStatus == StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) { @@ -282,6 +308,89 @@ _unitOfWorkManage.BeginTran(); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); + int taskId = BaseDal.AddData(newTask); + newTask.TaskId = taskId; + _stockRepository.StockInfoRepository.UpdateData(stockInfo); + _unitOfWorkManage.CommitTran(); + WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); + + PushTasksToWCS(new List<Dt_Task> { newTask }); + if (newTask.WarehouseId == 5) PutFinish(stationCode); + return WebResponseContent.Instance.OK(data: wMSTaskDTO); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + + /// <summary> + /// 浠呯敵璇蜂换鍔★紝璁¦CS鏍规嵁璺敱纭畾涓嬩竴鍦板潃 + /// </summary> + /// <param name="stationCode"></param> + /// <param name="palletCode"></param> + /// <returns></returns> + public WebResponseContent DeviceRequestInboundTask(string stationCode, string palletCode) + { + try + { + Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); + if (task != null) + { + PushTasksToWCS(new List<Dt_Task> { task }); + return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task)); + } + + if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) + { + return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); + } + + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); + if (stockInfo == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); + } + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt()) + { + return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); + } + if (!string.IsNullOrEmpty(stockInfo.LocationCode)) + { + return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); + } + + Dt_Task newTask = new Dt_Task() + { + CurrentAddress = stationCode, + Grade = 0, + NextAddress = "", + PalletCode = palletCode, + Roadway = "", + SourceAddress = stationCode, + TargetAddress = "", + TaskType = TaskTypeEnum.Inbound.ObjToInt(), + TaskStatus = TaskStatusEnum.New.ObjToInt(), + WarehouseId = stockInfo.WarehouseId, + PalletType = stockInfo.PalletType + }; + + + if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) + { + stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + } + else if (stockInfo.StockStatus == StockStatusEmun.MES閫�搴�.ObjToInt()) + { + newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); + } + else + { + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + } + + _unitOfWorkManage.BeginTran(); int taskId = BaseDal.AddData(newTask); newTask.TaskId = taskId; _stockRepository.StockInfoRepository.UpdateData(stockInfo); @@ -345,5 +454,53 @@ return WebResponseContent.Instance.Error(ex.Message); } } + + /// <summary> + /// + /// </summary> + /// <param name="taskNum"></param> + /// <param name="roadwayNo"></param> + /// <param name="heightType"></param> + /// <returns></returns> + public WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType) + { + try + { + Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); + } + + if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) + { + return WebResponseContent.Instance.OK(data: task.TargetAddress); + } + + Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, task.PalletType, task.WarehouseId, heightType: heightType); + if (locationInfo == null) + { + return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅"); + } + + task.Roadway = roadwayNo; + task.TargetAddress = locationInfo.LocationCode; + task.TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(); + + LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; + + _unitOfWorkManage.BeginTran(); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); + BaseDal.UpdateData(task); + _unitOfWorkManage.CommitTran(); + return WebResponseContent.Instance.OK(data: locationInfo.LocationCode); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" index 98f8469..3b3657b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" @@ -67,10 +67,29 @@ return Service.OutEmpty(qty, address, WarehouseId, barcode); } + /// <summary> + /// WCS鐢宠鍏ュ簱浠诲姟(鍒嗛厤璐т綅) + /// </summary> + /// <param name="stationCode"></param> + /// <param name="roadwayNo"></param> + /// <param name="palletCode"></param> + /// <returns></returns> [HttpPost, HttpGet, Route("DeviceRequestInboundTask"), AllowAnonymous] public WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode) { return Service.DeviceRequestInboundTask(stationCode, roadwayNo, palletCode); + } + + /// <summary> + /// WCS鐢宠鍏ュ簱浠诲姟(涓嶅垎閰嶈揣浣�) + /// </summary> + /// <param name="stationCode"></param> + /// <param name="palletCode"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("DeviceRequestInboundTaskSimple"), AllowAnonymous] + public WebResponseContent DeviceRequestInboundTaskSimple(string stationCode, string palletCode) + { + return Service.DeviceRequestInboundTask(stationCode, palletCode); } /// <summary> @@ -83,6 +102,19 @@ public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) { return Service.AssignInboundTaskLocation(taskNum, roadwayNo); + } + + /// <summary> + /// + /// </summary> + /// <param name="taskNum"></param> + /// <param name="roadwayNo"></param> + /// <param name="heightType"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("AssignInboundTaskLocationByHeight"), AllowAnonymous] + public WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType) + { + return Service.AssignInboundTaskLocationByHeight(taskNum, roadwayNo, heightType); } /// <summary> @@ -188,7 +220,20 @@ } /// <summary> - /// 鍒嗛厤宸烽亾 + /// 鍒嗛厤宸烽亾(甯︿换鍔″彿鍙婇珮搴�) + /// </summary> + /// <param name="roadwayNos"></param> + /// <param name="taskNum"></param> + /// <param name="heightType"></param> + /// <returns></returns> + [HttpPost, Route("AssignRoadwayByHeight"), AllowAnonymous] + public WebResponseContent AssignRoadwayByHeight([FromBody] List<string> roadwayNos, int taskNum, int heightType = 0) + { + return Service.AssignRoadway(roadwayNos, taskNum, heightType); + } + + /// <summary> + /// 鍒嗛厤宸烽亾(甯︿换鍔″彿) /// </summary> /// <param name="taskNum"></param> /// <param name="roadwayNos"></param> @@ -199,6 +244,11 @@ return Service.AssignRoadway(taskNum, roadwayNos); } + /// <summary> + /// 鍒嗛厤宸烽亾 + /// </summary> + /// <param name="roadwayNos"></param> + /// <returns></returns> [HttpPost, Route("SingleAssignRoadway"), AllowAnonymous] public WebResponseContent AssignRoadway([FromBody] List<string> roadwayNos) { -- Gitblit v1.9.3