|  |  | 
 |  |  | { | 
 |  |  |     public  class ClsSc_MESStopWorkBill:DBUtility.ClsXt_BaseBill | 
 |  |  |     { | 
 |  |  |         public Model.ClsSc_MESStopWorkBillMain omodel = new Model.ClsSc_MESStopWorkBillMain(); | 
 |  |  |         public List<Model.ClsSc_MESStopWorkBillSub> DetailColl = new List<Model.ClsSc_MESStopWorkBillSub>(); | 
 |  |  |         //public List<Model.ClsSc_MESStopWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESStopWorkBillSub_Item>(); | 
 |  |  |         public Models.ClsSc_MESStopWorkBillMain omodel = new Models.ClsSc_MESStopWorkBillMain(); | 
 |  |  |         public List<Models.ClsSc_MESStopWorkBillSub> DetailColl = new List<Models.ClsSc_MESStopWorkBillSub>(); | 
 |  |  |         //public List<Models.ClsSc_MESStopWorkBillSub_Item> DetailColl1 = new List<Models.ClsSc_MESStopWorkBillSub_Item>(); | 
 |  |  |         public ClsSc_MESStopWorkBill() | 
 |  |  |         { | 
 |  |  |             base.MvarItemKeySub = "Sc_MESStopWorkBillSub"; | 
 |  |  | 
 |  |  |         { | 
 |  |  |             DetailColl = null; | 
 |  |  |         } | 
 |  |  |         | 
 |  |  |  | 
 |  |  |         #endregion   自定义方法 | 
 |  |  |  | 
 |  |  |         //保存前控制 | 
 |  |  |         public bool BeforeSave(Int64 HInterID, Int64 HICMOInterID, Int64 HICMOEntryID, string HICMOBillNo, Int64 OperationType, ref string sReturn) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MESStopWorkBill_BeforeSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + OperationType.ToString(), "h_p_Sc_MESStopWorkBill_BeforeSaveCtrl"); | 
 |  |  |                 if (Ds == null || Ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = "保存前判断失败!"; | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) | 
 |  |  |                     { | 
 |  |  |                         sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); | 
 |  |  |                         return false; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 throw (e); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //保存后控制 | 
 |  |  |         public bool AfterSave(Int64 HInterID, Int64 HICMOInterID, Int64 HICMOEntryID, string HICMOBillNo, Int64 OperationType, ref string sReturn) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MESStopWorkBill_AfterSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + OperationType.ToString(), "h_p_Sc_MESStopWorkBill_AfterSaveCtrl"); | 
 |  |  |                 if (Ds == null || Ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = "保存后判断失败!"; | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) | 
 |  |  |                     { | 
 |  |  |                         sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); | 
 |  |  |                         return false; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 throw (e); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //修改单据 | 
 |  |  |         public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 // | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 //保存前控制 | 
 |  |  |                 if (!BeforeSave(lngBillKey, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 2, ref sReturn)) | 
 |  |  |                 { | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 //更新主表 | 
 |  |  |                 oCn.RunProc("UpDate Sc_MESStopWorkBillMain set  " + | 
 |  |  |                 " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值=============== | 
 |  |  | 
 |  |  |                 ",HDeptID=" + omodel.HDeptID.ToString() + | 
 |  |  |                 ",HEmpID=" + omodel.HEmpID.ToString() + | 
 |  |  |                 ",HStopReason='" + omodel.HStopReason + "'" + | 
 |  |  |                 ",HStopType='" + omodel.HStopType + "'" + | 
 |  |  |                 ",HReportType='" + omodel.HReportType + "'" + | 
 |  |  |                 ",HBarCode='" + omodel.HBarCode + "'" + | 
 |  |  |                 ",HAddr='" + omodel.HAddr + "'" + | 
 |  |  |                 ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" + | 
 |  |  |                 ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "'" + | 
 |  |  |                 ",HWorkShiftID='" + omodel.HWorkShiftID + "'" + | 
 |  |  |                 " where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 //删除关联 | 
 |  |  |                 DeleteRelation(ref sReturn, lngBillKey); | 
 |  |  | 
 |  |  |                 DeleteBillSub(lngBillKey); | 
 |  |  |                 //插入子表 | 
 |  |  |                 omodel.HInterID = lngBillKey; | 
 |  |  |                 foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) | 
 |  |  |                 foreach (Models.ClsSc_MESStopWorkBillSub oSub in DetailColl) | 
 |  |  |                 { | 
 |  |  |                     //oCn.RunProc("Insert into Sc_MESStopWorkBillSub " + | 
 |  |  |                     //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + | 
 |  |  | 
 |  |  |                 //        return false; | 
 |  |  |                 //    } | 
 |  |  |                 //} | 
 |  |  |                 sReturn = "修改单据成功!"; | 
 |  |  |  | 
 |  |  |                 //保存后控制 | 
 |  |  |                 if (!AfterSave(lngBillKey, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 2, ref sReturn)) | 
 |  |  |                 { | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 sReturn = "单据号:" + omodel.HBillNo + " 修改成功!"; | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 DataSet ds; | 
 |  |  |                 //得到mainid | 
 |  |  |                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 //若MAINDI重复则重新获取 | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 //保存前控制 | 
 |  |  |                 if (!BeforeSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn)) | 
 |  |  |                 { | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //主表 | 
 |  |  |                 oCn.RunProc("Insert Into Sc_MESStopWorkBillMain " + | 
 |  |  |                 "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + | 
 |  |  |                 ",HYear,HPeriod,HRemark" + | 
 |  |  |                 ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + | 
 |  |  |                 ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + | 
 |  |  |                 ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStopBeginWorkTime,HStopEndWorkTime,HSourceID" + | 
 |  |  |                 ",HGroupID,HDeptID,HEmpID,HStopReason,HReportType,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + | 
 |  |  |                 ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" + | 
 |  |  |                 ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HStopType,HWorkShiftID" + | 
 |  |  |                 ") " + | 
 |  |  |                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker + "',getdate()" + | 
 |  |  |                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" + | 
 |  |  |                 "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + | 
 |  |  |                 "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + | 
 |  |  |                 ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate(),'" + omodel.HStopEndWorkTime.ToShortDateString() + "'," + omodel.HSourceID.ToString() + | 
 |  |  |                 "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HStopReason + "','" + omodel.HReportType + "','" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + | 
 |  |  |                 "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo.ToString() + "','" + omodel.HMainSourceBillType + "'" + | 
 |  |  |                 "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo.ToString() + "','" + omodel.HMainSourceBillType + "','"+ omodel.HStopType + "','" + omodel.HWorkShiftID + "'" + | 
 |  |  |                 ") "); | 
 |  |  |                 //插入子表 | 
 |  |  |                 foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) | 
 |  |  |  | 
 |  |  |                 //再次验证 保存是否 合理 | 
 |  |  |                 ds = oCn.RunProcReturn("exec h_p_JIT_MESStopWorkBill_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_MESStopWorkBill_SaveCtrl"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     //oCn.RunProc("Insert into Sc_MESStopWorkBillSub " + | 
 |  |  |                     //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + | 
 |  |  |                     //  ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + | 
 |  |  |                     //  ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
 |  |  |                     //  ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + | 
 |  |  |  | 
 |  |  |                     //  ") values(" | 
 |  |  |                     //  + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + | 
 |  |  |                     //  ",getdate()," + 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.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + | 
 |  |  |                     //  ") "); | 
 |  |  |                     sReturn = "无验证数据!"; | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 //foreach (Model.ClsSc_MESStopWorkBillSub_Item oSub2 in DetailColl1) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCn.RunProc("Insert into Sc_MESStopWorkBillSub_Item " + | 
 |  |  |                 //      " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + | 
 |  |  |                 //      ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + | 
 |  |  |                 //      ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
 |  |  |                 //      ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + | 
 |  |  |                 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; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //      ") values(" | 
 |  |  |                 //      + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + | 
 |  |  |                 //      ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + | 
 |  |  |                 //      "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + | 
 |  |  |                 //      "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + | 
 |  |  |                 //      ") "); | 
 |  |  |                 //} | 
 |  |  |                 // | 
 |  |  |                 //foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) | 
 |  |  |                 //{ | 
 |  |  |                 //    Ds = oCn.RunProcReturn("exec h_p_Sc_MESStopWorkBill_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 = "新增单据成功!"; | 
 |  |  |                 //保存后控制 | 
 |  |  |                 if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn)) | 
 |  |  |                 { | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sReturn = omodel.HInterID.ToString(); | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 DetailColl.Clear();//清空 | 
 |  |  |                 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     Model.ClsSc_MESStopWorkBillSub oSub = new Model.ClsSc_MESStopWorkBillSub(); | 
 |  |  |                     Models.ClsSc_MESStopWorkBillSub oSub = new Models.ClsSc_MESStopWorkBillSub(); | 
 |  |  |                     // 固定赋值=============================================== | 
 |  |  |                     //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); | 
 |  |  |                     //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //删除单据 | 
 |  |  |         public bool DeleteBill(Int64 lngBillKey, string HBillNo, string procName, string user, ref string sReturn) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 //判断是否允许删除 | 
 |  |  |                 DataSet ds = oCn.RunProcReturn("exec h_p_JIT_MESStopWorkBill_DelCtrl @HInterId=" + lngBillKey + "", "h_p_JIT_MESBeginWorkBill_SaveCtrl"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = "无验证数据!"; | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") | 
 |  |  |                 { | 
 |  |  |                     sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //删除关联关系 | 
 |  |  |                 oCn.RunProc("exec h_p_JIT_MESStopWorkBill_DelRelation @HInterId=" + lngBillKey + ""); | 
 |  |  |  | 
 |  |  |                 //删除明细表 | 
 |  |  |                 oCn.RunProc("Delete From " + MvarItemKeySub + "  where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 //删除主表 | 
 |  |  |                 oCn.RunProc("Delete From " + MvarItemKey + "  where HInterID=" + lngBillKey.ToString()); | 
 |  |  |  | 
 |  |  |                 //删除后控制==================================================================================       | 
 |  |  |                 string sql2 = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + user + "'"; | 
 |  |  |                 ds = oCn.RunProcReturn(sql2, procName); | 
 |  |  |                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |  | 
 |  |  |                     sReturn = "删除失败!原因:删除后判断失败,请与网络管理人员联系"; | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") | 
 |  |  |                 { | 
 |  |  |                     sReturn = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
 |  |  |                     oCn.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 //============================================================================================== | 
 |  |  |  | 
 |  |  |                 sReturn = "删除单据成功!"; | 
 |  |  |                 oCn.Commit(); | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 sReturn = e.Message; | 
 |  |  |                 oCn.RollBack(); | 
 |  |  |                 throw (e); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //审核 | 
 |  |  |         public bool CheckBill(Int64 lngBillKey, ref string sReturn) | 
 |  |  |         { | 
 |  |  |  | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HChecker = DBUtility.ClsPub.CurUserName; | 
 |  |  |                 string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); | 
 |  |  |                 oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 oCn.BeginTran(); | 
 |  |  |                 oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); | 
 |  |  |                 //根据开工单内码 设置 生产状态表 开工状态(先把 本资源全部工单 设置为非开工状态,再设置本单对应得源单 为开工状态) | 
 |  |  |                 oCn.RunProc("exec h_p_JIT_MESBeginWorkBill_BeginWork @HInterId=" + lngBillKey + ",@flag='停工'"); | 
 |  |  |                 oCn.Commit(); | 
 |  |  |  | 
 |  |  |                 //生成调拨单 | 
 |  |  |                 //得到调拨单 mainid 单据号 | 
 |  |  |                 //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |          | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |