From 7d410c1f0d4e36f8281ce2277f355c9abf1c231b Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周五, 16 5月 2025 16:19:36 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo

---
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 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 ee97a01..58720e2 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;
 
@@ -437,9 +443,9 @@
     /// <param name="_serviceProvider">鏈嶅姟鎻愪緵鑰�</param>
     /// <returns>鎿嶄綔缁撴灉</returns>
     /// <exception cref="UserFriendlyException">褰撴暟鎹笉瀛樺湪鎴栫姸鎬佷笉鍏佽鍙枡鏃舵姏鍑�</exception>
-    public async Task<MesOrderResponse> CallMaterialByDataIdentifier(Guid id, IServiceProvider _serviceProvider)
+    public async Task<MesOrderResponse> CallMaterial(CallMaterialByDataIdentifierInput input, IServiceProvider _serviceProvider, MyCurrentUser myCurrentUser)
     {
-        if (string.IsNullOrEmpty(id.ToString()))
+        if (string.IsNullOrEmpty(input.Id.ToString()))
         {
             throw new UserFriendlyException("鍘熸枡鏍囪瘑涓嶈兘涓虹┖");
         }
@@ -451,7 +457,7 @@
 
         // 鏌ユ壘鏁版嵁
 
-        var callMaterialOrder = await callMaterialOrderRepository.GetAsync(id);
+        var callMaterialOrder = await callMaterialOrderRepository.GetAsync(input.Id);
         if (callMaterialOrder == null)
         {
             throw new UserFriendlyException($"鎵句笉鍒板彨鏂欒褰�");
@@ -460,10 +466,38 @@
         // 楠岃瘉鐘舵��
         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="Q235B-桅89脳4",
+             }
+        };
+            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;
+            }
+            else {
+                throw new UserFriendlyException(res.Message);
+            }
+        }
+        catch (Exception)
+        {
+
+            throw;
+        }
+
 
         // 鏇存柊鏁版嵁
         callMaterialOrder.MaterialBatch = GenerateRandomBatch();//wms杩斿洖鐨勫師鏂欐壒娆�

--
Gitblit v1.9.3