From f0564e2f990fe9855e041274ad2905e8e08650d1 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期一, 05 一月 2026 17:50:25 +0800
Subject: [PATCH] 出运单

---
 WebAPI/Controllers/物流管理/出运单/WLYayBillController.cs |  551 ++++++++++++++++++++++++++++++
 DAL/ClsWL_YayBillMain.cs                           |  389 +++++++++++++++++++++
 Model/物流管理/ClsWL_YayBillMainBillSub.cs             |   48 ++
 WebAPI/ListModels.cs                               |   19 +
 WebAPI/Controllers/条码管理/WEBSController.cs          |    3 
 DAL/DAL.csproj                                     |    1 
 Model/Model.csproj                                 |    2 
 WebAPI/WebAPI.csproj                               |    1 
 Model/物流管理/ClsWL_YayBillMainBillMain.cs            |   55 +++
 9 files changed, 1,068 insertions(+), 1 deletions(-)

diff --git a/DAL/ClsWL_YayBillMain.cs b/DAL/ClsWL_YayBillMain.cs
new file mode 100644
index 0000000..bf3cd02
--- /dev/null
+++ b/DAL/ClsWL_YayBillMain.cs
@@ -0,0 +1,389 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public class ClsWL_YayBillMain : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsWL_YayBillMainBillMain omodel = new Model.ClsWL_YayBillMainBillMain();
+        public List<Model.ClsWL_YayBillMainBillSub> DetailColl = new List<Model.ClsWL_YayBillMainBillSub>();
+        string SafeString(string value, string defaultValue = "") =>
+                   string.IsNullOrEmpty(value) ? defaultValue : value;
+
+        // 杈呭姪鏂规硶锛氬畨鍏ㄨ浆鎹负鏁存暟锛屽鐞唍ull銆佺┖瀛楃涓插拰闈炴暟瀛�
+        int SafeInt(string value, int defaultValue = 0) =>
+            int.TryParse(value, out int result) ? result : defaultValue;
+
+        // 杈呭姪鏂规硶锛氬畨鍏ㄨ浆鎹负灏忔暟
+        decimal SafeDecimal(string value, decimal defaultValue = 0) =>
+            decimal.TryParse(value, out decimal result) ? result : defaultValue;
+
+        // 杈呭姪鏂规硶锛氬畨鍏ㄨ浆鎹负鏃ユ湡
+        string SafeDateTime(string dateStr, string defaultValue)
+        {
+            if (string.IsNullOrEmpty(dateStr) || dateStr == "\"\"")
+                return defaultValue;
+
+            if (DateTime.TryParse(dateStr, out DateTime result) && result != DateTime.MinValue)
+                return "'" + result.ToString("yyyy-MM-dd HH:mm:ss") + "'";
+
+            return defaultValue;
+        }
+
+        public ClsWL_YayBillMain()
+        {
+            base.MvarItemKeySub = "WL_YayBillMain";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey = "WL_YayBillMain";
+            base.MvarReportTitle = "鍑鸿繍鍗�";
+            base.BillType = "3321";
+            base.HBillSubType = "3321";
+
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsWL_YayBillMain()
+        {
+            DetailColl = null;
+        }
+
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',2 ", "h_p_Gy_QCVerificationBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
+
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate WL_YayBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                ",HDate='" + omodel.HDate + "'" +
+                ",HYear='" + omodel.HYear.ToString() + "'" +
+                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+                ",HUpDateDate=getdate()" +
+                //========================================
+                ",HChecker='" + omodel.HChecker.ToString()+ "'" +
+                ",HMainSourceBillType='" + omodel.HMainSourceBillType + "'" +
+                ",HMainSourceBillNo='" + omodel.HMainSourceBillNo + "'" +
+                ",HMainSourceInterID='" + omodel.HMainSourceInterID.ToString() + "'" +
+                ",HMainSourceEntryID='" + omodel.HMainSourceEntryID.ToString() + "'" +
+
+                ",HCusID='" + omodel.HCusID.ToString() + "'" +
+                ",HBeginAddr='" + omodel.HBeginAddr.ToString() + "'" +
+                ",HEndAddr='" + omodel.HEndAddr.ToString() + "'" +
+                ",HPickAddr='" + omodel.HPickAddr.ToString() + "'" +
+                ",HArriverAddr='" + omodel.HArriverAddr.ToString() + "'" +
+                ",HTransType='" + omodel.HTransType.ToString() + "'" +
+                ",HCarTypeID='" + omodel.HCarTypeID.ToString() + "'" +
+                ",HCarTypeMaxVolume='" + omodel.HCarTypeMaxVolume.ToString() + "'" +
+                ",HTotalVolume='" + omodel.HTotalVolume.ToString() + "'" +
+                ",HLoadingRate='" + omodel.HLoadingRate.ToString() + "'" +
+                ",HContractTransportInterID='" + omodel.HContractTransportInterID.ToString() + "'" +
+                ",HContractTransportEntryID='" + omodel.HContractTransportEntryID.ToString() + "'" +
+                ",HContractTransportBillNo='" + omodel.HContractTransportBillNo.ToString() + "'" +
+                ",HCarrierID='" + omodel.HCarrierID.ToString() + "'" +
+                ",HDistance='" + omodel.HDistance.ToString() + "'" +
+                ",HTransportTimes='" + omodel.HTransportTimes.ToString() + "'" +
+                ",HTransportTyep='" + omodel.HTransportTyep.ToString() + "'" +
+                ",HSSID='" + omodel.HSSID.ToString() + "'" +
+                ",HCurID='" + omodel.HCurID.ToString() + "'" +
+                ",HMoney='" + omodel.HMoney.ToString() + "'" +
+                ",HDateForRequestedPick='" + omodel.HDateForRequestedPick.ToString() + "'" +
+                ",HDataForRequestedArrived='" + omodel.HDataForRequestedArrived.ToString() + "'" +
+                ",HCarryStatus='" + omodel.HCarryStatus.ToString() + "'" +
+                ",HDate_CarrierSure='" + omodel.HDate_CarrierSure.ToString() + "'" +
+                ",HDate_AllocationDriver='" + omodel.HDate_AllocationDriver.ToString() + "'" +
+                ",HCarID='" + omodel.HCarID.ToString() + "'" +
+                ",HDriverID='" + omodel.HDriverID.ToString() + "'" +
+                ",HSurer_Arrive='" + omodel.HSurer_Arrive.ToString() + "'" +
+                ",HDate_Arrive='" + omodel.HDate_Arrive.ToString() + "'" +
+                ",HSurer_Pick='" + omodel.HSurer_Pick.ToString() + "'" +
+                ",HDate_Pick='" + omodel.HDate_Pick.ToString() + "'" +
+                ",HSurer_Trans='" + omodel.HSurer_Trans.ToString() + "'" +
+                ",HDate_Trans='" + omodel.HDate_Trans.ToString() + "'" +
+                ",HSurer_Receive='" + omodel.HSurer_Receive.ToString() + "'" +
+                ",HDate_Receive='" + omodel.HDate_Receive.ToString() + "'" +
+                ",HSurer_Accounting='" + omodel.HSurer_Accounting.ToString() + "'" +
+                ",HDate_Accounting='" + omodel.HDate_Accounting.ToString() + "'" +
+
+
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                oCn.RunProc("delete from WL_YayBillSub_Material where HInterID=" + lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                string sql = "";
+                foreach (Model.ClsWL_YayBillMainBillSub oSub in DetailColl)
+                {
+                    sql = "Insert into WL_YayBillSub_Material " +
+               "(HInterID,HBillNo_bak,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+               ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+               ",HMaterID,HUnitID,HMouldID,HMouldLength,HMouldHeight,HMouldWidth" +
+               ",HMouldFoldHeight,HVolume,HQty,HSNP,HMouldQty) values("
+               + SafeInt(omodel.HInterID.ToString(), 0) + ",'" // HInterID int
+               + SafeString(omodel.HBillNo.ToString()) + "'," // HBillNo_bak varchar(50)
+               + (oSub.HEntryID) + ",'" // HEntryID int
+               + SafeString(oSub.HCloseMan?.ToString()) + "','" // HCloseMan varchar(20)
+               + (oSub.HEntryCloseDate == null ? DateTime.Now : oSub.HEntryCloseDate) + "'," // HEntryCloseDate datetime
+               + (oSub.HCloseType ? "1" : "0") + ",'" // HCloseType bit
+               + SafeString(oSub.HRemark?.ToString() ?? "") + "'," // HRemark varchar(200)
+               + (oSub.HSourceInterID == null ? 0 : oSub.HSourceInterID) + "," // HSourceInterID int
+               + (oSub.HSourceEntryID == null ? 0 : oSub.HSourceEntryID) + ",'" // HSourceEntryID int
+               + SafeString(oSub.HSourceBillNo?.ToString(), "") + "','" // HSourceBillNo varchar(50)
+               + SafeString(oSub.HSourceBillType?.ToString(), "") + "'," // HSourceBillType varchar(10)
+               + (oSub.HRelationQty == null ? 0 : oSub.HRelationQty) + "," // HRelationQty dec(18,8)
+               + (oSub.HRelationMoney) + "," // HRelationMoney dec(18,8)
+               + (oSub.HMaterID) + "," // HMaterID int
+               + (oSub.HUnitID.ToString() == "" ? 0 : oSub.HUnitID) + "," // HUnitID int
+               + (oSub.HMouldID) + "," // HMouldID int
+               + (oSub.HMouldLength.ToString() == "" ? 0 : oSub.HMouldLength) + "," // HMouldLength dec(18,8)
+               + (oSub.HMouldHeight.ToString() == "" ? 0 : oSub.HMouldHeight) + "," // HMouldHeight dec(18,8)
+               + (oSub.HMouldWidth.ToString() == "" ? 0 : oSub.HMouldWidth) + "," // HMouldWidth dec(18,8)
+               + (oSub.HMouldFoldHeight.ToString() == "" ? 0 : oSub.HMouldFoldHeight) + "," // HMouldFoldHeight dec(18,8)
+               + (oSub.HVolume.ToString() == "" ? 0 : oSub.HVolume) + "," // HVolume dec(18,8)
+               + (oSub.HQty.ToString() == "" ? 0 : oSub.HQty) + "," // HQty dec(18,8)
+               + (oSub.HSNP.ToString() == "" ? 0 : oSub.HSNP) + "," // HSNP dec(18,8)
+               + (oSub.HMouldQty.ToString() == "" ? 0 : oSub.HMouldQty) + ")"; // HMouldQty dec(18,8)
+                    oCn.RunProc(sql);
+                }
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',2 ", "h_p_Gy_QCVerificationBill_AfterSaveCtrl");
+
+
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                //寰楀埌mainid
+                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_QCVerificationBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
+
+
+                oCn.BeginTran();
+                // 鑾峰彇褰撳墠鏃ユ湡鏃堕棿锛岀敤浜庣┖鏃ユ湡瀛楁鐨勯粯璁ゅ��
+                // 鑾峰彇褰撳墠鏃ユ湡鏃堕棿
+                string currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                // 杈呭姪鏂规硶锛氬畨鍏ㄨ浆鎹负瀛楃涓诧紝澶勭悊null鍜岀┖瀛楃涓�
+
+
+                string sql = "Insert Into WL_YayBillMain " +
+                           "(HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus," +
+                           "HCheckItemNowID,HCheckItemNextID,HCheckFlowID,HRemark,HBacker,HBackDate," +
+                           "HBackRemark,HChecker,HCheckDate,HMaker,HMakeDate,HUpDater,HUpDateDate," +
+                           "HCloseMan,HCloseDate,HCloseType,HDeleteMan,HDeleteDate," +
+                           "HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo," +
+                           "HPrintQty,HOrgID,HCusID,HBeginAddr,HEndAddr,HPickAddr," +
+                           "HArriverAddr,HTransType,HCarTypeID,HCarTypeMaxVolume,HTotalVolume," +
+                           "HLoadingRate,HContractTransportInterID,HContractTransportEntryID," +
+                           "HContractTransportBillNo,HCarrierID,HDistance,HTransportTimes," +
+                           "HTransportTyep,HSSID,HCurID,HMoney,HDateForRequestedPick," +
+                           "HDataForRequestedArrived,HCarryStatus,HDate_CarrierSure," +
+                           "HDate_AllocationDriver,HCarID,HDriverID,HSurer_Arrive,HDate_Arrive," +
+                           "HSurer_Pick,HDate_Pick,HSurer_Trans,HDate_Trans,HSurer_Receive," +
+                           "HDate_Receive,HSurer_Accounting,HDate_Accounting) " +
+                           "values(" +
+                           SafeInt(omodel.HInterID.ToString(), 0) + "," + // HInterID
+                           "0,0," + // HYear, HPeriod - 闇�瑕佷粠HDate璁$畻锛岃繖閲屽厛缁�0
+                           "'" + SafeString(this.BillType) + "'," +
+                           "'" + SafeString(this.HBillSubType) + "'," +
+                           SafeDateTime(omodel.HDate.ToString(), "'" + currentDateTime + "'") + "," +
+                           "'" + SafeString(omodel.HBillNo) + "'," +
+                           SafeInt(omodel.HBillStatus.ToString(), 1) + "," + // HBillStatus
+                           SafeInt(omodel.HCheckItemNowID.ToString(), 0) + "," + // HCheckItemNowID
+                           SafeInt(omodel.HCheckItemNextID.ToString(), 0) + "," + // HCheckItemNextID
+                           SafeInt(omodel.HCheckFlowID.ToString(), 0) + "," + // HCheckFlowID
+                           "'" + SafeString(omodel.HRemark) + "'," +
+                           "'" + SafeString(omodel.HBacker) + "'," +
+                           SafeDateTime(omodel.HBackDate?.ToString(), "NULL") + "," +
+                           "'" + SafeString(omodel.HBackRemark) + "'," +
+                           "'" + SafeString(omodel.HChecker) + "'," +
+                           SafeDateTime(omodel.HCheckDate?.ToString(), "NULL") + "," +
+                           "'" + SafeString(omodel.HMaker) + "',getdate()," + // HMaker, HMakeDate
+                           "'" + SafeString(omodel.HUpDater) + "'," +
+                           SafeDateTime(omodel.HUpDateDate?.ToString(), "NULL") + "," +
+                           "'" + SafeString(omodel.HCloseMan) + "'," +
+                           SafeDateTime(omodel.HCloseDate?.ToString(), "NULL") + "," +
+                           (omodel.HCloseType.ToString() == "1" ? "1" : "0") + "," + // HCloseType
+                           "'" + SafeString(omodel.HDeleteMan) + "'," +
+                           SafeDateTime(omodel.HDeleteDate?.ToString(), "NULL") + "," +
+                           "'" + SafeString(omodel.HMainSourceBillType) + "'," +
+                           SafeInt(omodel.HMainSourceInterID.ToString(), 0) + "," + // HMainSourceInterID
+                           SafeInt(omodel.HMainSourceEntryID.ToString(), 0) + "," + // HMainSourceEntryID
+                           "'" + SafeString(omodel.HMainSourceBillNo) + "'," +
+                           SafeInt(omodel.HPrintQty.ToString(), 0) + "," + // HPrintQty
+                           SafeInt(omodel.HOrgID.ToString(), 0) + "," + // HOrgID
+                           SafeInt(omodel.HCusID?.ToString(), 0) + "," + // HCusID
+                           SafeInt(omodel.HBeginAddr?.ToString(), 0) + "," + // HBeginAddr
+                           SafeInt(omodel.HEndAddr?.ToString(), 0) + "," + // HEndAddr
+                           "'" + SafeString(omodel.HPickAddr) + "'," +
+                           "'" + SafeString(omodel.HArriverAddr) + "'," +
+                           "'" + SafeString(omodel.HTransType) + "'," +
+                           SafeInt(omodel.HCarTypeID?.ToString(), 0) + "," + // HCarTypeID
+                           SafeDecimal(omodel.HCarTypeMaxVolume?.ToString(), 0) + "," + // HCarTypeMaxVolume
+                           SafeDecimal(omodel.HTotalVolume?.ToString(), 0) + "," + // HTotalVolume
+                           SafeDecimal(omodel.HLoadingRate?.ToString(), 0) + "," + // HLoadingRate
+                           SafeInt(omodel.HContractTransportInterID?.ToString(), 0) + "," + // HContractTransportInterID
+                           SafeInt(omodel.HContractTransportEntryID?.ToString(), 0) + "," + // HContractTransportEntryID
+                           "'" + SafeString(omodel.HContractTransportBillNo) + "'," +
+                           SafeInt(omodel.HCarrierID?.ToString(), 0) + "," + // HCarrierID
+                           SafeDecimal(omodel.HDistance?.ToString(), 0) + "," + // HDistance
+                           SafeDecimal(omodel.HTransportTimes?.ToString(), 0) + "," + // HTransportTimes
+                           "'" + SafeString(omodel.HTransportTyep) + "'," +
+                           SafeInt(omodel.HSSID?.ToString(), 0) + "," + // HSSID
+                           SafeInt(omodel.HCurID?.ToString(), 0) + "," + // HCurID
+                           SafeDecimal(omodel.HMoney?.ToString(), 0) + "," + // HMoney
+                           SafeDateTime(omodel.HDateForRequestedPick?.ToString(), "'" + currentDateTime + "'") + "," +
+                           SafeDateTime(omodel.HDataForRequestedArrived?.ToString(), "'" + currentDateTime + "'") + "," +
+                           SafeInt(omodel.HCarryStatus?.ToString(), 1) + "," + // HCarryStatus
+                           SafeDateTime(omodel.HDate_CarrierSure?.ToString(), "'" + currentDateTime + "'") + "," +
+                           SafeDateTime(omodel.HDate_AllocationDriver?.ToString(), "'" + currentDateTime + "'") + "," +
+                           SafeInt(omodel.HCarID?.ToString(), 0) + "," + // HCarID
+                           SafeInt(omodel.HDriverID?.ToString(), 0) + "," + // HDriverID
+                           "'" + SafeString(omodel.HSurer_Arrive) + "'," +
+                           SafeDateTime(omodel.HDate_Arrive?.ToString(), "'" + currentDateTime + "'") + "," +
+                           "'" + SafeString(omodel.HSurer_Pick) + "'," +
+                           SafeDateTime(omodel.HDate_Pick?.ToString(), "'" + currentDateTime + "'") + "," +
+                           "'" + SafeString(omodel.HSurer_Trans) + "'," +
+                           SafeDateTime(omodel.HDate_Trans?.ToString(), "'" + currentDateTime + "'") + "," +
+                           "'" + SafeString(omodel.HSurer_Receive) + "'," +
+                           SafeDateTime(omodel.HDate_Receive?.ToString(), "'" + currentDateTime + "'") + "," +
+                           "'" + SafeString(omodel.HSurer_Accounting) + "'," +
+                           SafeDateTime(omodel.HDate_Accounting?.ToString(), "'" + currentDateTime + "'") + ")"; 
+
+                oCn.RunProc(sql);
+                //涓昏〃              
+                //鎻掑叆瀛愯〃
+
+                foreach (Model.ClsWL_YayBillMainBillSub oSub in DetailColl)
+                {
+                    sql = "Insert into WL_YayBillSub_Material " +
+              "(HInterID,HBillNo_bak,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+              ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+              ",HMaterID,HUnitID,HMouldID,HMouldLength,HMouldHeight,HMouldWidth" +
+              ",HMouldFoldHeight,HVolume,HQty,HSNP,HMouldQty) values("
+              + SafeInt(omodel.HInterID.ToString(), 0) + ",'" // HInterID int
+              + SafeString(omodel.HBillNo.ToString()) + "'," // HBillNo_bak varchar(50)
+              + (oSub.HEntryID) + ",'" // HEntryID int
+              + SafeString(oSub.HCloseMan?.ToString()) + "','" // HCloseMan varchar(20)
+              + (oSub.HEntryCloseDate == null ? DateTime.Now : oSub.HEntryCloseDate) + "'," // HEntryCloseDate datetime
+              + (oSub.HCloseType ? "1" : "0") + ",'" // HCloseType bit
+              + SafeString(oSub.HRemark?.ToString() ?? "") + "'," // HRemark varchar(200)
+              + (oSub.HSourceInterID == null ? 0 : oSub.HSourceInterID) + "," // HSourceInterID int
+              + (oSub.HSourceEntryID == null ? 0 : oSub.HSourceEntryID) + ",'" // HSourceEntryID int
+              + SafeString(oSub.HSourceBillNo?.ToString(), "") + "','" // HSourceBillNo varchar(50)
+              + SafeString(oSub.HSourceBillType?.ToString(), "") + "'," // HSourceBillType varchar(10)
+              + (oSub.HRelationQty == null ? 0 : oSub.HRelationQty) + "," // HRelationQty dec(18,8)
+              + (oSub.HRelationMoney) + "," // HRelationMoney dec(18,8)
+              + (oSub.HMaterID) + "," // HMaterID int
+              + (oSub.HUnitID.ToString() == "" ? 0 : oSub.HUnitID) + "," // HUnitID int
+              + (oSub.HMouldID) + "," // HMouldID int
+              + (oSub.HMouldLength.ToString() == "" ? 0 : oSub.HMouldLength) + "," // HMouldLength dec(18,8)
+              + (oSub.HMouldHeight.ToString() == "" ? 0 : oSub.HMouldHeight) + "," // HMouldHeight dec(18,8)
+              + (oSub.HMouldWidth.ToString() == "" ? 0 : oSub.HMouldWidth) + "," // HMouldWidth dec(18,8)
+              + (oSub.HMouldFoldHeight.ToString() == "" ? 0 : oSub.HMouldFoldHeight) + "," // HMouldFoldHeight dec(18,8)
+              + (oSub.HVolume.ToString() == "" ? 0 : oSub.HVolume) + "," // HVolume dec(18,8)
+              + (oSub.HQty.ToString() == "" ? 0 : oSub.HQty) + "," // HQty dec(18,8)
+              + (oSub.HSNP.ToString() == "" ? 0 : oSub.HSNP) + "," // HSNP dec(18,8)
+              + (oSub.HMouldQty.ToString() == "" ? 0 : oSub.HMouldQty) + ")"; // HMouldQty dec(18,8)
+                    oCn.RunProc(sql);
+                }
+                    //=========================淇濆瓨鍚庢帶鍒�  
+                    DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1", "h_p_Gy_QCVerificationBill_AfterSaveCtrl");
+
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    return false;
+                }
+                //============================
+
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        
+
+
+    }
+
+}
diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index ec5e9b6..87c6dcd 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -81,6 +81,7 @@
     <Compile Include="APS\ClsSc_WorkBillMonthSortBill.cs" />
     <Compile Include="APS\ClsSc_ICMOChangeBill.cs" />
     <Compile Include="ClsGy_MaterialPackingRelation.cs" />
