From cfc40ec33d286b9bf6106d32f20ee3e9533ed026 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周五, 16 5月 2025 16:30:57 +0800
Subject: [PATCH] 22

---
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
index 3a1e6b2..06bd5f4 100644
--- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
+++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
@@ -25,6 +25,12 @@
 using CMS.Plugin.TraceManagement.Abstractions;
 using CMS.Plugin.ProductManagement.Abstractions.Models;
 using CMS.Plugin.MaterialManagement.Abstractions;
+using CMS.Plugin.HIAWms.Application.Contracts.Services;
+using CMS.Plugin.HIAWms.Application.Contracts.Dtos.CommonDto;
+using System.Collections.Generic;
+using CMS.Plugin.HIAWms.Abstractions;
+using Newtonsoft.Json;
+using CmsQueryExtensions;
 
 namespace CMS.Plugin.PipeLineLems.Application.Implements;
 
@@ -203,6 +209,13 @@
         if (input.Count == 0)
         {
             throw new UserFriendlyException("杈撳叆鍙傛暟Data涓嶈兘涓虹┖");
+        }
+
+        //鍐欐 鎵撶爜鍐呭
+        foreach (var item in input)
+        {
+            //鏍煎紡 绠℃缂栫爜,绠℃鍚嶇О,鑸瑰彿,椤圭洰鍙�
+            item.MarkingContent = item.PipeSpecCode + "," + item.PipeSectionName + "," + item.ShipNumber + "," + item.ProjectNumber;
         }
 
         //鏍¢獙鏁版嵁
@@ -460,15 +473,46 @@
         // 楠岃瘉鐘舵��
         if (callMaterialOrder.CallMaterialStatus != Domain.Shared.Enums.CallMaterialStatusEnum.鏈墽琛�)
         {
-            throw new UserFriendlyException($"鍘熸枡鏍囪瘑涓� '{callMaterialOrder.DataIdentifier}' 鐨勫彨鏂欒褰曠姸鎬佷负 '{callMaterialOrder.CallMaterialStatus}'锛屼笉鍏佽鍙枡");
+            //throw new UserFriendlyException($"鍘熸枡鏍囪瘑涓� '{callMaterialOrder.DataIdentifier}' 鐨勫彨鏂欒褰曠姸鎬佷负 '{callMaterialOrder.CallMaterialStatus}'锛屼笉鍏佽鍙枡");
         }
 
         //TODO:杩欓噷璋冪敤wms鐨勫彨鏂欐帴鍙�
+        try
+        {
+            List<LMesCallMaterialInput> param = new List<LMesCallMaterialInput>() {
+             new LMesCallMaterialInput(){
+                     DataIdentifier=callMaterialOrder.DataIdentifier,
+                      MaterialMode=callMaterialOrder.MaterialMode,
+             }
+        };
+            string baseUrl = @"http://127.0.0.1:18000/api/v1/HIAWms/";
+            string url = baseUrl + "lMesOperate/LMesCallMaterial";
+            string json = JsonConvert.SerializeObject(param);
+            var result = HttpApiRequest.HttpPost(url, json);
+            var res = JsonConvert.DeserializeObject<CmsApiResponse<List<MyCallMaterialOutput>>>(result);
+            if (res.Code == 200)
+            {
+                var retData = res.Data;
+                callMaterialOrder.MaterialBatch = retData[0].MaterialBatch;
+                callMaterialOrder.WmsTaskNo = retData[0].TaskNo;
+                callMaterialOrder.WmsRetResult = res.Message;
+            }
+            else
+            {
+                throw new UserFriendlyException(res.Message);
+            }
+        }
+        catch (Exception)
+        {
+
+            throw;
+        }
+
 
         // 鏇存柊鏁版嵁
-        callMaterialOrder.MaterialBatch = GenerateRandomBatch();//wms杩斿洖鐨勫師鏂欐壒娆�
-        callMaterialOrder.WmsRetResult = "鎴愬姛";
-        callMaterialOrder.WmsTaskNo = GenerateRandomTaskNo();
+        //callMaterialOrder.MaterialBatch = GenerateRandomBatch();//wms杩斿洖鐨勫師鏂欐壒娆�
+        //callMaterialOrder.WmsRetResult = "鎴愬姛";
+        //callMaterialOrder.WmsTaskNo = GenerateRandomTaskNo();
         callMaterialOrder.CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鍙枡瀹屾垚;
         callMaterialOrder.LastModifierName = "SuperAdmin";
 

--
Gitblit v1.9.3