From eaeff1134f0e4e35ba050d0809500d05ee869cc8 Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期一, 30 三月 2026 18:33:07 +0800
Subject: [PATCH] 出运单修改

---
 WebAPI/Controllers/物流管理/出运单/WLYayBillController.cs |  627 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 351 insertions(+), 276 deletions(-)

diff --git "a/WebAPI/Controllers/\347\211\251\346\265\201\347\256\241\347\220\206/\345\207\272\350\277\220\345\215\225/WLYayBillController.cs" "b/WebAPI/Controllers/\347\211\251\346\265\201\347\256\241\347\220\206/\345\207\272\350\277\220\345\215\225/WLYayBillController.cs"
index 0f31741..ca1e21c 100644
--- "a/WebAPI/Controllers/\347\211\251\346\265\201\347\256\241\347\220\206/\345\207\272\350\277\220\345\215\225/WLYayBillController.cs"
+++ "b/WebAPI/Controllers/\347\211\251\346\265\201\347\256\241\347\220\206/\345\207\272\350\277\220\345\215\225/WLYayBillController.cs"
@@ -23,7 +23,7 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
 
-        #region 鍒嗛〉鍒楄〃
+        #region 鍑鸿繍鍗� 鍒嗛〉鍒楄〃
         [Route("WLYayBillController/GetListPage")]
         [HttpGet]
         public object GetListPage(string sWhere, string user)
@@ -79,8 +79,7 @@
         }
         #endregion
 
-
-        #region 鏍规嵁婧愬崟浼犵墿鏂欏垪琛�
+        #region 鍑鸿繍鍗� 鏍规嵁婧愬崟浼犵墿鏂欏垪琛�
         [Route("WLYayBillController/GetMesByOrginBill")]
         [HttpGet]
         public object GetMesByOrginBill(string ListMaterial)
@@ -126,8 +125,7 @@
         }
         #endregion
 
-
-        #region  淇濆瓨/缂栬緫
+        #region  鍑鸿繍鍗� 淇濆瓨/缂栬緫
 
         [Route("WLYayBillController/SaveBill")]
         [HttpPost]
@@ -144,7 +142,7 @@
             ListModels oListModels = new ListModels();
             try
             {
-                if (!DBUtility.ClsPub.Security_Log("Gy_QCVerificationBillMain_Edit", 1, false, msg4))
+                if (!DBUtility.ClsPub.Security_Log("WLYayBill_Edit", 1, false, msg4))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -237,8 +235,7 @@
         }
         #endregion
 
-
-        #region[缂栬緫鏃惰幏鍙栨暟鎹甝
+        #region 鍑鸿繍鍗� 缂栬緫鏃惰幏鍙栨暟鎹�
         [Route("WLYayBillController/WL_YayBillDetail")]
         [HttpGet]
         public ApiResult<DataSet> WL_YayBillDetail(string HID)
@@ -253,8 +250,76 @@
         }
         #endregion      
 
+        #region 鍑鸿繍鍗� 鍒犻櫎
+        [Route("WLYayBillController/deleteBill")]
+        [HttpGet]
+        public object deleteBill(string HItemID, string user)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("WLYayBill_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-        #region 瀹℃牳銆佸弽瀹℃牳
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁ID涓虹┖锛岃瀵绘壘绯荤粺缁存姢浜哄憳杩涜澶勭悊锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HItemID, "WL_YayBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁淇℃伅澶辫触锛屽崟鎹笉瀛樺湪锛屽垹闄ゅけ璐ワ紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HChecker"]) != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触銆傚崟鎹凡瀹℃牳锛屾棤娉曡繘琛屽垹闄わ紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                oCN.RunProc("delete from WL_YayBillMain where HInterID=" + HItemID);
+                oCN.RunProc("delete from WL_YayBillSub_Material where HInterID=" + HItemID);
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍑鸿繍鍗� 瀹℃牳/鍙嶅鏍�
         /// <summary>
         /// 
         /// </summary>
@@ -349,15 +414,45 @@
         }
         #endregion
 
