From 7e514494e595531a0517d6266823bc7f6d673831 Mon Sep 17 00:00:00 2001
From: bklLiudl <673013083@qq.com>
Date: 星期四, 14 三月 2024 13:41:29 +0800
Subject: [PATCH] 呼叫小车

---
 Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs |   67 ++++++++++++++++++++++++---------
 1 files changed, 48 insertions(+), 19 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index adb86a9..4e5e8b7 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -114,8 +114,19 @@
         {
             try
             {
+                Expression<Func<BllBoxInfo, bool>> item1 = Expressionable.Create<BllBoxInfo>()
+                  .AndIF(!string.IsNullOrWhiteSpace(model.ASNNo), it => it.ASNNo.Contains(model.ASNNo.Trim()))
+                  .AndIF(!string.IsNullOrWhiteSpace(model.PalletNo), it => it.PalletNo.Contains(model.PalletNo.Trim()))
+                  .AndIF(!string.IsNullOrWhiteSpace(model.LotNo), it => it.LotNo.Contains(model.LotNo.Trim()))
+                  .AndIF(!string.IsNullOrWhiteSpace(model.SkuNo), it => it.SkuNo.Contains(model.SkuNo.Trim()))
+                  .AndIF(!string.IsNullOrWhiteSpace(model.SkuName), it => it.SkuName.Contains(model.SkuName.Trim()))
+                  .AndIF((model.BindNo != 0 && !string.IsNullOrWhiteSpace(model.BindNo.ToString())),it=>it.BindNo == model.BindNo)
+                  .And(m => m.IsDel == "0")
+                  .ToExpression();
+
                 var total = 0;
-                var data = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BindNo == model.BindNo)
+                DbHelper<BllBoxInfo> helper = new DbHelper<BllBoxInfo>(Db);
+                var data = helper.GetAllWhereAsync(item1).Where(m => m.IsDel == "0")
                     .LeftJoin<BllPalletBind>((a, b) => a.BindNo == b.Id)
                     .GroupBy((a, b) => new
                     {
@@ -380,7 +391,8 @@
                 Db.Updateable(boxInfos).ExecuteCommand();
 
                 //淇敼鎵樼洏缁戝畾淇℃伅
-                bind.Qty -= qty;
+                bind.Qty -= qty;                    // 鏁伴噺鍙樻洿
+                bind.BitPalletMark = "1";           // 闆舵墭鏍囪鍙樻洿
 
                 if (bind.Qty == 0)
                 {
@@ -574,7 +586,7 @@
                    .And(m => m.AreaNo.Contains(categoryAreaNo))
                    .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
                 var total = 0;
-                var list = Db.Queryable<SysStorageLocat>().Where(item)
+                var list = Db.Queryable<SysStorageLocat>().Where(item).OrderByDescending(a=>a.Depth).OrderBy(a=>a.Column)
                     .Select(a => new LocatDto()
                     {
                         Id = a.Id,
@@ -1218,17 +1230,23 @@
                         throw new Exception($"{palletNo}鎵樼洏鏉$爜涓嶅叿鏈夌鐮佷俊鎭紝涓嶅彲鍏ュ簱锛�");
                     }
                     skuNo = stockDetail.First().SkuNo;
-                    //else
-                    //{
-                    //    //鍒ゆ柇鏄惁鏈夐浂绠�
-                    //    var detailIdList = stockDetail.Select(m => m.Id).ToList();
-                    //    var dataBoxInfo = Db.Queryable<DataBoxInfo>().Where(m => detailIdList.Contains(m.StockDetailId)).ToList();
-                    //    if (dataBoxInfo.Count(m => m.BitBoxMark == "1")>0)
-                    //    {
-                    //        throw new Exception($"{palletNo}鎵樼洏涓婃湁闆剁锛屼笉鍙叆搴擄紒");
-                    //    }
+                    if (!string.IsNullOrWhiteSpace(stockDetail.First().WareHouseNo))
+                    {
+                        if (stockDetail.First().WareHouseNo == "W01")//绔嬪簱
+                        {
+                            throw new Exception($"{palletNo}鎵樼洏涓婂湪绔嬪簱涓湁搴撳瓨鍌ㄤ綅淇℃伅锛岃鏍稿疄锛�");
+                        }
 
-                    //}
+                        if (stockDetail.First().WareHouseNo == "W02")//骞冲簱
+                        {
+                            var locatePingKu = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == stockDetail.First().LocatNo);
+                            if (locatePingKu != null)
+                            {
+                                locatePingKu.Status = "0";
+                                Db.Updateable(locatePingKu).ExecuteCommand();
+                            }
+                        }
+                    }
 
 
                     //鑾峰彇瀵瑰簲鍥炲簱瑙勫垯
@@ -1621,13 +1639,21 @@
                                 IsBelt = item.IsBelt,
                                 Demo = item.Demo,
 
-                                OwnerNo = ownerNo,
-                                OwnerName = ownerName,
-
                                 IsDel = "0",
                                 CreateUser = 0,
                                 CreateTime = comTime
                             };
+                            //缁存姢搴撳瓨鏄庣粏璐т富/渚涘簲鍟嗕俊鎭�
+                            if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+                            {
+                                sd.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+                                sd.OwnerName = notice.CustomerName;//璐т富鍚嶇О
+                            }
+                            else if (notice.Type == "1" || notice.Type == "5")//1:閲囪喘鍏ュ簱,2:鍏跺畠鍏ュ簱
+                            { 
+                                sd.SupplierNo= notice.CustomerNo;//渚涘簲鍟嗙紪鐮�
+                                sd.SupplierName = notice.CustomerName;//渚涘簲鍟嗗悕绉�
+                            }
 
                             //if (quality.Count() > 0)
                             //{
@@ -1712,13 +1738,16 @@
                                     LockQty = 0,
                                     FrozenQty = 0,
 
-                                    OwnerNo = ownerNo,
-                                    OwnerName = ownerName,
-
                                     IsDel = "0",
                                     CreateUser = userId,
                                     CreateTime = comTime
                                 };
+                                //缁存姢搴撳瓨璐т富淇℃伅
+                                if (notice.Type == "0" || notice.Type == "2" || notice.Type == "4" || notice.Type == "6" || notice.Type == "7")//0:鎴愬搧鍏ュ簱锛�2:涓棿鍝佸叆搴�,4:杞﹂棿浣欐枡鍏ュ簱,6:浠e偍鍏ュ簱,7:瀵勫瓨鍏ュ簱
+                                {
+                                    stock.OwnerNo = notice.CustomerNo;//璐т富缂栫爜
+                                    stock.OwnerName = notice.CustomerName;//璐т富鍚嶇О
+                                }
                                 Db.Insertable(stock).ExecuteCommand();
                             }
                             #endregion

--
Gitblit v1.8.0