From 02f63552cc964132b9348cf27c3f73f65db750f2 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期一, 14 四月 2025 11:33:18 +0800
Subject: [PATCH] 1
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 53 ++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index f18b745..6bd7ee0 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -1,11 +1,9 @@
锘縰sing AutoMapper;
using HslCommunication;
using Mapster;
-using Microsoft.AspNetCore.Components.Routing;
using Newtonsoft.Json;
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
-using System.Threading.Tasks;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
@@ -13,6 +11,7 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_DTO.WMS;
using WIDESEAWCS_ISystemServices;
@@ -20,8 +19,6 @@
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
@@ -97,7 +94,7 @@
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
// 鍒ゆ柇浠诲姟鐩爣鍦板潃鍜岃矾寰勬槸鍚︽弧瓒崇壒瀹氭潯浠�
- if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray)
+ if ((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ"))
{
// 璁剧疆浠诲姟鐘舵�佷负鍑哄簱鏂板缓
task.TaskState = (int)TaskOutStatusEnum.OutNew;
@@ -138,8 +135,11 @@
// 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄叆搴撲换鍔�
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
{
+ var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue;
+ var valueList = value.Split(',').ToList();
// 鍒ゆ柇婧愬湴鍧�鏄惁涓嶇瓑浜�"1359-4"
- if (task.SourceAddress != "1359-4")
+ //if (task.SourceAddress != "1359-4" && task.SourceAddress != "1357-4")
+ if (!valueList.Contains(task.SourceAddress))
{
// 鏌ヨ浠庢簮鍦板潃鍒扮洰鏍囧湴鍧�鐨勮矾鐢�
List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
@@ -155,8 +155,13 @@
}
else
{
- // 璁剧疆褰撳墠鍦板潃涓�"002-021-001"
- task.CurrentAddress = "002-021-001";
+ task.CurrentAddress = string.Empty;
+ if (task.SourceAddress == "1325-6")
+ // 璁剧疆褰撳墠鍦板潃涓�"001-021-001"
+ task.CurrentAddress = "001-021-001";
+ else
+ // 璁剧疆褰撳墠鍦板潃涓�"002-021-001"
+ task.CurrentAddress = "002-021-001";
// 璁剧疆涓嬩竴涓湴鍧�涓虹洰鏍囧湴鍧�
task.NextAddress = item.TargetAddress;
}
@@ -210,7 +215,7 @@
wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestTask);
}
- var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode }.ToJsonString());
+ var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode, stationManager.productLine }.ToJsonString());
content = JsonConvert.DeserializeObject<WebResponseContent>(result);
if (!content.Status)
@@ -503,6 +508,12 @@
BaseDal.DeleteData(task);
_taskHtyRepository.AddData(task_Hty);
}
+
+ if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
+ {
+ content = StackCraneTaskCompleted(task.TaskNum);
+ return content;
+ }
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
{
@@ -553,6 +564,12 @@
}
else if (task.TaskState == (int)TaskInStatusEnum.SC_InFinish)
{
+ if (App.User.UserId > 0)
+ {
+ content = StackCraneTaskCompleted(task.TaskNum);
+ return content;
+ }
+
task.ModifyDate = DateTime.Now;
task.Modifier = "System";
@@ -752,7 +769,9 @@
catch (Exception ex)
{
content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�");
+ QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆戝紓甯镐俊鎭�恵ex.Message}銆憑Environment.NewLine}{Environment.NewLine}");
}
+ QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
return content;
}
@@ -867,5 +886,21 @@
}
return wcsBasez + address;
}
+
+ #region 閲嶅啓鏂规硶
+
+ public override WebResponseContent DeleteData(object[] key)
+ {
+ foreach (var item in key)
+ {
+ var task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(item));
+ var taskHty = task.Adapt<Dt_Task_Hty>();
+ taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System";
+ _taskHtyRepository.AddData(taskHty);
+ }
+ return base.DeleteData(key);
+ }
+
+ #endregion 閲嶅啓鏂规硶
}
}
\ No newline at end of file
--
Gitblit v1.9.3