肖洋
2024-12-11 68dbe298a5c67d8755cb4379e5106de7c54608c6
添加childDeviceCode至多个任务类,优化代码逻辑
已修改6个文件
94 ■■■■ 文件已修改
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -188,6 +188,7 @@
                object obj = new
                {
                    childDeviceCode,
                    command,
                    commandWrite
                };
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -115,6 +115,7 @@
                        object obj = new
                        {
                            childDeviceCode = station.stationChildCode,
                            commandAfter = command,
                        };
                        _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -178,6 +178,7 @@
                        object obj = new
                        {
                            childDeviceCode,
                            commandAfter = command,
                        };
                        _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
@@ -216,7 +217,7 @@
                var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
                //HandleTaskOut(conveyorLine, command, childDeviceCode, task);
                // && command.ConveyorLineBarcode != "NoRead" && !command.ConveyorLineBarcode.IsNotEmptyOrNull()
                ConsoleHelper.WriteSuccessLine($"【{conveyorLine.DeviceName}】托盘号:【{command.ConveyorLineBarcode}】设备编码:【{childDeviceCode}】");
                if (task == null)
                {
                    HandleNewTask(conveyorLine, command, childDeviceCode);
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -142,10 +142,9 @@
                {
                    //Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
                    ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】任务完成,任务号:【{e.TaskNum}】", ConsoleColor.Blue);
                    if (commonStackerCrane.DeviceCode.Contains("GW"))
                    {
                        var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
                    if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    {
                        var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress);
                        IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC);
@@ -255,7 +254,7 @@
                        }
                        else
                        {
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                        }
                    }
                }
@@ -278,7 +277,7 @@
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                        }
                    }
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.TargetAddress}】信息,无法校验站台");
                }
            }
            else
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj
@@ -16,8 +16,8 @@
    <PackageReference Include="AutoMapper" Version="13.0.1" />
    <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.8" />
    <PackageReference Include="log4net" Version="2.0.17" />
    <PackageReference Include="Magicodes.IE.EPPlus" Version="2.7.5.1" />
    <PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.1" />
    <PackageReference Include="Magicodes.IE.EPPlus" Version="2.7.5.2" />
    <PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.2" />
    <PackageReference Include="MailKit" Version="4.7.1.1" />
    <PackageReference Include="Masuit.Tools.Core" Version="2024.5.6" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.29" />
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -391,61 +391,9 @@
                }
            }
            //if (input.area != 3)
            //{
            //    if (input.PalletCode == null || input.PalletCode.Trim() == "")
            //        return content.Error("托盘条码为空");
            //}
            //创建一个TrayCellsStatusDto对象,并赋值
            //TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
            //{
            //    Software = "WMS",
            //    TrayBarcode = input.PalletCode,
            //    //EquipmentCode = "EQ_CWJZ01"
            //    EquipmentCode = input.EquiCodeMOM
            //};
            // 调用GetTrayCellStatusAsync方法,获取整盘电芯
            //content = await GetTrayCellStatusAsync(trayCells);
            // 如果状态为false,则返回content
            //if (!content.Status) return content;
            // 添加组盘信息
            // 将content.Data转换为ResultTrayCellsStatus对象
            //var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
            //if (result.SerialNos.Count <= 0)
            //    return content.Error(result.MOMMessage);
            //Console.WriteLine(result);
            //// TODO 获取本地料框属性与整盘电芯属性获取的值进行对比,如果一致则继续,否则返回错误信息
            ////var productions = await _productionRepository.QueryDataAsync(x => result.TrayBarcodePropertys.Select(x => x.TrayBarcodeProperty).ToList().Contains(x.TrayBarcodeProperty));
            ////if (productions.Count <= 0)
            ////    return content.Error("料框属性不存在");
            //// 调用CreateBoxingInfo方法,创建组盘信息
            //var boxing = CreateBoxingInfo(result, input.PalletCode);
            //if (boxing == null) return content.Error("组盘失败");
            //// 调用GetProcessApplyAsync方法,获取工艺路线
            //ProcessApplyDto process = await GetProcessApplyAsync(input, result);
            //// 如果process为null,则返回content
            //if (process == null) return content;
            //// 调用_processApplyService.GetProcessApplyAsync方法,获取工艺申请
            //content = await _processApplyService.GetProcessApplyAsync(process);
            //// 如果状态为false,则返回null
            //if (!content.Status) return content.Error("工艺申请失败");
            ////// 调用GetProcessResponseAsync方法,获取工艺响应
            ////var processResponse = await GetProcessResponseAsync(process, input.Position);
            // 调用CreateNewTask方法,创建新任务
            content = await CreateNewTask(input);
            //if (content.Status)
            //{
            //    var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
            //}
        }
        catch (Exception err)
        {
@@ -482,26 +430,8 @@
        }
        var task = await CreateNewTaskByStation(input, stationinfo);
        // 创建新任务实例
        //var task = new Dt_Task
        //{
        //    CurrentAddress = input.Position,
        //    Grade = 1,
        //    Roadway = input.Roadways,
        //    TargetAddress = locationInfo.LocationCode,
        //    Dispatchertime = DateTime.Now,
        //    MaterialNo = "",
        //    NextAddress = input.Roadways,
        //    OrderNo = null,
        //    PalletCode = input.PalletCode,
        //    SourceAddress = stationinfo.stationLocation,
        //    TaskState = (int)TaskInStatusEnum.Line_InFinish,
        //    TaskType = (int)TaskInboundTypeEnum.Inbound,
        //    TaskNum = await BaseDal.GetTaskNo(),
        //    Creater = "Systeam"
        //};
        // 尝试添加新任务
        if (task == null) return content.Error() ;
        var taskId = await BaseDal.AddDataAsync(task);
        bool isResult = taskId > 0;
        if (isResult)
@@ -605,6 +535,10 @@
                };
                return taskNG;
            }
            else
            {
                return null;
            }
        }
        // 处理异常电芯情况