From 06bc1ebcdbc217a7f53be2926ee4c25eb2990903 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期四, 29 八月 2024 09:07:25 +0800
Subject: [PATCH] 修改组托收货箱码关联,和平库出库单页面

---
 Wms/Wms/Controllers/UpApiController.cs        |   30 +++++
 Pda/View/AsnSetting/productEnterQuantity.html |   68 ++++++++++++
 Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs      |    3 
 Wms/Wms/Controllers/PdaSoController.cs        |   13 ++
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs       |   18 +++
 Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs       |    7 +
 Pda/View/SoSetting/pingKuOut.html             |   82 +++++++++++----
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs      |   56 ++++++++++
 8 files changed, 243 insertions(+), 34 deletions(-)

diff --git a/Pda/View/AsnSetting/productEnterQuantity.html b/Pda/View/AsnSetting/productEnterQuantity.html
index 18a62b3..0e45433 100644
--- a/Pda/View/AsnSetting/productEnterQuantity.html
+++ b/Pda/View/AsnSetting/productEnterQuantity.html
@@ -1257,6 +1257,68 @@
                 sendData(IP + "/PdaAsn/GetBindBoxInfos", param, 'post', function (res) {
                     BoxLevelVal = "0";
                     if (res.code == 0) { //鎴愬姛
+                        //鍒ゆ柇鏄惁涓洪浂绠盉itBoxMark
+                        if (res.data[0].BitBoxMark == '1') {
+                            getFMBoxinfo();
+                        } else {
+                            var bl = false;
+                            if (res.data.length == 0) {
+                                layer.msg("鏈煡璇㈠埌姝ょ鐗╂枡淇℃伅锛岃鏍稿疄!", {
+                                    icon: 2,
+                                    time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                                });
+                                return;
+                            }
+                        
+                            if (res.data[0].ASNNo != '' && res.data[0].ASNNo != null) {
+                                $("#bar").empty()
+                                $("#bar").append('<option value =>' + '</option>');
+                                form.render('select');
+
+                                $("#bar").append('<option value =' + res.data[0].ASNNo + ' selected>' + res.data[0].ASNNo + '</option>');
+
+                                updateGoodList(res.data[0].SkuNo)
+                                setOrderGoods();
+                            } else {
+                                if (asnDetails == '') {
+                                    layer.msg("璇峰厛閫夋嫨鍏ュ簱鍗曟嵁!", {
+                                        icon: 2,
+                                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                                    });
+                                    return;
+                                }
+                            }
+                            asnDetails.forEach(element => {
+                                console.log(element);
+
+                                if (element.SkuNo == res.data[0].SkuNo && element.LotNo == res.data[0].LotNo) {
+                                    var sel = 'dd[lay-value=' + element.id + ']';
+                                    $('#goodSelect').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this');
+                                    bl = true;
+                                }
+                            });
+                            if (!bl) {
+                                layer.msg("姝ょ鐗╂枡涓嶇鍚堣鍏ュ簱鍗曪紝璇锋牳瀹�!", {
+                                    icon: 2,
+                                    time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                                });
+                            } else {
+                                $("#BoxQty").val(res.data[0].Qty);
+                            }
+                        }
+                    } else { //涓嶆垚鍔�
+                        //绠辩爜涓嶅瓨鍦紝璋冪敤璧嬬爜鎺ュ彛鑾峰彇绠变俊鎭�
+                        getFMBoxinfo();
+                    }
+                });
+
+            }
+            function getFMBoxinfo(){
+                var param = {
+                    "BoxNo": $("#BOXCODE").val(),
+                }
+                sendData(IP + "/UpApi/GetFMBindBoxInfos", param, 'post', function (res) {
+                    if (res.code == 0) { //鎴愬姛//鏍规嵁瀵规帴鎺ュ彛瀹氫箟鍚勫瓧娈靛垽鏂潯浠�
                         var bl = false;
                         if (res.data.length == 0) {
                             layer.msg("鏈煡璇㈠埌姝ょ鐗╂枡淇℃伅锛岃鏍稿疄!", {
@@ -1301,15 +1363,13 @@
                         } else {
                             $("#BoxQty").val(res.data[0].Qty);
                         }
-
-                    } else { //涓嶆垚鍔�
+                    } else {
                         layer.msg(res.msg, {
                             icon: 2,
                             time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
                         });
                     }
-                });
-
+                })
             }
 
 
