From 52e9c09747672c7d185e17dd6461900f67a97ee4 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期二, 31 十月 2023 11:01:35 +0800 Subject: [PATCH] 工序不良品采集 --- Model/生产管理/ClsSc_QualityReportBillSub.cs | 3 WebAPI/Controllers/CJGL/Cj_SingleStationController.cs | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++++ WebAPI/WebAPI.csproj | 2 3 files changed, 213 insertions(+), 0 deletions(-) diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBillSub.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBillSub.cs" index 37ca2a1..ea99eb9 100644 --- "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBillSub.cs" +++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBillSub.cs" @@ -11,6 +11,9 @@ public Int64 HUnitID; public Int64 HEmpID; public Int64 HSourceID; + public Int64 HProcExchInterID; + public Int64 HProcExchEntryID; + public string HProcExchBillNo; public string HBarCode; public Int64 HBadReasonID; public string HBadReasonNumber; diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs new file mode 100644 index 0000000..e0d8611 --- /dev/null +++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs @@ -0,0 +1,208 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers.CJGL +{ + public class Cj_SingleStationController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 宸ュ簭鍗曞搧涓嶈壇閲囬泦 鐢ㄦ埛鏌ヨ鍏宠仈瀛楁 + [Route("Cj_SingleStation/Cj_CollectionOfSingleProductDefectsUserList")] + [HttpGet] + public object Cj_CollectionOfSingleProductDefectsUserList(string sWhere, string user) + { + try + { + + if (sWhere == null || sWhere.Equals("")) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = new DataTable(); + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from h_v_Cj_UserAssociationList where 1=1 "+sWhere, "h_v_Cj_UserAssociationList"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ュ簭鍗曞搧涓嶈壇閲囬泦 鎵爜鏌ヨ + [Route("Cj_SingleStation/HBardCodeList")] + [HttpGet] + public object HBardCodeList(string HBarCode, string user) + { + try + { + + ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBillHICOMProcessExchange where 鏉$爜='" + HBarCode + "'", "h_v_Gy_BarCodeBillHICOMProcessExchange"); + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉$爜鏌ユ棤鏁版嵁锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + objJsonResult.data = ds.Tables[0]; + } + + return objJsonResult; + } + catch (Exception e) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ュ簭鍗曞搧涓嶈壇閲囬泦 淇濆瓨 + [Route("Cj_SingleStation/ProcessBLSave")] + [HttpPost] + public object ProcessBLSave([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁 + string HResult = sArray[1].ToString(); + string user = sArray[2].ToString(); + + try + { + var msg3 = msg2.ToString(); + msg2 = "[" + msg2.ToString() + "]"; + List<Model.ClsSc_QualityReportBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_QualityReportBillMain>>(msg2); + + long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + DateTime HDate = DateTime.Now;//鏃ユ湡 + string HRemark = mainList[0].HRemark;//澶囨敞 + long HEmpID = mainList[0].HEmpID;//璐ㄦ鍛� + long HGroupID = mainList[0].HGroupID;//鐝粍 + long HDeptID = mainList[0].HDeptID;//杞﹂棿 + string HMaker = user;//鍒跺崟浜� + + ds = oCN.RunProcReturn("select * from Sc_QualityReportBillMain where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Sc_QualityReportBillMain"); + if (ds.Tables[0].Rows.Count != 0) { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + if (ds.Tables[0].Rows.Count == 0)//鏂板 + { + //涓昏〃 + oCN.RunProc(@"Insert Into Sc_QualityReportBillMain +(HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate +,HYear,HPeriod,HRemark,HMaker,HMakeDate +,HEmpID,HGroupID,HDeptID) + values('3717','3717',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" + + ",'" + HEmpID + "'," + HGroupID + "," + HDeptID + ") "); + + } + + //淇濆瓨瀛愯〃 + objJsonResult = AddBillSub_NoTable(msg3, HInterID, HResult); + + if (objJsonResult.code == "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public json AddBillSub_NoTable(string msg3, long HInterID, string HResult) + { + Model.ClsSc_QualityReportBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<Model.ClsSc_QualityReportBillSub>(msg3); + + if (oSub.HMaterID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐗╂枡涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc($@"Insert into Sc_QualityReportBillSub +(HInterID,HENTRYID,HBillNo_bak,HEmpID,HBarCode,HBadReasonID,HAddr,HMaker,HMakeDate +,HMaterID,HUnitID,HRemark,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType +,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney +,HQty,HResult,HProcExchInterID,HProcExchEntryID,HProcExchBillNo) +values({HInterID},1,'{oSub.HBillNo_bak}',{oSub.HEmpID},'{oSub.HBarCode}',{oSub.HBadReasonID},'','{oSub.HMaker}','{oSub.HMakeDate}' +,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HICMOInterID},{oSub.HICMOEntryID},'{oSub.HICMOBillNo}',{oSub.HReportType} +,0,0,'','',0,0 +,0,'{HResult}',{oSub.HProcExchInterID},{oSub.HProcExchEntryID},'{oSub.HProcExchBillNo}')"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index ecacc82..26f7db0 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -406,6 +406,7 @@ <Compile Include="Controllers\CJGL\Sc_ProcExchWorkBackBillController.cs" /> <Compile Include="Controllers\CJGL\Sc_ProcExchWWSendWorkBillController.cs" /> <Compile Include="Controllers\CJGL\Sc_WorkBillAutoSortBillMainController.cs" /> + <Compile Include="Controllers\CJGL\Cj_SingleStationController.cs" /> <Compile Include="Controllers\Gy_MateMouldController.cs" /> <Compile Include="Controllers\Gy_StdMinPickQtyController.cs" /> <Compile Include="Controllers\MJGL\Sc_MouldDotCheckRuleBillController.cs" /> @@ -959,6 +960,7 @@ <Folder Include="Views\Cj_CallGoodsBillMain\" /> <Folder Include="Views\Cj_ComplementGoodsBill\" /> <Folder Include="Views\Cj_SendGoodsBill\" /> + <Folder Include="Views\Cj_SingleStation\" /> <Folder Include="Views\Gy_BarCodeBill_Out\" /> <Folder Include="Views\Gy_COMMONCONTACTBill\" /> <Folder Include="Views\Gy_ConkType\" /> -- Gitblit v1.9.1