using DBUtility; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DAL { public class ClsGy_BarCodeBill_ChaiMa : DBUtility.ClsGy_Base_Ctl { public Model.ClsGy_BarCodeEdit_Model omodel = new Model.ClsGy_BarCodeEdit_Model(); public List DetailColl_Mater = new List(); public List DetailColl_Pay = new List(); public bool AddBill(ref string sReturn,string HBillNo) { try { //若MAINDI重复则重新获取 oCn.BeginTran(); string sql = "update Gy_BarCodeBill set HStopflag=1,HStopMan='"+ ClsPub.CurUserName + "',HStopManDate=getdate() where HBarCode='" + HBillNo + "'"; oCn.RunProc(sql); ////插入子表 foreach (Model.ClsGy_BarCodeEdit_Model oSub in DetailColl_Mater) { string sql2 = "Insert Into Gy_BarCodeBill " + "(HInterID,HEntryID,HBillType,HProcID,HBarCode,HBarCodeType,HItemSubID" + ",HMaterID,HUnitID,HPieceQty,HQty,HBatchNo,HSupID,HGroupID,HDeptID,HEmpID" + ",HMaker,HMakeDate,HPrintQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + ",HRemark,HUseFlag,HEndQty,HWei,HStopflag,HBarCodeStatus,HReadyQty,HinitQty,HAuxPropID" + ",HMTONo,HSupflag,HEndDate,HSourceID,HCusType,HWorkLineName,HCusID,HSTOCKORGID,HOWNERID" + ",HJiaYe,HPressModel,HCusModel,HMaterialModel,HColor,HLogo,HPackageSize,HMaterialJQty" + ",HMaterialMQty,HCustomBatchNo,HBarCodeDate,HGBBarCode,HOLDBarCodeFlag,HOldSourceInterID" + ",HOldSourceEntryID,HOldSourceBillNo,HOrderInterID,HOrderEntryID,HOrderBillNo,HOrderBillType" + ",HRelationNum,HLabelQty,HMinQty,HNowQty,HStopMan,HInStockDate_XF,HExpressNumber,POOrderBillNo" + ",HICMOReportBillNo,HInStockCounts,HReportCounts,HOutStockCounts,HInStockBillNo,HOutStockBillNo" + ",HSendGoodsBillNo,HServerItemID,HBadReasonList,HProdLev,HInnerBillNo,HCusBarCode,HStatus,HInitSourceEntryID" + ",HOldSourceBillType,HMZ,HGiveAwayFlag" + ") " + " values("+ oSub.HInterID + ",1,'3710',0,'" + oSub.HBarCode + "','" + oSub.HBarCodeType + "','" + oSub.HItemSubID+ "'," + oSub.HMaterID + ","+ oSub.HUnitID + ",0,"+ oSub.HQty + ",'"+oSub.HBatchNo + "',"+ oSub.HSupID + "," + oSub.HGroupID + "," + oSub.HDeptID + "," + oSub.HEmpID + ",'" + oSub.HMaker + "','" + oSub.HMakeDate + "',0," + oSub.HSourceInterID + ","+ oSub.HSourceEntryID + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + "'','" + oSub.HUseFlag + "','','',0,'',0,"+ oSub.HInitQty+",0"+ ",'',0,'',"+ oSub.HSourceID+",'','',"+ oSub.HCusID+","+ oSub.HSTOCKORGID+","+ oSub.HOWNERID + ",'','','','','','','',0,"+ "0,'','"+oSub.HBarCodeDate+"','',0,0"+ ",0,'',0,0,'',''"+ ",'',0,0,0,'','','',''"+ ",'',0,0,0,'',''"+ ",'',0,'','','"+oSub.HInnerBillNo+"','','',0,''"+ ","+ oSub.HMZ+",0"+ ") "; oCn.RunProc(sql2); } sReturn = "新增单据成功!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } } }