|  |  | 
 |  |  |                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 //若MAINDI重复则重新获取 | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 //主表 | 
 |  |  |                 oCn.RunProc("Insert Into Sc_MouldStockBillMain   " + | 
 |  |  |                 string sql = "Insert Into Sc_MouldStockBillMain   " + | 
 |  |  |                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + | 
 |  |  |                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + | 
 |  |  |                 ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + | 
 |  |  |                 ",HRemark,HMaker,HMakeDate" + /*"HYear, HPeriod,"*/ | 
 |  |  |                 ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + | 
 |  |  |                 ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + | 
 |  |  |                 ") " + | 
 |  |  |                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + | 
 |  |  |                 ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + | 
 |  |  |                 ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + | 
 |  |  |                 ", '" + omodel.HRemark.ToString() + "','" + omodel.HMaker + "',getdate()" + /*omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" +*/ | 
 |  |  |                 ", " + omodel.HSupID.ToString() + ", " + omodel.HSupTypeID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + | 
 |  |  |                 ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + | 
 |  |  |  | 
 |  |  |                 ") "); | 
 |  |  |                 ") "; | 
 |  |  |                 //主表 | 
 |  |  |                 oCn.RunProc(sql); | 
 |  |  |                 //插入子表 | 
 |  |  |                 foreach (Models.ClsSc_MouldProdBillSub oSub in DetailColl) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                           ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + | 
 |  |  |                           ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + | 
 |  |  |                           ",HDesignLife,HLeaveLife,HUseLife" + | 
 |  |  |                           ",HSCSPID,HSPGroupID,HBatchNo" + | 
 |  |  |                           ",HSCSPID,HSPGroupID,HBatchNo,HStockOrgID" + | 
 |  |  |                           ") values(" | 
 |  |  |                           + omodel.HInterID.ToString() + "," + 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.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + | 
 |  |  |                           "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + | 
 |  |  |                           "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + | 
 |  |  |                           "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + | 
 |  |  |                           "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HStockOrgID.ToString() + | 
 |  |  |                           ") "); | 
 |  |  |                 } | 
 |  |  |                 DataSet Ds; | 
 |  |  | 
 |  |  |                 ",HUpDateDate=getdate()" + | 
 |  |  |                 //======================================== | 
 |  |  |                 ",HSupID=" + omodel.HSupID.ToString() + | 
 |  |  |                 ",HSupTypeID=" + omodel.HSupTypeID.ToString() + | 
 |  |  |                 ",HWHID=" + omodel.HWHID.ToString() + | 
 |  |  |                 ",HSCWHID=" + omodel.HSCWHID.ToString() + | 
 |  |  |                 ",HEmpID=" + omodel.HEmpID.ToString() + | 
 |  |  | 
 |  |  |                         ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + | 
 |  |  |                         ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + | 
 |  |  |                         ",HDesignLife,HLeaveLife,HUseLife" + | 
 |  |  |                         ",HSCSPID,HSPGroupID,HBatchNo" + | 
 |  |  |                         ",HSCSPID,HSPGroupID,HBatchNo,HStockOrgID" + | 
 |  |  |                         ") values(" | 
 |  |  |                         + omodel.HInterID.ToString() + "," + 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.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + | 
 |  |  |                         "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + | 
 |  |  |                         "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + | 
 |  |  |                         "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + | 
 |  |  |                         "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HStockOrgID.ToString() + | 
 |  |  |                         ") "); | 
 |  |  |                 } | 
 |  |  |                 DataSet Ds; |