From ec622206f5adcbd7cb96f06d75ec03e6dc83a7fd Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期二, 07 四月 2026 12:39:35 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/物流管理/出运单/WLYayBillController.cs |  256 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 248 insertions(+), 8 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 9a41d24..e95095a 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"
@@ -79,6 +79,62 @@
         }
         #endregion
 
+        #region 鍑鸿繍鍗� 鍒嗛〉鍒楄〃2
+        [Route("WLYayBillController/page")]
+        [HttpGet]
+        public json page(string sWhere, string user, int page, int size, string Type)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒楄〃杩涘叆鏃跺垽鏂潈闄愶紝閫夋簮鍗曡繘鍏ヤ笉鍒ゆ柇鏉冮檺
+
+                if (!DBUtility.ClsPub.Security_Log("WLYayBill_Query", 3, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                sWhere = sWhere.Replace("'", "''");
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_WL_YayBill " + page + "," + size + ",'','" + Type + "'", "h_p_WL_YayBill");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_WL_YayBill " + page + "," + size + ",'" + sWhere + "','" + Type + "'", "h_p_WL_YayBill");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 鍑鸿繍鍗� 鏍规嵁婧愬崟浼犵墿鏂欏垪琛�
         [Route("WLYayBillController/GetMesByOrginBill")]
         [HttpGet]
@@ -428,11 +484,11 @@
                 return objJsonResult;
             }
 
-            DataSet ds = oCN.RunProcReturn("select * from WL_YayBillMain a inner join WL_YayBillSub_Material b on b.HInterID=a.HInterID where a.HInterID=" + HInterID + " and b.HEntryID = " + HEntryID, "WL_YayBillMain");
+            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_YayBillSub_Material set HScatteredVolume= " + ScatteredVolume + " where HInterID=" + HInterID + "and HEntryID=" + HEntryID);
+                oCN.RunProc("update WL_YayBillMain set HScatteredVolume= " + ScatteredVolume + " where HInterID=" + HInterID );
                 oCN.Commit();
 
                 objJsonResult.code = "1";
@@ -553,11 +609,15 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
+               
                 if (IsAudit == 1)
                 {
+
+                    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 + "' where HInterID=" + HInterID);
+                    oCN.RunProc("update WL_YayBillMain set HCarID='" + HcheckID + "', CarHNumber='" + HNumber + "', CarHName='" + HName + "' where HInterID=" + HInterID);
                     oCN.Commit();
 
                     objJsonResult.code = "1";
@@ -569,8 +629,11 @@
                 else
                 {
 
+                    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 + "',HDate_AllocationDriver=getdate()  where HInterID=" + HInterID);
+                    oCN.RunProc("update WL_YayBillMain set HDriverID='" + HcheckID + "', DriverHName='" + HName + "', DriverHIDCard='" + HIDCard + "',HDate_AllocationDriver=getdate() where HInterID=" + HInterID);
                     oCN.Commit();
 
                     objJsonResult.code = "1";
@@ -579,6 +642,74 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region 鍑鸿繍鍗� 缁存姢鍙告満(骞冲彴)
+        [Route("WLYayBillController/selectDriver1")]
+        [HttpGet]
+        public object selectDriver1(string CarHNumber, string CarHName,string DriverHName,string DriverHIDCard, string CurUserName, int HInterID)
+        {
+            try
+            {
+                //if (!DBUtility.ClsPub.Security_Log("WLYayBill_SelectDriver1", 1, false, CurUserName))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                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;
+                }
+
+                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)
             {
@@ -637,7 +768,7 @@
                         return objJsonResult;
                     }
 
-                    if (ds.Tables[0].Rows[0]["HDate_AllocationDriver"] == null || ds.Tables[0].Rows[0]["HDriverID"].ToString() == "0" || ds.Tables[0].Rows[0]["HCarID"].ToString() == "0")
+                    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;
@@ -741,9 +872,118 @@
         }
         #endregion
 
-        
 
 
-        
+        #region 鍑鸿繍鍗� 鑾峰彇瀛愯〃鏁版嵁
+        [Route("WLYayBillController/GetList")]
+        [HttpGet]
+        public object GetList(string hmainid_hsubid, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (!DBUtility.ClsPub.Security_Log("WLYayBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                string sql = $"select * from h_v_Gy_MaterialPackingRelation where hmainid_hsubid in (" + hmainid_hsubid + ")";
+
+                // 鎵ц鏌ヨ
+                DataSet ds = oCN.RunProcReturn(sql, "WL_YayBillMain");
+
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region 鍑鸿繍鍗� 鑾峰彇鎵胯繍鍚堝悓鏁版嵁 
+        [Route("WLYayBillController/initDataForSelectContractTransportBill")]
+        [HttpGet]
+        public object initDataForSelectContractTransportBill(int hmainid)
+        {
+            try
+            {
+                string sql = "exec WL_YayBill_initDataForSelectContractTransportBill " + hmainid;
+
+                // 鎵ц鏌ヨ
+                DataSet ds = oCN.RunProcReturn(sql, "WL_YayBill_initDataForSelectContractTransportBill");
+
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍑鸿繍鍗� 鏍规嵁 鎵胯繍鍟唅d銆佽繍杈撹矾绾垮悕绉般�佽溅鍨媔d銆佽繍杈撴柟寮� 鑾峰彇 鎵胯繍鍚堝悓鏁版嵁
+        [Route("WLYayBillController/getSelectContractTransportBillEntryData")]
+        [HttpGet]
+        public object getSelectContractTransportBillEntryData(int Cg_ContractTransportBillInterID,int HSupID, string HTransportLineName, int HCarTypeID, string HTransportTyep)
+        {
+            try
+            {
+                string sql = "exec WL_YayBill_getSelectContractTransportBillEntryData " + Cg_ContractTransportBillInterID + "," + HSupID + ",'" + HTransportLineName + "'," + HCarTypeID + ",'" + HTransportTyep + "'";
+
+                // 鎵ц鏌ヨ
+                DataSet ds = oCN.RunProcReturn(sql, "WL_YayBill_getSelectContractTransportBillEntryData");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }

--
Gitblit v1.9.1