diff --git a/Pda/View/SoSetting/pingKuOut.html b/Pda/View/SoSetting/pingKuOut.html
index 3f0cecb..3f8ed4a 100644
--- a/Pda/View/SoSetting/pingKuOut.html
+++ b/Pda/View/SoSetting/pingKuOut.html
@@ -175,37 +175,71 @@
 				}
 				GetBoxInfo();
 			});
+
+			$("#selectDiv").click(function () {
+				var input = $('select[id="bar"]').next().find('.layui-select-title input')
+				var val = input.val()
+				//鍏堟洿鏂颁竴涓嬪嚭搴撳崟
+				updateBillList(function (data) {
+					$('select[id="bar"]').next().addClass('layui-form-selected')
+
+					$('select[id="bar"]').next().find('.layui-select-title input').val(val)
+				})
+			})
 			//鍒濆鍖栨覆鏌� 鍑哄簱鍗�
 			function updateBillList() {
 				$("#bar").empty()
 				$("#bar").append('<option value =>' + '</option>');
 				form.render('select');
-
-				var param = {
-					PalletNo: $("#PalletNo").val(),
-					Type: "1",
-				};
-				synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) {
-					console.log(res);
-
-					if (res.code == 0) { //鎴愬姛
-						console.log(res.data);
-						for (var i = 0; i < res.data.length; i++) {
-							if (i == 0) {
-								$("#bar").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>');
-							} else {
-								$("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
+				var PalletNo =  $("#PalletNo").val();
+				if(PalletNo == null && PalletNo == ""){ //涓嬫媺妗嗚幏鍙栧钩搴撳嚭搴撳崟
+					synData(IP + "/PdaSo/GetSoNoticeList", 'post', function (res) {
+						console.log(res);
+						if (res.code == 0) { //鎴愬姛
+							console.log(res.data);
+							for (var i = 0; i < res.data.length; i++) {
+								if (i == 0) {
+									$("#bar").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>');
+								} else {
+									$("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
+								}
 							}
-						}
-						form.render('select');
+							form.render('select');
 
-					} else { //涓嶆垚鍔�
-						layer.msg(res.msg, {
-							icon: 2,
-							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-						});
-					}
-				});
+						} else { //涓嶆垚鍔�
+							layer.msg(res.msg, {
+								icon: 2,
+								time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+							});
+						}
+					});
+				}else{//鏍规嵁鎵樼洏鍙疯幏鍙栧嚭搴撳崟
+					var param = {
+						PalletNo: $("#PalletNo").val(),
+						Type: "1",
+					};
+					synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) {
+						console.log(res);
+
+						if (res.code == 0) { //鎴愬姛
+							console.log(res.data);
+							for (var i = 0; i < res.data.length; i++) {
+								if (i == 0) {
+									$("#bar").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>');
+								} else {
+									$("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
+								}
+							}
+							form.render('select');
+
+						} else { //涓嶆垚鍔�
+							layer.msg(res.msg, {
+								icon: 2,
+								time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+							});
+						}
+					});
+				}
 			}
 
 			//鑾峰彇鎵樼洏鐗╂枡鍚嶇粏
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index bed4f60..35a07f3 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -1888,16 +1888,17 @@
                                         BoxNo, 
                                         SkuNo,
                                         SkuName, 
-                                        LotNo, 
+                                        LotNo,
+                                        BitBoxMark,
                                         SUM(Qty) as Qty 
                                       FROM BllBoxInfo 
                                       WHERE IsDel = '0' 
                                         AND Status='0'  
                                         AND BoxNo = '{model.BoxNo}'
-                                      GROUP BY ASNNo,BoxNo,SkuNo,SkuName,LotNo; ";
+                                      GROUP BY ASNNo,BoxNo,SkuNo,SkuName,LotNo,BitBoxMark; ";
                 var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString);
 
-                if (models == null)
+                if (models.Count == 0 )
                 {
                     throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
                 }
@@ -1909,6 +1910,55 @@
                 throw ex;
             }
         }
+
+        /// <summary>
+        /// 鏍规嵁绠辩爜鍚戣拷婧郴缁熻姹傛爣绛剧鐮佷俊鎭�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public List<BoxInfoDto> GetFMBindBoxInfos(string boxno)
+        {
+            try
+            {
+                #region 绠辩爜璇锋眰鎺ュ彛锛屾寮忕郴缁熸斁寮�
+                /*var jsonData = JsonConvert.SerializeObject(boxno);
+
+                var response = HttpHelper.DoPost(url, jsonData, "绠辩爜淇℃伅璇锋眰", "FM");
+
+                var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
+                if (obj.Success != 0)
+                {
+                    throw new Exception("璇锋眰澶辫触" + obj.Message);
+                }*/
+                #endregion
+                string sqlString = $@"SELECT 
+                                        ASNNo,
+                                        BoxNo, 
+                                        SkuNo,
+                                        SkuName, 
+                                        LotNo,
+                                        BitBoxMark,
+                                        SUM(Qty) as Qty 
+                                      FROM BllBoxInfo 
+                                      WHERE IsDel = '0' 
+                                        AND Status='0'  
+                                        AND BoxNo = '{boxno}'
+                                      GROUP BY ASNNo,BoxNo,SkuNo,SkuName,LotNo,BitBoxMark; ";
+                var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString);  // response
+
+                if (models.Count == 0)
+                {
+                    throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!");
+                }
+
+                return models;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
         // 鏍规嵁鍗曟嵁鍙疯幏鍙栧崟鎹槑缁嗗垪琛�
         public List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
         {
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 3a75010..de3e6a4 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -81,6 +81,24 @@
             return allotList2;
         }
 
+        //鑾峰彇鎵樼洏涓惈鏈夌殑鎵ц涓殑鍗曟嵁
+        public async Task<List<string>> GetRunNoticeList(string type)
+        {
+            if (type == "1")//骞冲簱鍑哄簱鑾峰彇鍗曟嵁
+            {
+                var allotList = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.Status == "1" ).Select(m => m.SONo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
+                return allotList;
+            }
+            //鑾峰彇鐘舵�佷负寰呮嫞璐ф垨鑰呴儴鍒嗘嫞璐х殑鍑哄簱鍗�
+            var allotList2 = await Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && (m.Status == "2" || m.Status == "3")).Select(m => m.SONo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToListAsync();
+
+            //var allotList = Db.Queryable<BllExportAllot>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo).Select(m => m.SONo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToList();
+            //鑾峰彇鍑哄簱鍗曟嵁涓嶄负寰呮嫞璐� 鎵ц瀹屾瘯 璁㈠崟鍏抽棴 绛夊緟鎵ц鐨勫崟鎹�
+            //var export = Db.Queryable<BllExportNotice>().Where(a => a.IsDel == "0" && a.Status == "1" || a.Status == "2" || a.Status == "3").Select(a => a.SONo).Distinct().Where(m => !string.IsNullOrWhiteSpace(m)).ToList();
+
+            return allotList2;
+        }
+
         //鑾峰彇鍑哄簱鎵樼洏涓婄殑鐗╂枡鎵规(鏍规嵁鎵樼洏鐮�)
         public async Task<List<DetailIdSkuLotNo>> GetSoSkuLotNoListByPallet(string palletNo, string soNo)
         {
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index 702e76c..e826d99 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -112,6 +112,9 @@
         //骞冲簱纭鍏ュ簱
         void ConfirmInStock(PalletBindVm model);
 
+        //鏍规嵁绠辩爜鍚戣拷婧郴缁熻姹傜淇℃伅
+        List<BoxInfoDto> GetFMBindBoxInfos(string boxno);
+
         #region JC23鍙栨牱涓氬姟鎺ュ彛
 
         /// <summary>
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
index 7d2dfe1..7d5b452 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
@@ -26,6 +26,13 @@
         Task<List<string>> GetRunSoNoticeList(string palletNo, string type);
 
         /// <summary>
+        /// 鑾峰彇鎵ц涓殑鍑哄簱鍗�
+        /// </summary>
+        /// <param name="type">绫诲瀷 鍖哄垎鏄惁鏄钩搴撳嚭搴撹幏鍙栧崟鎹�</param>
+        /// <returns></returns>
+        Task<List<string>> GetRunNoticeList(string type);
+
+        /// <summary>
         /// 鑾峰彇鍑哄簱鎵樼洏涓婄殑鐗╂枡鎵规(鏍规嵁鎵樼洏鐮�)
         /// </summary>
         /// <param name="palletNo">鎵樼洏鐮�</param>
diff --git a/Wms/Wms/Controllers/PdaSoController.cs b/Wms/Wms/Controllers/PdaSoController.cs
index 3c63851..dc08249 100644
--- a/Wms/Wms/Controllers/PdaSoController.cs
+++ b/Wms/Wms/Controllers/PdaSoController.cs
@@ -48,7 +48,7 @@
         }
 
         /// <summary>
-        /// 鑾峰彇鍗曟嵁鍒楄〃
+        /// 鏍规嵁鎵樼洏鍙疯幏鍙栧崟鎹垪琛�
         /// </summary>
         /// <param name="model">PalletNo:鎵樼洏鍙�</param> 
         /// <returns></returns>
@@ -59,6 +59,17 @@
         }
 
         /// <summary>
