From 0acd18b6bebdcfc24a0d7c27edb0f8ef1fc7f9aa Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 04 三月 2024 10:29:34 +0800
Subject: [PATCH] 出库单复核功能修改

---
 Wms/Wms/Controllers/UpApiController.cs          |   50 +++++++++++-----
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs   |   35 ++++++-----
 Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs |    4 +
 HTML/views/SOSetting/ExportNotice.html          |   33 +++++++++-
 4 files changed, 86 insertions(+), 36 deletions(-)

diff --git a/HTML/views/SOSetting/ExportNotice.html b/HTML/views/SOSetting/ExportNotice.html
index 9b37cf2..8299035 100644
--- a/HTML/views/SOSetting/ExportNotice.html
+++ b/HTML/views/SOSetting/ExportNotice.html
@@ -90,7 +90,7 @@
 									<option value="3">姝e湪鎵ц</option>
 									<option value="4">鎵ц瀹屾瘯</option>
 									<option value="5">璁㈠崟鍏抽棴</option>
-									<option value="6">宸插鏍�</option>
+									<option value="6">涓婁紶瀹屾瘯</option>
 								</select>
 							</div>
 						</div>
@@ -362,11 +362,13 @@
 											</a>`;
 								}								
 								if( d.Status == '5'){
-									html += `<a class="layui-btn layui-btn-normal layui-btn-xs shangClass" lay-event="xml"> 
+									html += `<a class="layui-btn layui-btn-normal layui-btn-xs checkClass" lay-event="check"> 
 										<i class="layui-icon layui-icon-ok"></i>澶嶆牳
 									</a>`;
 								}
-								
+								html += `<a class="layui-btn layui-btn-normal layui-btn-xs shangClass" lay-event="xml"> 
+									<i class="layui-icon layui-icon-ok"></i>XML
+								</a>`;
 								html += `<a class="layui-btn layui-btn-normal layui-btn-xs editDemoClass" lay-event="editDemo">
 									<i class="layui-icon layui-icon-edit"></i>澶囨敞</a>`;
 								return html;
@@ -1135,7 +1137,7 @@
 							var param = {
 								Id: parseInt(Id), 
 							};
-							sendData(IP + "/UpApi/FinishExportNotice", param, 'post', function(res) {
+							sendData(IP + "/UpApi/CloseExportNotice", param, 'post', function(res) {
 								console.log(res);
 								if (res.code == 0) { //鎴愬姛
 									layer.msg(res.msg, {
@@ -1371,6 +1373,29 @@
 								});
 							}
 						}); 
+					}else if(obj.event === 'check'){//澶嶆牳
+						// 浠g爜鍖哄煙
+						layer.confirm('纭畾澶嶆牳姝ゅ崟鎹悧锛�', function(index) { 	
+							var param = {
+								Id:data.Id,
+							};
+							sendData(IP + "/UpApi/FinishExportNotice", param, 'post', function (res) {
+								if (res.code == 0) { //鎴愬姛
+									layer.msg(res.msg, {
+										icon: 1,
+										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+									}, function () {
+										refreshTable();
+										doing = true
+									});
+								} else { //涓嶆垚鍔�
+									layer.msg(res.msg, {
+										icon: 2,
+										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+									}, function () { doing = true });
+								}
+							});
+						});
 					}
 				});
 				
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index 76d9ccf..f08c74b 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -972,6 +972,10 @@
                 {
                     throw new Exception("鏈煡璇㈠埌鍗曟嵁淇℃伅");
                 }
+                if (notice.Status != "3")
+                {
+                    throw new Exception("澶嶆牳澶辫触锛屽崟鎹潪鍏抽棴鐘舵��");
+                }
                 var detail = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.ASNNo == notice.ASNNo && m.IsDel == "0").ToList();
                 if (detail.Count == 0)
                 {
diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index e09c0ca..81e5525 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -204,10 +204,18 @@
                 {
                     throw new Exception("鏈煡璇㈠埌鍗曟嵁淇℃伅");
                 }
+                if (notice.Status != "5")
+                {
+                    throw new Exception("澶嶆牳澶辫触锛屽崟鎹潪鍏抽棴鐘舵��");
+                }
                 var detail = Db.Queryable<BllExportNoticeDetail>().Where(m => m.SONo == notice.SONo && m.IsDel == "0").ToList();
                 if (detail.Count == 0)
                 {
                     throw new Exception("鏈煡璇㈠埌鍗曟嵁鏄庣粏淇℃伅");
+                }
+                if (userId == notice.UpdateUser)
+                {
+                    throw new Exception("澶嶆牳澶辫触锛屽鏍镐汉鍛樺拰鍏抽棴璁㈠崟浜哄憳涓嶈兘鐩稿悓锛�");
                 }
                 var list = new List<SoDetail>();
                 foreach (var d in detail)
@@ -225,21 +233,25 @@
                     OrderCode = notice.OrderCode,
                     SoDetails = list
                 };
