From 5e2454c2a75cb70afc0d1933e5c29e02e21231e6 Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期一, 19 八月 2024 17:01:31 +0800
Subject: [PATCH] 测试流程,修改问题

---
 Wms/WMS.Entity/BllAsnEntity/BllBoxInfo.cs              |    7 
 Pda/View/HouseDataSetting/agvTransport.html            |    4 
 Wms/Wms/Controllers/PdaCrController.cs                 |   14 
 Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs        |    2 
 Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDto.cs       |    5 
 Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs         |   52 ++
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs               |   90 +++++
 Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs                |    2 
 Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs |    2 
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs          |   10 
 Wms/Wms/appsettings.json                               |    3 
 Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs               |    2 
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs                |   10 
 HTML/views/ASNSetting/ArrivalNotice.html               |   15 
 Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs                |   54 ++-
 Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs        |   11 
 Wms/Model/InterFaceModel/HttpModel.cs                  |  158 ++++++++++
 Wms/Wms/Controllers/DownApiController.cs               |   62 ++++
 Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs           |  364 ++++++++++++++++++++++++
 19 files changed, 811 insertions(+), 56 deletions(-)

diff --git a/HTML/views/ASNSetting/ArrivalNotice.html b/HTML/views/ASNSetting/ArrivalNotice.html
index f0ab3d4..52a48ab 100644
--- a/HTML/views/ASNSetting/ArrivalNotice.html
+++ b/HTML/views/ASNSetting/ArrivalNotice.html
@@ -415,18 +415,20 @@
 			var TotalColsArr = [[
 						{field: '',title: '搴忓彿',type:'numbers',width: 50,align: 'center',fixed: 'left', "disabled": true},
 						{field: 'ASNNo',title: '鍏ュ簱鍗曞彿',align: 'center',fixed: 'left',sort: true,width: 180, "disabled": true},
-						{field: 'Status',title: '鎵ц鐘舵��',align: 'center',templet: '#buttonTpl'},
+						{field: 'Status',title: '鎵ц鐘舵��',align: 'center',width: 100,templet: '#buttonTpl'},
 						{field: 'Origin',title: '鏉ユ簮',align: 'center',width: 80},
+						{field: 'OrderCode',title: '涓婃父鍗曞彿',align: 'center',width: 180},
+						
 						{field: 'CustomerName',title: '瀹㈡埛鍚嶇О',align: 'center'},
-						{field: 'Type',title: '鍗曟嵁绫诲瀷',align: 'center',templet: '#templetType'},
-						{field: 'CompleteTime',title: '瀹屾垚鏃堕棿',align: 'center',templet: '#templetCompleteTime'},
+						{field: 'Type',title: '鍗曟嵁绫诲瀷',align: 'center',width: 100,templet: '#templetType'},
+						{field: 'CompleteTime',title: '瀹屾垚鏃堕棿',align: 'center',width: 165,templet: '#templetCompleteTime'},
 						{field: 'Demo',title: '澶囨敞',align: 'center',width: 180},
 						{field: 'CreateUserName',title: '鍒涘缓浜�',align: 'center',width: 110},
-						{field: 'CreateTime',title: '鍒涘缓鏃堕棿',align: 'center',templet: '#templetCreateTime'},
+						{field: 'CreateTime',title: '鍒涘缓鏃堕棿',align: 'center',width: 165,templet: '#templetCreateTime'},
 						{field: 'UpdateUserName',title: '淇敼浜�',align: 'center',width: 110},
-						{field: 'UpdateTime',title: '淇敼鏃堕棿',align: 'center',templet: '#templetUpdateTime'}, 
+						{field: 'UpdateTime',title: '淇敼鏃堕棿',align: 'center',width: 165,templet: '#templetUpdateTime'}, 
 						{field: 'CheckUserName',title: '澶嶆牳浜�',align: 'center',width: 110},
-						{field: 'CheckTime',title: '澶嶆牳鏃堕棿',align: 'center',templet: '#templetCheckTime'}, 
+						{field: 'CheckTime',title: '澶嶆牳鏃堕棿',align: 'center',width: 165,templet: '#templetCheckTime'}, 
 						{field: 'caozuo',title: '鎿嶄綔',fixed: 'right',width: 280,align: 'center',toolbar: '#toolbarDemo1', "disabled": true}
 					]];
 			var TotalColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜
@@ -649,6 +651,7 @@
 						{field: 'PackagName',title: '鍖呰鍚嶇О',align: 'center',width: 110,}, 
 						{field: 'IsBale',title: '鏄惁瑁瑰寘',align: 'center',width: 150}, 
 						{field: 'IsBelt',title: '鏄惁鎵撳甫',align: 'center',width: 150},
+						{field: 'OrderDetailCode',title: '涓婃父鍗曞彿',align: 'center',width: 180},
 						{field: 'UDF1',title: '鑷畾涔夊垪1',align: 'center',width: 140}, 
 						{field: 'UDF2',title: '鑷畾涔夊垪2',align: 'center',width: 140}, 
 						{field: 'UDF3',title: '鑷畾涔夊垪3',align: 'center',width: 140}, 
diff --git a/Pda/View/HouseDataSetting/agvTransport.html b/Pda/View/HouseDataSetting/agvTransport.html
index 6151fab..e0660df 100644
--- a/Pda/View/HouseDataSetting/agvTransport.html
+++ b/Pda/View/HouseDataSetting/agvTransport.html
@@ -507,7 +507,7 @@
                 $("#Quyu2").append('<option value =>' + '</option>');
                 form.render('select');
 
-                refreshTable()
+                //refreshTable()
             });
 
             //鐐瑰嚮鎵樼洏鏉$爜涓嬫媺妗嗕簨浠�
@@ -701,7 +701,7 @@
                     var param = {
                         SoNo: $("#OutNo").val(), //鍑哄簱鍗曟嵁
                         PalletNo: $("#PalletNo").val(), //鎵樼洏鏉$爜
-                        AreaNo: $("#Quyu").val()//鐩爣鍖哄煙
+                        AreaNo: $("#Quyu2").val()//鐩爣鍖哄煙
                     }
                     //鍛煎彨灏忚溅
                     sendData(IP + "/PdaCr/AgvTransport2", param, 'post', function (res) {
diff --git a/Wms/Model/InterFaceModel/HttpModel.cs b/Wms/Model/InterFaceModel/HttpModel.cs
index 43afea7..47d6be3 100644
--- a/Wms/Model/InterFaceModel/HttpModel.cs
+++ b/Wms/Model/InterFaceModel/HttpModel.cs
@@ -19,6 +19,9 @@
         /// </summary>
         public string Message { get; set; }
     }
+
+    #region WCS-Model
+
     /// <summary>
     /// 鎺ユ敹wcs鎺ュ彛杩斿洖鍙傛暟鐨刴odel
     /// </summary>
@@ -101,6 +104,140 @@
         public string TaskType { get; set; }
 
     }
