| | |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from gy_czygl where czymc='" + user + "'", "gy_czygl"); |
| | | string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + ds.Tables[0].Rows[0]["HProcID"].ToString(), "h_p_Gy_BarCodeBillBomList"); |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "配件清单查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList"); |
| | | |
| | | if (dataSet.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "2"; |
| | | objJsonResult.count = 2; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = dataSet.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "配件清单查无数据!,可能是当前用户工序不正确或者流转卡输入错误!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | if (tempList.Count == 0) { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无数据!"; |
| | | objJsonResult.Message = "无配件数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | sub = JsonConvert.DeserializeObject<List<Model.ClsSc_AssemblyBillSub>>(sSubStr); |
| | | |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList where 产品条码='" + omodel.HBarCode_P + "'", "h_v_Gy_QualifiedRecordsList"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList where 产品条码='" + omodel.HBarCode_P + "' and HProcExchInterID="+ omodel .HProcExchInterID+ " and HProcExchEntryID="+ omodel.HProcExchEntryID + " and HProcID="+ omodel.HProcID, "h_v_Gy_QualifiedRecordsList"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | //反写工序出站单的不良数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HBadCount-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID); |
| | | //反写流转卡状态 |
| | | oCN.RunProc("update Gy_BarCodeBill set HStatus='' where HBarCode='" + HBarCode + "'"); |
| | | |
| | | |
| | | oCN.Commit(); |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HProcID"].ToString() != HProcID) |
| | | int num = 0; |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | | if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID) |
| | | { |
| | | num = 1; |
| | | } |
| | | } |
| | | if (num == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | ({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID} |
| | | ,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')"); |
| | | |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub where HInterID=" + model.HInterID, "Sc_SourceLineRepairBillSub"); |
| | | |
| | | if (ds.Tables[0].Rows[0]["HRepairResult"].ToString() == "OK") { |
| | | |
| | | //生产工序出站SN数据 |
| | | ds = oCN.RunProcReturn("select top 1 HInterID,HBillNo from Sc_StationOutBillMain where HProcExchInterID=" + temp.HProcExchInterID + " and HProcExchEntryID=" + temp.HProcExchEntryID + " and HBadCount<>0 order by HInterID desc", "Sc_StationOutBillMain"); |
| | | |
| | | string HInterIDSN = ds.Tables[0].Rows[0]["HInterID"].ToString(); |
| | | string HBillNoSN = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HInterID=" + HInterIDSN , "Sc_StationOutBillSub_SN"); |
| | | |
| | | oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) |
| | | values({HInterIDSN}, '{HBillNoSN}', {ds.Tables[0].Rows.Count + 1}, '{model.HBarCode}', 1, GETDATE(), '', "+ temp.HProcExchInterID + ","+ temp.HProcExchEntryID+ ", '"+ temp.HProcExchBillNo+ "', '', 0, 0)"); |
| | | //反写工序出站单 主表 不良数量 和 合格数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterIDSN + "'"); |
| | | } |
| | | |
| | | //修改产线追溯单绑定的条码批号 |
| | | oCN.RunProc("update Sc_AssemblyBillSub set HBarCode='" + temp.HBarCode + "' where HInterID=" + temp.HInterID + " and HEntryID=" + temp.HEntryID); |
| | | //oCN.RunProc("exec h_p_AssemblyBill_Temp '" + temp.HProcExchBillNo + "'," + model.HProcess + "," + temp.HMaterID + ",'" + temp.HBatchNo + "'"); |
| | |
| | | |
| | | if (HResult == "OK") |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub where HInterID=" + model.HInterID, "Sc_SourceLineRepairBillSub"); |
| | | |
| | | if (ds.Tables[0].Rows[0]["HRepairResult"].ToString() == "OK") |
| | | { |
| | | |
| | | //生产工序出站SN数据 |
| | | ds = oCN.RunProcReturn("select top 1 HInterID,HBillNo from Sc_StationOutBillMain where HProcExchInterID=" + model.HProcExchInterID + " and HProcExchEntryID=" + model.HProcExchEntryID + " and HBadCount<>0 order by HInterID desc", "Sc_StationOutBillMain"); |
| | | |
| | | string HInterIDSN = ds.Tables[0].Rows[0]["HInterID"].ToString(); |
| | | string HBillNoSN = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HInterID=" + HInterIDSN, "Sc_StationOutBillSub_SN"); |
| | | |
| | | oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) |
| | | values({HInterIDSN}, '{HBillNoSN}', {ds.Tables[0].Rows.Count + 1}, '{model.HBarCode}', 1, GETDATE(), '', " + model.HProcExchInterID + "," + model.HProcExchEntryID + ", '" + model.HProcExchBillNo + "', '', 0, 0)"); |
| | | //反写工序出站单 主表 不良数量 和 合格数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterIDSN + "'"); |
| | | } |
| | | |
| | | oCN.RunProc("update Gy_BarCodeBill set HStatus='' where HBarCode='" + model.HBarCode + "'"); |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序单品过站 合格追溯查询报表 |
| | | [Route("Cj_SingleStation/RetrospectiveQueryReport")] |
| | | [HttpGet] |
| | | public object RetrospectiveQueryReport(string HBardCode, string HProcExchBillNo, string HICMOBillNo, string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = @"exec h_p_RetrospectiveQueryReport '" + sWhere + "', '" + HBardCode + "', '" + HProcExchBillNo + "','" + HICMOBillNo + "' "; |
| | | ds = oCN.RunProcReturn(sql, "h_p_RetrospectiveQueryReport"); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序单品过站 不良追溯查询报表 |
| | | [Route("Cj_SingleStation/BadQueryReport")] |
| | | [HttpGet] |
| | | public object BadQueryReport(string HBardCode, string HProcExchBillNo, string HICMOBillNo, string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = @"exec h_p_BadQueryReport '" + sWhere + "', '" + HBardCode + "', '" + HProcExchBillNo + "','" + HICMOBillNo + "' "; |
| | | ds = oCN.RunProcReturn(sql, "h_p_BadQueryReport"); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |