From ea4fe1a6d1decf926292d3d71e7656bbcff4c937 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 03 七月 2024 16:58:52 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/BllTransServer/NoticeServer.cs |  212 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 150 insertions(+), 62 deletions(-)

diff --git a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
index 2a8f453..32f8b77 100644
--- a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
@@ -5,6 +5,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using Utility.Tools;
 using WMS.BLL.LogServer;
 using WMS.DAL;
 using WMS.Entity.BllAsnEntity;
@@ -15,6 +16,7 @@
 using WMS.Entity.LogEntity;
 using WMS.Entity.SysEntity;
 using WMS.IBLL.IBllTransServer;
+using static Model.InterFaceModel.RCSModel;
 
 namespace WMS.BLL.BllTransServer
 {
@@ -29,7 +31,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        public ErpModel CreateAsn(AsnInfo model)
+        public ErpModel CreateAsnWork(AsnInfo model)
         {
             try
             {
@@ -55,7 +57,7 @@
                     Origin = string.IsNullOrEmpty(model.Origin) ? "MES" : model.Origin,
                     CustomerNo = model.Customer,
                     CustomerName = "",
-                    OrderCode = model.OrderCode,
+                    OrderCode = model.OrderCode
                 };
 
                 // 鍏ュ簱鏄庣粏琛ㄤ俊鎭�
@@ -127,7 +129,7 @@
         /// <param name="TaskNo"></param>
         /// <param name="Status"></param>
         /// <returns></returns>
-        public ErpModel FinishTask(string TaskNo,string Status)
+        public ErpModel RCSFinishTask(string TaskNo,string Status)
         {
             try
             {
@@ -163,6 +165,10 @@
 
                     resultModel.Success = 0;
                     resultModel.Message = "鎴愬姛";
+
+                    //鎻愪氦浜嬪姟
+                    Db.CommitTran();
+
                     return resultModel;
                 }
                 switch (taskInfo.OrderType)
@@ -232,7 +238,7 @@
                                 IsBale = "0",
                                 IsBelt = "0",
 
-                                PalletStatus = "1",
+                                PalletStatus = "2",
 
                                 IsDel = "0",
                                 CreateUser = 0,
@@ -255,7 +261,7 @@
                             sd1.LocatNo = locatInfo.LocatNo;//鍌ㄤ綅鍦板潃
                             sd1.CompleteTime = comTime;
                             sd1.InspectStatus = "0";//寰呮楠�
-                            sd1.PalletStatus = "1";//棰勬贩
+                            sd1.PalletStatus = "2";//鍗婃垚鍝�
 
                             //淇敼搴撳瓨鏄庣粏
                             Db.Updateable(sd1).ExecuteCommand();
@@ -414,13 +420,6 @@
                             resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
                             return resultModel;
                         }
-                        //鐩爣鍌ㄤ綅淇℃伅
-                        var endLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
-                        if (endLocatInfo == null)
-                        {
-                            resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
-                            return resultModel;
-                        }
                         //搴撳瓨鏄庣粏
                         var sd2 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo);
                         if (sd2 == null)
@@ -452,10 +451,10 @@
                         sd2.InspectQty = 0;
                         sd2.ASNNo = "";
                         sd2.ASNDetailNo = null;
-                        sd2.WareHouseNo = endLocatInfo.WareHouseNo;//鎵�灞炰粨搴�
-                        sd2.RoadwayNo = endLocatInfo.RoadwayNo;//鎵�灞炲贩閬�
-                        sd2.AreaNo = endLocatInfo.AreaNo;//鎵�灞炲尯鍩�
-                        sd2.LocatNo = endLocatInfo.LocatNo;//鍌ㄤ綅鍦板潃
+                        sd2.WareHouseNo = "";//鎵�灞炰粨搴�
+                        sd2.RoadwayNo = "";//鎵�灞炲贩閬�
+                        sd2.AreaNo = "";//鎵�灞炲尯鍩�
+                        sd2.LocatNo = "";//鍌ㄤ綅鍦板潃
                         sd2.CompleteTime = comTime;
                         //淇敼搴撳瓨鏄庣粏
                         Db.Updateable(sd2).ExecuteCommand();
@@ -464,29 +463,11 @@
                         //淇敼璧峰鍌ㄤ綅鐘舵��
                         Db.Updateable(startLocatInfo).ExecuteCommand();
 
-                        endLocatInfo.Status = "1";//鏈夌墿鍝�
-                        //淇敼鐩爣鍌ㄤ綅鐘舵��
-                        Db.Updateable(endLocatInfo).ExecuteCommand();
-
                         break;
                     #endregion
 
-                    #region 浠诲姟瀹屾垚
-                    case "2":
-                        //璧峰鍌ㄤ綅淇℃伅
-                        var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
-                        if (startLocatInfo2 == null)
-                        {
-                            resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
-                            return resultModel;
-                        }
-                        //鐩爣鍌ㄤ綅淇℃伅
-                        var endLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
-                        if (endLocatInfo2 == null)
-                        {
-                            resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
-                            return resultModel;
-                        }
+                    #region 绉诲簱瀹屾垚
+                    case "3":
                         //搴撳瓨鏄庣粏
                         var sd3 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo);
                         if (sd3 == null)
