From 8aa4fcd006dc25d19f22f0d858dfa146c4493a7d Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期四, 10 四月 2025 16:10:23 +0800
Subject: [PATCH] 1
---
.gitignore | 4 +
代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 180 +++++++++++++++++++++++++++++++--------------
2 files changed, 128 insertions(+), 56 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6d1a514..39499d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -286,3 +286,7 @@
/浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/CopilotIndices/17.13.444.19527/SemanticSymbols.db
/浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/DesignTimeBuild/.dtbcache.v2
/浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/v17/DocumentLayout.backup.json
+浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/CopilotIndices/17.13.444.19527/CodeChunks.db-shm
+浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/CopilotIndices/17.13.444.19527/CodeChunks.db-wal
+浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/CopilotIndices/17.13.444.19527/SemanticSymbols.db-shm
+浠g爜绠$悊/淇″彿浼犻��/WIDESEA_WCSServer/.vs/WIDESEA_WCSServer/CopilotIndices/17.13.444.19527/SemanticSymbols.db-wal
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index ccc1969..2e871c8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -1,4 +1,5 @@
锘�#region << 鐗� 鏈� 娉� 閲� >>
+
/*----------------------------------------------------------------
* 鍛藉悕绌洪棿锛歐IDESEAWCS_Tasks.ConveyorLineJob
* 鍒涘缓鑰咃細鑳$搴�
@@ -11,19 +12,13 @@
* 淇敼鏃堕棿锛�
* 鐗堟湰锛歏1.0.1
* 淇敼璇存槑锛�
- *
+ *
*----------------------------------------------------------------*/
+
#endregion << 鐗� 鏈� 娉� 閲� >>
using AutoMapper;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Quartz;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
@@ -31,7 +26,6 @@
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -71,58 +65,22 @@
// 瀹氫箟绾夸綋瀹炵洏鍏ュ簱璇锋眰鐨勫湴鍧�鍜屼换鍔$被鍨�
var requests = new Dictionary<string, string>
{
- { "DB1002.293.0", "ZJXL-WLX002" },
+ { "DB1002.1093.0", "ZJXL-WLX002" },
{ "DB1002.1493.0", "FJXL-WLX002" }
};
- foreach (var request in requests)
+ // 瀹氫箟绾夸綋绌虹洏鍥炴祦璇锋眰鐨勫湴鍧�鍜屼换鍔$被鍨�
+ var requestsKP = new Dictionary<string, string>
{
- var isDownRequest = conveyorLine.Communicator.Read<bool>(request.Key);
- if (!isDownRequest)
- {
- continue;
- }
+ { "DB1002.1893.0", "ZJXL-KPHLX001" },
+ { "DB1002.2293.0", "FJXL-KPHLX001" }
+ };
- string fromAdd = request.Value;
- string taskType = request.Value.Contains("ZJXL") ? "姝f瀬" : "璐熸瀬";
+ // 澶勭悊瀹炵洏鍏ュ簱璇锋眰
+ ProcessRequests(conveyorLine, requests, "涓嬬嚎璇锋眰鍏ュ簱");
- // 鏌ヨ鏄惁瀛樺湪宸茬敓鎴愮殑鏂颁换鍔�
- var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd && x.TaskState == (int)TaskInStatusEnum.InNew);
- if (task != null)
- {
- ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}涓嬬嚎璇锋眰鍏ュ簱,浠诲姟宸茬敓鎴愬瓨鍦紝绋嶅悗閲嶈瘯......");
- continue;
- }
-
- // 鏌ヨ浠诲姟绫诲瀷瀵瑰簲鐨刢zTask
- DtCZTask czTask = _taskCZRepository.QueryFirst(x => x.TaskType == taskType);
- if (czTask == null)
- {
- ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}涓嬬嚎璇锋眰鍏ュ簱,{taskType}浠诲姟涓嶅瓨鍦紝绋嶅悗閲嶈瘯......");
- continue;
- }
-
- // 鍒涘缓鏂扮殑浠诲姟骞舵坊鍔犲埌浠诲姟浠撳簱
- task = new Dt_Task()
- {
- TaskNum = _taskService.GetTaskNum(),
- CreateDate = DateTime.Now,
- Creater = "system",
- CurrentAddress = fromAdd,
- SourceAddress = fromAdd,
- TaskState = (int)TaskInStatusEnum.InNew,
- TaskType = (int)TaskOutboundTypeEnum.Outbound,
- Grade = 1,
- PalletCode = czTask.TaskProductCode,
- TargetAddress = czTask.TaskEndAddress,
- NextAddress = czTask.TaskEndAddress,
- Roadway = $"{taskType}AGV",
- WMSId = czTask.Id,
- Remark = czTask.TaskOrderNo
- };
- _taskRepository.AddData(task);
- ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}涓嬬嚎璇锋眰鍏ュ簱,浠诲姟宸茬敓鎴愶紝绛夊緟鎵ц......");
- }
+ // 澶勭悊绌虹洏鍥炴祦璇锋眰
+ ProcessKpRequests(conveyorLine, requestsKP);
}
catch (Exception ex)
{
@@ -140,6 +98,116 @@
return Task.CompletedTask;
}
+ private void ProcessRequests(CommonConveyorLine conveyorLine, Dictionary<string, string> requests, string requestType)
+ {
+ foreach (var request in requests)
+ {
+ var isDownRequest = conveyorLine.Communicator.Read<bool>(request.Key);
+ if (!isDownRequest)
+ {
+ continue;
+ }
+
+ string fromAdd = request.Value;
+ string taskType = request.Value.Contains("ZJXL") ? "姝f瀬" : "璐熸瀬";
+
+ // 鏌ヨ鏄惁瀛樺湪宸茬敓鎴愮殑鏂颁换鍔�
+ var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd && x.TaskState == (int)TaskInStatusEnum.InNew);
+ if (task != null)
+ {
+ ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},浠诲姟宸茬敓鎴愬瓨鍦紝绋嶅悗閲嶈瘯......");
+ continue;
+ }
+
+ // 鏌ヨ浠诲姟绫诲瀷瀵瑰簲鐨刢zTask
+ DtCZTask czTask = _taskCZRepository.QueryFirst(x => x.TaskType == taskType);
+ if (czTask == null)
+ {
+ ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},{taskType}浠诲姟涓嶅瓨鍦紝绋嶅悗閲嶈瘯......");
+ continue;
+ }
+
+ // 鍒涘缓骞舵坊鍔犳柊浠诲姟鍒颁换鍔′粨搴�
+ task = CreateTask(fromAdd, czTask.TaskEndAddress, czTask.TaskOrderNo, czTask.TaskProductCode, taskType);
+ _taskRepository.AddData(task);
+ ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},浠诲姟宸茬敓鎴愶紝绛夊緟鎵ц......");
+ }
+ }
+
+ private void ProcessKpRequests(CommonConveyorLine conveyorLine, Dictionary<string, string> requestsKP)
+ {
+ foreach (var request in requestsKP)
+ {
+ var isDownRequest = conveyorLine.Communicator.Read<bool>(request.Key);
+ if (!isDownRequest)
+ {
+ continue;
+ }
+
+ string fromAdd = request.Value;
+ string taskType = request.Value.Contains("ZJXL") ? "姝f瀬" : "璐熸瀬";
+
+ // 鏍规嵁浠诲姟绫诲瀷纭畾璇锋眰鍦板潃
+ (string upRequest, string gmRequest, string gmState) = GetRequestAddresses(taskType);
+
+ var isUpRequest = conveyorLine.Communicator.Read<bool>(upRequest);
+ var isGMRequest = conveyorLine.Communicator.Read<bool>(gmRequest);
+ var isGMState = conveyorLine.Communicator.Read<int>(gmState);
+
+ // 鏍规嵁鏉′欢鍒涘缓浠诲姟瀵硅薄
+ Dt_Task task = null;
+ if (isUpRequest)
+ {
+ task = CreateTask(fromAdd, "WaitBind", "姝f瀬鐗╂祦绾�002鐨勪笂鏂欒姹�", "绌烘墭鐩�", taskType);
+ }
+ else if (isGMRequest && isGMState == 1)
+ {
+ task = CreateTask(fromAdd, "WaitBind", "姝f瀬鐗╂祦绾�002鐨勪笂鏂欒姹�", "闅旇啘绌烘墭鐩�", taskType);
+ }
+
+ // 娣诲姞浠诲姟鍒颁换鍔¤〃
+ if (task != null)
+ {
+ _taskRepository.AddData(task);
+ }
+ }
+ }
+
+ private (string upRequest, string gmRequest, string gmState) GetRequestAddresses(string taskType)
+ {
+ if (taskType == "姝f瀬")
+ {
+ // 鐗╂祦绾�002鐨勪笂鏂欒姹�
+ return ("DB1002.93.0", "DB1002.2493.0", "DB1002.2424.0");
+ }
+ else
+ {
+ // 鐗╂祦绾�002鐨勪笂鏂欒姹�
+ return ("DB1002.1293.0", "DB1002.2893.0", "DB1002.2824.0");
+ }
+ }
+
+ // 杈呭姪鏂规硶锛氬垱寤轰换鍔″璞�
+ private Dt_Task CreateTask(string currentAddress, string targetAddress, string remark, string palletCode, string taskType)
+ {
+ return new Dt_Task
+ {
+ TaskNum = _taskService.GetTaskNum(),
+ CreateDate = DateTime.Now,
+ Creater = "system",
+ CurrentAddress = currentAddress,
+ SourceAddress = currentAddress,
+ TaskState = targetAddress != "WaitBind" ? (int)TaskInStatusEnum.InNew : (int)TaskInStatusEnum.InPending,
+ TaskType = (int)TaskInboundTypeEnum.Inbound,
+ Grade = 1,
+ PalletCode = palletCode,
+ TargetAddress = targetAddress,
+ NextAddress = targetAddress,
+ Roadway = $"{taskType}AGV",
+ WMSId = 0,
+ Remark = remark
+ };
+ }
/// <summary>
/// 杈撻�佺嚎璇锋眰鍏ュ簱
@@ -263,4 +331,4 @@
GC.SuppressFinalize(this);
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3