肖洋
2025-01-10 5d663325953692c634046194bedd39b89ace41f0
更新多个文件,优化逻辑和异常处理

更新 .gitignore,忽略所有 XML 文件。
在 `HttpHelper.cs` 的 `PostAsync` 方法中优化请求跟踪和异常处理。
增强 `CommonConveyorLineJob.cs` 中对 `DeviceProAddress` 的处理逻辑。
扩展 `CommonStackerCraneJob.cs` 中设备状态判断的条件逻辑,更新异常信息。
在 `ProcessApplyService.cs` 中改进库存查询和异常反馈。
在 `Dt_TaskService.cs` 中强化反序列化处理,确保所有异常电芯状态被捕获。
已修改6个文件
95 ■■■■■ 文件已修改
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1652,3 +1652,4 @@
/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.csproj.CopyComplete
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/bef6627e/sessions/22de66c6-d93f-400b-aaa1-cc12e218c2e7
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/36708593-3f69-4656-815a-651b3ad17c7d
*.xml
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
@@ -47,6 +47,8 @@
        {
            try
            {
                if (serviceAddress.Contains("http://c24-cellmi3:12020"))
                {
                // 将 JSON 字符串转换为字典
                var parameters = JsonConvert.DeserializeObject<Dictionary<string, object>>(requestJson);
@@ -74,7 +76,7 @@
                {
                    requestTracker[requestKey] = (1, DateTime.Now);
                }
                }
                string result = string.Empty;
                using (HttpContent httpContent = new StringContent(requestJson))
                {
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -604,9 +604,13 @@
            // 将修改后的数组x重新拼接成字符串,作为新的DeviceProAddress
            string DeviceProAddress = string.Join(".", x);
            var writeBool = conveyorLine.Communicator.Read<bool>(DeviceProAddress);
            if (writeBool != value)
            {
            // 使用conveyorLine的Communicator对象的Write方法,将value写入新的DeviceProAddress地址
            conveyorLine.Communicator.Write(DeviceProAddress, value);
        }
        }
        #region 检测空盘实盘任务
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -312,6 +312,12 @@
            }
            else
            {
                if ((task.NextAddress == ("002-021-001") || task.NextAddress == ("001-021-001")) && task.Roadway.Contains("JZ"))
                {
                    return task;
                }
                else
                {
                //Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
                if (router != null)
                {
@@ -334,6 +340,7 @@
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                }
            }
            }
            return null;
        }
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
@@ -100,13 +100,13 @@
            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
            if (result.SerialNos.Count > 0)
            {
                var stockHty = await SqlSugarHelper.DbWMS.Queryable<DtStockInfo>().IncludesAllFirstLayer().FirstAsync();
                if (stockHty != null)
                var stock = await SqlSugarHelper.DbWMS.Queryable<DtStockInfo>().FirstAsync(x => x.PalletCode == palletCode);
                if (stock != null)
                {
                    var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stockHty.ParameterInfos).FirstOrDefault(y => y.Description.Contains("时间"));
                    var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos).FirstOrDefault(y => y.Description.Contains("时间"));
                    if (parameterInfo == null) throw new Exception("");
                    var outHours = (DateTime.Now - (stockHty.LinedProcessFeedbackTime == null ? stockHty.ModifyDate.Value : stockHty.LinedProcessFeedbackTime.ToDateTime())).TotalHours;
                    var outHours = (DateTime.Now - (stock.LinedProcessFeedbackTime == null ? stock.ModifyDate.Value : stock.LinedProcessFeedbackTime.ToDateTime())).TotalHours;
                    var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble();
                    var defectCode = string.Empty;
@@ -139,6 +139,52 @@
                    };
                    content = await _gingInOrOutInputService.GetOCVOutputAsync(outputDto);
                }
                else
                {
                    var stockHty = await SqlSugarHelper.DbWMS.Queryable<DtStockInfo_Hty>().Where(x => x.PalletCode == palletCode).OrderByDescending(x => x.CreateDate).FirstAsync();
                    if (stockHty != null)
                    {
                        var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stockHty.ParameterInfos).FirstOrDefault(y => y.Description.Contains("时间"));
                        if (parameterInfo == null) throw new Exception("");
                        var outHours = (DateTime.Now - (stockHty.LinedProcessFeedbackTime == null ? "2025-01-08 15:59:34.310".ToDateTime() : stockHty.LinedProcessFeedbackTime.ToDateTime())).TotalHours;
                        var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble();
                        var defectCode = string.Empty;
                        if (!isNG) defectCode = "TQCK";
                        var outputDto = new AgingOutputDto
                        {
                            OpFlag = 1,
                            Software = area.Spare3,
                            EquipmentCode = area.Spare2,
                            TrayBarcode = palletCode,
                            SerialNos = result.SerialNos.Select(x => new SerialNoOutDto
                            {
                                SlotNo = x.PositionNo,
                                SerialNo = x.SerialNo,
                                SerialNoResult = true, //isNG,
                                ParameterInfo = new List<ParameterInfoOutput> {
                                new ParameterInfoOutput() {
                                    Value = outHours.ToString(),
                                    ParameterCode =parameterInfo.ParameterCode,
                                    ParameterDesc = parameterInfo.Description,
                                    ParameterResult  = "OK", //isNG.ToString(),
                                    TargetValue = parameterInfo.TargetValue,
                                    LowerLimit = parameterInfo.LowerSpecificationsLimit,
                                    UpperLimit = parameterInfo.UpperSpecificationsLimit,
                                    DefectCode = defectCode,
                                    UOMCode = parameterInfo.UOMCode,
                                }
                            }
                            }).ToList()
                        };
                        content = await _gingInOrOutInputService.GetOCVOutputAsync(outputDto);
                    }
                    else
                    {
                        content.Error("杀杀杀");
                    }
                }
            }
            else
            {
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -186,6 +186,29 @@
            // 组盘信息
            // 将content.Data转换为ResultTrayCellsStatus对象
            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
            if (!result.Success)
            {
                var taskNG = new Dt_Task
                {
                    CurrentAddress = input.Position,
                    Grade = 1,
                    Roadway = input.Roadways,
                    TargetAddress = stationManager.stationNGLocation,
                    Dispatchertime = DateTime.Now,
                    MaterialNo = "",
                    NextAddress = stationManager.stationNGChildCode,
                    OrderNo = null,
                    PalletCode = input.PalletCode,
                    SourceAddress = stationManager.stationLocation,
                    TaskState = (int)TaskInStatusEnum.Line_InFinish,
                    TaskType = (int)TaskOutboundTypeEnum.InToOut,
                    TaskNum = await BaseDal.GetTaskNo(),
                    Creater = "Systeam"
                };
                return taskNG;
            }
            if (result.SerialNos.Count <= 0)
            {
                ConsoleHelper.WriteErrorLine(result.MOMMessage);
@@ -218,7 +241,7 @@
            }
            // 处理异常电芯情况
            var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1).ToList();
            var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList();
            if (serialNosError.Count > 0)
            {
                if (stationManager.stationType != 3)