| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "") |
| | | if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "正常") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | 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"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码:" + omodel.HBarCode_P + ",已存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | //保存生产组装单主表 |
| | |
| | | "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + ") "); |
| | | } |
| | | |
| | | |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HInterID='" + omodel.HInterID + "' order by HEntryID desc", "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({omodel.HInterID}, '{omodel.HBillNo}', {ds.Tables[0].Rows.Count + 1}, '{omodel.HBarCode_P}', 1, GETDATE(), '', 0, 0, '', '', 0, 0)"); |
| | | values({omodel.HInterID}, '{omodel.HBillNo}', {(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)}, '{omodel.HBarCode_P}', 1, GETDATE(), '', " + HProcExchInterID + ","+ HProcExchEntryID + ", '"+ HProcExchBillNo + "', '', 0, 0)"); |
| | | |
| | | //反写工序出站单的合格数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty+=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID); |
| | | |
| | | oCN.Commit(); |
| | | |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | |
| | | if (ds.Tables[0].Rows[0]["HStatus"].ToString() !="") |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前条码的状态为:"+ ds.Tables[0].Rows[0]["HStatus"].ToString() + "!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "") { |
| | | if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "正常") { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前条码状态为"+ ds.Tables[0].Rows[0]["HStatus"].ToString() + "!"; |
| | |
| | | #region 工序单品过站 查询合格记录 |
| | | [Route("Cj_SingleStation/HGRecordsList")] |
| | | [HttpGet] |
| | | public object HGRecordsList(string HBarCode, string user) |
| | | public object HGRecordsList(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn(@"select * from h_v_Sc_AssemblyBillList where HProcExchBillNo='" + HBarCode + "'", "h_v_Sc_AssemblyBillList"); |
| | | ds = oCN.RunProcReturn(@"select * from h_v_Gy_QualifiedRecordsList where 1=1"+ sWhere, "h_v_Gy_QualifiedRecordsList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序单品过站 删除不良记录 |
| | | [Route("Cj_SingleStation/DelBadRecords")] |
| | | [HttpGet] |
| | | public object DelBadRecords(int HInterID, int HEntryID, string user,int HProcID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_BadRecordsList where HInterID = " + HInterID, "h_v_Gy_BadRecordsList"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查无数据!"; |
| | | objJsonResult.data = null; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | string sql = ""; |
| | | sql = "delete from Sc_QualityReportBillMain where HInterID = " + HInterID; |
| | | oCN.RunProc(sql); |
| | | sql = "delete from Sc_QualityReportBillSub where HInterID = " + HInterID + " and HEntryID = " + HEntryID; |
| | | oCN.RunProc(sql); |
| | | string HProcExchInterID = ds.Tables[0].Rows[0]["HProcExchInterID"].ToString(); |
| | | string HProcExchEntryID = ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString(); |
| | | //反写工序出站单的不良数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HBadCount-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID); |
| | | |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = null; |
| | | 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/DelQualifiedRecords")] |
| | | [HttpGet] |
| | | public object DelQualifiedRecords(int HInterID, int HEntryID, string user) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_QualifiedRecordsList where hmainid = " + HInterID, "h_v_Gy_QualifiedRecordsList"); |
| | | |
| | | string HProcExchInterID = ds.Tables[0].Rows[0]["HProcExchInterID"].ToString(); |
| | | string HProcExchEntryID = ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString(); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查无数据!"; |
| | | objJsonResult.data = null; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | string sql = ""; |
| | | if (ds.Tables[0].Rows.Count == 1) { |
| | | sql = "delete from Sc_StationOutBillMain where HInterID = " + HInterID; |
| | | oCN.RunProc(sql); |
| | | } |
| | | ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HInterID = " + HInterID + " and HEntryID = " + HEntryID, "Sc_StationOutBillSub_SN"); |
| | | string HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString(); |
| | | string HBillNo_bak = ds.Tables[0].Rows[0]["HBillNo_bak"].ToString(); |
| | | |
| | | //删除组装追溯单 |
| | | oCN.RunProc("delete from Sc_AssemblyBillSub where HInterID in(select HInterID from Sc_AssemblyBillMain where HMainSourceInterID=" + HProcExchInterID + " and HMainSourceEntryID=" + HProcExchEntryID + " and HBarCode_P='" + HBarCode + "')"); |
| | | oCN.RunProc("delete from Sc_AssemblyBillMain where HMainSourceInterID=" + HProcExchInterID + " and HMainSourceEntryID=" + HProcExchEntryID + " and HBarCode_P='" + HBarCode + "'"); |
| | | |
| | | sql = "delete from Sc_StationOutBillSub_SN where HInterID = " + HInterID + " and HEntryID = " + HEntryID; |
| | | oCN.RunProc(sql); |
| | | //反写工序出站单的合格数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'"); |
| | | |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | string[] sArray = msg.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string sMainStr = sArray[0].ToString(); |
| | | string sSubStr = sArray[1].ToString(); |
| | | string user = sArray[2].ToString(); |
| | | string HResult = sArray[3].ToString(); |
| | | string sSubStr2 = sArray[2].ToString(); |
| | | string user = sArray[3].ToString(); |
| | | string HResult = sArray[4].ToString(); |
| | | |
| | | oCN.BeginTran(); |
| | | if (HResult == "配件") |
| | |
| | | ({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") { |
| | | //生成 产线组装追溯单 |
| | | |
| | | Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillMain where HInterID=" + model.HInterID, "Sc_SourceLineRepairBillMain"); |
| | | string HMaterID = ds.Tables[0].Rows[0]["HMaterID"].ToString(); |
| | | //保存生产组装单主表 |
| | | string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate |
| | | ,HBillNo,HBillStatus,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo |
| | | ,HICMOInterID,HICMOBillNo,HBarCode_P,HMaterID,HUnitID,HAssemblyStatus,HProdOrgID) |
| | | values('{DateTime.Now.Year}','{DateTime.Now.Month}','3727','3727',{HInterID1},getdate() |
| | | ,'{HBillNo1}','1','{user}',getdate(),{temp.HProcExchInterID.ToString()},{temp.HProcExchEntryID.ToString()},'{temp.HProcExchBillNo.ToString()}' |
| | | ,{model.HICMOInterID.ToString()},'{model.HICMOBillNo.ToString()}','{model.HBarCode.ToString()}',{HMaterID},0,'汇报',{model.HProdOrgID})"; |
| | | oCN.RunProc(sql); |
| | | |
| | | List<Model.Sc_AssemblyBill_BindSourceTemp> sub = new List<Model.Sc_AssemblyBill_BindSourceTemp>(); |
| | | sub = JsonConvert.DeserializeObject<List<Model.Sc_AssemblyBill_BindSourceTemp>>(sSubStr2); |
| | | |
| | | for (int i = 0; i < sub.Count; i++) |
| | | { |
| | | //子表存储 |
| | | string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo |
| | | ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty |
| | | ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber) |
| | | values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,'' |
| | | ,'',{sub[i].HMaterID},0,0,0,{sub[i].HQty} |
| | | ,0,0,getdate(),'{sub[i].HBarCode}','{model.HBarCode}','') "; |
| | | oCN.RunProc(sq2); |
| | | } |
| | | |
| | | //生产工序出站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("exec h_p_AssemblyBill_Temp '" + temp.HProcExchBillNo + "'," + model.HProcess + "," + temp.HMaterID + ",'" + temp.HBatchNo + "'"); |
| | | //oCN.RunProc("exec h_p_AssemblyBill_Temp '" + temp.HProcExchBillNo + "'," + model.HProcess + "," + temp.HMaterID + ",'" + temp.HBatchNo + "'"); |
| | | } |
| | | else if (HResult == "NG"|| HResult == "OK") { |
| | | Model.ClsSc_SourceLineRepairBillMain model = new Model.ClsSc_SourceLineRepairBillMain(); |