+        #region 鍑鸿繍鍗� 缁存姢闆舵媴浣撶Н
+        [Route("WLYayBillController/updateBillMEs")]
+        [HttpGet]
+        public object updateBillMEs(int HInterID, int HEntryID, int ScatteredVolume, string CurUserName)
+        {
+            if (!DBUtility.ClsPub.Security_Log("WLYayBill_ScatteredVolume", 1, false, CurUserName))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犳潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
-        #region 渚涘簲鍟嗙‘璁ゆ椂闂�
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="HInterID">鍗曟嵁ID</param>
-        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
-        /// <param name="CurUserName">瀹℃牳浜�</param>
-        /// <returns></returns>
+            DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" +HInterID  , "WL_YayBillMain");
+            if (ds != null || ds.Tables[0].Rows.Count > 0)
+            {
+                oCN.BeginTran();
+                oCN.RunProc("update WL_YayBillMain set HScatteredVolume= " + ScatteredVolume + " where HInterID=" + HInterID );
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "闆舵媴浣撶Н鏁版嵁缁存姢澶辫触銆備负鏌ヨ鍒板崟鎹俊鎭紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍑鸿繍鍗� 渚涘簲鍟嗙‘璁ゆ椂闂�
         [Route("WLYayBillController/ConfrimBillNo")]
         [HttpGet]
         public object ConfrimBillNo(int HInterID, int IsAudit, string CurUserName)
@@ -374,26 +469,33 @@
                     return objJsonResult;
                 }
 
-                var ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
-                if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "璇峰厛瀹℃牳鍗曟嵁锛�";
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁淇℃伅澶辫触锛屽崟鎹笉瀛樺湪锛屾棤娉曡繘琛屾壙杩愬晢纭锛侊紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HChecker"]) == "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈鏍革紝鏃犳硶杩涜鎵胯繍鍟嗙‘璁わ紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 oCN.BeginTran();
+                oCN.RunProc("update WL_YayBillMain set HDate_CarrierSure='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where HInterID=" + HInterID);
 
-
-                oCN.RunProc("update WL_YayBillMain set HDate_CarrierSure='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where HInterID=" + HInterID);
-
+                oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鎴愬姛";
                 objJsonResult.data = null;
-                oCN.Commit();
-
                 return objJsonResult;
             }
             catch (Exception e)
@@ -408,159 +510,7 @@
         }
         #endregion
 
-
-        #region 鍏朵粬纭
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="HInterID">鍗曟嵁ID</param>
-        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
-        /// <param name="CurUserName">瀹℃牳浜�</param>
-        /// <returns></returns>
-        [Route("WLYayBillController/ConfrimOtherBillNo")]
-        [HttpGet]
-        public object ConfrimOtherBillNo(int HInterID, int IsAudit, string CurUserName)
-        {
-            try
-            {
-                //瀹℃牳鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_Check", 1, false, CurUserName))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                var ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
-
-                oCN.BeginTran();
-                if (IsAudit == 1)
-                {
-                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_arriveConfirm", 1, false, CurUserName))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍒板満纭澶辫触锛佹棤鏉冮檺锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0].Rows[0]["HDate_AllocationDriver"] == null || ds.Tables[0].Rows[0]["HDate_AllocationDriver"].ToString() == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "璇峰厛鍒嗛厤鍙告満锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    oCN.RunProc("update WL_YayBillMain set HSurer_Arrive='" + CurUserName + "',HDate_Arrive=getdate()  where HInterID=" + HInterID);
-                }
-                else if (IsAudit == 2)
-                {
-                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_arriveConfirm", 1, false, CurUserName))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍒板満纭澶辫触锛佹棤鏉冮檺锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_pickConfirm", 1, false, CurUserName))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鎻愯揣澶辫触锛佹棤鏉冮檺锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0].Rows[0]["HSurer_Arrive"] == null)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "璇峰厛鍒板巶纭锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    oCN.RunProc("update WL_YayBillMain set HSurer_Pick='" + CurUserName + "',HDate_Pick=getdate()  where HInterID=" + HInterID);
-
-                }
-                else if (IsAudit == 3)
-                {
-                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_tranConfirm", 1, false, CurUserName))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍑哄巶杩愯緭澶辫触锛佹棤鏉冮檺锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0].Rows[0]["HSurer_Pick"] == null || ds.Tables[0].Rows[0]["HSurer_Pick"].ToString() == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "璇峰厛鎻愯揣纭锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    oCN.RunProc("update WL_YayBillMain set HSurer_Trans='" + CurUserName + "',HDate_Trans=getdate()  where HInterID=" + HInterID);
-
-                }
-                else if (IsAudit == 4)
-                {
-                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_receiveConfirm", 1, false, CurUserName))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "绛炬敹澶辫触锛佹棤鏉冮檺锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0].Rows[0]["HSurer_Trans"] == null || ds.Tables[0].Rows[0]["HSurer_Trans"].ToString() == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "璇峰厛鍑哄巶杩愯緭纭锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    oCN.RunProc("update WL_YayBillMain set HSurer_Receive='" + CurUserName + "',HDate_Receive=getdate()  where HInterID=" + HInterID);
-
-                }
-                else
-                {
-                    throw new Exception();
-                }
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎴愬姛";
-                objJsonResult.data = null;
-                oCN.Commit();
-
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                oCN.RollBack();
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-
-
-        #region 閫夋嫨杞﹁締鍜屽徃鏈�
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="HInterID">鍗曟嵁ID</param>
-        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
-        /// <param name="CurUserName">瀹℃牳浜�</param>
-        /// <returns></returns>
+        #region 鍑鸿繍鍗� 鍒嗛厤杞﹁締鍜屽徃鏈�
         [Route("WLYayBillController/selectDriver")]
         [HttpGet]
         public object selectDriver(int HInterID, int HcheckID, int IsAudit, string CurUserName)
