using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebAPI.DLL { public class ClsWW_EntrustProcessSendOutBill : DBUtility.ClsXt_BaseBill { public WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain omodel = new WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain(); public List DetailColl = new List(); public ClsWW_EntrustProcessSendOutBill() { base.MvarItemKeySub = "WW_EntrustProcessSendOutBillSub"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey = "WW_EntrustProcessSendOutBillMain"; base.MvarReportTitle = "委外工序计划转出单"; base.BillType = "3741"; base.HBillSubType = "3741"; } #region 固定代码 ~ClsWW_EntrustProcessSendOutBill() { DetailColl = null; } #endregion 自定义方法 //新增单据 public override bool AddBill(ref string sReturn) { try { //得到mainid omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); //若MAINDI重复则重新获取 oCn.BeginTran(); //主表 oCn.RunProc("Insert Into WW_EntrustProcessSendOutBillMain " + "(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], [HDeptID], [HSupID], [HEmpID], [HExplanation], [HInnerBillNo]" + ") " + " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + this.BillType + "','" + omodel.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() + "," + omodel.HCheckFlowID.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBacker + "','" + omodel.HBackDate + "','" + omodel.HBackRemark + "'" + ",'" + omodel.HChecker + "','" + omodel.HCheckDate + "','" + DBUtility.ClsPub.CurUserName + "',getdate(),'" + omodel.HUpDater + "'" + ",'" + omodel.HUpDateDate + "','" + omodel.HCloseMan + "','" + omodel.HCloseDate + "'," + Convert.ToString(omodel.HCloseType ? 1 : 0) + ",'" + omodel.HDeleteMan + "'" + ",'" + omodel.HDeleteDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "'" + "," + omodel.HPrintQty.ToString() + ",'" + omodel.HDeptID + "'," + omodel.HSupID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" + ") "); //插入子表 foreach (Models.ClsWW_EntrustProcessSendOutBillSub oSub in DetailColl) { oCn.RunProc("Insert into WW_EntrustProcessSendOutBillSub " + "([HInterID], [HBillNo_bak], [HEntryID], [HCloseMan], [HEntryCloseDate], [HCloseType], [HRemark], [HSourceInterID]" + ",[HSourceEntryID], [HSourceBillNo], [HSourceBillType], [HRelationQty], [HRelationMoney], [HProcID]" + ", [HSupFlag], [HMaterID], [HQty],[HPrice], [HMoney], [HBatchNo], [HPackType], [HProcPlanInterID]" + ", [HProcPlanEntryID], [HProcPlanBillNo], [HICMOInterID], [HICMOEntryID], [HICMOBillNo], [HSeOrderInterID], [HSeOrderEntryID],[HSeOrderBillNo]" + ") " + "values(" + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + oSub.HEntryCloseDate.ToShortDateString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HProcID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HMaterID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HPackType+"'" + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo+ "'," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo +"'"+ ") "); } sReturn = "新增单据成功!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } } }