From f5e302847933cb5c09bca3bc5731556ae52d3a4a Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期三, 24 十二月 2025 09:59:41 +0800
Subject: [PATCH] 播种墙(一期)
---
项目代码/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs | 121 +++++++++++++++++++++++++++++++++++++++
1 files changed, 119 insertions(+), 2 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 4010c1c..f270d4a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -20,12 +20,14 @@
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
+using RYB_PTL_API;
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.DirectoryServices.Protocols;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Policy;
+using System.Text;
using System.Threading.Tasks;
using WIDESEA_DTO.Agv;
using WIDESEA_External.Model;
@@ -295,6 +297,96 @@
return content;
}
/// <summary>
+ /// 涓�鏈熸挱绉嶅涓嬪彂
+ /// </summary>
+ /// <returns></returns>
+ public EPLightContent Phase1PickOrderInfoRequest(List<EPLightSendDTO> lightSendDTOs)
+ {
+ EPLightContent content = new EPLightContent();
+
+ try
+ {
+ string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.Phase1PickOrderInfoRequest.ToString())?.ApiAddress;
+ if (string.IsNullOrEmpty(url))
+ {
+ return content.Error("鏈壘鍒版挱绉嶅涓嬪彂鎺ュ彛锛岃妫�鏌ユ帴鍙i厤缃�");
+ }
+
+ bool allSuccess = true;
+ StringBuilder errorMessages = new StringBuilder();
+
+ foreach (EPLightSendDTO lightSendDTO in lightSendDTOs)
+ {
+ try
+ {
+ bool operationResult;
+
+ // 澶勭悊鐏厜绫诲瀷杞崲
+ if (!int.TryParse(lightSendDTO.LIGHTTYPE, out int lightType))
+ {
+ allSuccess = false;
+ errorMessages.AppendLine($"浣嶇疆 {lightSendDTO.LOCATION} 閿欒: 鏃犳晥鐨勭伅鍏夌被鍨� '{lightSendDTO.LIGHTTYPE}'");
+ continue;
+ }
+
+ // 澶勭悊鍏抽棴鐏厜璇锋眰
+ if (lightType == 2)
+ {
+ operationResult = RYB_PTL.RYB_PTL_CloseDigit5(url, lightSendDTO.LOCATION);
+ // TODO: 鍏抽棴鐏厜鍥炶皟澶勭悊
+ List<EPLightBackDTO> lightBackDTOs = new List<EPLightBackDTO>();
+ List<TaskBackLight> taskBackLights = lightBackDTOs.Select(x => new TaskBackLight()
+ {
+ TagNo = "B1",
+ TagCode = x.LOCATION,
+ }).ToList();
+ content = WMSLightBack(taskBackLights);
+ }
+ // 澶勭悊鏄剧ず鐏厜璇锋眰
+ else
+ {
+ // 澶勭悊鐏厜棰滆壊杞崲
+ if (!int.TryParse(lightSendDTO.LIGHTCOLOR, out int lightColor))
+ {
+ allSuccess = false;
+ errorMessages.AppendLine($"浣嶇疆 {lightSendDTO.LOCATION} 閿欒: 鏃犳晥鐨勭伅鍏夐鑹� '{lightSendDTO.LIGHTCOLOR}'");
+ continue;
+ }
+
+ operationResult = RYB_PTL.RYB_PTL_DspDigit5(
+ url,
+
+ lightSendDTO.LOCATION,
+ lightSendDTO.QUANTITY,
+ lightType,
+ lightColor);
+ }
+
+ if (!operationResult)
+ {
+ allSuccess = false;
+ errorMessages.AppendLine($"浣嶇疆 {lightSendDTO.LOCATION} 鎿嶄綔澶辫触");
+ }
+ }
+
+ catch (Exception ex)
+ {
+ allSuccess = false;
+ errorMessages.AppendLine($"浣嶇疆 {lightSendDTO.LOCATION} 澶勭悊寮傚父: {ex.Message}");
+ }
+ }
+
+ return allSuccess
+ ? content.OK("鎵�鏈夋挱绉嶅涓嬪彂鎿嶄綔鎴愬姛")
+ : content.Error(errorMessages.ToString());
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ /// <summary>
/// 鎾澧欎寒鐏�
/// </summary>
/// <returns></returns>
@@ -303,7 +395,32 @@
WebResponseContent content = new WebResponseContent();
try
{
- if (taskSendLight.TagNo=="B2")
+ if (taskSendLight.TagNo == "B1")
+ {
+ List<EPLightSendDTO> lightSendDTOs = new List<EPLightSendDTO>()
+ {
+ new EPLightSendDTO
+ {
+ DOCNO = taskSendLight.DocNo,
+ TASKNO= taskSendLight.TaskNo,
+ LOCATION=taskSendLight.TagCode,
+ QUANTITY=taskSendLight.TagQunity,
+ LIGHTCOLOR=taskSendLight.Color switch
+ {
+ "Blue" => "1",
+ "Green" => "2",
+ "Red" => "4",
+ _ => throw new Exception($"鏈壘鍒伴鑹插畾涔�")
+ },
+ ORDERTYPE="1",
+ LIGHTTYPE=taskSendLight.Mode.ToString(),
+ }
+ };
+ EPLightContent pLightContent = Phase1PickOrderInfoRequest(lightSendDTOs);
+ if (pLightContent.Result != "0") throw new Exception($"{pLightContent.Msg}");
+ content.OK();
+ }
+ else if (taskSendLight.TagNo == "B2")
{
List<EPLightSendDTO> lightSendDTOs = new List<EPLightSendDTO>()
{
@@ -332,7 +449,7 @@
{
content.OK();
}
-
+
}
catch (Exception ex)
{
--
Gitblit v1.9.3