From f2c15afd5db47e5ebec1cefd3c17cfb605688187 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期日, 04 二月 2024 16:06:53 +0800
Subject: [PATCH] 修改PDA托盘绑定

---
 Pda/View/AsnSetting/productEnterQuantity.html |   34 +++++++++++++---
 Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs      |    3 +
 Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs           |    4 ++
 Wms/Wms/Controllers/PdaAsnController.cs       |   13 ++++++
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs      |   59 ++++++++++++++++++++++++++++-
 5 files changed, 103 insertions(+), 10 deletions(-)

diff --git a/Pda/View/AsnSetting/productEnterQuantity .html b/Pda/View/AsnSetting/productEnterQuantity.html
similarity index 96%
rename from Pda/View/AsnSetting/productEnterQuantity .html
rename to Pda/View/AsnSetting/productEnterQuantity.html
index caaa38d..43c99f9 100644
--- a/Pda/View/AsnSetting/productEnterQuantity .html
+++ b/Pda/View/AsnSetting/productEnterQuantity.html
@@ -705,6 +705,7 @@
 					AsnNo: $("#bar").val(),
 					PalletNo: $("#STOCKCODE").val(),
 					AsnDetailId: parseInt($("#goodSelect").val()),
+                    LotNo:$("#goodSelect").find("option:selected").text(),
 					BoxNo: $("#BOXCODE").val(),
 					IsContinue: isContinue,
 					TailBoxNo: $("#BOXCODE2").val(),
@@ -851,25 +852,44 @@
                     var param = {
                         AsnNo: $("#bar").val(),
                     };
-                    synData(IP + "/PdaAsn/GetArrivalNoticeDetails", param, 'post', function (res) {
+                    synData(IP + "/PdaAsn/GetBindArrivalNoticeDetails", param, 'post', function (res) {
                         console.log("鍑哄簱鍙o細" + JSON.stringify(res))
                         if (res.code == 0) { //鎴愬姛
                             asnDetails = res.data;
                             for (var i = 0; i < res.data.length; i++) {
                                 if(skuNo!='' && skuNo==res.data[i].SkuNo){
-                                    $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
+                                    if(res.data[i].LotNo=='' || res.data[i].LotNo == null){
+                                        $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
+                                        .SkuName +
+                                        '</option>');
+                                    }else{
+                                        $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
                                         .SkuName + "-" + res.data[i].LotNo +
                                         '</option>');
+                                    }                                    
                                 }else{
                                     if (i == 0) {
-                                        $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
+                                        if(res.data[i].LotNo=='' || res.data[i].LotNo == null){
+                                            $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
+                                            .SkuName +
+                                            '</option>');
+                                        }else{
+                                            $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
                                             .SkuName + "-" + res.data[i].LotNo +
                                             '</option>');
-                                        } else {
-                                            $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i]
-                                                .SkuName + "-" + res.data[i].LotNo +
-                                                '</option>');
                                         }
+                                        
+                                    } else {
+                                        if(res.data[i].LotNo=='' || res.data[i].LotNo == null){
+                                            $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i]
+                                            .SkuName +
+                                            '</option>');
+                                        }else{
+                                            $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i]
+                                            .SkuName + "-" + res.data[i].LotNo +
+                                            '</option>');
+                                        }                                         
+                                     }
                                 }							
                             }
                             form.render('select');
diff --git a/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs b/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs
index b57c800..7d734a0 100644
--- a/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs
+++ b/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs
@@ -65,5 +65,9 @@
         /// </summary>           
         public int SkuQty { get; set; }
 
+        /// <summary>
+        /// Desc:鎵规鍙�
+        /// </summary>
+        public string LotNo { get; set; }
     }
 }
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 3b76924..353c602 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -1667,8 +1667,48 @@
                 throw ex;
             }
         }