+        /// 鑾峰彇鍗曟嵁鍒楄〃
+        /// </summary>
+        /// <param name=""></param> 
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<List<string>> GetRunNoticeList(PdaSoVm model)
+        {
+            return await _pdaSoSvc.GetRunNoticeList(model.Type);
+        }
+
+        /// <summary>
         /// 鑾峰彇鐗╂枡-鎵规淇℃伅
         /// </summary>
         /// <param name="model">PalletNo:鎵樼洏鐮併�丼oNo:鍗曟嵁鍙�</param> 
diff --git a/Wms/Wms/Controllers/UpApiController.cs b/Wms/Wms/Controllers/UpApiController.cs
index b966b0b..eefb118 100644
--- a/Wms/Wms/Controllers/UpApiController.cs
+++ b/Wms/Wms/Controllers/UpApiController.cs
@@ -22,6 +22,8 @@
 using Newtonsoft.Json.Linq;
 using System.Runtime.CompilerServices;
 using System.Threading.Tasks;
+using WMS.BLL.BllPdaServer;
+using WMS.IBLL.IPdaServer;
 
 namespace Wms.Controllers
 {
@@ -38,13 +40,15 @@
         private readonly IArrivalNoticeServer _arrivalNoticeSvc;
         private readonly IStockCheckServer _stockCheckSvc;//鐩樼偣鍗昐vc 
         private readonly IProcurePlanServer _procurePlanSvc;//閲囪喘鍗昐vs
-        public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc)
+        private readonly IPdaAsnServer _pdaAsnServer;// PDA
+        public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer)
         {
             _config = setting.Value;
             _exNoticeSvc = exNoticeSvc;
             _arrivalNoticeSvc = arrivalNoticeServer;
             _stockCheckSvc = stockCheckSvc;
             _procurePlanSvc = procurePlanSvc;
+            _pdaAsnServer = pdaAsnServer;
         }
         #endregion
 
@@ -249,8 +253,30 @@
             }
         }
 
-        //绠辩爜淇℃伅 鎵嬫寔缁勬墭鐢� (鎵鐮佸悜杩芥函瑕佷俊鎭�)  
+        //
+        /// <summary>
+        /// 绠辩爜淇℃伅 鎵嬫寔缁勬墭鐢� (鎵鐮佸悜杩芥函瑕佷俊鎭�)  
+        /// </summary>
+        /// <param name="model">BoxNo:绠卞彿</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetFMBindBoxInfos(string BoxNo)
+        {
+            try
+            {     
+                if (string.IsNullOrWhiteSpace(BoxNo))
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠璇锋眰绠辩爜淇℃伅" });
+                }
+                var models = _pdaAsnServer.GetFMBindBoxInfos(BoxNo);
 
+                return Ok(new { code = 0, msg = "鏍囩绠辩爜淇℃伅", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
 
         #endregion
 

--
Gitblit v1.8.0