+    <Compile Include="ClsWL_YayBillMain.cs" />
     <Compile Include="MES\ClsSc_MESStopRestoreWorkBill.cs" />
     <Compile Include="WLGL\ClsCg_CarTrajectoryBill.cs" />
     <Compile Include="浠撳簱绠$悊\灏忚溅閿佸畾\ClsKf_TrolleyPositionBill.cs" />
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 949d008..fca16fa 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -126,6 +126,8 @@
     <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_RepairCheckClass_Model.cs" />
     <Compile Include="鐗╂祦绠$悊\ClsCg_CarTrajectoryBillMain.cs" />
     <Compile Include="鐗╂祦绠$悊\ClsCg_CarTrajectoryBillSub.cs" />
+    <Compile Include="鐗╂祦绠$悊\ClsWL_YayBillMainBillSub.cs" />
+    <Compile Include="鐗╂祦绠$悊\ClsWL_YayBillMainBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\ClsSc_ShiftsBeginInfoBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\ClsSc_ShiftsBeginInfoBillSub.cs" />
     <Compile Include="ClsHR_EmpFosterBillMain.cs" />
diff --git "a/Model/\347\211\251\346\265\201\347\256\241\347\220\206/ClsWL_YayBillMainBillMain.cs" "b/Model/\347\211\251\346\265\201\347\256\241\347\220\206/ClsWL_YayBillMainBillMain.cs"
new file mode 100644
index 0000000..6955470
--- /dev/null
+++ "b/Model/\347\211\251\346\265\201\347\256\241\347\220\206/ClsWL_YayBillMainBillMain.cs"
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsWL_YayBillMainBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HCheckEmp;
+        public Int64 HDeptID;
+        public Int64 HEmpID;
+        public Int64 HOrgID;
+        public Int64 HPrintQty;
+
+        // 新增字段
+        public int? HCusID;                          // 客户ID
+        public int? HBeginAddr;                      // 始发地
+        public int? HEndAddr;                        // 目的地
+        public string HPickAddr;                     // 提货地址
+        public string HArriverAddr;                  // 到货地址
+        public string HTransType;                    // 运输方式(整车、零单)
+        public int? HCarTypeID;                      // 车型ID
+        public decimal? HCarTypeMaxVolume;           // 车型最大容积
+        public decimal? HTotalVolume;                // 总体积(平方米)
+        public decimal? HLoadingRate;                // 装载率
+        public int? HContractTransportInterID;       // 承运合同ID
+        public int? HContractTransportEntryID;       // 承运合同子ID
+        public string HContractTransportBillNo;      // 承运合同单据号
+        public int? HCarrierID;                      // 承运商ID
+        public decimal? HDistance;                   // 距离(公里)
+        public decimal? HTransportTimes;             // 运输时效
+        public string HTransportTyep;                // 运输类型(单程,往返)
+        public int? HSSID;                           // 结算方式
+        public int? HCurID;                          // 币别
+        public decimal? HMoney;                      // 运输费用
+
+        public DateTime? HDateForRequestedPick;      // 要求提货时间
+        public DateTime? HDataForRequestedArrived;   // 要求到货时间
+        public int? HCarryStatus;                    // 物流状态(1-9)
+        public DateTime? HDate_CarrierSure;          // 承运商确认时间
+        public DateTime? HDate_AllocationDriver;     // 分配司机时间
+        public int? HCarID;                          // 车辆ID
+        public int? HDriverID;                       // 司机ID
+        public string HSurer_Arrive;                 // 到厂确认人
+        public DateTime? HDate_Arrive;               // 到厂确认时间
+        public string HSurer_Pick;                   // 提货确认人
+        public DateTime? HDate_Pick;                 // 提货确认时间
+        public string HSurer_Trans;                  // 出厂运输确认人
+        public DateTime? HDate_Trans;                // 出厂运输确认时间
+        public string HSurer_Receive;                // 签收确认人
+        public DateTime? HDate_Receive;              // 签收确认时间
+        public string HSurer_Accounting;             // 核算人
+        public DateTime? HDate_Accounting;           // 核算时间
+    }
+}
diff --git "a/Model/\347\211\251\346\265\201\347\256\241\347\220\206/ClsWL_YayBillMainBillSub.cs" "b/Model/\347\211\251\346\265\201\347\256\241\347\220\206/ClsWL_YayBillMainBillSub.cs"
new file mode 100644
index 0000000..8841cab
--- /dev/null
+++ "b/Model/\347\211\251\346\265\201\347\256\241\347\220\206/ClsWL_YayBillMainBillSub.cs"
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsWL_YayBillMainBillSub : DBUtility.ClsXt_BaseBillMain
+    {
+        // 关联主表
+        public int HInterID { get; set; }                      // 主内码
+        public string HBillNo_bak { get; set; }                // 单据号(备份)
+
+        // 子表信息
+        public int HEntryID { get; set; }                      // 子内码
+
+        // 行关闭相关
+        public string HCloseMan { get; set; }                  // 行关闭人
+        public DateTime HEntryCloseDate { get; set; }          // 行关闭日期
+        public bool HCloseType { get; set; }                   // 关闭类型
+
+        // 备注
+        public string HRemark { get; set; }                    // 表体备注
+
+        // 源单信息
+        public int HSourceInterID { get; set; }                // 源单ID
+        public int HSourceEntryID { get; set; }                // 源单子ID
+        public string HSourceBillNo { get; set; }              // 源单单号
+        public string HSourceBillType { get; set; }            // 源单类型
+        public decimal HRelationQty { get; set; }              // 关联数量
+        public decimal HRelationMoney { get; set; }            // 关联金额
+
+        // 自增列
+        public int HItemSubID { get; set; }                    // 自增列
+
+        ///自定义
+        public int HMaterID { get; set; }
+        public int HUnitID { get; set; }
+        public int HMouldID { get; set; }
+        public decimal HMouldLength { get; set; }
+        public decimal HMouldHeight { get; set; }
+        public decimal HMouldWidth { get; set; }
+        public decimal HMouldFoldHeight { get; set; }
+        public decimal HVolume { get; set; }
+        public decimal HQty { get; set; }
+        public decimal HSNP { get; set; }
+        public decimal HMouldQty { get; set; }
+    }
+}
diff --git "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs" "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
index 167b234..6cf0f57 100644
--- "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
+++ "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
@@ -13675,7 +13675,7 @@
         #endregion
 
         #region 娣诲悍鏍规嵁灏忚溅鏉$爜鎵惧嚭鐩稿簲鐗╂枡
