|  |  | 
 |  |  |         } | 
 |  |  |         | 
 |  |  |         #endregion   自定义方法 | 
 |  |  |  | 
 |  |  |         //修改单据 | 
 |  |  |         public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) | 
 |  |  |         { | 
 |  |  | 
 |  |  |                 ",HRelationEntryID=" + omodel.HRelationEntryID.ToString() + | 
 |  |  |                 ",HRelationBillNo='" + omodel.HRelationBillNo + "'" + | 
 |  |  |                 ",HReportEntryID=" + omodel.HReportEntryID.ToString() + | 
 |  |  |                 ",HGroupID=" + omodel.HGroupID.ToString() + | 
 |  |  |                 ",HWorkManID=" + omodel.HWorkManID.ToString() + | 
 |  |  |                 ",HBadQty=" + omodel.HBadQty.ToString() + | 
 |  |  |                 ",HWasterQty=" + omodel.HWasterQty.ToString() + | 
 |  |  |                 " where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 //删除关联 | 
 |  |  |                 DeleteRelation(ref sReturn, lngBillKey); | 
 |  |  | 
 |  |  |                 //若MAINDI重复则重新获取 | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 //主表 | 
 |  |  |                 oCn.RunProc("Insert Into Sc_ICMOBillWorkQtyStatus_Tmp   " + | 
 |  |  |                 "(HInterID,HBillType,HSourceID,HReportType,HPieceQty" + | 
 |  |  |                 ",HQty,HBarCode,HAddr,HMaker,HMakeDate" + | 
 |  |  |                 ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSplitNO,HSourceBillType" + | 
 |  |  |                 ",HRelationInterID,HRelationEntryID,HRelationBillNo,HReportEntryID" + | 
 |  |  |                 ") " + | 
 |  |  |  | 
 |  |  |                 oCn.RunProc("Insert Into Sc_ICMOBillWorkQtyStatus_Tmp   " +    | 
 |  |  |                "(HInterID,HBillType,HSourceID,HReportType,HPieceQty" + | 
 |  |  |                ",HMaterID,HGroupID,HWorkManID,HWorkReportDate,HDate" + | 
 |  |  |                ",HBillSubType,HBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" + | 
 |  |  |                ",HQty,HBadQty,HWasterQty,HBarCode,HAddr,HMaker,HMakeDate" + | 
 |  |  |                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSplitNO,HSourceBillType" + | 
 |  |  |                ",HRelationInterID,HRelationEntryID,HRelationBillNo,HReportEntryID" + | 
 |  |  |                ") " + | 
 |  |  |                 " values(" + omodel.HInterID.ToString() + ",'" + BillType + "'," + omodel.HSourceID.ToString() + "," + omodel.HReportType.ToString() + "," + omodel.HPieceQty.ToString() + | 
 |  |  |                 "," + omodel.HQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'" + | 
 |  |  |                 "," + omodel.HMaterID.ToString() + ",'" + omodel.HGroupID + "','" + omodel.HWorkManID + "','" + omodel.HWorkReportDate + "','" + omodel.HDate + "'" + | 
 |  |  |                 ",'" + omodel.HBillSubType.ToString() + "','" + omodel.HBillNo + "','" + omodel.HICMOInterID + "','" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'" + | 
 |  |  |                 "," + omodel.HQty.ToString() + "," + omodel.HBadQty.ToString() + "," + omodel.HWasterQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HMaker+ "','" + omodel.HMakeDate + "'" + | 
 |  |  |                 "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSplitNO + "','" + omodel.HSourceBillType + "'" + | 
 |  |  |                 "," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() +  | 
 |  |  |                 ") "); | 
 |  |  |                   | 
 |  |  |                 sReturn = "新增单据成功!"; | 
 |  |  |  | 
 |  |  |                 //再次验证 保存是否 合理 | 
 |  |  |                 DataSet ds = oCn.RunProcReturn("exec h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = "无验证数据!"; | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") | 
 |  |  |                 { | 
 |  |  |                     sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 sReturn = omodel.HInterID.ToString(); | 
 |  |  |  | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]); | 
 |  |  |                 omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]); | 
 |  |  |                 omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]); | 
 |  |  |                 omodel.HMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HMakeDate"]); | 
 |  |  |                 omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]); | 
 |  |  |                 omodel.HSourceInterID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSourceInterID"]); | 
 |  |  |                 omodel.HSourceEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSourceEntryID"]); | 
 |  |  |                 omodel.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"]); | 
 |  |  | 
 |  |  |                 omodel.HRelationEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HRelationEntryID"]); | 
 |  |  |                 omodel.HRelationBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRelationBillNo"]); | 
 |  |  |                 omodel.HReportEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HReportEntryID"]); | 
 |  |  |                  | 
 |  |  |                   | 
 |  |  |                 omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); | 
 |  |  |                 omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); | 
 |  |  |                 omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); | 
 |  |  |                 omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); | 
 |  |  |                 omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); | 
 |  |  |                 omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); | 
 |  |  |                 omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim(); | 
 |  |  |                 omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); | 
 |  |  |                 omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); | 
 |  |  |                 omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); | 
 |  |  |                 omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); | 
 |  |  |                 omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); | 
 |  |  |  | 
 |  |  |                 sReturn = "显示单据成功!"; | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //审核 | 
 |  |  |         public bool CheckBill(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, Int64 lngBillKey, ref string sReturn) | 
 |  |  |         { | 
 |  |  |  | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HChecker = DBUtility.ClsPub.CurUserName; | 
 |  |  |                 string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 //根据源单主内码 设置 生产状态表 完工状态(设置本单对应得源单 为完工状态) | 
 |  |  |                 //oCn.RunProc("exec h_p_JIT_MESICMOReport_Status " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','" + HPlanQty + "'"); | 
 |  |  |                 //更新生产状态临时状态表数量 | 
 |  |  |                 //oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty " + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ""); | 
 |  |  |                 //根据源单主内码 设置 生产状态表 完工状态(设置本单对应得源单 为完工状态) 更新生产状态临时状态表数量 | 
 |  |  |                 oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_AddRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "',"+ HICMOInterID.ToString() + ","+ HICMOEntryID.ToString()+ ""); | 
 |  |  |                 sReturn = "审核单据成功!"; | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 //生成调拨单 | 
 |  |  |                 //得到调拨单 mainid 单据号 | 
 |  |  |                 //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//得到新单号 | 
 |  |  |                 //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); | 
 |  |  |                 // | 
 |  |  |                 sReturn = ""; | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 sReturn = e.Message; | 
 |  |  |                 throw (e); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //反审核 | 
 |  |  |         public bool AbandonCheck(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, Int64 lngBillKey, ref string sReturn) | 
 |  |  |         { | 
 |  |  |  | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HChecker = DBUtility.ClsPub.CurUserName; | 
 |  |  |                 string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 //还原单据状态为未审核状态 | 
 |  |  |                 oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 //扣减生产状态表本工单的拆分汇报数、当日完工数量、更新生产状态表 单据状态(汇报数量扣减小于) | 
 |  |  |                 oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_DelRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "'," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ","+ lngBillKey + ""); | 
 |  |  |                 sReturn = "审核单据成功!"; | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 //生成调拨单 | 
 |  |  |                 //得到调拨单 mainid 单据号 | 
 |  |  |                 //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//得到新单号 | 
 |  |  |                 //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); | 
 |  |  |                 // | 
 |  |  |                 sReturn = ""; | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 sReturn = e.Message; | 
 |  |  |                 throw (e); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //判断是否完工 | 
 |  |  |         public bool IsEnded(long HInterID, ref string sReturn) | 
 |  |  |         { |