@@ -494,37 +475,119 @@
                             resultModel.Message = "搴撳瓨淇℃伅涓嶅瓨鍦�!";
                             return resultModel;
                         }
-                        sd3.WareHouseNo = endLocatInfo2.WareHouseNo;//鎵�灞炰粨搴�
-                        sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//鎵�灞炲贩閬�
-                        sd3.AreaNo = endLocatInfo2.AreaNo;//鎵�灞炲尯鍩�
-                        sd3.LocatNo = endLocatInfo2.LocatNo;//鍌ㄤ綅鍦板潃
-                        if (endLocatInfo2.AreaNo == "A01")//娲佸噣鍖�
+                        if (taskInfo.Type == "0")//鍏ュ簱浠诲姟
                         {
-                            sd3.PalletStatus = "0";
-                        }
-                        else if (endLocatInfo2.AreaNo == "A02")//棰勬贩鍖�
-                        {
-                            sd3.PalletStatus = "1";
-                        }
-                        else if (endLocatInfo2.AreaNo == "A03")//鍗婃垚鍝佸尯
-                        {
-                            sd3.PalletStatus = "2";
-                        }
-                        else if (endLocatInfo2.AreaNo == "A04")//鑴忔《鍖�
-                        {
-                            sd3.PalletStatus = "3";
-                        }
+                            //鐩爣鍌ㄤ綅淇℃伅
+                            var endLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
+                            if (endLocatInfo2 == null)
+                            {
+                                resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
+                                return resultModel;
+                            }
+                            endLocatInfo2.Status = "1";//鏈夌墿鍝�
+                            //淇敼鐩爣鍌ㄤ綅鐘舵��
+                            Db.Updateable(endLocatInfo2).ExecuteCommand();
 
