From 275e50d8521fb2228c18956e9a3a8ad7bb3bfc99 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期一, 27 十一月 2023 14:03:32 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/CJGL/Cj_SingleStationController.cs | 160 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 132 insertions(+), 28 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs index 178aa71..79f48fe 100644 --- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs +++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs @@ -320,15 +320,29 @@ } 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 = "閰嶄欢娓呭崟鏌ユ棤鏁版嵁锛�,鍙兘鏄綋鍓嶇敤鎴峰伐搴忎笉姝g‘鎴栬�呮祦杞崱杈撳叆閿欒!"; + objJsonResult.data = null; + return objJsonResult; + } } else { @@ -387,7 +401,7 @@ if (tempList.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鏃犳暟鎹�!"; + objJsonResult.Message = "鏃犻厤浠舵暟鎹�!"; objJsonResult.data = null; return objJsonResult; } @@ -460,7 +474,7 @@ 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"; @@ -1042,6 +1056,8 @@ //鍙嶅啓宸ュ簭鍑虹珯鍗曠殑涓嶈壇鏁伴噺 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(); @@ -1165,7 +1181,15 @@ 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; @@ -1341,25 +1365,6 @@ ({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 + "'"); @@ -1387,6 +1392,25 @@ 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 + "'"); } } @@ -1577,5 +1601,85 @@ } #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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + 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 + } } \ No newline at end of file -- Gitblit v1.9.1