| | |
| | | |
| | | //创建临时表 |
| | | DataTable tb2 = new DataTable("dt2"); |
| | | DataTable tb3 = new DataTable("dt3"); |
| | | |
| | | //添加列名 |
| | | for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string hnumber = ""; |
| | | if (tb2.Rows.Count > 0) |
| | | { |
| | | hnumber = DBUtility.ClsPub.isStrNull(tb2.Rows[0]["产品代码"].ToString()); |
| | | } |
| | | |
| | | for (int i = 0; i <= tb2.Rows.Count - 1; i++) |
| | | { |
| | | string sHNumber = ""; |
| | | if (DBUtility.ClsPub.isStrNull(tb2.Rows[i]["产品代码"].ToString()) != "") |
| | | { |
| | | // |
| | | sHNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["产品代码"].ToString()); |
| | | //审核代码是否合理 |
| | | if (!DBUtility.ClsPub.AllowNumber(sHNumber)) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (hnumber == DBUtility.ClsPub.isStrNull(tb2.Rows[i]["产品代码"].ToString())) |
| | | //得到物料内码 |
| | | if (!oMaterHlp.GetInfoByNumber(sHNumber)) |
| | | { |
| | | //得到物料内码 |
| | | if (!oMaterHlp.GetInfoByNumber(sHNumber)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i+1).ToString() + "行," + sHNumber + "没有找到对应的物料!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hnumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["产品代码"].ToString()); |
| | | sHNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["产品代码"].ToString()); |
| | | |
| | | //审核代码是否合理 |
| | | if (!DBUtility.ClsPub.AllowNumber(sHNumber)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "物料代码中不能出现连续‘.’并且首位末位不能为‘.’!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //得到物料内码 |
| | | if (!oMaterHlp.GetInfoByNumber(sHNumber)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1).ToString() + "行," + sHNumber + "没有找到对应的物料!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + (i + 1).ToString() + "行," + sHNumber + "没有找到对应的物料!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | |
| | | public string HPeriod; |
| | | public string DataAppend; |
| | | public string HOrgID; |
| | | public Int64 HTProcessFlag; |
| | | } |
| | | |
| | | [Route("Gy_RoutingBill/Gy_RoutingBill_btnSave")] |
| | |
| | | HProcID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | |
| | | //获取工作中心 |
| | | ds = oCN.RunProcReturn("select * from Gy_WorkCenter Where HNumber='" + list[i]["工作中心代码"].ToString() + "'", "Gy_WorkCenter"); |
| | | ds = oCN.RunProcReturn("select * from Gy_WorkCenter Where HName='" + list[i]["工作中心"].ToString() + "'", "Gy_WorkCenter"); |
| | | var HCenterID = "0"; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | HCenterID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | HCenterID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | |
| | | var HProcNo = list[i]["工序序号"].ToString(); |
| | | var HTimeUnit = list[i]["时间单位"].ToString(); |
| | |
| | | var HProcWorkNum = list[i]["程序号"].ToString(); |
| | | //物料分类 |
| | | |
| | | oCN.RunProc("Insert into Gy_RoutingBillSub (HInterID,HEntryID,HSupID,HProcID,HCenterID,HProcNO,HTimeUnit" + |
| | | ", hworkqty, HFixPrice, HBadPrice, HWasterPrice, HBeginFixQty, HBeginDayQty, HFixWorkDays" + |
| | | ", HTrunWorkDays, HAutoTrunFlag, HSupFlag, HTechnologyParameter, HPicNum, HProcCheckNote" + |
| | | ", hpassrate, hremark, HMouldNo, HProcWorkNum, HReadyTime, HQueueTime, HMoveTime, HUnitTime)values" + |
| | | $"({HInterID}, {num[0]}, {HSupID}, {HProcID},{HCenterID}, '{HProcNo}', '{HTimeUnit}'" + |
| | | $", {hworkqty}, {(HFixPrice==""?"0": HFixPrice)}, {(HBadPrice == "" ? "0": HBadPrice)}, {(HWasterPrice == "" ? "0": HWasterPrice)}, {(HBeginFixQty == "" ? "0": HBeginFixQty)}, {(HBeginDayQty == "" ? "0": HBeginDayQty)}, {(HFixWorkDays == "" ? "0": HFixWorkDays)}" + |
| | | $", {(HTrunWorkDays == "" ? "0": HTrunWorkDays)},{(HAutoTrunFlag == "True" ? "1": "0")},{(HSupFlag == "True" ? "1" : "0")}, '{HTechnologyParameter}', '{HPicNum}', '{HProcCheckNote}'" + |
| | | $", {hpassrate}, '{hremark}', '{HMouldNo}', '{HProcWorkNum}', 0, 0, 0, 0)"); |
| | | //自增次数 |
| | | num[0]++; |
| | | |
| | | |
| | | oCN.RunProc("Insert into Gy_RoutingBillSub (HInterID,HEntryID,HSupID,HProcID,HCenterID,HProcNO,HTimeUnit" + |
| | | ", hworkqty, HFixPrice, HBadPrice, HWasterPrice, HBeginFixQty, HBeginDayQty, HFixWorkDays" + |
| | | ", HTrunWorkDays, HAutoTrunFlag, HSupFlag, HTechnologyParameter, HPicNum, HProcCheckNote" + |
| | | ", hpassrate, hremark, HMouldNo, HProcWorkNum, HReadyTime, HQueueTime, HMoveTime, HUnitTime)values" + |
| | | $"({HInterID}, {num[0]}, {HSupID}, {HProcID},{HCenterID}, '{HProcNo}', '{HTimeUnit}'" + |
| | | $", {hworkqty}, {(HFixPrice == "" ? "0" : HFixPrice)}, {(HBadPrice == "" ? "0" : HBadPrice)}, {(HWasterPrice == "" ? "0" : HWasterPrice)}, {(HBeginFixQty == "" ? "0" : HBeginFixQty)}, {(HBeginDayQty == "" ? "0" : HBeginDayQty)}, {(HFixWorkDays == "" ? "0" : HFixWorkDays)}" + |
| | | $", {(HTrunWorkDays == "" ? "0" : HTrunWorkDays)},{(HAutoTrunFlag == "True" ? "1" : "0")},{(HSupFlag == "True" ? "1" : "0")}, '{HTechnologyParameter}', '{HPicNum}', '{HProcCheckNote}'" + |
| | | $", {hpassrate}, '{hremark}', '{HMouldNo}', '{HProcWorkNum}', 0, 0, 0, 0)"); |
| | | //自增次数 |
| | | num[0]++; |
| | | if(omdelMian.HTProcessFlag == 1 ) |
| | | { |
| | | if ((i == list.Count - 1) || (list[i]["产品代码"].ToString() != list[i + 1]["产品代码"].ToString())) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Gy_Process Where HTProcessFlag = 1", "Gy_Process"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | HProcID = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | HProcNo = ds.Tables[0].Rows[0]["HSno"].ToString(); |
| | | oCN.RunProc("Insert into Gy_RoutingBillSub (HInterID,HEntryID,HSupID,HProcID,HCenterID,HProcNO,HTimeUnit" + |
| | | ", hworkqty, HFixPrice, HBadPrice, HWasterPrice, HBeginFixQty, HBeginDayQty, HFixWorkDays" + |
| | | ", HTrunWorkDays, HAutoTrunFlag, HSupFlag, HTechnologyParameter, HPicNum, HProcCheckNote" + |
| | | ", hpassrate, hremark, HMouldNo, HProcWorkNum, HReadyTime, HQueueTime, HMoveTime, HUnitTime)values" + |
| | | $"({HInterID}, {num[0]}, {HSupID}, {HProcID},{HCenterID}, '{HProcNo}', '{HTimeUnit}'" + |
| | | $", {hworkqty}, {(HFixPrice == "" ? "0" : HFixPrice)}, {(HBadPrice == "" ? "0" : HBadPrice)}, {(HWasterPrice == "" ? "0" : HWasterPrice)}, {(HBeginFixQty == "" ? "0" : HBeginFixQty)}, {(HBeginDayQty == "" ? "0" : HBeginDayQty)}, {(HFixWorkDays == "" ? "0" : HFixWorkDays)}" + |
| | | $", {(HTrunWorkDays == "" ? "0" : HTrunWorkDays)},{(HAutoTrunFlag == "True" ? "1" : "0")},{(HSupFlag == "True" ? "1" : "0")}, '{HTechnologyParameter}', '{HPicNum}', '{HProcCheckNote}'" + |
| | | $", {hpassrate}, '{hremark}', '{HMouldNo}', '{HProcWorkNum}', 0, 0, 0, 0)"); |
| | | } |
| | | num[0]++; |
| | | } |
| | | |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |