using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DBUtility; namespace DAL { public class ClsCg_OrderTransportBill_Ctl : ClsXt_BaseBill { public ClsCg_OrderTransportBill_Ctl() { base.MvarItemKeySub = "ClsCg_OrderTransportBillSub"; base.MvarItemKeySub2 = "ClsCg_OrderTransportBillSub_Money"; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey = "ClsCg_OrderTransportBillMain"; base.MvarReportTitle = "运单申请"; base.BillType = "1118"; base.HBillSubType = "1118"; } SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //原代码 用于 替换子项目 public string HOldNumber; public Model.ClsCg_OrderTransportBill_Model oModel = new Model.ClsCg_OrderTransportBill_Model(); public Model.ClsCg_OrderTransportBillSub_Model oModel_Sub = new Model.ClsCg_OrderTransportBillSub_Model(); public Model.ClsCg_OrderTransportBillSub_Money_Model oModel_Sub_Money = new Model.ClsCg_OrderTransportBillSub_Money_Model(); public override bool DeleteBill(long lngBillKey, ref string sReturn) { return base.DeleteBill(lngBillKey, ref sReturn); } public override bool IsExistMainID(ref string sReturn, long lngBillKey, Pub_Class.ClsPub.Enum_BillStatus oBillStatus) { return base.IsExistMainID(ref sReturn, lngBillKey, oBillStatus); } public override bool IsExistBillNo(ref string sReturn, string sBillNo, Pub_Class.ClsPub.Enum_BillStatus oBillStatus, long lngBillKey) { return base.IsExistBillNo(ref sReturn, sBillNo, oBillStatus, lngBillKey); } public override bool ModifyBill(long lngBillKey, ref string sReturn) { return base.ModifyBill(lngBillKey, ref sReturn); } public override bool AddBill(ref string sReturn) { bool success = false; // 添加主表 string sql = $@" Insert Into {MvarItemKey} INSERT INTO BillMain ( HYear, HPeriod, HBillType, HBillSubType, HInterID, 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, HItemMainID, HCusID, HStockOutBillMainID, HStockOutBillNo, HSupID, HOrderBillNumber, HOrderType, HTransportType, HTransportMoney, HSendAddr, HReceAddr, HGoodsVolume, HTakeGoodsTime, HArriveGoodsTime, HCarID, HDriverID, HLoadRate, HOrderStatus ) VALUES ( {oModel.HYear}, {oModel.HPeriod}, '{oModel.HBillType}', '{oModel.HBillSubType}', {oModel.HInterID}, '{oModel.HDate}', '{oModel.HBillNo}', {oModel.HBillStatus}, {oModel.HCheckItemNowID}, {oModel.HCheckItemNextID}, {oModel.HCheckFlowID}, '{oModel.HRemark}', '{oModel.HBacker}', '{oModel.HBackDate}', '{oModel.HBackRemark}', '{oModel.HChecker}', '{oModel.HCheckDate}', '{oModel.HMaker}', '{oModel.HMakeDate}', '{oModel.HUpDater}', '{oModel.HUpDateDate}', '{oModel.HCloseMan}', '{oModel.HCloseDate}', {oModel.HCloseType}, '{oModel.HDeleteMan}', '{oModel.HDeleteDate}', '{oModel.HMainSourceBillType}', {oModel.HMainSourceInterID}, {oModel.HMainSourceEntryID}, '{oModel.HMainSourceBillNo}', {oModel.HPrintQty}, {oModel.HItemMainID}, {oModel.HCusID}, {oModel.HStockOutBillMainID}, '{oModel.HStockOutBillNo}', {oModel.HSupID}, '{oModel.HOrderBillNumber}', '{oModel.HOrderType}', '{oModel.HTransportType}', {oModel.HTransportMoney}, '{oModel.HSendAddr}', '{oModel.HReceAddr}', {oModel.HGoodsVolume}, '{oModel.HTakeGoodsTime}', '{oModel.HArriveGoodsTime}', {oModel.HCarID}, {oModel.HDriverID}, {oModel.HLoadRate}, {oModel.HOrderStatus} "; oCn.RunProc(sql); // 添加子表 success = AddBillSub(ref DBUtility.ClsPub.sExeReturnInfo); // 添加子表-金额 success = AddBillSub_Money(ref DBUtility.ClsPub.sExeReturnInfo); return success; } public override bool ShowBill(long lngBillKey, ref string sReturn) { return base.ShowBill(lngBillKey, ref sReturn); } public override void DeleteRelation(ref string sReturn, long lngBillKey) { base.DeleteRelation(ref sReturn, lngBillKey); } public override void AddNewRelation(ref string sReturn, long lngBillKey) { base.AddNewRelation(ref sReturn, lngBillKey); } // 添加子单据 public bool AddBillSub(ref string sReturn) { string sql = $@" INSERT INTO {MvarItemKeySub} ( HInterID, HBillNo_bak, HEntryID, HCloseMan, HEntryCloseDate, HCloseType, HRemark, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HRelationQty, HRelationMoney, HItemSubID, HMaterID, HVolume, HPack, HUnitID ) VALUES ( {oModel_Sub.HInterID}, '{oModel_Sub.HBillNo_bak}', {oModel_Sub.HEntryID}, '{oModel_Sub.HCloseMan}', '{oModel_Sub.HEntryCloseDate}', {oModel_Sub.HCloseType}, '{oModel_Sub.HRemark}', {oModel_Sub.HSourceInterID}, {oModel_Sub.HSourceEntryID}, '{oModel_Sub.HSourceBillNo}', '{oModel_Sub.HSourceBillType}', {oModel_Sub.HRelationQty}, '{oModel_Sub.HRelationMoney}', {oModel_Sub.HItemSubID}, {oModel_Sub.HMaterID}, {oModel_Sub.HVolume}, '{oModel_Sub.HPack}', {oModel_Sub.HUnitID} ) "; oCn.RunProc(sql); return true; } // 添加子单据 费用 public bool AddBillSub_Money(ref string sReturn) { string sql = $@" INSERT INTO {MvarItemKeySub} ( HInterID, HBillNo_bak, HEntryID, HCloseMan, HEntryCloseDate, HCloseType, HRemark, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HRelationQty, HRelationMoney, HItemSubID, HMaterID, HVolume, HPack, HUnitID ) VALUES ( {oModel_Sub.HInterID}, '{oModel_Sub.HBillNo_bak}', {oModel_Sub.HEntryID}, '{oModel_Sub.HCloseMan}', '{oModel_Sub.HEntryCloseDate}', {oModel_Sub.HCloseType}, '{oModel_Sub.HRemark}', {oModel_Sub.HSourceInterID}, {oModel_Sub.HSourceEntryID}, '{oModel_Sub.HSourceBillNo}', '{oModel_Sub.HSourceBillType}', {oModel_Sub.HRelationQty}, '{oModel_Sub.HRelationMoney}', {oModel_Sub.HItemSubID}, {oModel_Sub.HMaterID}, {oModel_Sub.HVolume}, '{oModel_Sub.HPack}', {oModel_Sub.HUnitID} ) "; oCn.RunProc(sql); return true; } } }