From b39f01141a3ec0dfff105647a485033f7cf27dc7 Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期五, 28 二月 2025 09:02:26 +0800
Subject: [PATCH] 增加数据脚本
---
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 80 ++++++++++++++++++++++++++++------------
1 files changed, 56 insertions(+), 24 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 86786fe..3da8be7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -29,6 +29,7 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.Http;
+using WIDESEAWCS_Common.ServiceLog;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
@@ -95,28 +96,31 @@
}
Dt_Task task = _mapper.Map<Dt_Task>(item);
task.Creater = "WMS";
- //绌鸿溅鍏ュ簱
- if (item.TaskType == (int)TaskInboundTypeEnum.InInventory)
- {
- task.TaskType= (int)TaskInboundTypeEnum.InInventory;
- task.TaskState= (int)TaskInStatusEnum.InNew;
-
- }
- else if(item.TaskType==(int)TaskOutboundTypeEnum.OutInventory)
+ if(item.TaskType==(int)TaskOutboundTypeEnum.OutInventory)
{
task.TaskType=(int)TaskOutboundTypeEnum.OutInventory;
task.TaskState=(int)TaskOutStatusEnum.OutNew;
+ }
+ else if (item.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+ {
+ task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
}
else if (item.TaskType == (int)TaskInboundTypeEnum.Inbound)
{
task.TaskType = (int)TaskInboundTypeEnum.Inbound;
task.TaskState = (int)TaskInStatusEnum.InNew;
}
- else if (item.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+ else if (item.TaskType == (int)TaskInboundTypeEnum.InInventory)
{
- task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
- task.TaskState = (int)TaskOutStatusEnum.OutNew;
+ task.TaskType = (int)TaskInboundTypeEnum.InInventory;
+ task.TaskState = (int)TaskInStatusEnum.InNew;
+ }
+ else if (item.TaskType == (int)TaskInboundTypeEnum.InPick)
+ {
+ task.TaskType = (int)TaskInboundTypeEnum.InPick;
+ task.TaskState = (int)TaskInStatusEnum.InNew;
}
tasks.Add(task);
}
@@ -477,6 +481,16 @@
_unitOfWorkManage.BeginTran();
UpdateTaskStatus(task.TaskId, (int)TaskOutStatusEnum.SC_OutFinish);
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍫嗗灈鏈哄嚭搴撳畬鎴愮姸鎬佸洖鍐橶MS,浠诲姟鍙�:銆恵taskNum}銆�");
+ var response = HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "UpdateTaskStatus?taskNum=" + task.TaskNum, "", "鏇存柊浠诲姟鐘舵��");
+ if(response.Status)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍫嗗灈鏈哄嚭搴撳畬鎴愮姸鎬佸洖鍐橶MS鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍫嗗灈鏈哄嚭搴撳畬鎴愮姸鎬佸洖鍐橶MS澶辫触,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
_unitOfWorkManage.CommitTran();
return content.OK();
}
@@ -489,27 +503,41 @@
}
- else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound || task.TaskType == (int)TaskInboundTypeEnum.InInventory)
+ else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound || task.TaskType == (int)TaskInboundTypeEnum.InInventory || task.TaskType == (int)TaskInboundTypeEnum.InPick)
{
_unitOfWorkManage.BeginTran();
UpdateTaskStatus(task.TaskId, (int)TaskInStatusEnum.SC_InFinish);
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍫嗗灈鏈哄叆搴撳畬鎴愮姸鎬佸洖鍐橶MS,浠诲姟鍙�:銆恵taskNum}銆�");
+ var response= HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "UpdateTaskStatus?taskNum=" + task.TaskNum, "", "鏇存柊浠诲姟鐘舵��");
+ if(response.Status)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍫嗗灈鏈哄叆搴撳畬鎴愮姸鎬佸洖鍐橶MS鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
+
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍫嗗灈鏈哄叆搴撳畬鎴愮姸鎬佸洖鍐橶MS澶辫触,浠诲姟鍙�:銆恵taskNum}銆�");
+ }
UpdateTaskStatus(task.TaskId, (int)TaskInStatusEnum.InFinish);
_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟瀹屾垚");
//if (App.User.UserId > 0)
//{
- task.Modifier = "System";
- var response = HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "TaskCompleted?taskNum=" + task.TaskNum, "", "浠诲姟瀹屾垚");
- if (response.Status)
- {
- _unitOfWorkManage.CommitTran();
- return content.OK();
- }
- else
- {
- _unitOfWorkManage.RollbackTran();
- return content = WebResponseContent.Instance.Error(response.Message);
- }
+ task.Modifier = "System";
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍏ュ簱浠诲姟瀹屾垚鍥炲啓WMS,浠诲姟鍙�:銆恵taskNum}銆�");
+ var response2 = HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "TaskCompleted?taskNum=" + task.TaskNum, "", "浠诲姟瀹屾垚");
+ if (response2.Status)
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍏ュ簱浠诲姟瀹屾垚鍥炲啓WMS鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
+ _unitOfWorkManage.CommitTran();
+ return content.OK();
+ }
+ else
+ {
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"鍏ュ簱浠诲姟瀹屾垚鍥炲啓WMS澶辫触,浠诲姟鍙�:銆恵taskNum}銆�");
+ _unitOfWorkManage.RollbackTran();
+ return content = WebResponseContent.Instance.Error(response.Message);
+ }
//}
//_unitOfWorkManage.CommitTran();
//return content.OK();
@@ -523,6 +551,7 @@
{
_unitOfWorkManage.RollbackTran();
content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�,寮傚父淇℃伅锛歿ex.Message}");
+ ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�,寮傚父淇℃伅锛歿ex.Message}");
}
finally
{
@@ -565,14 +594,17 @@
public WebResponseContent OutBoundTaskByWMS(int taskNum)
{
WebResponseContent content = new WebResponseContent();
+ ServiceLogger.WriteDebug("OutBoundTaskByWMS", $"鍑哄簱浠诲姟瀹屾垚鍥炲啓WMS锛屼换鍔″彿锛歿taskNum}");
var response = HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "TaskCompleted?taskNum=" + taskNum, "", "浠诲姟瀹屾垚");
if (response.Status)
{
+ ServiceLogger.WriteDebug("OutBoundTaskByWMS", $"鍑哄簱浠诲姟瀹屾垚鍥炲啓WMS鎴愬姛锛屼换鍔″彿锛歿taskNum}");
_unitOfWorkManage.CommitTran();
return content.OK();
}
else
{
+ ServiceLogger.WriteDebug("OutBoundTaskByWMS", $"鍑哄簱浠诲姟瀹屾垚鍥炲啓WMS澶辫触锛屼换鍔″彿锛歿taskNum}");
_unitOfWorkManage.RollbackTran();
return content = WebResponseContent.Instance.Error(response.Message);
}
--
Gitblit v1.9.3