+
+    //鎴愬搧鐮佸灈淇℃伅
+    public class BoxPalletBindVm
+    {
+        /// <summary>
+        /// 鐢熶骇宸ュ崟
+        /// </summary>
+        public string OrderCode { get; set; }
+        /// <summary>
+        /// 鍏ュ簱鍗曞彿
+        /// </summary>
+        public string AsnNo { get; set; }
+        /// <summary>
+        /// 鍏ュ簱鍗曟槑缁�
+        /// </summary>
+        public int AsnDetailNo { get; set; }
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        public string PalletNo { get; set; }
+        /// <summary>
+        /// 鎵樼洏鏁伴噺
+        /// </summary>
+        public decimal Qty { get; set; }
+        /// <summary>
+        /// 鎵樼洏绫诲瀷  0鐗╂枡鎵�  1绌烘墭鐩樻墭
+        /// </summary>
+        public string Type { get; set; }
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string SkuNo { get; set; }
+        /// <summary>
+        /// 鎵规鍙�
+        /// </summary>
+        public string LotNo { get; set; }
+        /// <summary>
+        /// 鎵规鎻忚堪
+        /// </summary>
+        public string LotText { get; set; }
+        /// <summary>
+        /// 渚涜揣鎵规
+        /// </summary>
+        public string SupplierLot { get; set; }
+        public List<BoxPalletBindDetailVm> Detail { get; set; }
+    }
+    //鐮佸灈绠辩爜鏄庣粏淇℃伅
+    public class BoxPalletBindDetailVm
+    {
+        /// <summary>
+        /// 鐢熶骇鍗曟嵁鍙�
+        /// </summary>
+        public string OrderCode { get; set; }
+        /// <summary>
+        /// 绠卞彿
+        /// </summary>
+        public string BoxNo { get; set; }
+        /// <summary>
+        /// 鐩掑彿
+        /// </summary>
+        public string BoxNo2 { get; set; }
+        /// <summary>
+        /// 鏀彿
+        /// </summary>
+        public string BoxNo3 { get; set; }
+        /// <summary>
+        /// 鏁伴噺
+        /// </summary>
+        public decimal Qty { get; set; }
+        /// <summary>
+        /// 婊$鏁伴噺
+        /// </summary>
+        public decimal FullQty { get; set; }
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string SkuNo { get; set; }
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string SkuName { get; set; }
+        /// <summary>
+        /// 鎵规鍙�
+        /// </summary>
+        public string LotNo { get; set; }
+        /// <summary>
+        /// 鎵规鎻忚堪
+        /// </summary>
+        public string LotText { get; set; }
+        /// <summary>
+        /// 鐢熶骇鏃ユ湡
+        /// </summary>
+        public DateTime? ProductionTime { get; set; }
+        /// <summary>
+        /// 杩囨湡鏃堕棿
+        /// </summary>
+        public DateTime? ExpirationTime { get; set; }
+        /// <summary>
+        /// 妫�楠屾爣璁�
+        /// </summary>
+        public string InspectMark { get; set; }
+        /// <summary>
+        /// 闆剁鏍囪
+        /// </summary>
+        public string BitBoxMark { get; set; }
+        /// <summary>
+        /// 璐ㄦ鐘舵��
+        /// </summary>
+        public string InspectStatus { get; set; }
+        /// <summary>
+        /// 鐗╂枡瑙勬牸
+        /// </summary>
+        public string Standard { get; set; }
+        /// <summary>
+        /// 鍖呰瑙勬牸
+        /// </summary>
+        public string PackageStandard { get; set; }
+        /// <summary>
+        /// 鍌ㄥ瓨鏈熻嚦
+        /// </summary>
+        public DateTime? StoreTime { get; set; }
+        /// <summary>
+        /// 绗嚑浠�
+        /// </summary>
+        public int? QtyOrd { get; set; }
+        /// <summary>
+        /// 鎬讳欢鏁�
+        /// </summary>
+        public int? QtyCount { get; set; }
+
+    }
+    #endregion
+
+    #region AGV-Model
 
     /// <summary>
     /// 鐢熸垚浠诲姟鍗�
@@ -584,4 +721,25 @@
         /// </summary>
         public string Data { get; set; }
     }
+    #endregion
+
+    #region FuMa-Model
+
+    /// <summary>
+    /// 鍙戦�佹帴鏀惰祴鐮佺郴缁熸帴鍙e弬鏁扮殑model
+    /// </summary>
+    public class FuMaModel
+    {
+        /// <summary>
+        /// 鐘舵�佺爜 0 鎴愬姛 -1澶辫触
+        /// </summary>
+        public int Success { get; set; }
+        /// <summary>
+        /// 淇℃伅璇︽儏
+        /// </summary>
+        public string Message { get; set; }
+    }
+
+    #endregion
+
 }
diff --git a/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs b/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs
index a19dc04..7b4f96a 100644
--- a/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs
+++ b/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDetailDto.cs
@@ -137,6 +137,8 @@
 
         public string AsnStatus { get; set; }
 
+        public string OrderDetailCode { get; set; }
+
         /// <summary>
         /// 鑷畾涔夊垪1
         /// </summary>
diff --git a/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDto.cs b/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDto.cs
index 7c7e39a..824d16f 100644
--- a/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDto.cs
+++ b/Wms/Model/ModelDto/BllAsnDto/ArrivalNoticeDto.cs
@@ -78,6 +78,11 @@
         public string Demo { get; set; }
 
         /// <summary>
+        /// 涓婃父鍗曞彿
+        /// </summary>
+        public string OrderCode { get; set; }   
+
+        /// <summary>
         /// 鐘舵�佸彉鏇存椂闂�
         /// </summary>
         public DateTime? CompleteTime { get; set; }
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index 9922b6d..723c6e5 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -112,7 +112,7 @@
                 sqlString += "LEFT JOIN SysMaterials AS tb5 on tb1.SkuNo = tb5.SkuNo ";
                 sqlString += "LEFT JOIN SysUnit AS tb6 on tb5.UnitNo = tb6.UnitNo ";
                 sqlString += "LEFT JOIN SysPackag AS tb7 on tb1.PackagNo = tb7.PackagNo ";
-                sqlString += $"WHERE tb1.ASNNo = '{model.ASNNo}' AND tb1.IsDel = '0' order by tb1.SkuNo desc ";
+                sqlString += $"WHERE tb1.ASNNo = '{model.ASNNo}' AND tb1.IsDel = '0' AND tb5.IsDel = '0' order by tb1.SkuNo desc ";
                 sqlString += $"offset {((model.Page - 1) * model.Limit)} rows fetch next {rowCount} rows only;";
 
                 var modelList = Db.Ado.SqlQuery<ArrivalNoticeDetailDto>(sqlString);
diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index 3fc7046..aa3f43a 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -31,6 +31,366 @@
         {
         }
 
