From 06e0e3b7d61e95902a6129de2490461cd0693e1d Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 15 十月 2025 15:06:40 +0800
Subject: [PATCH] 新增异步方法并优化服务调用逻辑在多个数据库文件中进行了二进制文件的修改、删除和新增操作,可能涉及数据库内容的更新或重建。在 HttpsClient.cs文件中新增了 PostNotLimitAsync方法,用于发送支持 JSON 格式的异步 HTTP POST 请求,并记录请求和响应参数。在 AgingInOrOutInputService.cs文件中,将 HttpsClient.PostAsync替换为PostNotLimitAsync,以利用新方法的功能特性。同时删除了不再需要的注释代码。
---
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