|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public  class ClsSc_ProcessReport:DBUtility.ClsXt_BaseBill | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public Model.ClsSc_ProcessReportMain omodel = new Model.ClsSc_ProcessReportMain(); | 
|---|
|  |  |  | public List<Model.ClsSc_ProcessReportSub> DetailColl = new List<Model.ClsSc_ProcessReportSub>(); | 
|---|
|  |  |  | public Models.ClsSc_ProcessReportMain omodel = new Models.ClsSc_ProcessReportMain(); | 
|---|
|  |  |  | public List<Models.ClsSc_ProcessReportSub> DetailColl = new List<Models.ClsSc_ProcessReportSub>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ClsSc_ProcessReport() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | DeleteBillSub(lngBillKey); | 
|---|
|  |  |  | //插入子表 | 
|---|
|  |  |  | omodel.HInterID = lngBillKey; | 
|---|
|  |  |  | foreach (Model.ClsSc_ProcessReportSub oSub in DetailColl) | 
|---|
|  |  |  | foreach (Models.ClsSc_ProcessReportSub oSub in DetailColl) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCn.RunProc("Insert into Sc_ProcessReportSub " + | 
|---|
|  |  |  | " (HInterID,HEntryID,HProcID,HProcNumber,HEmpID" + | 
|---|
|  |  |  | 
|---|
|  |  |  | "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HDeptNumber + "'," + omodel.HGroupID.ToString() + | 
|---|
|  |  |  | ",'" + omodel.HGroupNumber + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() + ",'" + omodel.HUnitNumber + "'" + | 
|---|
|  |  |  | ", " + omodel.HPlanQty.ToString() + "," + omodel.HInStockQty.ToString() + "," + omodel.HSumTimes.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HRemark + "'" + | 
|---|
|  |  |  | ",'" + omodel.HInnerBillNo  + "','" + DBUtility.ClsPub.CurUserName + "',getdate()," + omodel.HSupID.ToString() + ",'" + omodel.HMarker + "'" + | 
|---|
|  |  |  | ",'" + omodel.HInnerBillNo  + "','" + omodel.HMaker.ToString() + "',getdate()," + omodel.HSupID.ToString() + ",'" + omodel.HMarker + "'" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | //插入子表 | 
|---|
|  |  |  | foreach (Model.ClsSc_ProcessReportSub oSub in DetailColl) | 
|---|
|  |  |  | foreach (Models.ClsSc_ProcessReportSub oSub in DetailColl) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCn.RunProc("Insert into Sc_ProcessReportSub " + | 
|---|
|  |  |  | " (HInterID,HEntryID,HProcID,HProcNumber,HEmpID" + | 
|---|
|  |  |  | ",HMaterID,HMaterNumber,HOutPrice,HOutMoney" + | 
|---|
|  |  |  | 
|---|
|  |  |  | "HSecUnitQty1,HSecUnitRate1,HSecUnitQty2,HSecUnitRate2,HUsingQty,"+ | 
|---|
|  |  |  | "HSelfBadCount,HPreBadCount,HPayMentQty,HOtherDeduct,HRelPay,"+ | 
|---|
|  |  |  | "HOtherItem1,HOtherItem2,HOtherItem3,HOtherItem4,HOtherItem5,"+ | 
|---|
|  |  |  | "HPackType,HCheckEmpID,HWeight,HBatchNo" + | 
|---|
|  |  |  | "HPackType,HCheckEmpID,HWeight,HBatchNo,HRelationInterID" + | 
|---|
|  |  |  | ") values(" | 
|---|
|  |  |  | + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNumber + "'," + oSub.HEmpID.ToString() + | 
|---|
|  |  |  | "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'," + oSub.HOutPrice.ToString() + "," + oSub.HOutMoney.ToString() + | 
|---|
|  |  |  | 
|---|
|  |  |  | "," + oSub.HSecUnitQty1.ToString() + "," + oSub.HSecUnitRate1.ToString() + "," + oSub.HSecUnitQty2.ToString() + "," + oSub.HSecUnitRate2.ToString() + "," + oSub.HUsingQty.ToString() + | 
|---|
|  |  |  | "," + oSub.HSelfBadCount.ToString() + "," + oSub.HPreBadCount.ToString() + "," + oSub.HPayMentQty.ToString() + "," + oSub.HOtherDeduct.ToString() + "," + oSub.HRelPay.ToString() + | 
|---|
|  |  |  | ",'" + oSub.HOtherItem1.ToString() + "','" + oSub.HOtherItem2.ToString() + "','" + oSub.HOtherItem3.ToString() + "','" + oSub.HOtherItem4.ToString() + "','" + oSub.HOtherItem5.ToString() + | 
|---|
|  |  |  | "','" + oSub.HPackType.ToString() + "'," + oSub.HCheckEmpID.ToString() + "," + oSub.HWeight.ToString() + ",'" + oSub.HBatchNo + "'" + | 
|---|
|  |  |  | "','" + oSub.HPackType.ToString() + "'," + oSub.HCheckEmpID.ToString() + "," + oSub.HWeight.ToString() + ",'" + oSub.HBatchNo + "','0'" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //更新关联数量 | 
|---|
|  |  |  | AddNewRelation(ref sReturn, omodel.HInterID); | 
|---|
|  |  |  | //AddNewRelation(ref sReturn, omodel.HInterID); | 
|---|
|  |  |  | //更新关联数量 | 
|---|
|  |  |  | oCn.RunProc("exec h_p_Sc_UpDateICMOBillStepStatusRelation_Add " + omodel.HInterID); | 
|---|
|  |  |  | //回填 生产状态表  日计划  为 已完工 状态 | 
|---|
|  |  |  | oCn.RunProc("exec h_p_Sc_UpDateICMOBillQualityStatus " + omodel.HICMOStatusInterID.ToString() + ",3"); | 
|---|
|  |  |  | //oCn.RunProc("exec h_p_Sc_UpDateICMOBillQualityStatus " + omodel.HICMOStatusInterID.ToString() + ",3"); | 
|---|
|  |  |  | //默认变为 申请检验状态 | 
|---|
|  |  |  | oCn.RunProc("exec h_p_Sc_UpDateProcessReportStatus " + omodel.HInterID.ToString() + ",15"); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | sReturn = "新增单据成功!"; | 
|---|
|  |  |  | sReturn = omodel.HInterID.ToString(); | 
|---|
|  |  |  | oCn.Commit(); | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | DetailColl.Clear();//清空 | 
|---|
|  |  |  | for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Model.ClsSc_ProcessReportSub oSub = new Model.ClsSc_ProcessReportSub(); | 
|---|
|  |  |  | Models.ClsSc_ProcessReportSub oSub = new Models.ClsSc_ProcessReportSub(); | 
|---|
|  |  |  | oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); | 
|---|
|  |  |  | oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反审核 | 
|---|
|  |  |  | public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet oDs = new DataSet(); | 
|---|
|  |  |  | string sBillName = ""; | 
|---|
|  |  |  | sReturn = ""; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string HChecker = DBUtility.ClsPub.CurUserName; | 
|---|
|  |  |  | string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | oDs = oCn.RunProcReturn("select * from Sc_ProcessReportSub where HInterID=" + lngBillKey.ToString(), "Sc_ProcessReportSub"); | 
|---|
|  |  |  | if (oDs == null || oDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | long ProdMoveInterID = DBUtility.ClsPub.CreateBillID("3771", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | string ProdMoveBillNo = DBUtility.ClsPub.CreateBillCode("3771", ref DBUtility.ClsPub.sExeReturnInfo, true); | 
|---|
|  |  |  | //oCn.RunProc("exec h_p_Sc_ProcProdMoveBill_Add " + lngBillKey.ToString() + "," + DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[i]["HEntryID"]).ToString() + "," + ProdMoveInterID.ToString() + ",'" + ProdMoveBillNo + "','" + HChecker + "'"); | 
|---|
|  |  |  | sBillName = sBillName + ProdMoveBillNo + ","; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sReturn = sBillName; | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sReturn = e.Message; | 
|---|
|  |  |  | throw (e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除关联 | 
|---|
|  |  |  | public override void DeleteRelation(ref string sReturn, Int64 lngBillKey) | 
|---|