+        #region 鎺ュ彛鏂规硶
+
+        //缁戝畾鐗╂枡鎵樼洏
+        public void BindPalletStock(BoxPalletBindVm model, int userId)
+        {
+            try
+            {
+                #region 鍒ゆ柇
+
+                //鍒ゆ柇鎵樼洏鏄惁鍦ㄥ簱澶�
+                var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
+                if (stockDetail != null)
+                {
+                    if (!string.IsNullOrWhiteSpace(stockDetail.LocatNo))
+                    {
+                        throw new Exception("璇ユ墭鐩樺凡鏈夊簱瀛樹俊鎭紝璇锋牳瀹烇紒");
+                    }
+                    return;
+                }
+                if (model.Type != "0" && model.Type != "1")
+                {
+                    throw new Exception("鎵樼洏绫诲瀷閿欒");
+                }
+                if (string.IsNullOrEmpty(model.PalletNo))
+                {
+                    throw new Exception("鎵樼洏鍙蜂笉鍙负绌�!");
+                }
+                //鎵樼洏鏄惁瀛樺湪
+                var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo);
+                if (pallet == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�");
+                }
+                if (model.Detail.Count == 0)
+                {
+                    throw new Exception("鎵樼洏缁戝畾鏄庣粏淇℃伅涓虹┖锛岃鏍稿疄");
+                }
+                BllArrivalNotice notice = null;
+                BllArrivalNoticeDetail detail = null;
+                if (model.Type == "0")
+                {
+                    //0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 3锛氶��璐у叆搴� 4锛氳溅闂翠綑鏂欏叆搴� 5锛氬叾瀹冨叆搴� 6锛氫唬鍌ㄥ叆搴�
+                    if (string.IsNullOrEmpty(model.AsnNo))
+                    {
+                        throw new Exception("鍗曟嵁鍙蜂笉鍙负绌�!");
+                    }
+                    if (model.AsnDetailNo == 0)
+                    {
+                        throw new Exception("鍗曟嵁鏄庣粏涓嶅彲涓虹┖!");
+                    }
+                    //鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
+                    notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo && a.OrderCode == model.OrderCode);
+                    if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
+                    {
+                        throw new Exception("璇ュ崟鎹凡鍏冲崟!");
+                    }
+                    if (notice.Type != "0")
+                    {
+                        throw new Exception("褰撳墠鍗曟嵁涓嶈兘鐢熶骇鎴愬搧鍏ュ簱锛岃鏍稿疄");
+                    }
+                    if (string.IsNullOrEmpty(model.LotNo))
+                    {
+                        throw new Exception("鎵规涓嶈兘涓虹┖!");
+                    }
+                    // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
+                    detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailNo && m.ASNNo == model.AsnNo && m.LotNo == model.LotNo && m.SkuNo == model.SkuNo);
+                    if (detail == null)
+                    {
+                        throw new Exception("褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
+                    }
+                }
+
+                #endregion
+
+                Db.BeginTran();
+
+                var comTime = DateTime.Now;
+
+                #region 鍖呰
+                var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0");
+                var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == model.SkuNo);
+                SysPackag pack = null;
+                if (model.Type == "0")
+                {
+                    pack = package.First(m => m.IsDel == "0" && m.PackagNo == detail.PackagNo);     
+                }
+                else
+                {
+                    pack = package.First(m => m.IsDel == "0" && m.PackagNo == sku.PackagNo);     
+                }
+
+                var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺 
+                var bNum = 0;//绠辩爜鐗╁搧鏁伴噺 
+
+                if (pack == null)
+                {
+                    throw new Exception("鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!");
+                }
+                if (pack.L5Num.HasValue)
+                {
+                    pNum = (int)pack.L5Num;
+                    bNum = (int)pack.L4Num;
+                }
+                else if (pack.L4Num.HasValue)
+                {
+                    pNum = (int)pack.L4Num;
+                    bNum = (int)pack.L3Num;
+                }
+                else if (pack.L3Num.HasValue)
+                {
+                    pNum = (int)pack.L3Num;
+                    bNum = (int)pack.L2Num;
+                }
+                else if (pack.L2Num.HasValue)
+                {
+                    pNum = (int)pack.L2Num;
+                    bNum = (int)pack.L1Num;
+                }
+                else if (pack.L1Num.HasValue)
+                {
+                    pNum = (int)pack.L1Num;
+                    bNum = (int)pack.L1Num;
+                }
+                if (pNum == 0 || bNum == 0)
+                {
+                    throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒");
+                }
+
+                #endregion
+
+                #region 楠岃瘉鏄惁鍏佽绔嬪簱鍚屾墭鐩樹笉鍚岀墿鏂欏叆搴撴垨鍚屾墭鐩樺悓鐗╂枡涓嶅悓鎵规鍏ュ簱
+                var list = model.Detail.GroupBy(m => new { m.SkuNo, m.LotNo }).ToList();
+
+                if (list.Count >= 2)
+                {
+                    var funSetting = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == "Fun045");
+                    if (funSetting == null || funSetting.IsEnable == "OFF")
+                    {
+                        throw new Exception($"涓嶅厑璁哥珛搴撳悓鎵樼洏涓嶅悓鐗╂枡鍏ュ簱鎴栧悓鎵樼洏涓嶅悓鎵规鍏ュ簱锛�");
+                    }
+                }
+
+                #endregion
+
+                //鍒ゆ柇鎵樼洏缁戝畾淇℃伅涓槸鍚︽湁
+                var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailNo && m.PalletNo == model.PalletNo && m.Status != "2");
+                var bindId = 0;
+                if (bind == null)
+                {
+                    bind = new BllPalletBind
+                    {
+                        ASNNo = model.AsnNo,
+                        ASNDetailNo = model.AsnDetailNo,
+                        PalletNo = model.PalletNo,
+                        PalletNo2 = "",
+                        PalletNo3 = "",
+                        Qty = model.Qty,
+                        FullQty = pNum,
+                        Status = "0",//绛夊緟鎵ц
+                        Type = model.Type, //鎵樼洏绫诲瀷  0鐗╂枡鎵�  1绌烘墭鐩樻墭
+                        LotNo = model.LotNo,
+                        LotText = model.LotText,
+                        SupplierLot = model.SupplierLot,
+                        InspectMark = "0",      //鏄惁鍙栨牱鎵樼洏 
+                        //SamplingQty = 0,     //鍙栨牱鏁伴噺  鍚庢湡涓氬姟寮�鍙戞椂 鎺ュ彛浼犲�奸渶娣诲姞瀵瑰簲瀛楁鍒ゆ柇
+                        BitPalletMark = model.Qty == pNum ? "0" : "1",
+                        IsBale = "0",
+                        IsBelt = "0",
+                        CreateUser = userId,
+
+                    };
+                    if (bind.FullQty < bind.Qty)
+                    {
+                        throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺");
+                    }
+                    // 鎻掑叆鎵樼洏缁戝畾琛�
+                    bindId = Db.Insertable(bind).ExecuteReturnIdentity();
+                }
+                else
+                {
+                    throw new Exception("缁勭洏淇℃伅閲嶅");
+                }
+
+
+                #region 绠辩爜淇℃伅 
+                decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲�
+
+                var boxInfoList = new List<BllBoxInfo>();
+                if (model.Type == "1")//鎵樼洏鎵�
+                {
+                    if (model.Detail.Count > 1)
+                    {
+                        throw new Exception("绌烘墭鐩樼粦瀹氫俊鎭腑鏄庣粏閿欒锛岃秴杩囦簡涓ゆ潯鏄庣粏");
+                    }
+                    //娣诲姞绠辩爜淇℃伅/绌烘墭鐩樻槑缁嗕俊鎭�
+                    foreach (var box in model.Detail)
+                    {
+                        var boxInfo = new BllBoxInfo()
+                        {
+                            ASNNo = model.AsnNo,
+                            ASNDetailNo = model.AsnDetailNo,
+                            OrderCode = box.OrderCode,
+                            BindNo = bindId,
+                            BoxNo = box.BoxNo,
+                            BoxNo2 = box.BoxNo2,
+                            BoxNo3 = box.BoxNo3,
+                            PalletNo = model.PalletNo,
+                            Qty = box.Qty,
+                            FullQty = box.FullQty,
+                            Status = "1",
+                            SkuNo = box.SkuNo,
+                            SkuName = box.SkuName,
+                            LotNo = box.LotNo,
+                            LotText = box.LotText,
+                            SupplierLot = model.SupplierLot,
+                            ProductionTime = box.ProductionTime,
+                            ExpirationTime = box.ExpirationTime,
+                            CompleteTime = comTime,
+                            InspectMark = box.InspectMark,
+                            BitBoxMark = box.BitBoxMark,
+                            InspectStatus = box.InspectStatus,
+                            Origin = "WCS",
+                            Standard = box.Standard,
+                            PackageStandard = box.PackageStandard,
+                            StoreTime = box.StoreTime,
+                            CreateUser = userId,
+                            CreateTime = comTime,
+                        };
+
+                        boxInfoList.Add(boxInfo);
+                        factQty += box.Qty;
+                    }
+                    if (factQty > pNum)
+                    {
+                        throw new Exception($"缁戝畾澶辫触锛屾墭鐩樼粦瀹氭暟閲忓ぇ浜庤鐗╁搧鍖呰鏁伴噺锛�");
+                    }
+                }
+                else if (model.Type == "0")//鐗╂枡鎵�
+                {
+                    if (model.Detail.Count(m => m.OrderCode != detail.OrderDetailCode) > 0)
+                    {
+                        throw new Exception($"鎵樼洏缁戝畾鏄庣粏涓紝鍚湁绠辩爜鐢熶骇宸ュ崟涓嶄竴鑷�");
+                    }
+                    if (model.Detail.Count(m => m.SkuNo != model.SkuNo || m.LotNo != model.LotNo) > 0)
+                    {
+                        throw new Exception($"鎵樼洏缁戝畾鏄庣粏涓紝鍚湁绠辩爜鐗╂枡鎴栨壒娆′笉涓�鑷�");
+                    }
+                    var boxGroup = model.Detail.GroupBy(m => m.BoxNo).ToList();
+                    foreach (var g in boxGroup)
+                    {
+                        decimal boxFullQty = 0;//绠卞唴鎬绘暟閲�
+                        foreach (var box in g)
+                        {
+                            factQty += box.Qty;
+                            boxFullQty += box.Qty;
+                            var boxInfo = new BllBoxInfo()
+                            {
+                                ASNNo = model.AsnNo,
+                                ASNDetailNo = model.AsnDetailNo,
+                                OrderCode = box.OrderCode,
+                                BindNo = bindId,
+                                BoxNo = box.BoxNo,
+                                BoxNo2 = box.BoxNo2,
+                                BoxNo3 = box.BoxNo3,
+                                PalletNo = model.PalletNo,
+                                Qty = box.Qty,
+                                FullQty = box.FullQty,
+                                Status = "1",//宸茬粍鎵�
+                                SkuNo = box.SkuNo,
+                                SkuName = box.SkuName,
+                                LotNo = box.LotNo,
+                                LotText = box.LotText,
+                                SupplierLot = model.SupplierLot,
+                                ProductionTime = box.ProductionTime,
+                                ExpirationTime = box.ExpirationTime,
+                                CompleteTime = comTime,
+                                InspectMark = box.InspectMark,
+                                BitBoxMark = box.BitBoxMark,
+                                InspectStatus = box.InspectStatus,
+                                Origin = "WCS",
+                                Standard = box.Standard,
+                                PackageStandard = box.PackageStandard,
+                                StoreTime = box.StoreTime,
+                                QtyCount = (int)box.QtyCount,
+                                QtyOrd = (int)box.QtyOrd,
+                                CreateUser = userId,
+                                CreateTime = comTime,
+                            };
+                            boxInfoList.Add(boxInfo);
+
+                        }
+                        if (boxFullQty > bNum)
+                        {
+                            throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒");
+                        }
+                    }
+                }
+
+                Db.Insertable(boxInfoList).ExecuteCommand();
+                #endregion
+
+
+                if (factQty != bind.Qty)
+                {
+                    throw new Exception("绠辩爜鏄庣粏鎬绘暟閲忎笉鍚屼簬鎵樼洏鎬绘暟閲忥紝璇锋牳瀹�");
+                }
+
+                #region 鍏ュ簱鍗曞強鏄庣粏
+                if (model.Type == "0")
+                {
+                    detail.FactQty += factQty;//宸茬粍鏁伴噺
+                    //detail.CompleteQty += factQty;//瀹屾垚鏁伴噺
+
+                    detail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
+                    if (detail.CompleteQty >= detail.Qty)
+                    {
+                        detail.Status = "2";
+                        detail.CompleteTime = comTime;
+                    }
+                    detail.UpdateUser = userId;
+                    detail.UpdateTime = comTime;
+                    //鏇存柊鍏ュ簱鍗曟槑缁�
+                    Db.Updateable(detail).ExecuteCommand();
+
+                    notice.UpdateUser = userId;
+                    notice.UpdateTime = comTime;
+                    if (notice.Status == "0")
+                    {
+                        notice.Status = "1";
+                    }
+                    var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo && m.Status != "2");
+                    if (asnDetailNum == 0)
+                    {
+                        notice.Status = "2";
+                        notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
+                    }
+                    //鏇存柊鍏ュ簱鍗�
+                    Db.Updateable(notice).ExecuteCommand();
+                }
+
+                #endregion
+
+                // 鏇存敼鎵樼洏浣跨敤鐘舵��
+                var sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
+                //娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹�
+                sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
+                Db.Ado.ExecuteCommand(sqlStr);
+                new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}鐨勭粍鐩樹俊鎭�", userId);
+
+                Db.CommitTran();
+            }
+            catch (Exception e)
+            {
+                Db.RollbackTran();
+                throw new Exception(e.Message);
+            }
+        }
+
+        #endregion
+
         #region 鎵樼洏缁戝畾
         public List<PalletBindDto> GetPalletBindList(PalletBindVm model, out int count)
         {
@@ -1770,10 +2130,11 @@
                         var oldTask = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == oldTaskNo);
                         oldTask.EndLocat = locate.LocatNo;
                         oldTask.EndRoadway = locate.RoadwayNo;
+                        oldTask.Msg += $"{roadwayNo}宸烽亾鍙�=>>{locate.LocatNo}鍌ㄤ綅鍦板潃";
                         if (oldTask.IsSuccess == 0)
                         {
                             oldTask.IsSuccess = 1;
-                            oldTask.Status = "1";
+                            oldTask.Status = "1"; 
                         }
                         Db.Updateable(oldTask).ExecuteCommand();
 
@@ -2045,6 +2406,7 @@
                 {
                     locate.Status = "1";
                     Db.Updateable(locate).ExecuteCommand();
+                    Db.CommitTran();
                     return;
                 }
                 // 鍒ゆ柇鍌ㄤ綅鏄惁涓虹┖
diff --git a/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs b/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
index 28b7459..889ab1e 100644
--- a/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
+++ b/Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
@@ -1332,22 +1332,23 @@
                 var endLocate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.EndLocat);
                 if (endLocate != null)
                 {
-                    if (endLocate.Status != "0")
+                    if (endLocate.Status != "4")
                     {
-                        throw new Exception("鐩爣鍌ㄤ綅鐘舵�侀潪绌哄偍浣�");
+                        throw new Exception("鐩爣鍌ㄤ綅鐘舵�侀潪绉诲叆涓�");
                     }
                 }
                 //鏇存敼搴撳瓨鏄庣粏
                 foreach (var item in stockDetail)
                 {
-                    item.Status = "0";//寰呭垎閰�
-                    item.LockQty = 0;//閿佸畾鏁伴噺鏀逛负0
+                    //item.Status = "0";//寰呭垎閰�
+                    //item.LockQty = 0;//閿佸畾鏁伴噺鏀逛负0
                     if (endLocate != null)//鏈夌洰鏍囧偍浣嶈鏄庣Щ鍒板叾浠栧尯鍩熷偍浣�
                     {
                         item.LocatNo = endLocate.LocatNo;//鍌ㄤ綅鏇存敼
                         item.WareHouseNo = endLocate.WareHouseNo;//鎵�灞炰粨搴撴洿鏀�
                         item.RoadwayNo = endLocate.RoadwayNo;//鎵�灞炲贩閬撴洿鏀�
-                        item.AreaNo = endLocate.AreaNo;//鎵�灞炲尯鍩熸洿鏀�
+                        item.AreaNo = endLocate.AreaNo;//鎵�灞炲尯鍩熸洿鏀� 
+
                     }
                     else//娌℃湁鐩爣鍌ㄤ綅璇存槑绉诲埌鍏ュ簱鍙�
                     {
@@ -1355,13 +1356,44 @@
                         item.WareHouseNo = "";//鎵�灞炰粨搴撴洿鏀癸紙鏀逛负绌猴級
                         item.RoadwayNo = "";//鎵�灞炲贩閬撴洿鏀癸紙鏀逛负绌猴級
                         item.AreaNo = "";//鎵�灞炲尯鍩熸洿鏀癸紙鏀逛负绌猴級
-                    }                   
+                    }
+                    if (item.Qty == item.LockQty && item.LockQty>0)
+                    {
+                        item.Status = "2";
+                    }
+                    else if (item.Qty > item.LockQty && item.LockQty > 0)
+                    {
+                        item.Status = "1";
+                    }
+                    else if (item.Qty > item.LockQty && item.LockQty == 0)
+                    {
+                        item.Status = "0";
+                    }
                     Db.Updateable(item).ExecuteCommand();
 
