From 43aed67468cd72b19e355db58cf42e2665bfd0f1 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期一, 07 七月 2025 09:01:26 +0800 Subject: [PATCH] 1 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs | 73 ++++++++++++++++++++++++++++++++---- 1 files changed, 64 insertions(+), 9 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..78df137 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 @@ -47,7 +47,7 @@ input.SessionId = Guid.NewGuid().ToString(); input.EmployeeNo = "MITest"; input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); - var inputJson = input.ToDictionary(); + var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(input); var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress); var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue; var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ProcessApply)?.ConfigValue; @@ -58,18 +58,27 @@ 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); } catch (Exception ex) { - Console.WriteLine(ex.Message); + //Console.WriteLine(ex.Message); LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Error(true, $"\r\r--------------------------------------"); LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Error(true, ex.StackTrace); } @@ -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