| | |
| | | |
| | | 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;//日期 |
| | |
| | | string HProductNum = mainList[0].HProductNum;//成品编号 |
| | | string HVerNum = mainList[0].HVerNum;//版本 |
| | | |
| | | 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 && ds.Tables[0].Rows.Count == 0)//新增 |
| | | if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增 |
| | | { |
| | | //主表 |
| | | oCN.RunProc("Insert Into Gy_RoutingBillMain " + |
| | |
| | | ",HProductNum='" + HProductNum + "',HVerNum='" + HVerNum + "' where HInterID='" + HInterID + "'"); |
| | | |
| | | //删除子表 |
| | | oCN.RunProc("delete from Gy_RoutingBillSub where HInterID='" + HInterID+ "' and HProcNo!='9999'"); |
| | | oCN.RunProc("delete from Gy_RoutingBillSub where HInterID='" + HInterID + "' and HProcNo!='9999'"); |
| | | } |
| | | //保存子表 |
| | | objJsonResult = AddBillSub(msg3, HInterID); |
| | | 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) |
| | | 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; |
| | | } |
| | | |
| | | if (oSub.HProcNo!="9999") |
| | | if (oSub.HProcNo != "9999" || OperationType == 2) |
| | | { |
| | | oCN.RunProc("Insert into Gy_RoutingBillSub " + |
| | | "(HInterID,HEntryID,HProcID,HProcNO,HSupID,HSupFlag" + |
| | |
| | | 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 |
| | | ('" + 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() + "')"); |
| | |
| | | { |
| | | if (HBillNo != "") |
| | | { |
| | | if (dataSet.Tables[0].Rows.Count==0) |
| | | if (dataSet.Tables[0].Rows.Count == 0) |
| | | { |
| | | break; |
| | | } |