-        #endregion
+        
         [Route("WEBSController/GetMaterIDByCarBarCode")]
         [HttpGet]
         public object GetMaterIDByCarBarCode(string CarBarCode)
@@ -13718,5 +13718,6 @@
                 return objJsonResult;
             }
         }
+        #endregion
     }
 }
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"
new file mode 100644
index 0000000..c851767
--- /dev/null
+++ "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"
@@ -0,0 +1,551 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Pub_Class;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers
+{
+    public class WLYayBillController : ApiController
+    {
+
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public DataSet ds1 = new DataSet();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+
+        #region 鍒嗛〉鍒楄〃
+        [Route("WLYayBillController/GetListPage")]
+        [HttpGet]
+        public object GetListPage(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCVerificationBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_WL_YayBill order by 鍗曟嵁鍙� desc", "锘縣_v_WL_YayBill");
+                }
+                else
+                {
+                    string sql1 = "select * from  h_v_WL_YayBill  where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "锘縣_v_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 = "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/GetMesByOrginBill")]
+        [HttpGet]
+        public object GetMesByOrginBill(string ListMaterial)
+        {
+            try
+            {
+                if (ListMaterial.EndsWith(";"))
+                {
+                    ListMaterial = ListMaterial.Remove(ListMaterial.Length - 1);
+                }
+                ListMaterial = ListMaterial.Replace(';', ',');
+                List<object> columnNameList = new List<object>();
+                
+
+
+                    ds = oCN.RunProcReturn("select a.*,b.HUnitID from h_v_Gy_MaterialPackingRelationList_Edit a left JOIN Gy_Material b on a.HMaterID=b.HItemID where HDefaultSendPackFlag=1 and  HMaterID in (" + ListMaterial+")", "锘縣_v_Gy_MaterialPackingRelationList");
+
+
+                //娣诲姞鍒楀悕
+                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/SaveBill")]
+        [HttpPost]
+        public object SaveBill([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string msg4 = sArray[2].ToString();
+
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCVerificationBillMain_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsWL_YayBillMain oBill = new DAL.ClsWL_YayBillMain();
+                List<Model.ClsWL_YayBillMainBillMain> lsmain = new List<Model.ClsWL_YayBillMainBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_WL_YayBillMainMain(msg2);
+                foreach (Model.ClsWL_YayBillMainBillMain oItem in lsmain)
+                {
+                    oItem.HMaker = msg4;
+                    DBUtility.ClsPub.CurUserName = msg4;  //鍒跺崟浜�
+                    oItem.HBillType = "3321";
+                    oItem.HBillSubType = "3321";
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HCheckEmp = oItem.HEmpID;
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsWL_YayBillMainBillSub> ls = new List<Model.ClsWL_YayBillMainBillSub>();
+                ls = oListModels.getObjectByJson_WL_YayBillMainBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsWL_YayBillMainBillSub oItem in ls)
+                {
+
+                    i++;
+                    oItem.HEntryID = i;
+                    oItem.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItem.HCloseType = false;   //鍏抽棴绫诲瀷
+                    oBill.DetailColl.Add(oItem);
+
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region[缂栬緫鏃惰幏鍙栨暟鎹甝
+        [Route("WLYayBillController/WL_YayBillDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> WL_YayBillDetail(string HID)
+        {
+            if (string.IsNullOrEmpty(HID))
+                return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn("select  * from h_v_WL_YayBillEdit  where HInterID= " + HID + " ", "h_v_WL_YayBillEdit");
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ崟鍙�" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        #endregion      
+
+
+        #region 瀹℃牳銆佸弽瀹℃牳
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("WLYayBillController/AuditWLYayBill")]
+        [HttpGet]
+        public object AuditWLYayBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_Supplier_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");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                {
+                    oCN.RunProc("update WL_YayBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate() ,HBillStatus=2 where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update WL_YayBillMain set HChecker='',HCheckDate=null,HBillStatus=1 where HInterID=" + HInterID);
+
+                    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>
+        [Route("WLYayBillController/ConfrimBillNo")]
+        [HttpGet]
+        public object ConfrimBillNo(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_Supplier_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();
+
+
+                    oCN.RunProc("update WL_YayBillMain set HDate_CarrierSure='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where HInterID=" + HInterID);
+
+                    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>
+        [Route("WLYayBillController/ConfrimOtherBillNo")]
+        [HttpGet]
+        public object ConfrimOtherBillNo(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_Supplier_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)
+                {
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Arrive='" + CurUserName + "',HDate_Arrive=getdate()  where HInterID=" + HInterID);
+                }
+                else if(IsAudit == 2)
+                {
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Pick='" + CurUserName + "',HDate_Pick=getdate()  where HInterID=" + HInterID);
+
+                }
+                else if(IsAudit == 3)
+                {
+                    oCN.RunProc("update WL_YayBillMain set HSurer_Trans='" + CurUserName + "',HDate_Trans=getdate()  where HInterID=" + HInterID);
+
+                }
+                else if(IsAudit == 4)
+                {
+                    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>
+        [Route("WLYayBillController/selectDriver")]
+        [HttpGet]
+        public object selectDriver(int HInterID,int HcheckID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                DataSet ds;
+                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();
+
+
+                        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;
+                    }
+
+                   
+                }
+                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();
+
+
+                        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;
+                    }
+                }
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "澶辫触锛�";
+                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
+    }
+}
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index c6ce47b..8deb00e 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -711,6 +711,17 @@
             return list;
         }
         /// <summary>
+        /// 澶勭悊杩愬崟json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsWL_YayBillMainBillMain> getObjectByJson_WL_YayBillMainMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsWL_YayBillMainBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsWL_YayBillMainBillMain>>(jsonString);
+            return list;
+        }
+        /// <summary>
         /// 澶勭悊鏂板妯″叿缁翠慨瀛愯〃淇濆吇淇℃伅鐨刯son
         /// </summary>
         /// <param name="jsonString"></param>
@@ -745,6 +756,14 @@
             return list;
         }
         
+        
+        public List<Model.ClsWL_YayBillMainBillSub> getObjectByJson_WL_YayBillMainBillSub(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsWL_YayBillMainBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsWL_YayBillMainBillSub>>(jsonString);
+            return list;
+        }
+        
 
         /// <summary>
         /// 澶勭悊鏂板妯″叿缁翠慨楠屾敹鍗曚富琛ㄧ殑json
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 6ceda4b..1721193 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -670,6 +670,7 @@
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_PNLInfoTypeLevelController.cs" />
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_ShelfLifeNearExpiryController.cs" />
     <Compile Include="Controllers\妫�楠岀敵璇峰崟\QC_RequestCheckBillController.cs" />
+    <Compile Include="Controllers\鐗╂祦绠$悊\鍑鸿繍鍗昞WLYayBillController.cs" />
     <Compile Include="Controllers\椤圭洰绠$悊\宸ョ▼椤圭洰\PM_ProjectBill_WorkController.cs" />
     <Compile Include="DLL\ClsGy_ItemMoney_Ctl.cs" />
     <Compile Include="DLL\ClsSc_MESStopRestoreWorkBill.cs" />

--
Gitblit v1.9.1