From c51aaf0a95836b83bb4c209556cfddaf42ea3314 Mon Sep 17 00:00:00 2001 From: xxyy <cathay_xy@163.com> Date: 星期四, 06 三月 2025 10:09:49 +0800 Subject: [PATCH] 优化缓存使用和定时器设置 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs | 69 +++++++++++++++++++++++++++++++--- 1 files changed, 62 insertions(+), 7 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 a06a7b0..0725b0b 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 @@ -58,11 +58,20 @@ var wmsIpAddress = wmsBase + ipAddress; var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result; - //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/ProcessApply", inputJson); + if (result != null) { - //var ResultProcess = JsonConvert.DeserializeObject<ResultProcessApply>(x); content.OK(data: result); + + //var respone = JsonConvert.DeserializeObject<ResultProcessApply>(result.ToString()); + //if (!respone.Success) + //{ + // MoMErrorMsg.AddMoMErrorMsg(0, input.WipOrderNo, respone.MOMMessage, SysConfigConst.TrayCellsStatus); + //} + //else + //{ + // MoMErrorMsg.DeleteMoMErrorMsg(0, input.WipOrderNo); + //} } LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Info(true, result); @@ -100,13 +109,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; @@ -129,7 +138,7 @@ ParameterDesc = parameterInfo.Description, ParameterResult = "OK", //isNG.ToString(), TargetValue = parameterInfo.TargetValue, - LowerLomit = parameterInfo.LowerSpecificationsLimit, + LowerLimit = parameterInfo.LowerSpecificationsLimit, UpperLimit = parameterInfo.UpperSpecificationsLimit, DefectCode = defectCode, UOMCode = parameterInfo.UOMCode, @@ -139,6 +148,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