|  |  | 
 |  |  |         Gy_RoutingBill_temporary omdelMian = new Gy_RoutingBill_temporary(); | 
 |  |  |         public string BillType = "3301"; | 
 |  |  |  | 
 |  |  |         #region 工艺路线 列表 | 
 |  |  |         #region 未知 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 返回工艺路线列表 | 
 |  |  |         /// 未知 | 
 |  |  |         ///参数:string sql。 | 
 |  |  |         ///返回值:object。 | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_MES_StationEntrustOutBillList " + sWhere, "h_v_MES_StationEntrustOutBillList"); | 
 |  |  |                     ds = oCN.RunProcReturn("select  * from h_v_MES_StationEntrustOutBillList " + sWhere, "h_v_MES_StationEntrustOutBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     string sql1 = "select * from h_v_MES_StationEntrustOutBillList where 1 = 1 "; | 
 |  |  |                     string sql1 = "select  * from h_v_MES_StationEntrustOutBillList where 1 = 1 "; | 
 |  |  |                     string sql = sql1 + sWhere; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_MES_StationEntrustOutBillList"); | 
 |  |  |                 } | 
 |  |  | 
 |  |  |             string msg2 = sArray[0].ToString(); | 
 |  |  |             string msg3 = sArray[1].ToString(); | 
 |  |  |  | 
 |  |  |             int hentryid = int.Parse(sArray[2].ToString());//子表的顺序id | 
 |  |  |             int OperationType = int.Parse(sArray[3].ToString());//数据类型 1添加 3修改 | 
 |  |  |             string user = sArray[4].ToString();//用户名 | 
 |  |  |             //int hentryid = int.Parse(sArray[2].ToString());//子表的顺序id | 
 |  |  |             int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 | 
 |  |  |             string user = sArray[3].ToString();//用户名 | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断是否有编辑权限 | 
 |  |  | 
 |  |  |  | 
 |  |  |                 msg2 = "[" + msg2.ToString() + "]"; | 
 |  |  |                 List<Gy_RoutingBill> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_RoutingBill>>(msg2); | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 long HInterID = mainList[0].HInterID;//递入type得到的单据ID | 
 |  |  |                 string HBillNo = mainList[0].HBillNo;//递入type得到的单据号 | 
 |  |  |                 DateTime HDate = mainList[0].HDate;//日期 | 
 |  |  | 
 |  |  |                 double HStdSourceQty = mainList[0].HStdSourceQty;//标准资源数 | 
 |  |  |                 double HAddSourceRate = mainList[0].HAddSourceRate;//加资源增量 | 
 |  |  |                 double HDelSourceRate = mainList[0].HDelSourceRate;//减资源减量 | 
 |  |  |                 int HPRDORGID = mainList[0].HPRDORGID;  //生产组织 | 
 |  |  |                 int HPRDORGID = mainList[0].HOrgID;  //生产组织 | 
 |  |  |                 int HOrgID = mainList[0].HOrgID;  //组织 | 
 |  |  |                 string HPicNumVer = mainList[0].HPicNumVer;//图号版本 | 
 |  |  |                 string HPicNumAssemble = mainList[0].HPicNumAssemble;//总装图号 | 
 |  |  | 
 |  |  |                 string HProductNum = mainList[0].HProductNum;//成品编号 | 
 |  |  |                 string HVerNum = mainList[0].HVerNum;//版本 | 
 |  |  |  | 
 |  |  |                 if (OperationType == 1)//新增 | 
 |  |  |                 if (OperationType == 2) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where  单据号='" + HBillNo + "'", "h_v_Gy_RoutingBillList"); | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据号重复,请重新输入!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where hmainid=" + HInterID + " and 单据号='" + HBillNo + "'", "h_v_Gy_RoutingBillList"); | 
 |  |  |  | 
 |  |  |                 if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增 | 
 |  |  |                 { | 
 |  |  |                     //主表 | 
 |  |  |                     oCN.RunProc("Insert Into Gy_RoutingBillMain   " + | 
 |  |  | 
 |  |  |                     "," + HRoutingGroupID + "," + HUnitID + ",'" + HMaterNumber + "','" + HUnitNumber + "'," + Convert.ToString(HStandard ? 1 : 0) + | 
 |  |  |                     "," + HMainGroupID + "," + HMainProcID + "," + HMainCenterID + ",'" + HMainTimeUnit + "'," + HMainUnitTime + "," + HMainWorkQty + | 
 |  |  |                     "," + HMainPrice + "," + HStdSourceQty + "," + HAddSourceRate + "," + HPRDORGID + "," + HDelSourceRate + | 
 |  |  |                     ",'"+ HPicNumVer + "','" + HPicNumAssemble + "','" + HMaterTexture + "','" + HProductNum + "','" + HVerNum + "',"+ HOrgID + ") "); | 
 |  |  |                     ",'" + HPicNumVer + "','" + HPicNumAssemble + "','" + HMaterTexture + "','" + HProductNum + "','" + HVerNum + "'," + HOrgID + ") "); | 
 |  |  |                 } | 
 |  |  |                 else if (OperationType == 3) | 
 |  |  |                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) | 
 |  |  |                 { //修改 | 
 |  |  |                     oCN.RunProc("update Gy_RoutingBillMain  set " + | 
 |  |  |                        "HDate='" + HDate + | 
 |  |  | 
 |  |  |                         ",HProductNum='" + HProductNum + "',HVerNum='" + HVerNum + "' where HInterID='" + HInterID + "'"); | 
 |  |  |  | 
 |  |  |                     //删除子表 | 
 |  |  |                     oCN.RunProc("delete from Gy_RoutingBillSub where HInterID='" + HInterID + "' and HEntryID='" + hentryid + "'"); | 
 |  |  |                     oCN.RunProc("delete from Gy_RoutingBillSub where HInterID='" + HInterID + "' and HProcNo!='9999'"); | 
 |  |  |                 } | 
 |  |  |                 //保存子表 | 
 |  |  |                 objJsonResult = AddBillSub(msg3, HInterID, hentryid); | 
 |  |  |                 objJsonResult = AddBillSub(msg3, HInterID, OperationType); | 
 |  |  |                 if (objJsonResult.code == "0") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 if (OperationType == 1) | 
 |  |  |                 { | 
 |  |  |                      | 
 |  |  |  | 
 |  |  |                     if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public json AddBillSub(string msg3, long HInterID, int hentryid) | 
 |  |  |         public json AddBillSub(string msg3, long HInterID,int OperationType) | 
 |  |  |         { | 
 |  |  |             List<Gy_RoutingBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_RoutingBillSub>>(msg3); | 
 |  |  |             int i = 0; | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 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(" | 
 |  |  |                   + HInterID + "," + (hentryid==-1?i: hentryid) + "," + oSub.HProcID.ToString() + ",'" + (hentryid == -1 ? i : hentryid) + "'," + 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() + "'" + | 
 |  |  |                   ") "); | 
 |  |  |                 if (oSub.HProcNo != "9999" || OperationType == 2) | 
 |  |  |                 { | 
 |  |  |                     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(" | 
 |  |  |                     + HInterID + "," + i + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNo + "'," + 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() + "'" + | 
 |  |  |                     ") "); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             objJsonResult.code = "1"; | 
 |  |  | 
 |  |  |                 file.SaveAs(ExcelPath); | 
 |  |  |  | 
 |  |  |                 NpoiHelper np = new NpoiHelper(); | 
 |  |  |                 DataSet ExcelDs = np.ReadExcel(ExcelPath, 1,2, WorkBookName); | 
 |  |  |                 DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 2, WorkBookName); | 
 |  |  |  | 
 |  |  |                 //删除文件 | 
 |  |  |                 File.Delete(ExcelPath); | 
 |  |  | 
 |  |  |  | 
 |  |  |                 if (!tb2.Columns.Contains("工序")) | 
 |  |  |                     error += "没有找到【工序】的标题,"; | 
 |  |  |                | 
 |  |  |  | 
 |  |  |                 if (!tb2.Columns.Contains("工作中心")) | 
 |  |  |                     error += "没有找到【工作中心】的标题,"; | 
 |  |  |  | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = $"Excel模板存在错误,{error}\r\n" ; | 
 |  |  |                     objJsonResult.Message = $"Excel模板存在错误,{error}\r\n"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                                 , 良率, 工序工价, 不合格单价, 报废单价, 本道固定开工天数, 本道开工余量, 上道等待天数 | 
 |  |  |                                 , 上道循环周期, 自动转移, 外协标记, 供应商代码, 供应商, 工艺参数, 图纸编号 | 
 |  |  |                                 , 本工序确认记录, 备注, 图号版本, 总装图号, 材质, 成品编号, 版本 | 
 |  |  |                                 , 模具编号, 程序号, 班产定额, 工艺路线名称, 时间单位)values | 
 |  |  |                                 , 模具编号, 程序号, 班产定额, 工艺路线名称, 时间单位,工艺路线代码)values | 
 |  |  |                                 ('" + tb2.Rows[i]["产品代码"].ToString() + "','" + tb2.Rows[i]["产品名称"].ToString() + "','" + tb2.Rows[i]["工序序号"].ToString() + "','" + tb2.Rows[i]["工序代码"].ToString() + "','" + tb2.Rows[i]["工序"].ToString() + "','" + tb2.Rows[i]["工作中心"].ToString() + "','" + tb2.Rows[i]["加工数量"].ToString() + "'" + | 
 |  |  |                                 ",'" + tb2.Rows[i]["良率"].ToString() + "','" + (tb2.Rows[i]["工序工价"].ToString()==""?"0": tb2.Rows[i]["工序工价"].ToString()) + "','" + tb2.Rows[i]["不合格单价"].ToString() + "','" + tb2.Rows[i]["报废单价"].ToString() + "','" + tb2.Rows[i]["本道固定开工天数"].ToString() + "','" + tb2.Rows[i]["本道开工余量"].ToString() + "','" + tb2.Rows[i]["上道等待天数"].ToString() + "'" + | 
 |  |  |                                 ",'" + tb2.Rows[i]["良率"].ToString() + "','" + (tb2.Rows[i]["工序工价"].ToString() == "" ? "0" : tb2.Rows[i]["工序工价"].ToString()) + "','" + tb2.Rows[i]["不合格单价"].ToString() + "','" + tb2.Rows[i]["报废单价"].ToString() + "','" + tb2.Rows[i]["本道固定开工天数"].ToString() + "','" + tb2.Rows[i]["本道开工余量"].ToString() + "','" + tb2.Rows[i]["上道等待天数"].ToString() + "'" + | 
 |  |  |                                 ",'" + tb2.Rows[i]["上道循环周期"].ToString() + "','" + tb2.Rows[i]["自动转移"].ToString() + "','" + tb2.Rows[i]["外协标记"].ToString() + "','" + tb2.Rows[i]["供应商代码"].ToString() + "','" + tb2.Rows[i]["供应商"].ToString() + "','" + tb2.Rows[i]["工艺参数"].ToString() + "','" + tb2.Rows[i]["图纸编号"].ToString() + "'" + | 
 |  |  |                                 ",'" + tb2.Rows[i]["本工序确认记录"].ToString() + "','" + tb2.Rows[i]["备注"].ToString() + "','" + tb2.Rows[i]["图号版本"].ToString() + "','" + tb2.Rows[i]["总装图号"].ToString() + "','" + tb2.Rows[i]["材质"].ToString() + "','" + tb2.Rows[i]["成品编号"].ToString() + "','" + tb2.Rows[i]["版本"].ToString() + "'" + | 
 |  |  |                                 ",'" + tb2.Rows[i]["模具编号"].ToString() + "','" + tb2.Rows[i]["程序号"].ToString() + "','" + tb2.Rows[i]["班产定额"].ToString() + "','" + tb2.Rows[i]["工艺路线名称"].ToString() + "','" + tb2.Rows[i]["时间单位"].ToString() + "')"); | 
 |  |  |                                 ",'" + tb2.Rows[i]["模具编号"].ToString() + "','" + tb2.Rows[i]["程序号"].ToString() + "','" + tb2.Rows[i]["班产定额"].ToString() + "','" + tb2.Rows[i]["工艺路线名称"].ToString() + "','" + tb2.Rows[i]["时间单位"].ToString() + "','" + tb2.Rows[i]["工艺路线代码"].ToString() + "')"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  | 
 |  |  |                 omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Gy_RoutingBill_temporary>(msg2); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select  distinct 产品代码 from  diyipi ", "diyipi"); | 
 |  |  |                 ds = oCN.RunProcReturn("select  distinct 产品代码,isnull(工艺路线代码,'') 工艺路线代码 from  diyipi ", "diyipi"); | 
 |  |  |  | 
 |  |  |                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     var HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);//获得一个新的单据号 | 
 |  |  |                     var HBillNo = ds.Tables[0].Rows[i]["工艺路线代码"].ToString();//获得一个新的单据号 | 
 |  |  |                     if (HBillNo == "") | 
 |  |  |                     { | 
 |  |  |                         DataSet dataSet = oCN.RunProcReturn($"select HBillNo  from  Gy_RoutingBillMain where HBillNo='1' ", "Gy_RoutingBillMain"); | 
 |  |  |                         while (1 == 1) | 
 |  |  |                         { | 
 |  |  |                             if (HBillNo != "") | 
 |  |  |                             { | 
 |  |  |                                 if (dataSet.Tables[0].Rows.Count == 0) | 
 |  |  |                                 { | 
 |  |  |                                     break; | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                             HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); | 
 |  |  |                             dataSet = oCN.RunProcReturn($"select HBillNo  from  Gy_RoutingBillMain where HBillNo='{HBillNo}' ", "Gy_RoutingBillMain"); | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                     var HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//获得一个新的id | 
 |  |  |                     oCN.RunProc($"exec Gy_RoutingBill_Excel '{ds.Tables[0].Rows[i]["产品代码"].ToString()}',{HInterID},'{HBillNo}','{user}',{omdelMian.HOrgID},{omdelMian.HTProcessFlag} "); | 
 |  |  |                 } |