using SQLHelper; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebAPI.Code { public class TestDAL : DBUtility.ClsXt_BaseBill { public Model.ClsCg_POInStockBillMain omodel = new Model.ClsCg_POInStockBillMain(); public List DetailColl = new List(); public override bool AddBill(ref string sReturn) { try { //得到mainid omodel.HInterID = DBUtility.ClsPub.CreateBillID("1103", ref DBUtility.ClsPub.sExeReturnInfo); //若MAINDI重复则重新获取 oCn.BeginTran(); //主表 //oCn.RunProc("Insert Into Cg_POInStockBillMain " + // "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + // ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + // ",HAddress,HSupID,HCurID,HWHID,HExRate" + // ",HEmpID,HManagerID,HDeptID,HExplanation,HInnerBillNo,HMainSourceBillType,HMainSourceBillNo,HMainSourceEntryID,HMainSourceInterID" + // ",HBillStatus,HCheckItemNowID,HCheckItemNextID,HCheckFlowID,HBacker,HBackDate) " + // " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + // ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + // ",'" + omodel.HAddress + "'," + omodel.HSupID.ToString() + "," + omodel.HCurID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HExRate.ToString() + // ", " + omodel.HEmpID.ToString() + "," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "','" + omodel.HMainSourceBillType + "','" + omodel.HMainSourceBillNo + "'," + omodel.HMainSourceInterID + "," + omodel.HMainSourceEntryID + // "," + omodel.HBillStatus + "," + omodel.HCheckItemNowID + "," + omodel.HCheckItemNextID + "," + omodel.HCheckFlowID + ",'','" + omodel.HBackDate + "') "); //插入子表 //foreach (Model.ClsCg_POInStockBillSub oSub in DetailColl) //{ // oCn.RunProc("Insert into Cg_POInStockBillSub " + // " (HInterID,HEntryID,HMaterID,HUnitID" + // ",HDate,HQty,HCheckQty,HPassQty,HBadQty,HPrice" + // ",HMoney,HWHID,HState,HSPID,HCloseMan,HEntryCloseDate" + // ",HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + // ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HRelationQty,HRelationMoney" + // ",HPropertyID,HSecUnitID,HSecUnitRate,HTaxPrice,HTaxMoney,HMainSourceInterID,HBatChNo" + // ",HAuxPropID,HMTONo,HPlanMode,HERPInterID,HERPEntryID,HReturnedQty,HDetailID) values(" // + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID + "," + oSub.HUnitID + // ",'" + oSub.HDate.ToString() + "'," + oSub.HQty + "," + oSub.HCheckQty + "," + oSub.HPassQty + "," + oSub.HBadQty.ToString() + "," + oSub.HPrice + // "," + oSub.HMoney + "," + oSub.HWHID + "," + oSub.HState + "," + oSub.HSPID + ",'','" + oSub.HEntryCloseDate.ToString() + // "',0,''," + oSub.HSourceInterID + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo.ToString() + "','" + oSub.HSourceBillType.ToString() + // "'," + oSub.HPOOrderInterID + ","+ oSub.HPOOrderEntryID + ",'" + oSub.HPOOrderBillNo.ToString() + "'," + oSub.HRelationQty + "," + oSub.HRelationMoney + // "," + oSub.HPropertyID + ",0," + oSub.HSecUnitRate + "," + oSub.HTaxPrice + "," + oSub.HTaxMoney + "," + oSub.HMainSourceInterID + ",'" + oSub.HBatChNo + // "'," + oSub.HAuxPropID + ",'" + oSub.HMTONo.ToString() + "'," + oSub.HPlanMode + "," + oSub.HERPInterID + "," + oSub.HERPEntryID + "," + oSub.HReturnedQty + "," + oSub.HDetailID + // ") "); //} // //foreach (Model.ClsCg_POInStockBillSub oSub in DetailColl) //{ // Ds = oCn.RunProcReturn("exec h_p_Cg_POInStockBill_Qty " + oSub.HICMOInterID, ""); // if (Ds.Tables[0].Rows.Count == 0) // return; // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") // { // sReturn = "汇报数量超过计划数量!不允许保存"; // return false; // } //} // sReturn = "新增单据成功!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } } }