From 5d663325953692c634046194bedd39b89ace41f0 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期五, 10 一月 2025 18:55:01 +0800
Subject: [PATCH] 更新多个文件,优化逻辑和异常处理

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
index 1941906..d4776a2 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
+++ b/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
             {

--
Gitblit v1.9.3