From 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 09 七月 2025 22:55:27 +0800 Subject: [PATCH] 增加质检出入库逻辑 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs | 69 ++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 29 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs" index 1ee935b..08bf6b2 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineExtend/ConveyorLineExtend.cs" @@ -7,6 +7,7 @@ using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_DTO.WMSInfo; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -26,12 +27,15 @@ public List<Task> ConveyorLineExtend(CommonConveyorLine conveyorLine) { List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); + List<string> strings = new List<string>() { "1003", "1006", "1007" }; + childDeviceCodes.AddRange(strings); List<Task> tasks = new List<Task>(); foreach (string childDeviceCode in childDeviceCodes) { try { ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode); + _cacheService.AddOrUpdate(childDeviceCode, command); if (command != null) { if (childDeviceCode == "1002" && command.Status == (ushort)ConveyorStatus.Wait) @@ -44,36 +48,33 @@ } else if (childDeviceCode == "1008" && command.Status == (ushort)ConveyorStatus.Stored) { - ConveyorLineOutFinish(conveyorLine, command, childDeviceCode); + Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + if (task != null) + { + #region MyRegion + //List<Dt_Router> routers = _routerRepository.QueryData(x => x.StartPosi == task.TargetAddress && x.ChildPosiDeviceCode == "AGV" && x.Remark == "鏈崰鐢�"); + //if (routers != null && routers.Count > 0) + //{ + // var router = routers.FirstOrDefault(); + // if (router != null) + // { + // task.TaskState = TaskOutStatusEnum.Line_OutFinish.ObjToInt(); + // task.CurrentAddress = childDeviceCode; + // task.NextAddress = router.NextPosi; + // task.TargetAddress = task.NextAddress; + // router.Remark = "鍗犵敤"; + // _routerRepository.UpdateData(router); + // _taskService.UpdateData(task); + // } + //} + #endregion + task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt(); + WMSTaskDTO WMStask = _mapper.Map<WMSTaskDTO>(task); + _taskService.AddTask_Hty(task, TaskOperateTypeEnum.AutoComplete); + HttpHelper.PostAsync(WMSInterfaceAddress.UpdateTaskStatus, WMStask.ToJson(), headers: new Dictionary<string, string>()); + } } } - #region MyRegion - - //if (command != null && command.Status == (ushort)ConveyorStatus.Stored)//娣诲姞杈撻�佺嚎鐘舵�丆onveyorLineStatus enum - //{ - // switch (childDeviceCode) - // { - // case "1002": - // { - // RequestInbound(conveyorLine, command, childDeviceCode); - // } - // break; - // case "1004": - // ConveyorLineInFinish(conveyorLine, command, childDeviceCode); - // break; - // //case "105": - // // RequestOutbound(conveyorLine, command, childDeviceCode); - // // break; - // case "1008": - // ConveyorLineOutFinish(conveyorLine, command, childDeviceCode); - // break; - // //default: - // // RequestInNextAddress(conveyorLine, command, childDeviceCode); - // // RequestOutNextAddress(conveyorLine, command, childDeviceCode); - // // break; - // } - //} - #endregion } catch (Exception ex) { @@ -120,6 +121,7 @@ { task.ExceptionMessage = content?.Message; _taskService.UpdateData(task); + return; } //if (content.Status) //{ @@ -150,6 +152,15 @@ // if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) _taskService.UpdateData(task); // //} //} + } + else + { + Dt_Task _Task = new Dt_Task(); + _Task.TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")); + _Task.CurrentAddress = childDeviceCode; + _Task.NextAddress = "1001"; + ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(_Task); + taskCommand.WriterTrue = (short)command.inRead; } } @@ -185,7 +196,7 @@ Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.Barcode, childDeviceCode); if (task != null) _taskService.UpdateTaskStatusToNext(task); - task = _taskService.QueryCompletedConveyorLineTask(command.TaskNum, childDeviceCode); + task = _taskService.QueryCompletedConveyorLineTask(command.Barcode, childDeviceCode); if (task != null && string.IsNullOrEmpty(task.TargetAddress)) { _taskService.StackerCraneRequestInbound(task); -- Gitblit v1.9.3