+                            sd3.WareHouseNo = endLocatInfo2.WareHouseNo;//鎵�灞炰粨搴�
+                            sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//鎵�灞炲贩閬�
+                            sd3.AreaNo = endLocatInfo2.AreaNo;//鎵�灞炲尯鍩�
+                            sd3.LocatNo = endLocatInfo2.LocatNo;//鍌ㄤ綅鍦板潃
+                            if (endLocatInfo2.AreaNo.Contains("01"))//娲佸噣鍖�
+                            {
+                                sd3.PalletStatus = "0";                               
+                            }
+                            else if (endLocatInfo2.AreaNo.Contains("02"))//棰勬贩鍖�
+                            {
+                                sd3.PalletStatus = "1";
+                            }
+                            else if (endLocatInfo2.AreaNo.Contains("03"))//鍗婃垚鍝佸尯
+                            {
+                                sd3.PalletStatus = "2";
+                            }
+                            else if (endLocatInfo2.AreaNo.Contains("04"))//鑴忔《鍖�
+                            {
+                                sd3.PalletStatus = "3";
+                                sd3.LotNo = "";//鎵规
+                                sd3.SkuNo = "";
+                                sd3.SkuName = "";
+                                sd3.InspectStatus = "0";//寰呮楠�
+                            }                            
+                        }
+                        else if (taskInfo.Type == "1")//鍑哄簱浠诲姟
+                        {
+                            //璧峰鍌ㄤ綅淇℃伅
+                            var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
+                            if (startLocatInfo2 == null)
+                            {
+                                resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
+                                return resultModel;
+                            }
+                            startLocatInfo2.Status = "0";//绌哄偍浣�
+                            //淇敼璧峰鍌ㄤ綅鐘舵��
+                            Db.Updateable(startLocatInfo2).ExecuteCommand();
+
+                            sd3.WareHouseNo = "";//鎵�灞炰粨搴�
+                            sd3.RoadwayNo = "";//鎵�灞炲贩閬�
+                            sd3.AreaNo = "";//鎵�灞炲尯鍩�
+                            sd3.LocatNo = "";//鍌ㄤ綅鍦板潃
+                        }
+                        else if (taskInfo.Type == "2")//绉诲簱浠诲姟
+                        {
+                            //璧峰鍌ㄤ綅淇℃伅
+                            var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
+                            if (startLocatInfo2 == null)
+                            {
+                                resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
+                                return resultModel;
+                            }
+                            startLocatInfo2.Status = "0";//绌哄偍浣�
+                            //淇敼璧峰鍌ㄤ綅鐘舵��
+                            Db.Updateable(startLocatInfo2).ExecuteCommand();
+
+                            //鐩爣鍌ㄤ綅淇℃伅
+                            var endLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
+                            if (endLocatInfo2 == null)
+                            {
+                                resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
+                                return resultModel;
+                            }
+                            endLocatInfo2.Status = "1";//鏈夌墿鍝�
+                            //淇敼鐩爣鍌ㄤ綅鐘舵��
+                            Db.Updateable(endLocatInfo2).ExecuteCommand();
+
+                            sd3.WareHouseNo = endLocatInfo2.WareHouseNo;//鎵�灞炰粨搴�
+                            sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//鎵�灞炲贩閬�
+                            sd3.AreaNo = endLocatInfo2.AreaNo;//鎵�灞炲尯鍩�
+                            sd3.LocatNo = endLocatInfo2.LocatNo;//鍌ㄤ綅鍦板潃
+                            sd3.Status = "0";
+                            if (endLocatInfo2.AreaNo.Contains("01"))//娲佸噣鍖�
+                            {
+                                sd3.PalletStatus = "0";
+                                sd3.Status = "0";
+                            }
+                            else if (endLocatInfo2.AreaNo.Contains("02"))//棰勬贩鍖�
+                            {
+                                sd3.PalletStatus = "1";
+                            }
+                            else if (endLocatInfo2.AreaNo.Contains("03"))//鍗婃垚鍝佸尯
+                            {
+                                sd3.PalletStatus = "2";
+                            }
+                            else if (endLocatInfo2.AreaNo.Contains("04"))//鑴忔《鍖�
+                            {
+                                sd3.PalletStatus = "3";
+                                sd3.LotNo = "";//鎵规
+                                sd3.SkuNo = "";
+                                sd3.SkuName = "";
+                                sd3.InspectStatus = "0";//寰呮楠�
+                            }
+                        }
                         //淇敼搴撳瓨鏄庣粏
                         Db.Updateable(sd3).ExecuteCommand();
 
-                        startLocatInfo2.Status = "0";//绌哄偍浣�
-                        //淇敼璧峰鍌ㄤ綅鐘舵��
-                        Db.Updateable(startLocatInfo2).ExecuteCommand();
+                        //鍥炰紶妗剁姸鎬佺粰MES
+                        BackPalletStatus(taskInfo.PalletNo, sd3.PalletStatus);
 
-                        endLocatInfo2.Status = "1";//鏈夌墿鍝�
-                        //淇敼鐩爣鍌ㄤ綅鐘舵��
-                        Db.Updateable(endLocatInfo2).ExecuteCommand();
                         break;    
                     #endregion
                 }
@@ -548,11 +611,36 @@
         }
 
         /// <summary>
+        /// 鍥炰紶妗剁姸鎬佺粰MES
+        /// </summary>
+        /// <param name="PalletNo">妗跺彿</param>
+        /// <param name="Status">0锛氬噣妗� 1锛氶娣� 2锛氬崐鎴愬搧 3锛氳剰妗�</param>
+        /// <param name="url"></param>
+        public void BackPalletStatus(string PalletNo, string Status,string url="")
+        {
+            try
+            {
+                var obj = new
+                {
+                    PalletNo = PalletNo,
+                    Status = Status
+                };
+                string jsonReq = JsonConvert.SerializeObject(obj);
+                var response = HttpHelper.DoPost(url, jsonReq, "鍥炰紶MES妗剁姸鎬�", "MES").ToString();
+                var result = JsonConvert.DeserializeObject<ReMes>(response);//瑙f瀽杩斿洖鏁版嵁
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        /// <summary>
         /// 涓嬪彂鍑哄簱鍗�
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        public SoResInfo ErpAddExportNotice(SoInfo model)
+        public SoResInfo CreateSoWork(SoInfo model)
         {
             try
             {

--
Gitblit v1.8.0