@@ -575,64 +525,67 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                DataSet ds;
-                var dss = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
-                if (dss.Tables[0].Rows[0]["HDate_CarrierSure"] == null || dss.Tables[0].Rows[0]["HDate_CarrierSure"].ToString() == "")
+
+                DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "璇峰厛渚涘簲鍟嗙‘璁わ紒";
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁淇℃伅澶辫触锛屽崟鎹笉瀛樺湪锛屾棤娉曡繘琛屽垎閰嶈溅杈嗐�佸徃鏈烘搷浣滐紒锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HChecker"]) == "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈鏍革紝鏃犳硶杩涜鍒嗛厤杞﹁締銆佸徃鏈烘搷浣滐紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HDate_CarrierSure"] == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈繘琛屼緵搴斿晢纭銆傝鍏堣繘琛屼緵搴斿晢纭锛岀劧鍚庡啀杩涜鍒嗛厤杞﹁締銆佸徃鏈烘搷浣滐紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+               
                 if (IsAudit == 1)
                 {
-                    
-                    ds = oCN.RunProcReturn("select * from h_v_Gy_CarList where HItemID=" + HcheckID, "h_v_Gy_CarList");
-                    
-                    if (ds.Tables[0].Rows.Count > 0)
-                    {
-                        oCN.BeginTran();
 
+                    ds = oCN.RunProcReturn("select * from gy_car where  HItemID=" + HcheckID + "", "gy_car");
+                    var HNumber = ds.Tables[0].Rows[0]["HNumber"].ToString(); 
+                    var HName = ds.Tables[0].Rows[0]["HName"].ToString();
+                    oCN.BeginTran();
+                    oCN.RunProc("update WL_YayBillMain set HCarID='" + HcheckID + "', CarHNumber='" + HNumber + "', CarHName='" + HName + "' where HInterID=" + HInterID);
+                    oCN.Commit();
 
-                        oCN.RunProc("update WL_YayBillMain set HCarID='" + HcheckID + "' where HInterID=" + HInterID);
-
-                        objJsonResult.code = "1";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鎴愬姛";
-                        objJsonResult.data = null;
-                        oCN.Commit();
-                        return objJsonResult;
-                    }
-
-
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
                 else
                 {
 
-                    ds = oCN.RunProcReturn("select * from h_v_Gy_driver where HItemID=" + HcheckID, "h_v_Gy_driver");
-                    if (ds.Tables[0].Rows.Count > 0)
-                    {
-                        oCN.BeginTran();
+                    ds = oCN.RunProcReturn("select * from Gy_Driver where  HItemID=" + HcheckID + "", "Gy_Driver");
+                    var HName = ds.Tables[0].Rows[0]["HName"].ToString();
+                    var HIDCard = ds.Tables[0].Rows[0]["HIDCard"].ToString();
+                    oCN.BeginTran();
+                    oCN.RunProc("update WL_YayBillMain set HDriverID='" + HcheckID + "', DriverHName='" + HName + "', DriverHIDCard='" + HIDCard + "' where HInterID=" + HInterID);
+                    oCN.Commit();
 
-
-                        oCN.RunProc("update WL_YayBillMain set HDriverID='" + HcheckID + "',HDate_AllocationDriver=getdate()  where HInterID=" + HInterID);
-
-                        objJsonResult.code = "1";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鎴愬姛";
-                        objJsonResult.data = null;
-                        oCN.Commit();
-                        return objJsonResult;
-                    }
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
-                oCN.RollBack();
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "澶辫触锛�";
-                objJsonResult.data = null;
-
-                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -647,103 +600,225 @@
         #endregion
 
 
-        [Route("WLYayBillController/deleteBill")]
+        #region 鍑鸿繍鍗� 缁存姢鍙告満(骞冲彴)
+        [Route("WLYayBillController/selectDriver1")]
         [HttpGet]
-        public object deleteBill(string HItemID, string user)
+        public object selectDriver1(string CarHNumber, string CarHName,string DriverHName,string DriverHIDCard, string CurUserName, int HInterID)
         {
-            DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
             try
             {
-                //鍒犻櫎鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("WLYayBill_Delete", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                //if (!DBUtility.ClsPub.Security_Log("WLYayBill_SelectDriver1", 1, false, CurUserName))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
 
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (string.IsNullOrWhiteSpace(HItemID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HItemID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-                ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HItemID, "WL_YayBillMain");
-                DataSet dds = oCN.RunProcReturn("select * from WL_YayBillSub_Material where HInterID=" + HItemID, "WL_YayBillSub_Material");
+                DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁淇℃伅澶辫触锛屽崟鎹笉瀛樺湪锛屾棤娉曡繘琛屽垎閰嶈溅杈嗐�佸徃鏈烘搷浣滐紒锛�";
                     objJsonResult.data = null;
-                    return objJsonResult; ;
+                    return objJsonResult;
                 }
 
-
-                oCN.RunProc("delete WL_YayBillMain where HInterID=" + HItemID);
-                if (dds != null || dds.Tables[0].Rows.Count != 0)
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HChecker"]) == "")
                 {
-                    oCN.RunProc("delete WL_YayBillSub_Material where HInterID=" + HItemID);
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈鏍革紝鏃犳硶杩涜鍒嗛厤杞﹁締銆佸徃鏈烘搷浣滐紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
-                oCN.Commit();//鎻愪氦浜嬪姟
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
 
+                if (ds.Tables[0].Rows[0]["HDate_CarrierSure"] == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈繘琛屼緵搴斿晢纭銆傝鍏堣繘琛屼緵搴斿晢纭锛岀劧鍚庡啀杩涜鍒嗛厤杞﹁締銆佸徃鏈烘搷浣滐紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                    oCN.BeginTran();
+                    oCN.RunProc("update WL_YayBillMain set CarHNumber='" + CarHNumber + "', CarHName='" + CarHName + "', DriverHName='" + DriverHName + "', DriverHIDCard='" + DriverHIDCard + "',HDate_AllocationDriver=getdate() where HInterID=" + HInterID);
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                
+              
             }
             catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.Message = "澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
         }
+        #endregion
 
-
-        [Route("WLYayBillController/updateBillMEs")]
+        #region 鍑鸿繍鍗� 鍏朵粬纭(IsAudit)銆�1锛氬埌鍘傜‘璁わ紱2锛氭彁璐х‘璁わ紱3锛氬嚭鍘傜‘璁わ紱4锛氱鏀剁‘璁ゃ��
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("WLYayBillController/ConfrimOtherBillNo")]
         [HttpGet]
-        public object updateBillMEs(int HInterID,int HEntryID, int ScatteredVolume, string CurUserName)
+        public object ConfrimOtherBillNo(int HInterID, int IsAudit, string CurUserName)
         {
-            //鍒犻櫎鏉冮檺
-            if (!DBUtility.ClsPub.Security_Log("WLYayBill_ScatteredVolume", 1, false, CurUserName))
+            try
             {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鏃犳潈闄愶紒";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            var ds = oCN.RunProcReturn("select * from WL_YayBillMain a inner join WL_YayBillSub_Material b on b.HInterID=a.HInterID where a.HInterID=" + HInterID, "WL_YayBillMain");
-            if (ds != null || ds.Tables[0].Rows.Count <= 0)
-            {
+                DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁淇℃伅澶辫触锛屽崟鎹笉瀛樺湪锛屾棤娉曡繘琛屽埌鍘傜‘璁ゆ搷浣滐紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HChecker"]) == "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈鏍革紝鏃犳硶杩涜鍒板巶纭鎿嶄綔锛侊紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 oCN.BeginTran();
-                oCN.RunProc("update WL_YayBillSub_Material set HScatteredVolume= " + ScatteredVolume + " where HInterID=" + HInterID+ "and HEntryID="+ HEntryID);
+                if (IsAudit == 1)
+                {
+                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_arriveConfirm", 1, false, CurUserName))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒板巶纭澶辫触锛佹棤鏉冮檺锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HDate_AllocationDriver"] == null || ds.Tables[0].Rows[0]["CarHName"].ToString() == "0" || ds.Tables[0].Rows[0]["DriverHName"].ToString() == "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍑鸿繍鍗曟湭鍒嗛厤杞﹁締涓庨┚椹跺憳锛屾棤娉曡繘琛屽埌鍘傜‘璁ゆ搷浣滐紒锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Arrive='" + CurUserName + "',HDate_Arrive=getdate()  where HInterID=" + HInterID);
+                }
+                else if (IsAudit == 2)
+                {
+                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_pickConfirm", 1, false, CurUserName))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎻愯揣纭澶辫触锛佹棤鏉冮檺锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSurer_Arrive"]) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍑鸿繍鍗曡鍏堣繘琛屽埌鍘傜‘璁わ紝鐒跺悗鍐嶈繘琛屾彁璐х‘璁わ紒锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Pick='" + CurUserName + "',HDate_Pick=getdate()  where HInterID=" + HInterID);
+
+                }
+                else if (IsAudit == 3)
+                {
+                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_tranConfirm", 1, false, CurUserName))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍑哄巶杩愯緭澶辫触锛佹棤鏉冮檺锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSurer_Pick"]) == "" )
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍑鸿繍鍗曟湭杩涜鎻愯揣纭銆傝鍏堣繘琛屾彁璐х‘璁わ紝鐒跺悗鍐嶈繘琛屽嚭鍘傜‘璁わ紒锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Trans='" + CurUserName + "',HDate_Trans=getdate()  where HInterID=" + HInterID);
+                }
+                else if (IsAudit == 4)
+                {
+                    if (!DBUtility.ClsPub.Security_Log_second("WLYayBill_receiveConfirm", 1, false, CurUserName))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "绛炬敹澶辫触锛佹棤鏉冮檺锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSurer_Trans"]) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍑鸿繍鍗曟湭杩涜鍑哄巶纭銆傝鍏堣繘琛屽嚭鍘傜‘璁わ紝鐒跺悗鍐嶈繘琛岀鏀剁‘璁わ紒锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Receive='" + CurUserName + "',HDate_Receive=getdate()  where HInterID=" + HInterID);
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎿嶄綔澶辫触锛屽綋鍓嶆搷浣滄寚浠ゆ棤娉曡瘑鍒�傝鑱旂郴绯荤粺缁存姢浜哄憳杩涜澶勭悊锛侊紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鎴愬姛";
                 objJsonResult.data = null;
-                oCN.Commit();
                 return objJsonResult;
             }
-            else
+            catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鏇存柊澶辫触锛�";
+                objJsonResult.Message = "澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
         }
+        #endregion
+
+        
+
+
+        
     }
 }

--
Gitblit v1.9.1