-                    //鏇存敼搴撳瓨鎬昏〃
-                    var stock = Db.Queryable<DataStock>().First(w => w.IsDel == "0" && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
-                    stock.LockQty -= (decimal)item.Qty;
-                    Db.Updateable(stock).ExecuteCommand();
+                    
+                    
+
+                    if (endLocate != null && endLocate.AreaNo == "B12") //鏄惁鏄�3妤肩紦瀛樺尯 鏄細鍒犻櫎搴撳瓨
+                    {
+                        //搴撳瓨绠辩爜鏄庣粏鍒犻櫎
+                        var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.StockDetailId == item.Id).ToList();
+                        Db.Deleteable(boxInfo).ExecuteCommand();
+                        //鍒犻櫎搴撳瓨鎵樼洏淇℃伅
+                        Db.Deleteable(item).ExecuteCommand();
+                        //鏇存敼搴撳瓨鎬昏〃
+                        var stock = Db.Queryable<DataStock>().First(w => w.IsDel == "0" && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
+                        stock.LockQty -= (decimal)item.Qty;
+                        stock.Qty -= (decimal)item.Qty;
+                        Db.Updateable(stock).ExecuteCommand();
+                        //鏇存敼鎵樼洏鐘舵��
+                        var pallet = Db.Queryable<SysPallets>().First(m=>m.IsDel =="0" && m.PalletNo == task.PalletNo);
+                        if (pallet != null)
+                        {
+                            pallet.Status = "0";
+                            Db.Updateable(pallet).ExecuteCommand();
+                        }
+                    }
                 }
                 if (endLocate != null)
                 {
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index c4a2bbc..fdbe63d 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -18,6 +18,10 @@
 using Dm;
 using Model.InterFaceModel;
 using WMS.Entity.BllQualityEntity;
+using Newtonsoft.Json;
+using Utility.Tools;
+using System.Reflection;
+using System.IO;
 
 namespace WMS.BLL.BllPdaServer
 {
@@ -1685,6 +1689,82 @@
         }
 
         #region 浜у搧缁勬墭
+
+        public void GetBoxInfoByFuMa(string boxNo,string url)
+        {
+            try
+            {
+                var list = new List<BllBoxInfo>();
+
+                var data = new { BoxNo = boxNo };
+                var jsonData = JsonConvert.SerializeObject(data);
+
+                ////绋嬪簭姝e紡鍙戝竷鍚庢斁寮�
+                //var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+                //var response = HttpHelper.DoPost(url, jsonData,"鑾峰彇绠辩爜淇℃伅", "璧嬬爜");
+                //var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
+
+                ////瑙f瀽杩斿洖鏁版嵁 
+                //var fuMaModel = JsonConvert.DeserializeObject<FuMaModel>(response);
+                //if (fuMaModel.Success == 0)
+                //{
+
+                    var datas = Assembly.GetExecutingAssembly();
+                var s = "0";
+                    //string filePath = "Assembly.GetExecutingAssembly()";
+                    //string json = File.ReadAllText(filePath);
+                    //var person = JsonConvert.DeserializeObject<BllBoxInfo>(json);
+
+                    //var comTime = DateTime.Now;
+                    ////娣诲姞绠辩爜淇℃伅琛ㄤ腑  //鏆傛椂杩欎簺鍐�--娣诲姞鏁版嵁锛屽悗缁渶瑕佸拰璧嬬爜绯荤粺瀵规帴鍚� 鏍规嵁鏄庣‘杩斿洖鐨勬暟鎹牸寮忔洿鏀�
+                    //var boxInfo = new BllBoxInfo()
+                    //{
+                    //    ASNNo = "",
+                    //    //ASNDetailNo = 0,
+                    //    OrderCode = "",
+                    //    //BindNo = 0,
+                    //    BoxNo = person.BoxNo,
+                    //    BoxNo2 = "",
+                    //    BoxNo3 = "",
+                    //    PalletNo = "",
+                    //    Qty = 0,
+                    //    FullQty = 0,
+                    //    Status = "0",
+                    //    SkuNo = "",
+                    //    SkuName = "",
+                    //    LotNo = "",
+                    //    LotText = "",
+                    //    SupplierLot = "",
+                    //    ProductionTime = DateTime.Now,
+                    //    ExpirationTime = DateTime.Now,
+                    //    //CompleteTime = comTime,
+                    //    InspectMark = "0",
+                    //    BitBoxMark = "0",
+                    //    InspectStatus = "0",
+                    //    Origin = "璧嬬爜",
+                    //    Standard = "box.Standard",
+                    //    PackageStandard = "box.PackageStandard",
+                    //    StoreTime = DateTime.Now,
+                    //    CreateUser = 0,
+                    //    CreateTime = comTime,
+                    //};
+                    //Db.Insertable(boxInfo).ExecuteCommand();
+
+                //}
+                //if (fuMaModel.Success == -1)
+                //{
+                //    throw new Exception($"璧嬬爜绯荤粺杩斿洖鐘舵�佸紓甯革細{fuMaModel.Message}");
+                //}
+                 
+
+                 
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
         /// <summary>
         /// 鏍规嵁绠辩爜鑾峰彇鏍囩绠辩爜淇℃伅
         /// </summary>
@@ -1698,6 +1778,12 @@
                 {
                     throw new Exception("璇锋壂鎻忓绠辨潯鐮�!");
                 }
+                var count = Db.Queryable<BllBoxInfo>().Count(m => m.IsDel == "0" && m.Status == "0" && m.BoxNo == model.BoxNo);
+                if (count == 0)
+                {
+                    GetBoxInfoByFuMa("",""); //浠庤祴鐮佺郴缁熻幏鍙栫鐮佷俊鎭�
+                }
+
                 string sqlString = $@"SELECT 
                                         ASNNo,
                                         BoxNo, 
@@ -2466,7 +2552,7 @@
                         SendDate = serverTime,  //鍙戦�佹椂闂�
                         BackDate = serverTime,  //杩斿洖鏃堕棿
                         StartLocat = "",//璧峰浣嶇疆
-                        EndLocat = "鍔涜骞冲簱",//鐩爣浣嶇疆
+                        EndLocat = model.LocatNo,//鐩爣浣嶇疆
                         PalletNo = bindInfo.PalletNo,//鎵樼洏鐮�
                         IsSend = 0,//鏄惁鍙啀娆′笅鍙�
                         IsCancel = 0,//鏄惁鍙彇娑�
@@ -2584,7 +2670,7 @@
                         SendDate = DateTime.Now,  //鍙戦�佹椂闂�
                         BackDate = DateTime.Now,  //杩斿洖鏃堕棿
                         StartLocat = "",//璧峰浣嶇疆
-                        EndLocat = "鍔涜骞冲簱",//鐩爣浣嶇疆
+                        EndLocat = model.LocatNo,//鐩爣浣嶇疆
                         PalletNo = model.PalletNo,//鎵樼洏鐮�
                         IsSend = 0,//鏄惁鍙啀娆′笅鍙�
                         IsCancel = 0,//鏄惁鍙彇娑�
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index 43ca4af..5fe710b 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -826,7 +826,7 @@
         {
             try
             {
-                var allotList = Db.Queryable<BllExportNotice>().Where(m => m.IsDel == "0" && m.Status == "2").Select(m => m.SONo).Distinct().ToList();
+                var allotList = Db.Queryable<BllExportNotice>().Where(m => m.IsDel == "0" && (m.Status == "3" || m.Status == "4")).Select(m => m.SONo).Distinct().ToList();
                 return allotList;
             }
             catch (Exception ex)
@@ -983,11 +983,11 @@
 
                 //淇敼搴撳瓨鏄庣粏淇℃伅
                 stockDetail.Status = "4";//绉诲簱閿佸畾
-                stockDetail.LockQty = stockDetail.Qty;//閿佸畾搴撳瓨鏁伴噺
+                //stockDetail.LockQty = stockDetail.Qty;//閿佸畾搴撳瓨鏁伴噺
                 Db.Updateable(stockDetail).ExecuteCommand();
                 //淇敼搴撳瓨淇℃伅
-                stock.LockQty += (decimal)stockDetail.Qty;
-                Db.Updateable(stock).ExecuteCommand();
+                //stock.LockQty += (decimal)stockDetail.Qty;
+                //Db.Updateable(stock).ExecuteCommand();
 
                 //淇敼璧峰鍌ㄤ綅鍦板潃鐘舵��
                 storageLocat.Status = "5";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑 
@@ -1069,7 +1069,7 @@
         /// <param name="palletNo"></param>
         /// <param name="areaNo"></param>
         /// <param name="userId"></param>
-        public void AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url)
+        public List<string> AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url)
         {
             if (string.IsNullOrEmpty(soNo))
             {
@@ -1084,7 +1084,7 @@
                 //寮�鍚簨鍔�
                 Db.BeginTran();
                 List<AgvSchedulingTask> agvTaskList = new List<AgvSchedulingTask>();
-
+                var strList = new List<string>();//閿欒淇℃伅闆嗗悎  //0 锛氶儴鍒嗘墭鐩樺凡鏈夊皬杞︾瓑寰呮墽琛屾垨姝e湪鎵ц鐨勪换鍔�
                 //鍑哄簱鍗曚俊鎭�
                 var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo);
                 if (notice == null)
@@ -1104,8 +1104,9 @@
                 }
                 else//鏁翠釜鍑哄簱鍗曞彨璐�
                 {
-                    string sqlStr = $"select * from DataStockDetail where PalletNo in (select PalletNo from BllExportAllot where IsDel='0' and SONo='{soNo}')";
-                    stockDetailList = Db.Ado.SqlQuery<DataStockDetail>(sqlStr).ToList();
+                //    string sqlStr = $"select * from DataStockDetail where PalletNo in (select PalletNo from BllExportAllot where IsDel='0' and SONo='{soNo}')";
+                //    stockDetailList = Db.Ado.SqlQuery<DataStockDetail>(sqlStr).ToList();
+                    stockDetailList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SONo == soNo).ToList();
                 }
                 if (stockDetailList.Count <= 0)
                 {
@@ -1117,14 +1118,10 @@
                 var stock = Db.Queryable<DataStock>().Where(w => w.IsDel == "0");//搴撳瓨鎬昏〃
                 string EndLocat = string.Empty;//鐩爣浣嶇疆
                 string hasLocatNoList = string.Empty;//宸插垎閰嶇殑鍌ㄤ綅
+
                 foreach (var item in stockDetailList)
                 {
-                    //浠诲姟淇℃伅
-                    var logInfo = log.First(w => w.PalletNo == item.PalletNo);
-                    if (logInfo != null)
-                    {
-                        throw new Exception($"鎵樼洏鍙凤細{item.PalletNo}宸叉湁灏忚溅绛夊緟鎵ц鎴栨鍦ㄦ墽琛岀殑浠诲姟!");
-                    }
+                    
                     if (string.IsNullOrEmpty(item.LocatNo))
                     {
                         throw new Exception($"鎵樼洏鍙凤細{item.PalletNo}鐨勫偍浣嶄俊鎭笉瀛樺湪,璇锋鏌�!");
@@ -1132,6 +1129,17 @@
                     if (item.WareHouseNo != "W02")
                     {
                         throw new Exception($"鎵樼洏鍙凤細{item.PalletNo}鏈湪骞冲簱鍐�,璇锋鏌�!");
+                    }
+                    //浠诲姟淇℃伅
+                    var logInfo = log.First(w => w.PalletNo == item.PalletNo);
+                    if (logInfo != null)
+                    {
+                        if (!strList.Contains("1"))
+                        {
+                            strList.Add("1");
+                        }
+                        continue;
+                        //throw new Exception($"鎵樼洏鍙凤細{item.PalletNo}宸叉湁灏忚溅绛夊緟鎵ц鎴栨鍦ㄦ墽琛岀殑浠诲姟!");
                     }
                     //璧峰鍌ㄤ綅淇℃伅
                     var storageLocatBegin = storageLocat.First(w => w.LocatNo == item.LocatNo);
@@ -1171,7 +1179,7 @@
                         Msg = string.Format("杞繍浠诲姟锛歿0}=>>{1}", item.LocatNo, EndLocat),
                         StartLocat = item.LocatNo,//璧峰浣嶇疆
                         EndLocat = EndLocat,//鐩爣浣嶇疆
-                        PalletNo = palletNo,//鎵樼洏鐮�
+                        PalletNo = item.PalletNo,//鎵樼洏鐮�
                         IsSend = 1,//鏄惁鍙啀娆′笅鍙�
                         IsCancel = 1,//鏄惁鍙彇娑�
                         IsFinish = 1,//鏄惁鍙畬鎴�
@@ -1194,7 +1202,7 @@
 
                     //淇敼搴撳瓨鏄庣粏淇℃伅
                     item.Status = "4";//绉诲簱閿佸畾
-                    item.LockQty = item.Qty;//閿佸畾搴撳瓨鏁伴噺
+                    //item.LockQty = item.Qty;//閿佸畾搴撳瓨鏁伴噺
                     Db.Updateable(item).ExecuteCommand();
 
                     //淇敼璧峰鍌ㄤ綅鍦板潃鐘舵��
@@ -1203,11 +1211,16 @@
                     //淇敼鐩爣鍌ㄤ綅鍦板潃鐘舵��
                     storageLocatEnd.Status = "4";//0锛氱┖鍌ㄤ綅 1锛氭湁鐗╁搧 2锛氬叆搴撲腑 3锛氬嚭搴撲腑 4锛氱Щ鍏ヤ腑 5锛氱Щ鍑轰腑 
                     Db.Updateable(storageLocatEnd).ExecuteCommand();
+                    
+                    if (!strList.Contains("0"))
+                    {
+                        strList.Add("0");
+                    }
 
-                    var stockInfo = stock.First(w => w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
-                    //淇敼搴撳瓨淇℃伅
-                    stockInfo.LockQty += (decimal)item.Qty;//閿佸畾鏁伴噺
-                    Db.Updateable(stockInfo).ExecuteCommand();
+                    //var stockInfo = stock.First(w => w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
+                    ////淇敼搴撳瓨淇℃伅
+                    //stockInfo.LockQty += (decimal)item.Qty;//閿佸畾鏁伴噺
+                    //Db.Updateable(stockInfo).ExecuteCommand();
                 }
                 if (string.IsNullOrEmpty(palletNo))
                 {
@@ -1264,6 +1277,7 @@
 
                 //鎻愪氦浜嬪姟
                 Db.CommitTran();
+                return strList;
             }
             catch (Exception ex)
             {
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 067314d..1909858 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -1228,7 +1228,7 @@
 
                 if (result.WareHouseNo != "W02")//W02锛氶浂绠卞簱
                 {
-                    throw new Exception("璇ユ墭鐩樻湭鍦ㄩ浂绠卞簱锛岃妫�鏌�!");
+                    throw new Exception("璇ユ墭鐩樻湭鍦ㄥ钩搴撳唴锛岃妫�鏌�!");
                 }
 
                 #endregion
@@ -1240,9 +1240,9 @@
                 {
                     throw new Exception("鏈幏鍙栧埌瀵瑰簲鍌ㄤ綅淇℃伅锛岃妫�鏌�!");
                 }
-                if (locat.Status != "1")
+                if (locat.Status != "3")
                 {
-                    throw new Exception("褰撳墠鍌ㄤ綅涓嶆槸鏈夌墿鍝侊紝璇锋鏌�!");
+                    throw new Exception("褰撳墠鍌ㄤ綅涓嶆槸鍑哄簱涓紝璇锋鏌�!");
                 }
 
                 #endregion
@@ -2615,7 +2615,7 @@
                 #region 鎷兼墭淇℃伅
                 var sdId = 0;
                 bool isNew = false;
-                var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew);
+                var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew && m.SkuNo == allot.SkuNo && m.LotNo == allot.LotNo);
                 if (pinStockDetail != null)
                 {
                     if (palletNo != palletNoNew)//闈炴暣鎵樻嫞璐�
@@ -3034,6 +3034,8 @@
                 {
                     sd.Qty = pickQty;
                     sd.LockQty = pickQty;
+
+                    Db.Updateable(sd).ExecuteCommand();
                 }
                 else
                 {
diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index 6b45a6d..f671968 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -2172,17 +2172,17 @@
 
                         try
                         {
-                            //var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+                            var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
                             //response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍑哄簱鍛戒护", "WCS");
-                            //var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
+                            var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
 
                             //////瑙f瀽杩斿洖鏁版嵁 
                             var wcsModel = JsonConvert.DeserializeObject<WcsModel>(response);
                             //if (wcsModel.StatusCode == 0)
                             //{
-                            //    //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�//
-                            //    new TaskServer().EditTaskIssueOk(list2, time1, time2);
-                            //    str += "涓嬪彂鎴愬姛";
+                            //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�//
+                            new TaskServer().EditTaskIssueOk(list2, time1, time2);
+                            str += "涓嬪彂鎴愬姛";
                             //}
                             //if (wcsModel.StatusCode == -1)
                             //{
diff --git a/Wms/WMS.Entity/BllAsnEntity/BllBoxInfo.cs b/Wms/WMS.Entity/BllAsnEntity/BllBoxInfo.cs
index 5de4dbc..b0d76e1 100644
--- a/Wms/WMS.Entity/BllAsnEntity/BllBoxInfo.cs
+++ b/Wms/WMS.Entity/BllAsnEntity/BllBoxInfo.cs
@@ -26,6 +26,13 @@
         public int? ASNDetailNo {get;set;}
 
         /// <summary>
+        /// Desc:鐢熶骇宸ュ崟锛堜笂娓哥郴缁熺敓浜у崟鍙凤級
+        /// Default:
+        /// Nullable:True
+        /// </summary>           
+        public string OrderCode { get; set; }
+
+        /// <summary>
         /// Desc:鎵樼洏缁戝畾鍙�
         /// Default:
         /// Nullable:True
diff --git a/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs b/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
index d44bcaf..3dc8720 100644
--- a/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
+++ b/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
@@ -8,6 +8,17 @@
 {
     public interface IPalletBindServer
     {
+        #region 鎺ュ彛鏂规硶
+
+        /// <summary>
+        /// 鎴愬搧/鎵樼洏 缁戝畾淇℃伅
+        /// </summary>
+        /// <param name="model"></param>
+        /// <param name="userId"></param>
+        void BindPalletStock(BoxPalletBindVm model, int userId);
+
+        #endregion
+
         #region 鎵樼洏缁戝畾
         List<PalletBindDto> GetPalletBindList(PalletBindVm model, out int count);
 
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index 8d2e7c8..d5b06b0 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -71,6 +71,8 @@
         //闆剁鍏ュ簱
         void CompleteInStockLing(PdaLingAsnVm model, int userId);
 
+        void GetBoxInfoByFuMa(string boxNo, string url);
+
         // 鏍规嵁绠辩爜鑾峰彇鏍囩绠辩爜淇℃伅
         List<BoxInfoDto> GetBindBoxInfos(BoxInfoVm model);
 
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
index b125082..b78fffb 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
@@ -137,7 +137,7 @@
         /// <param name="palletNo"></param>
         /// <param name="areaNo"></param>
         /// <param name="userId"></param>
-        void AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url);
+        List<string> AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url);
         #endregion
     }
 }
diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs
index 153772c..d38b5fb 100644
--- a/Wms/Wms/Controllers/DownApiController.cs
+++ b/Wms/Wms/Controllers/DownApiController.cs
@@ -500,8 +500,68 @@
                 throw new Exception(ex.Message);
             }
         }
+        
+        /// <summary>
+        /// 鑷姩鐮佸灈缁戝畾淇℃伅杩斿洖宸烽亾鍙�
+        /// </summary>
+        /// <param name="model">鍏ュ簱鍗曚俊鎭�</param>
+        /// <returns></returns>
+        [AllowAnonymous]
+        [HttpPost]
+        public IActionResult BindRequestRoadWay(BoxPalletBindVm model)
+        {
+            var logStr = $@".\log\WCS\WCS鎵樼洏缁戝畾-鐢宠宸烽亾" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
 
-        //鎵樼洏绠辩爜淇℃伅 鑷姩鐮佸灈 (wcs鎻愪緵)
+            try
+            {
+                var jsonData = JsonConvert.SerializeObject(model);
+                LogFile.SaveLogToFile($"WCS鎵樼洏缁戝畾-鐢宠宸烽亾锛�( {jsonData} ),", logStr);
+
+                _asnPalletBindSvc.BindPalletStock(model, 0);
+                //鐢宠宸烽亾
+                var list = _asnPalletBindSvc.RequestRoadWay(model.PalletNo, "W01");
+                LogFile.SaveLogToFile($"WCS鎵樼洏缁戝畾-鐢宠宸烽亾杩斿洖锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
+
+                return Ok(new { Success = 0, Message = "鎵樼洏缁戝畾-鐢宠宸烽亾鎴愬姛", TaskList = list });
+            }
+            catch (Exception e)
+            {
+                LogFile.SaveLogToFile($"WCS鎵樼洏缁戝畾-鐢宠宸烽亾杩斿洖锛�( {e.Message} ),", logStr);
+
+                return Ok(new ErpModel { Success = -1, Message = e.Message });
+            }
+        }
+
+        ///// <summary>
+        ///// 鎴愬搧绠辩爜鎷嗗灈鎷h揣
+        ///// </summary>
+        ///// <param name="model">鍏ュ簱鍗曚俊鎭�</param>
+        ///// <returns></returns>
+        //[AllowAnonymous]
+        //[HttpPost]
+        //public IActionResult BoxUnstackd(BoxPickList model)
+        //{
+        //    var logStr = $@".\log\WCS\WCS鎴愬搧绠辩爜鎷嗗灈" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
+
+        //    try
+        //    {
+
+        //        var jsonData = JsonConvert.SerializeObject(model);
+        //        LogFile.SaveLogToFile($"WCS鎴愬搧绠辩爜鎷嗗灈锛�( {jsonData} ),", logStr);
+
+        //        _comeSvc.BoxUnstackd(model.PalletNo, model.BoxList);
+        //        var list = new { Success = 0, Message = "鎴愬搧绠辩爜鎷嗗灈" };
+        //        LogFile.SaveLogToFile($"WCS鎴愬搧绠辩爜鎷嗗灈杩斿洖锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
+
+        //        return Ok(list);
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        LogFile.SaveLogToFile($"WCS鎴愬搧绠辩爜鎷嗗灈锛�( {e.Message} ),", logStr);
+
+        //        return Ok(new ErpModel { Success = -1, Message = e.Message });
+        //    }
+        //}
 
         //鐢宠绌烘墭(鑷姩鐮佺┖鎵樻椂鐢�)
 
diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs
index d9629c0..d135a64 100644
--- a/Wms/Wms/Controllers/PdaCrController.cs
+++ b/Wms/Wms/Controllers/PdaCrController.cs
@@ -395,9 +395,19 @@
                 }
 
                 var uId = int.Parse(userId);
-                _pdaCrSvc.AgvTransport2(model.SoNo,model.PalletNo, model.AreaNo, uId, _config.WcsHost + _config.GenAgvSchedulingTask);
+                var str = _pdaCrSvc.AgvTransport2(model.SoNo,model.PalletNo, model.AreaNo, uId, _config.WcsHost + _config.GenAgvSchedulingTask);
+                var msgStr = "";
+                if (str.Contains("0"))
+                {
+                    msgStr += "鎴愬姛";
+                }
+                if (str.Contains("1"))
+                {
+                    msgStr += "閮ㄥ垎鎵樼洏宸叉湁灏忚溅绛夊緟鎵ц鎴栨鍦ㄦ墽琛岀殑浠诲姟";
+                }
+                 
 
-                return Ok(new { data = "", code = 0, msg = "鎴愬姛" });
+                return Ok(new { data = "", code = 0, msg = msgStr });
             }
             catch (Exception e)
             {
diff --git a/Wms/Wms/appsettings.json b/Wms/Wms/appsettings.json
index 2445560..76f35d5 100644
--- a/Wms/Wms/appsettings.json
+++ b/Wms/Wms/appsettings.json
@@ -12,7 +12,8 @@
     //"ConnectionString": "Server=47.95.120.53;Database=WMS_JC09;User ID=sa;Password=boxline!@#;Integrated Security=False;",
     //"ConnectionString": "Server=192.168.62.106;Database=WMS_JC24;User ID=sa;Password=sql2019;Integrated Security=False;",
     //"ConnectionString": "Server=192.168.62.200;Database=WMS_JC24;User ID=sa;Password=sql2019;Integrated Security=False;"
-    "ConnectionString": "Server=10.18.99.10;Database=WMS_JC24;User ID=sa;Password=sql2024;Integrated Security=False;"
+    //"ConnectionString": "Server=10.18.99.10;Database=WMS_JC24;User ID=sa;Password=sql2024;Integrated Security=False;",
+    "ConnectionString": "Server=.;Database=WMS_JC24;User ID=sa;Password=sql2022;Integrated Security=False;"
     //"ConnectionString": "Data Source=DESKTOP-0EJDG95\\MSSQLSERVER1;Initial Catalog=WMS_V01;Integrated Security=True;"
   },
   "JWTConfig": {

--
Gitblit v1.8.0