-                // 閫氳繃鎺ュ彛鍙戦�佽嚦erp
-                var jsonData = JsonConvert.SerializeObject(soInfo);
+                #region 閫氳繃鎺ュ彛鍙戦�佽嚦erp
+                //绯荤粺瀵规帴鍚庢斁寮�
+                /*var jsonData = JsonConvert.SerializeObject(soInfo);
 
                 var response = HttpHelper.DoPost(url, jsonData, "鍑哄簱鍗曞畬鎴愪笂浼�", "ERP");
-
-                //瑙f瀽杩斿洖鏁版嵁
-                var obj = JsonConvert.DeserializeObject<ErpModel>(response);
+                
+                var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
                 if (obj.Success != 0)
                 {
                     throw new Exception("涓婁紶澶辫触" + obj.Message);
-                }
+                }*/
+                #endregion
+
                 notice.Status = "6";
                 notice.UpdateTime = DateTime.Now;
                 notice.UpdateUser = userId;
                 Db.Updateable(notice).ExecuteCommand();
+
+                new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鍑哄簱鍗曟嵁", notice.SONo, "澶嶆牳", $"澶嶆牳浜嗗崟鎹彿涓簕notice.SONo}鐨勫崟鎹俊鎭�", userId);
                 return true;
             }
             catch (Exception e)
@@ -1047,10 +1059,6 @@
                 {
                     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();//寮�鍚簨鍔�
@@ -1065,13 +1073,8 @@
                     //} 
 
                     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;
diff --git a/Wms/Wms/Controllers/UpApiController.cs b/Wms/Wms/Controllers/UpApiController.cs
index 5b724f7..857538a 100644
--- a/Wms/Wms/Controllers/UpApiController.cs
+++ b/Wms/Wms/Controllers/UpApiController.cs
@@ -97,9 +97,39 @@
                 return Ok(new { code = 1, msg = e.Message });
             }
         }
-        
+
         /// <summary>
-        /// 瀹屾垚鍑哄簱鍗曟嵁 //鍑哄簱鍗曞叧闂弽棣�
+        /// 瀹屾垚/鍏抽棴鍑哄簱鍗曟嵁
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult CloseExportNotice(IdVm model)
+        {
+            try
+            {
+                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                if (claimsIdentity == null)
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                if (string.IsNullOrWhiteSpace(userId))
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                _exNoticeSvc.CloseExportNotice(model.Id, int.Parse(userId));
+
+                return Ok(new { code = 0, count = 0, msg = "鍑哄簱鍗曞叧鍗曟垚鍔�" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+        /// <summary>
+        ///  //鍑哄簱鍗曞鏍稿苟涓婁紶
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
@@ -119,20 +149,8 @@
                 {
                     return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
-                var bolls = _exNoticeSvc.CloseExportNotice(model.Id, int.Parse(userId));
-                if (bolls)
-                {
-                    //绯荤粺瀵规帴鍚庢斁寮�
-                    //var bl =_exNoticeSvc.FinishSo(model.Id,_config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
-                    //if (bl)
-                    //{
-                        return Ok(new { code = 0, count = 0, msg = "鍑哄簱鍗曞叧鍗曚笂浼犳垚鍔�" });
-                    //}
-                    //return Ok(new { code = 1, count = 0, msg = "鍑哄簱鍗曞叧鍗曟垚鍔熶絾涓婁紶澶辫触" });
-                }
-
-                return Ok(new { code = 1, msg = "鍑哄簱鍗曞叧鍗曞け璐�" });
-
+                _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
+                return Ok(new { code = 0, count = 0, msg = "鍑哄簱鍗曞鏍稿苟涓婁紶鎴愬姛" });
             }
             catch (Exception e)
             {

--
Gitblit v1.8.0