using System; using System.Collections.Generic; using System.Text; using System.Data; namespace SCM { public class ClsJIT_ICStockTuiBill_CLD:DBUtility.ClsXt_BaseBill { public WMSWeb.ClsJIT_ICStockTuiBillMain_CLD omodel = new WMSWeb.ClsJIT_ICStockTuiBillMain_CLD(); public List DetailColl = new List(); public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1(); public ClsJIT_ICStockTuiBill_CLD() { //base.MvarItemKeyForWeb = "h_v_Xs_SeOrderBillMain_ForWeb"; //需要修改 //base.MvarItemKeySubForWeb = "h_v_Xs_SeOrderBillSub_ForWeb"; base.MvarItemKeySub = "JIT_ComplementGoodsBillSub"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey = "JIT_ComplementGoodsBillMain"; base.MvarReportTitle="退料单"; base.BillType="6666"; base.HBillSubType = "6666"; } #region 固定代码 ~ClsJIT_ICStockTuiBill_CLD() { DetailColl = null; } #endregion 自定义方法 //修改单据 //public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) //{ // try // { // // // oCn.BeginTran(); // //更新主表 // oCn.RunProc("UpDate JIT_ComplementGoodsBillMain set " + // " HBillNo='" + omodel.HBillNo + "'" + //固定赋值=============== // ",HDate='" + omodel.HDate + "'" + // ",HYear='" + omodel.HYear.ToString() + "'" + // ",HPeriod='" + omodel.HPeriod.ToString() + "'" + // ",HRemark='" + omodel.HRemark + "'" + // ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + // ",HUpDateDate=getdate()" + // //======================================== // ",HCallManID=" + omodel.HCallManID.ToString() + // ",HSendManID=" + omodel.HSendManID.ToString() + // ",HWareManID=" + omodel.HWareManID.ToString() + // ",HCallType='" + omodel.HCallType.ToString() + "'" + // //",HCurID=" + omodel.HCurID.ToString() + // //",HExRate=" + omodel.HExRate.ToString() + // //",HEmpID=" + omodel.HEmpID.ToString() + // //",HMangerID=" + omodel.HMangerID.ToString() + // //",HDeptID=" + omodel.HDeptID.ToString() + // //",HExplanation='" + omodel.HExplanation + "'" + // //",HInnerBillNo='" + omodel.HInnerBillNo + "'" + // //",HChangeMan='" + omodel.HChangeMan + "'" + // //",HChangeDate='" + omodel.HChangeDate.ToShortDateString() + "'" + // " where HInterID=" + lngBillKey.ToString()); // //删除关联 // DeleteRelation(ref sReturn, lngBillKey); // //删除子表 // DeleteBillSub(lngBillKey); // //插入子表 // omodel.HInterID = lngBillKey; // foreach (Model.ClsJIT_ComplementGoodsBillSub_CLD oSub in DetailColl) // { // oCn.RunProc("Insert into JIT_ComplementGoodsBillSub " + // " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + // ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" + // ",HDeptID,HMaterID,HQty,HProcID,HWHID,HSPID" + // ") 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.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo.ToString() + "'," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() + "'" + // "," + oSub.HDeptID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() + // ") "); // } // // // //foreach (Model.ClsJIT_ComplementGoodsBillSub_CLD oSub in DetailColl) // //{ // // Ds = oCn.RunProcReturn("exec h_p_Xs_SeOrderBill_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); // } //} //新增单据 //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 JIT_ComplementGoodsBillMain " + // "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + // ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + // ",HBillStatus,HCheckItemNowID,HCheckItemNextID,HCheckFlowID" + // ",HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo" + // ",HBacker,HBackDate,HBackRemark,HChecker,HCheckDate,HUpDater,HUpDateDate " + // ",HCloseMan,HCloseDate,HCloseType,HDeleteMan,HDeleteDate " + // ",HPrintQty,HCallManID,HSendManID,HCallType,HWareManID " + // ") " + // " 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.HBillStatus + "'," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() + ", " + omodel.HCheckFlowID.ToString() + // ",'" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ", '" + omodel.HMainSourceBillNo + "'" + // ",'" + omodel.HBacker + "','" + omodel.HBackDate+ "','" + omodel.HBackRemark + "', '" + omodel.HChecker + "','" + omodel.HCheckDate + "', '" + omodel.HUpDater + "'," + omodel.HUpDateTime.ToShortDateString() + // ",'" + omodel.HCloseMan + "','" + omodel.HCloseDate + "','" + omodel.HCloseType + "', '" + omodel.HDeleteMan + "','" + omodel.HDeleteDate + "'"+ // "," + omodel.HPrintQty.ToString() + "," + omodel.HCallManID.ToString() + "," + omodel.HSendManID.ToString() + ",'" + omodel.HCallType + "' ," + omodel.HWareManID.ToString() + // ") "); // //插入子表 // foreach (Model.ClsJIT_ComplementGoodsBillSub_CLD oSub in DetailColl) // { // oCn.RunProc("Insert into JIT_ComplementGoodsBillSub " + // " (HInterID,HEntryID,HRemark" + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + // ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" + // ",HDeptID,HMaterID,HQty,HProcID,HWHID,HSPID" + // ") values(" // + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo_bak + "','" + oSub.HRemark + "'" + // "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + // "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'" + // "," + oSub.HDeptID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWHID.ToString() + ", " + oSub.HSPID.ToString() + // ") "); // } // // // //foreach (Model.ClsJIT_ComplementGoodsBillSub_CLD oSub in DetailColl) // //{ // // Ds = oCn.RunProcReturn("exec h_p_Xs_SeOrderBill_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); // } //} //显示单据 public override bool ShowBill(Int64 lngBillKey, ref string sReturn) { oWeb.Url = ClsPub1.WEBSURL; try { //查询主表 DataSet Ds ; //if (ClsPub1.HPersonL == 1) //{ // Ds = oWeb.Get_ICMOBillInfo("Select * from JIT_CallGoodsBillMain Where HInterID=" + lngBillKey.ToString(), "JIT_CallGoodsBillMain", ref DBUtility.ClsPub.sExeReturnInfo); //} //else //{ Ds = oWeb.Get_ICMOBillInfo("Select * from Kf_ICStockTuiBillMain Where HInterID=" + lngBillKey.ToString(), "Kf_ICStockTuiBillMain", ref DBUtility.ClsPub.sExeReturnInfo); //} if(Ds.Tables[0].Rows.Count==0) { sReturn = "单据未找到!"; return false; } //固定赋值=========================================== //omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); //omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); //omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); //omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); //omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); //omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); //omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]); //omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); //omodel.HBackRemark = Ds.Tables[0].Rows[0]["HBackRemark"].ToString().Trim(); omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]); omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]); //omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); //omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); //omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]); //omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); //omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); //omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]); //omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); //omodel.HMainSourceBillType = Ds.Tables[0].Rows[0]["HMainSourceBillType"].ToString().Trim(); //omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]); //omodel.HMainSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceEntryID"]); //omodel.HMainSourceBillNo = Ds.Tables[0].Rows[0]["HMainSourceBillNo"].ToString().Trim(); //omodel.HPrintQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPrintQty"]); //======================================================== //omodel.HCallManID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCallManID"]); //omodel.HSendManID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSendManID"]); //omodel.HWareManID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWareManID"]); //omodel.HCallType = Ds.Tables[0].Rows[0]["HCallType"].ToString().Trim(); // //循环 DataSet DsSub ; //if (ClsPub1.HPersonL == 1) //{ // DsSub = oWeb.Get_ICMOBillInfo("Select * from JIT_CallGoodsBillSub Where HInterID=" + lngBillKey.ToString(), "JIT_CallGoodsBillSub", ref DBUtility.ClsPub.sExeReturnInfo); //} //else{ DsSub = oWeb.Get_ICMOBillInfo("Select * from Kf_ICStockTuiBillSub Where HInterID=" + lngBillKey.ToString(), "Kf_ICStockTuiBillSub", ref DBUtility.ClsPub.sExeReturnInfo); //} DetailColl.Clear();//清空 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { WMSWeb.ClsJIT_ICStockTuiBillSub_CLD oSub = new WMSWeb.ClsJIT_ICStockTuiBillSub_CLD(); // 固定赋值=============================================== oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); //oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); //oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); //oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); //oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); //oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); oSub.HResult = DsSub.Tables[0].Rows[i]["HResult"].ToString().Trim(); oSub.HPZCheck = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPZCheck"]); //=================================================== //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); //oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]); //oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]); //oSub.HICMOEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOEntryID"]); //oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]); oSub.HDeptID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDeptID"]); oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); //oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]); oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); DetailColl.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } } }