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/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs | 45 ++++++++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
index 54cb06c..9736d13 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -283,7 +283,7 @@
// 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩存帴鍑哄簱浠诲姟
private async Task<bool> HasDirectOutboundTask(Dt_StationManager stationManager)
{
- var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea);
+ var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea && x.Roadway == stationManager.Roadway);
var tasks = await BaseDal.QueryFirstAsync(x => x.TaskType == (int)TaskOutboundTypeEnum.InToOut && x.TargetAddress == stationManager.stationLocation && x.CurrentAddress == station.stationChildCode);
return tasks != null;
}
@@ -399,23 +399,26 @@
var wmsIpAddrss = wmsBase + requestTask;
var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = stationManager.stationChildCode }.ToJsonString());
+
+ QuartzLogger.WriteLogToFile($"鍖呰鍑哄簱", $"杩斿洖鍙傛暟銆恵JsonConvert.SerializeObject(result)}銆憑Environment.NewLine}{Environment.NewLine}");
+
+
content = JsonConvert.DeserializeObject<WebResponseContent>(result);
if (!content.Status)
{
//鏃犳弧瓒虫潯浠跺彲鍑哄簱鑷冲寘瑁呯殑搴撳瓨
+ ConsoleHelper.WriteErrorLine(JsonConvert.SerializeObject(content));
+ QuartzLogger.WriteLogToFile($"鍖呰鍑哄簱", $"杩斿洖鍙傛暟銆恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
return content;
}
var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
ConsoleHelper.WriteSuccessLine(content.Data.ToString());
- //_taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO })鈥�
+
content = ReceiveWMSTask(new List<WMSTaskDTO> { task });
- //content = ReceiveByBZOtuTask(task);
- //if (content.Status)
- //{
- // //鐩稿簲鐨勫湪閫旀暟鎹�+1
- // // _taskNeedBarcodeRepository.UpdateData();
- //}
+
+ QuartzLogger.WriteLogToFile($"鍖呰鍑哄簱", $"杩斿洖鍙傛暟銆恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
+ ConsoleHelper.WriteErrorLine(JsonConvert.SerializeObject(content));
return content;
}
catch (Exception ex)
@@ -443,12 +446,24 @@
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay);
- task.TaskState = (int)TaskOutStatusEnum.OutNew;
- task.CurrentAddress = taskDTO.RoadWay;
- task.NextAddress = stationinfo.stationChildCode;
- task.SourceAddress = taskDTO.SourceAddress;
- task.TargetAddress = taskDTO.TargetAddress;
+ if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut && taskDTO.RoadWay.Contains("CW"))
+ {
+ var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == taskDTO.RoadWay);
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.CurrentAddress = taskDTO.SourceAddress;
+ task.NextAddress = stationinfo.stationChildCode;
+ task.SourceAddress = taskDTO.SourceAddress;
+ task.TargetAddress = taskDTO.TargetAddress;
+ }
+ else
+ {
+ var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay);
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.CurrentAddress = taskDTO.RoadWay;
+ task.NextAddress = stationinfo.stationChildCode;
+ task.SourceAddress = taskDTO.SourceAddress;
+ task.TargetAddress = taskDTO.TargetAddress;
+ }
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
{
@@ -676,7 +691,7 @@
catch (Exception ex)
{
content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�");
- QuartzLogger.WriteLogToFile($"Info_鍒嗗浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.StackTrace}銆憑Environment.NewLine}{Environment.NewLine}");
+ QuartzLogger.WriteLogToFile($"Info_鍒嗗浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.Message}銆憑Environment.NewLine}寮傚父淇℃伅銆恵ex.StackTrace}銆憑Environment.NewLine}");
}
QuartzLogger.WriteLogToFile($"Info_鍒嗗浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
return content;
--
Gitblit v1.9.3