|  |  |  | 
|---|
|  |  |  | "," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //根据源单主内码 设置 生产状态表 完工状态(设置本单对应得源单 为完工状态) | 
|---|
|  |  |  | oCn.RunProcReturn("exec h_p_JIT_MESICMOReport_Status " + omodel.HSourceID.ToString() + "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo.ToString() + "','" + omodel.HPlanQty + "'", "h_p_JIT_MESICMOReport_Status"); | 
|---|
|  |  |  | //更新生产状态临时状态表数量 | 
|---|
|  |  |  | oCn.RunProcReturn("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty " + omodel.HICMOInterID.ToString() + "," + omodel.HICMOEntryID.ToString() + "", "h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty"); | 
|---|
|  |  |  | 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.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() + ""); | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | { | 
|---|