From 49209e6e3857f7e842362efbb71a630ce4571c10 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 11 一月 2025 14:51:04 +0800
Subject: [PATCH] 测试架同步添加字典
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 68 ++++++++++++++++++++++++++++-----
1 files changed, 57 insertions(+), 11 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 248436a..64d5cae 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -116,7 +116,8 @@
Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
if (task != null)
{
- BaseDal.DeleteAndMoveIntoHty(task, App.User == null ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ task.TaskState = TaskStatusEnum.Finish.ObjToInt();
+ BaseDal.DeleteAndMoveIntoHty(task, App.User?.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
}
string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress;
if (string.IsNullOrEmpty(url))
@@ -169,7 +170,7 @@
Dt_StationManger stationManger;
if (taskTypeGroup == TaskTypeGroup.InboundGroup)
{
- stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress);
+ stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress);
}
else
{
@@ -180,7 +181,7 @@
return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�");
}
- List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi));
+ List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi /*|| item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi*/));
router = routers.FirstOrDefault();
if (router == null)
{
@@ -189,15 +190,29 @@
if (routers.Count == 1)
{
- if(taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode)
+ if (taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode)
{
task.NextAddress = router.NextPosi;
task.DeviceCode = stationManger.StationDeviceCode;
}
+ else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
+ {
+ task.NextAddress = router.NextPosi;
+ task.DeviceCode = stationManger.StackerCraneCode;
+ task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
+ }
else
{
- task.NextAddress = item.TargetAddress;
- task.DeviceCode = stationManger.StationDeviceCode;
+ task.NextAddress = router.NextPosi;
+ if (item.RoadWay.Contains("AGV"))
+ {
+ task.DeviceCode = item.RoadWay;
+ task.AgvTaskNum = task.DeviceCode + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
+ }
+ else
+ {
+ task.DeviceCode = stationManger.StationDeviceCode;
+ }
}
}
else
@@ -210,7 +225,7 @@
{
if (taskTypeGroup == TaskTypeGroup.OutbondGroup)
{
- task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
+ task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi);
if (routers.FirstOrDefault() == null)
{
@@ -224,7 +239,7 @@
}
else
{
- task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
+ task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi);
if (routers.FirstOrDefault() == null)
{
@@ -275,8 +290,12 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙颁俊鎭�");
}
-
- string responseStr = HttpHelper.Get($"http://127.0.0.1:9293/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
+ string address = AppSettings.Get("WMSApiAddress");
+ if (string.IsNullOrEmpty(address))
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+ }
+ string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
if (responseContent != null && responseContent.Status && responseContent.Data != null)
{
@@ -295,6 +314,31 @@
return content;
}
+ public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ string address = AppSettings.Get("WMSApiAddress");
+ if (string.IsNullOrEmpty(address))
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+ }
+ string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}", roadwayNos.Serialize());
+ WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
+ if (responseContent != null && responseContent.Status && responseContent.Data != null)
+ {
+ return responseContent;
+ }
+
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+ }
+
/// <summary>
/// 鍚慦MS鐢宠鍒嗛厤璐т綅
/// </summary>
@@ -303,7 +347,9 @@
/// <returns></returns>
public string? RequestAssignLocation(int taskNum, string roadwayNo)
{
- string responseStr = HttpHelper.Get($"http://127.0.0.1:9283/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}");
+ string address = AppSettings.Get("WMSApiAddress");
+ if (string.IsNullOrEmpty(address)) throw new Exception("鏈壘鍒癢MSApi鍦板潃");
+ string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}");
WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
if (responseContent != null && responseContent.Status && responseContent.Data != null)
--
Gitblit v1.9.3