From 4acb88b7afaab5b18a1c9ca8a78ce346297c382f Mon Sep 17 00:00:00 2001
From: IPC-610 <IPC-610@DESKTOP-6LEOOS3>
Date: 星期四, 02 一月 2025 10:59:38 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs b/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
index 889ab1e..1a504ba 100644
--- a/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
+++ b/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
@@ -14,6 +14,7 @@
 using SqlSugar.Extensions;
 using Utility.Tools;
 using WMS.BLL.LogServer;
+using WMS.BLL.SysServer;
 using WMS.DAL;
 using WMS.Entity.BllAsnEntity;
 using WMS.Entity.BllCheckEntity;
@@ -1295,7 +1296,7 @@
         }
 
         //AGV绉诲簱瀹屾垚
-        public void MoveSuccess(string taskNo, int userId)
+        public void MoveSuccess(string taskNo,string mesTokenUrl, string mesUrl, int userId)
         {
             try
             {
@@ -1337,6 +1338,7 @@
                         throw new Exception("鐩爣鍌ㄤ綅鐘舵�侀潪绉诲叆涓�");
                     }
                 }
+                var data = new List<RequertBeiliaoInfoModel>();
                 //鏇存敼搴撳瓨鏄庣粏
                 foreach (var item in stockDetail)
                 {
@@ -1376,8 +1378,31 @@
 
                     if (endLocate != null && endLocate.AreaNo == "B12") //鏄惁鏄�3妤肩紦瀛樺尯 鏄細鍒犻櫎搴撳瓨
                     {
-                        //搴撳瓨绠辩爜鏄庣粏鍒犻櫎
+                        if (string.IsNullOrWhiteSpace(item.SONo))
+                        {
+                            throw new Exception("褰撳墠鎵樼洏涓嶆槸鎷兼墭鍑哄簱鎵樼洏");
+                        }
+                        //璁板綍鎵樼洏涓婁俊鎭粰MES
                         var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.StockDetailId == item.Id).ToList();
+                        if (boxInfo.Count == 0)
+                        {
+                            throw new Exception("鎵樼洏涓婄墿鏂欑鐮佷俊鎭笉瀛樺湪,璇锋鏌�!");
+                        }
+                        foreach (var item2 in boxInfo)
+                        {
+                            data.Add(new RequertBeiliaoInfoModel()
+                            {
+                                no = item2.BoxNo,
+                                materiel_no = item.SkuNo,
+                                materiel_name = item.SkuName,
+                                qty = item.Qty,
+                                batch = item.LotNo,
+                                producttime = item.ProductionTime,
+                                expiry = item.ExpirationTime
+
+                            });
+                        }
+                        //搴撳瓨绠辩爜鏄庣粏鍒犻櫎
                         Db.Deleteable(boxInfo).ExecuteCommand();
                         //鍒犻櫎搴撳瓨鎵樼洏淇℃伅
                         Db.Deleteable(item).ExecuteCommand();
@@ -1400,8 +1425,34 @@
                     //鏇存敼鐩爣鍌ㄤ綅鐘舵��
                     endLocate.Status = "1";//鏈夌墿鍝�
                     Db.Updateable(endLocate).ExecuteCommand();
-                }
 
+                }
+                if (endLocate!= null && endLocate.AreaNo == "B12")
+                {
+                    //鑾峰彇浠ょ墝
+                    var token = new Token().GetMesToken(mesTokenUrl);
+                    Dictionary<string, string> mesDic = new Dictionary<string, string>()
+                    {
+                        {"Authorization",token }
+                    };
+                    var mesData = new RequertBeiliaoModel()
+                    {
+                        morder_no = stockDetail.First().SONo,
+                        pallet = stockDetail.First().PalletNo,
+                        layer_no = endLocate.LocatNo,
+                        items = data
+                    };
+                    var jsonData = JsonConvert.SerializeObject(mesData);
+                    //璋冪敤鎺ュ彛
+                    var response = HttpHelper.DoPost(mesUrl, jsonData, "澶囨枡瀹屾垚杩愯嚦缂撳瓨鍖哄弽棣堣嚦MES", "MES", mesDic);
+
+                    var obj = JsonConvert.DeserializeObject<MesModel>(response);//瑙f瀽杩斿洖鏁版嵁
+                    if (obj.status != "0")
+                    {
+                        throw new Exception("澶囨枡鍚屾MES澶辫触锛�" + obj.message);
+                    }
+
+                }
                 if (userId != 0)
                 {
                     //娣诲姞鎿嶄綔鏃ュ織璁板綍

--
Gitblit v1.8.0