llj
3 天以前 f0564e2f990fe9855e041274ad2905e8e08650d1
出运单
5个文件已修改
4个文件已添加
1069 ■■■■■ 已修改文件
DAL/ClsWL_YayBillMain.cs 389 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/物流管理/ClsWL_YayBillMainBillMain.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/物流管理/ClsWL_YayBillMainBillSub.cs 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/条码管理/WEBSController.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/物流管理/出运单/WLYayBillController.cs 551 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/ClsWL_YayBillMain.cs
New file
@@ -0,0 +1,389 @@
using 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;
        // è¾…助方法:安全转换为整数,处理null、空字符串和非数字
        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 å›ºå®šä»£ç 
        ~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);
            }
        }
    }
}
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" />
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" />
Model/ÎïÁ÷¹ÜÀí/ClsWL_YayBillMainBillMain.cs
New file
@@ -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;           // æ ¸ç®—æ—¶é—´
    }
}
Model/ÎïÁ÷¹ÜÀí/ClsWL_YayBillMainBillSub.cs
New file
@@ -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; }
    }
}
WebAPI/Controllers/ÌõÂë¹ÜÀí/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
    }
}
WebAPI/Controllers/ÎïÁ÷¹ÜÀí/³öÔ˵¥/WLYayBillController.cs
New file
@@ -0,0 +1,551 @@
using 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", "h_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, "h_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));//获取到DataColumn列对象的列名
                }
                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+")", "h_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));//获取到DataColumn列对象的列名
                }
                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
    }
}
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>
        /// å¤„理新增模具维修子表保养信息的json
        /// </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
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" />