From 033a71417afc9f27a8794b13e94cc39cc41a8360 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 01 三月 2024 16:16:39 +0800
Subject: [PATCH] 出库修改

---
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs |   72 ++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index e863a79..4e36e9f 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -278,7 +278,8 @@
                     .LeftJoin<SysLogisticsInfo>((a, b) => a.LogisticsId == b.Id)
                     .LeftJoin<SysUserInfor>((a, b, c) => a.CreateUser == c.Id)
                     .LeftJoin<SysUserInfor>((a, b, c, d) => a.CreateUser == d.Id)
-                    .Select((a, b, c, d) => new ExportNoticeDto()
+                    .LeftJoin<SysUserInfor>((a, b, c, d,e) => a.CheckUser == e.Id)
+                    .Select((a, b, c, d,e) => new ExportNoticeDto()
                     {
                         Id = a.Id,
                         SONo = a.SONo,
@@ -300,7 +301,10 @@
                         CreateUserName = c.RealName,
                         UpdateUserName = c.RealName,
                         CreateTime = a.CreateTime,
-                        UpdateTime = a.UpdateTime
+                        UpdateTime = a.UpdateTime,
+
+                        CheckUserName=e.RealName,
+                        CheckTime=a.CheckTime
                     })
                     .OrderByDescending(a => a.CreateTime)
                     .ToOffsetPage(page, limit, ref total);
@@ -1043,6 +1047,10 @@
                 {
                     throw new Exception("鍙傛暟寮傚父,璇锋鏌ョ姸鎬佹槸鍚︿负鎵ц瀹屾垚鎴栬鍗曞叧闂�/宸蹭笂浼�");
                 }
+                if (userId == notice.UpdateUser)
+                {
+                    throw new Exception("澶嶆牳澶辫触锛屽鏍镐汉鍛樺拰鍏抽棴璁㈠崟浜哄憳涓嶈兘鐩稿悓锛�");
+                }
                 //鍑哄簱鍗曟槑缁�
                 var comDetail = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.SONo == notice.SONo).Select(m => m.BoxNo3).ToList();
                 Db.BeginTran();//寮�鍚簨鍔�
@@ -1057,8 +1065,13 @@
                     //} 
 
                     var dom = HttpHelper.EncodeParsToFuMa(comDetail, "ceshi", "ExInfoXml");
+
+                    notice.Status = "6";//鐘舵�侊細宸蹭笂浼�
+                    notice.CheckTime = DateTime.Now;//澶嶆牳鏃堕棿
+                    notice.CheckUser = userId;//澶嶆牳浜�
+                    Db.Updateable(notice).ExecuteCommand();
                     ////娣诲姞鎿嶄綔鏃ュ織璁板綍
-                    //var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鍑哄簱鍗曟嵁", notice.SONo, "鍏冲崟", $"鍏抽棴浜嗗崟鎹彿涓簕notice.SONo}鐨勫崟鎹俊鎭�", userId);
+                     var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鍑哄簱鍗曟嵁", notice.SONo, "澶嶆牳", $"澶嶆牳浜嗗崟鎹彿涓簕notice.SONo}鐨勫崟鎹俊鎭�", userId);
 
                     Db.CommitTran();
                     return dom;
@@ -2711,5 +2724,58 @@
 
         #endregion
 
+        /// <summary>
+        /// 鍒ゆ柇鍑哄簱鏄惁闇�瑕佹媶绠�
+        /// </summary>
+        /// <param name="soNo"></param>
+        /// <returns></returns>
+        public string IsNeedUnpack(string soNo)
+        {
+            string result = "0";//鏄惁闇�瑕佹媶绠憋紝0锛氬惁  1锛氭槸
+            if (string.IsNullOrEmpty(soNo))
+            {
+                throw new Exception("鏈壘鍒板搴斿嚭搴撳崟锛�");
+            }
+            try
+            {
+                var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo);
+                if (notice == null)
+                {
+                    throw new Exception("鏈壘鍒板搴斿嚭搴撳崟锛�");
+                }
+                //鐗╂枡缂栫爜琛�
+                var skuList = Db.Queryable<SysMaterials>().Where(w => w.IsDel == "0");
+                //鍖呰琛�
+                var packagList= Db.Queryable<SysPackag>().Where(w => w.IsDel == "0");
+                //鍑哄簱鍒嗛厤淇℃伅
+                var allotList = Db.Queryable<BllExportAllot>().Where(w => w.IsDel == "0" && w.SONo == soNo).ToList();
+                foreach (var item in allotList)
+                {
+                    var skuInfo = skuList.First(w => w.SkuNo == item.SkuNo);
+                    if (skuInfo == null)
+                    {
+                        throw new Exception("鐗╂枡淇℃伅涓嶅瓨鍦紒");
+                    }
+                    var packagInfo = packagList.First(w => w.PackagNo == skuInfo.PackagNo);
+                    if (packagInfo == null)
+                    {
+                        throw new Exception("鍖呰淇℃伅涓嶅瓨鍦紒");
+                    }
+                    if (packagInfo.L2Name == "绠�")
+                    {
+                        if (item.Qty % (decimal)packagInfo.L2Num != 0)//鑳芥暣闄よ鏄庝笉鐢ㄦ媶绠憋紝涓嶈兘鏁撮櫎璇存槑闇�瑕佹媶绠�
+                        {
+                            result = "1";//闇�瑕佹媶绠�
+                            break;
+                        }
+                    }
+                }
+                return result;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.8.0