using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsGy_RoutingBill:DBUtility.ClsXt_BaseBill { public Model.ClsGy_RoutingBillMain omodel = new Model.ClsGy_RoutingBillMain(); public List DetailColl = new List(); public ClsGy_RoutingBill() { base.MvarItemKeySub = "Gy_RoutingBillSub"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey="Gy_RoutingBillMain"; base.MvarReportTitle="工艺路线"; base.BillType="3301"; } #region 固定代码 ~ClsGy_RoutingBill() { DetailColl = null; } #endregion 自定义方法 //修改单据 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { try { // oCn.BeginTran(); //更新主表 oCn.RunProc("UpDate Gy_RoutingBillMain set " + ",HPRDORGID=" + omodel.HPRDORGID.ToString() + " HName='" + omodel.HName + "'" + ",HBillNo='" + omodel.HBillNo + "'" + ",HMaterTypeID=" + omodel.HMaterTypeID.ToString() + ",HMaterID=" + omodel.HMaterID.ToString() + ",HMaterNumber='" + omodel.HMaterNumber + "'" + ",HUnitID=" + omodel.HUnitID.ToString() + ",HUnitNumber='" + omodel.HUnitNumber + "'" + ",HRoutingGroupID=" + omodel.HRoutingGroupID.ToString() + ",HStandard=" + DBUtility.ClsPub.BoolToString(omodel.HStandard) + ",HDate='" + omodel.HDate + "'" + ",HYear=" + omodel.HYear.ToString() + "" + ",HPeriod=" + omodel.HPeriod.ToString() + "" + ",HUpDater='" + omodel.HUpDater + "'" + ",HUpDateDate='" + omodel.HUpDateDate + "'" + ",HRemark='" + omodel.HRemark + "'" + ",HMainGroupID=" + omodel.HMainGroupID.ToString() + ",HMainProcID=" + omodel.HMainProcID.ToString() + ",HMainCenterID=" + omodel.HMainCenterID.ToString() + ",HMainTimeUnit='" + omodel.HMainTimeUnit.ToString() + "'" + ",HMainUnitTime=" + omodel.HMainUnitTime.ToString() + ",HMainWorkQty=" + omodel.HMainWorkQty.ToString() + ",HMainPrice=" + omodel.HMainPrice.ToString() + ",HStdSourceQty=" + omodel.HStdSourceQty.ToString() + ",HAddSourceRate=" + omodel.HAddSourceRate.ToString() + ",HDelSourceRate=" + omodel.HDelSourceRate.ToString() + ",HPicNumVer='" + omodel.HPicNumVer.ToString() + "'" + ",HPicNumAssemble='" + omodel.HPicNumAssemble.ToString() + "'" + ",HMaterTexture='" + omodel.HMaterTexture.ToString() + "'" + ",HProductNum='" + omodel.HProductNum.ToString() + "'" + ",HVerNum='" + omodel.HVerNum.ToString() + "'" + " where HInterID=" + lngBillKey.ToString()); //删除关联 DeleteRelation(ref sReturn, lngBillKey); //删除子表 DeleteBillSub(lngBillKey); //插入子表 omodel.HInterID = lngBillKey; foreach (Model.ClsGy_RoutingBillSub oSub in DetailColl) { oCn.RunProc("Insert into Gy_RoutingBillSub " + "(HInterID,HEntryID,HProcID,HProcNO,HSupID,HSupFlag" + ",HWorkQty,HCenterID,HTimeUnit,HUnitTime" + ",HReadyTime,HQueueTime,HMoveTime" + ",HCloseMan,HCloseType,HRemark,HProcType,HNextProcFlag,HFlowProc" + ",HFixPrice,HProcPrice,HBadPrice,HWasterPrice,HStdFlag,HBeginDayQty,HBeginFixQty"+ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HAutoTrunFlag" + ",HFixWorkDays,HTrunWorkDays,HReadyTimes,HICMOReadyTimes,HSubStdEmpQty,HSubCanUseSourceQty" + ",HProcID_S,HCenterID_S,HWorkQty_S,HSubStdEmpQty_S,HMouldNo,HChangeMould" + ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" + ",HTechnologyParameter,HPicNum,HProcCheckNote" + ",HOverRate" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HProcNo.ToString() + "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" + "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() + "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HProcType + "'," + Convert.ToString(oSub.HNextProcFlag ? 1 : 0) + "," + Convert.ToString(oSub.HFlowProc ? 1 : 0) + "," + oSub.HFixPrice.ToString() + "," + oSub.HProcPrice.ToString() + "," + oSub.HBadPrice.ToString() + "," + oSub.HWasterPrice.ToString() + "," + Convert.ToString(oSub.HStdFlag ? 1 : 0) + "," + oSub.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + Convert.ToString(oSub.HAutoTrunFlag ? 1 : 0) + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() + "," + oSub.HICMOReadyTimes.ToString() + "," + oSub.HSubStdEmpQty.ToString() + "," + oSub.HSubCanUseSourceQty.ToString() + "," + oSub.HProcID_S.ToString() + "," + oSub.HCenterID_S.ToString() + "," + oSub.HWorkQty_S.ToString() + "," + oSub.HSubStdEmpQty_S.ToString() + ",'" + oSub.HMouldNo + "'," + oSub.HChangeMould.ToString() + ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() + ",'" + oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() + "', " + oSub.HOverRate.ToString() + ") "); } // oCn.RunProc("exec h_p_Gy_RoutingBillCheck " + omodel.HInterID.ToString()); //设置默认工艺路线 //oCn.RunProc("exec h_p_Sc_ProcessExchangeBillSetUpdate " + omodel.HInterID.ToString()); //设置首道末道 流转标记 等 字段。 // //判断是否重复工序号 DataSet ds = oCn.RunProcReturn("exec h_p_Gy_RoutingCtrl " + omodel.HInterID.ToString(), "h_p_Gy_RoutingCtrl"); if (ds == null || ds.Tables[0].Rows.Count == 0) { sReturn = "判断重复工序号失败!"; oCn.RollBack(); return false; } else { if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) == "2") { sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); oCn.RollBack(); 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(); //string BillType1 = this.BillType; //string HInterID = omodel.HInterID.ToString(); //string HBillNo = omodel.HBillNo; //DateTime HDate = omodel.HDate; //string HYear = omodel.HYear.ToString(); //string HPeriod = omodel.HPeriod.ToString(); //string HRemark = omodel.HRemark; //string CurUserName = DBUtility.ClsPub.CurUserName; //string HMaterID = omodel.HMaterID.ToString(); //string HName = omodel.HName; //string HMaterTypeID = omodel.HMaterTypeID.ToString(); //string HRoutingGroupID = omodel.HRoutingGroupID.ToString(); //string HUnitID = omodel.HUnitID.ToString(); //string HMaterNumber = omodel.HMaterNumber; //string HUnitNumber = omodel.HUnitNumber; //string HStandard = DBUtility.ClsPub.BoolToString(omodel.HStandard); //string HMainGroupID = omodel.HMainGroupID.ToString(); //string HMainProcID = omodel.HMainProcID.ToString(); //string HMainCenterID = omodel.HMainCenterID.ToString(); //string HMainTimeUnit = omodel.HMainTimeUnit; //string HMainUnitTime = omodel.HMainUnitTime.ToString(); //string HMainWorkQty = omodel.HMainWorkQty.ToString(); //string HMainPrice = omodel.HMainPrice.ToString(); //string HStdSourceQty = omodel.HStdSourceQty.ToString(); //string HAddSourceRate = omodel.HAddSourceRate.ToString(); //string HDelSourceRate = omodel.HDelSourceRate.ToString(); //string HPicNumVer = omodel.HPicNumVer.ToString(); //string HPicNumAssemble = omodel.HPicNumAssemble.ToString(); //string HMaterTexture = omodel.HMaterTexture.ToString(); //string HProductNum = omodel.HProductNum.ToString(); //string HVerNum = omodel.HVerNum.ToString(); //主表 //oCn.RunProc("Insert Into Gy_RoutingBillMain " + //"(HBillType,HInterID,HBillNo,HDate" + //",HYear,HPeriod,HRemark,HMaker,Hmakedate,HMaterID,HName,HMaterTypeID" + //",HRoutingGroupID,HUnitID,HMaterNumber,HUnitNumber,HStandard" + //",HMainGroupID,HMainProcID,HMainCenterID,HMainTimeUnit,HMainUnitTime,HMainWorkQty" + //",HMainPrice,HStdSourceQty,HAddSourceRate,HDelSourceRate" + //",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HPRDORGID,HVerNum" + //") " + //" values('" + this.BillType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + //"," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()," + omodel.HMaterID.ToString() + ",'" + omodel.HName + "'," + omodel.HMaterTypeID.ToString() + //",'" + omodel.HRoutingGroupID.ToString() + "'," + omodel.HUnitID.ToString() + ",'" + omodel.HMaterNumber + "','" + omodel.HUnitNumber + "'," + DBUtility.ClsPub.BoolToString(omodel.HStandard) + //"," + omodel.HMainGroupID.ToString() + "," + omodel.HMainProcID.ToString() + "," + omodel.HMainCenterID.ToString() + ",'" + omodel.HMainTimeUnit + "'," + omodel.HMainUnitTime.ToString() + "," + omodel.HMainWorkQty.ToString() + //"," + omodel.HMainPrice.ToString() + "," + omodel.HStdSourceQty.ToString() + "," + omodel.HAddSourceRate + "," + omodel.HDelSourceRate.ToString() + //",'" + omodel.HPicNumVer.ToString() + "','" + omodel.HPicNumAssemble.ToString() + "','" + omodel.HMaterTexture.ToString() + "','" + omodel.HProductNum.ToString() + "','"+omodel.HPRDORGID.ToString()+"','" + omodel.HVerNum.ToString() + "'"+ //") "); oCn.RunProc("Insert Into Gy_RoutingBillMain " + "(HBillType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,Hmakedate,HMaterID,HName,HMaterTypeID" + ",HRoutingGroupID,HUnitID,HMaterNumber,HUnitNumber,HStandard" + ",HMainGroupID,HMainProcID,HMainCenterID,HMainTimeUnit,HMainUnitTime,HMainWorkQty" + ",HMainPrice,HStdSourceQty,HAddSourceRate,HDelSourceRate" + ",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HPRDORGID,HVerNum,HOrgID" + ") " + " values('" + this.BillType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()," + omodel.HMaterID.ToString() + ",'" + omodel.HName + "'," + omodel.HMaterTypeID.ToString() + ",'" + omodel.HRoutingGroupID.ToString() + "'," + omodel.HUnitID.ToString() + ",'" + omodel.HMaterNumber + "','" + omodel.HUnitNumber + "'," + DBUtility.ClsPub.BoolToString(omodel.HStandard) + "," + omodel.HMainGroupID.ToString() + "," + omodel.HMainProcID.ToString() + "," + omodel.HMainCenterID.ToString() + ",'" + omodel.HMainTimeUnit + "'," + omodel.HMainUnitTime.ToString() + "," + omodel.HMainWorkQty.ToString() + "," + omodel.HMainPrice.ToString() + "," + omodel.HStdSourceQty.ToString() + "," + omodel.HAddSourceRate + "," + omodel.HDelSourceRate.ToString() + ",'" + omodel.HPicNumVer.ToString() + "','" + omodel.HPicNumAssemble.ToString() + "','" + omodel.HMaterTexture.ToString() + "','" + omodel.HProductNum.ToString() + "','" + omodel.HPRDORGID.ToString() + "','" + omodel.HVerNum.ToString() + "'," + DBUtility.ClsPub.HOrgID + ") "); //插入子表 foreach (Model.ClsGy_RoutingBillSub oSub in DetailColl) { oCn.RunProc("Insert into Gy_RoutingBillSub " + "(HInterID,HEntryID,HProcID,HProcNO,HSupID,HSupFlag" + ",HWorkQty,HCenterID,HTimeUnit,HUnitTime" + ",HReadyTime,HQueueTime,HMoveTime" + ",HCloseMan,HCloseType,HRemark,HProcType,HNextProcFlag,HFlowProc" + ",HFixPrice,HProcPrice,HBadPrice,HWasterPrice,HStdFlag,HBeginDayQty,HBeginFixQty" + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HAutoTrunFlag" + ",HFixWorkDays,HTrunWorkDays,HReadyTimes,HICMOReadyTimes,HSubStdEmpQty,HSubCanUseSourceQty" + ",HProcID_S,HCenterID_S,HWorkQty_S,HSubStdEmpQty_S,HMouldNo,HChangeMould" + ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" + ",HTechnologyParameter,HPicNum,HProcCheckNote" + ",HOverRate,HProcWorkNum" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HProcNo.ToString() + "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" + "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() + "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HProcType + "'," + Convert.ToString(oSub.HNextProcFlag ? 1 : 0) + "," + Convert.ToString(oSub.HFlowProc ? 1 : 0) + "," + oSub.HFixPrice.ToString() + "," + oSub.HProcPrice.ToString() + "," + oSub.HBadPrice.ToString() + "," + oSub.HWasterPrice.ToString() + "," + Convert.ToString(oSub.HStdFlag ? 1 : 0) + "," + oSub.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + Convert.ToString(oSub.HAutoTrunFlag ? 1 : 0) + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() + "," + oSub.HICMOReadyTimes.ToString() + "," + oSub.HSubStdEmpQty.ToString() + "," + oSub.HSubCanUseSourceQty.ToString() + "," + oSub.HProcID_S.ToString() + "," + oSub.HCenterID_S.ToString() + "," + oSub.HWorkQty_S.ToString() + ", " + oSub.HSubStdEmpQty_S.ToString() + ",'" + oSub.HMouldNo + "'," + oSub.HChangeMould.ToString() + ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() + ",'"+ oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() + "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'" + ") "); } // oCn.RunProc("exec h_p_Gy_RoutingBillCheck " + omodel.HInterID.ToString()); //设置默认工艺路线 //oCn.RunProc("exec h_p_Sc_ProcessExchangeBillSetUpdate " + omodel.HInterID.ToString()); //设置首道末道 流转标记 等 字段。 // //判断是否重复工序号 DataSet ds = oCn.RunProcReturn("exec h_p_Gy_RoutingCtrl " + omodel.HInterID.ToString(), "h_p_Gy_RoutingCtrl"); if (ds == null || ds.Tables[0].Rows.Count == 0) { sReturn = "判断重复工序号失败!"; oCn.RollBack(); return false; } else { if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) == "2") { sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); oCn.RollBack(); 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) { try { //查询主表 DataSet Ds ; Ds = oCn.RunProcReturn("Select * from Gy_RoutingBillMain Where HInterID=" + lngBillKey.ToString()+" and HPRDORGID='"+DBUtility.ClsPub.HOrgID.ToString()+"'", "Gy_RoutingBillMain"); if(Ds.Tables[0].Rows.Count==0) { sReturn = "单据未找到!"; return false; } //赋值 omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()); omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); omodel.HName = Ds.Tables[0].Rows[0]["HName"].ToString().Trim(); omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"].ToString().Trim()); omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"].ToString()); omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"].ToString()); omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel.HUseFlag = DBUtility.ClsPub.GridToBool(Ds.Tables[0].Rows[0]["HUseFlag"]); omodel.HStandard = DBUtility.ClsPub.GridToBool(Ds.Tables[0].Rows[0]["HStandard"]); omodel.HMaterNumber = Ds.Tables[0].Rows[0]["HMaterNumber"].ToString().Trim(); omodel.HUnitNumber = Ds.Tables[0].Rows[0]["HUnitNumber"].ToString().Trim(); omodel.HMaterTypeID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterTypeID"].ToString()); omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"].ToString()); omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"].ToString()); omodel.HRoutingGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRoutingGroupID"].ToString()); omodel.HMainGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainGroupID"].ToString()); // omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].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(); omodel.HUseDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HUseDate"]); omodel.HUseMan = Ds.Tables[0].Rows[0]["HUseMan"].ToString().Trim(); omodel.HMainProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainProcID"].ToString()); omodel.HMainCenterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainCenterID"].ToString()); omodel.HMainTimeUnit = Ds.Tables[0].Rows[0]["HMainTimeUnit"].ToString().Trim(); omodel.HMainUnitTime = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainUnitTime"].ToString()); omodel.HMainWorkQty = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HMainWorkQty"].ToString()); omodel.HMainPrice = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HMainPrice"].ToString()); omodel.HStdSourceQty = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HStdSourceQty"].ToString()); omodel.HAddSourceRate = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HAddSourceRate"].ToString()); omodel.HDelSourceRate = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HDelSourceRate"].ToString()); omodel.HPicNumVer = Ds.Tables[0].Rows[0]["HPicNumVer"].ToString().Trim(); omodel.HPicNumAssemble = Ds.Tables[0].Rows[0]["HPicNumAssemble"].ToString().Trim(); omodel.HMaterTexture = Ds.Tables[0].Rows[0]["HMaterTexture"].ToString().Trim(); omodel.HProductNum = Ds.Tables[0].Rows[0]["HProductNum"].ToString().Trim(); omodel.HVerNum = Ds.Tables[0].Rows[0]["HVerNum"].ToString().Trim(); //循环 DataSet DsSub ; DsSub = oCn.RunProcReturn("Select * from Gy_RoutingBillSub Where HInterID=" + lngBillKey.ToString() + " Order by HEntryID ", "Gy_RoutingBillSub"); DetailColl.Clear();//清空 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { Model.ClsGy_RoutingBillSub oSub = new Model.ClsGy_RoutingBillSub(); oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); // oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]); oSub.HCenterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCenterID"]); oSub.HProcNo = DBUtility.ClsPub.isInt(DsSub.Tables[0].Rows[i]["HProcNo"]); oSub.HUnitTime = DBUtility.ClsPub.isInt(DsSub.Tables[0].Rows[i]["HUnitTime"]); oSub.HWorkQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWorkQty"]); oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); oSub.HTimeUnit = DsSub.Tables[0].Rows[i]["HTimeUnit"].ToString().Trim(); oSub.HReadyTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HReadyTime"]); oSub.HQueueTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HQueueTime"]); oSub.HMoveTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoveTime"]); // oSub.HProcID_S = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID_S"]); oSub.HCenterID_S = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCenterID_S"]); oSub.HMouldNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMouldNo"]); oSub.HPackStd = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPackStd"]); oSub.HPack = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPack"]); oSub.HPutArea = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPutArea"]); oSub.HWorkQty_S = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWorkQty_S"]); oSub.HSubStdEmpQty_S = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HSubStdEmpQty_S"]); oSub.HChangeMould = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HChangeMould"]); oSub.HMyWorkDays = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMyWorkDays"]); oSub.HMyFixWorkDays = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMyFixWorkDays"]); // oSub.HCloseMan = DsSub.Tables[0].Rows[i]["HCloseMan"].ToString().Trim(); oSub.HCloseType =DBUtility.ClsPub.isBool( DsSub.Tables[0].Rows[i]["HCloseType"]); 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.HFixPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HFixPrice"]); oSub.HProcPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HProcPrice"]); oSub.HBadPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadPrice"]); oSub.HWasterPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterPrice"]); oSub.HStdFlag = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HStdFlag"]); oSub.HBeginDayQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginDayQty"]); oSub.HBeginFixQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginFixQty"]); oSub.HAutoTrunFlag = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HAutoTrunFlag"]); oSub.HFixWorkDays = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HFixWorkDays"]); oSub.HTrunWorkDays = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTrunWorkDays"]); oSub.HReadyTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HReadyTimes"]); oSub.HICMOReadyTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HICMOReadyTimes"]); oSub.HSubStdEmpQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSubStdEmpQty"]); oSub.HSubCanUseSourceQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSubCanUseSourceQty"]); oSub.HProcType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcType"]); oSub.HPassRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPassRate"]); oSub.HSumPassRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSumPassRate"]); oSub.HSupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSupID"]); oSub.HSupFlag = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HSupFlag"]); oSub.HNextProcFlag = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HNextProcFlag"]); oSub.HFlowProc = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HFlowProc"]); oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTechnologyParameter"]); oSub.HPicNum = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPicNum"]); oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcCheckNote"]); oSub.HOverRate = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HOverRate"]); DetailColl.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //启用工艺路线 public bool Sub_RoutingCheckAndUsed(Int64 HInterID) { try { string HChecker = DBUtility.ClsPub.CurUserName; oCn.RunProc("EXEC h_p_Gy_RoutingCheckAndUsed " + HInterID.ToString() + ",'" + HChecker + "'"); return true; } catch (Exception e) { throw (e); } } //反启用工艺路线 public bool Sub_RoutingUsed_Back(Int64 HInterID) { try { oCn.RunProc("EXEC h_p_Gy_RoutingUsed_Back " + HInterID.ToString()); return true; } catch (Exception e) { throw (e); } } //产品是否已存在工艺路线 public bool IsExistRouting(Int64 HMaterID) { DataSet Ds = new DataSet(); Ds = oCn.RunProcReturn("select * from Gy_RoutingBillMain where hmaterid=" + HMaterID, "Gy_RoutingBillMain"); if (Ds.Tables[0].Rows.Count > 0) { return true; } else { return false; } } //根据产品内码 删除工艺 public bool DeleteByMaterID(Int64 HMaterID) { try { oCn.RunProc("Delete from Gy_RoutingBillMain where HMaterID=" + HMaterID.ToString()); return true; } catch (Exception e) { return false; } } } }