From 9176aaed52f030ccb9e00be157f893633153d1ca Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期五, 30 八月 2024 08:55:53 +0800
Subject: [PATCH] PDA平库出库页根据出库单加载托盘所在位置

---
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs |   72 ++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 118e2bc..152ebb3 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -106,6 +106,19 @@
 
                 if (modelList.Count > 0)
                 {
+                    if (!string.IsNullOrWhiteSpace(modelList[0].PackagNo))
+                    {
+                        // 鏌ヨ鏁存墭鏁伴噺 姝ゅUDF1鐢ㄦ潵瀛樺偍鏁存墭鏁伴噺銆�
+                        var packagModel = Db.Queryable<SysPackag>().Where(m => m.PackagNo == modelList[0].PackagNo && m.IsDel == "0").First();
+                        switch (packagModel.Level.ToString())
+                        {
+                            case "1": modelList[0].UDF1 = packagModel.L1Num.ToString(); break;
+                            case "2": modelList[0].UDF1 = packagModel.L2Num.ToString(); break;
+                            case "3": modelList[0].UDF1 = packagModel.L3Num.ToString(); break;
+                            case "4": modelList[0].UDF1 = packagModel.L4Num.ToString(); break;
+                            default: modelList[0].UDF1 = packagModel.L5Num.ToString(); break;
+                        }
+                    }
                     return modelList[0];
                 }
 
@@ -277,7 +290,8 @@
             try
             {
                 string sqlString = string.Empty;
-                sqlString = "select b.SkuNo,b.SkuName,a.LotNo,a.Qty,a.PalletNo,a.Id from BllPalletBind a left join BllArrivalNoticeDetail b on a.ASNDetailNo = b.Id where a.IsDel = '0' and b.IsDel = '0' ";
+                sqlString = "select b.SkuNo,b.SkuName,a.LotNo,a.Qty,a.PalletNo,a.Id from BllPalletBind a " +
+                    "left join BllArrivalNoticeDetail b on a.ASNDetailNo = b.Id where a.IsDel = '0' and b.IsDel = '0' ";
                 if (!string.IsNullOrEmpty(model.PalletNo))
                 {
                     sqlString += $"and PalletNo = '{model.PalletNo}' and a.Status = '0' ";
@@ -1888,16 +1902,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 +1924,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)
         {

--
Gitblit v1.8.0