+        // 鏍规嵁鍗曟嵁鍙疯幏鍙栧崟鎹槑缁嗗垪琛�
+        public List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
+        {
+            string sqlString = string.Empty;
+            try
+            {
+                sqlString = $"select * from BllArrivalNoticeDetail where ASNNo = '{model.ASNNo}' and isdel='0' order by CreateTime;";
+                var modelList = Db.Ado.SqlQuery<ArrivalNoticeDetailDto>(sqlString);
+                List<ArrivalNoticeDetailDto> noticeList = new List<ArrivalNoticeDetailDto>();
+                foreach (var item in modelList)
+                {
+                    if (string.IsNullOrEmpty(item.LotNo))
+                    {
+                        noticeList.Add(item);
+                    }
+                    else
+                    {
+                        string[] LotNoList = item.LotNo.Split(';');
+                        foreach (var item2 in LotNoList)
+                        {
+                            ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto();
+                            entry = item;
+                            entry.LotNo = item2;
 
+                            noticeList.Add(entry);
+                        }
+                    }                   
+                }
+                return noticeList;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
 
+        /// <summary>
+        /// 缁戝畾鎵樼洏
+        /// </summary>
+        /// <param name="model"></param>
+        /// <param name="userId"></param>
+        /// <param name="origin"></param>
         public void BindPallet(PdaPalletBindVm model, int userId, string origin)
         {
             try
@@ -1686,6 +1726,19 @@
                 if (string.IsNullOrEmpty(model.PalletNo))
                 {
                     throw new Exception("-1:鎵樼洏鍙蜂笉鍙负绌�!");
+                }
+                if (string.IsNullOrEmpty(model.LotNo))
+                {
+                    throw new Exception("-1:鐗╂枡鎵规涓嶅彲涓虹┖!");
+                }
+                else
+                {
+                    //浠庣墿鏂欏悕绉�-鎵规涓彇鍑烘壒娆�
+                    int indexOfDash = model.LotNo.IndexOf("-");
+                    if (indexOfDash != -1)
+                    {
+                        model.LotNo = model.LotNo.Substring(indexOfDash + 1);
+                    }
                 }
                 //鍒ゆ柇鐗╂枡鏁伴噺鏄惁涓�0 涓�0鍒ゆ柇绠辩爜淇℃伅 涓嶄负0缁х画
                 if (model.SkuQty == 0)
@@ -1715,7 +1768,7 @@
                     throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�");
                 }
                 // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
-                var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo);
+                var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo));
                 if (detail == null)
                 {
                     throw new Exception("-1:褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
@@ -1791,7 +1844,7 @@
                         FullQty = pNum,
                         Status = "0",
                         Type = "0",
-                        LotNo = detail.LotNo,
+                        LotNo = model.LotNo,
                         LotText = detail.LotText,
                         SupplierLot = "",
                         InspectMark = "0",
@@ -1861,7 +1914,7 @@
                                 continue;
                             }
                             //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎
-                            if (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo)
+                            if (box.SkuNo != detail.SkuNo || box.LotNo != model.LotNo)
                             {
                                 throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!");
                             }
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index e30184c..10d4b2c 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -63,5 +63,8 @@
 
         // 鏍规嵁绠辩爜鑾峰彇鏍囩绠辩爜淇℃伅
         List<BoxInfoDto> GetBindBoxInfos(BoxInfoVm model);
+
+        //鏍规嵁鍗曟嵁鍙疯幏鍙栧崟鎹槑缁嗗垪琛�
+        List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model);
     }
 }
diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index 384d831..c70ef85 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -462,7 +462,20 @@
                 return Ok(new { code = 1, msg = e.Message });
             }
         }
+        [HttpPost]
+        public IActionResult GetBindArrivalNoticeDetails(ArrivalNoticeVm model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetBindArrivalNoticeDetails(model);
 
+                return Ok(new { code = 0, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
 
         /// <summary>
         /// 缁戝畾鎵樼洏

--
Gitblit v1.8.0