From 2566524594675a8d742f9ba0eff35dd5d8d33fa2 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期一, 31 三月 2025 12:43:22 +0800 Subject: [PATCH] 排产:Excel导入功能,上传文件时,如果时宝工,则返回excel文件中维护的数量,不然则取生产订单的数量 --- WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs | 70 +++++++++++++++++++++++++++++++--- 1 files changed, 63 insertions(+), 7 deletions(-) diff --git a/WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs b/WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs index 87ed716..572840a 100644 --- a/WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs +++ b/WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs @@ -8,6 +8,8 @@ using WebAPI.Models; using WebAPI.DLL; using DBUtility; +using SyntacticSugar.constant; +using Newtonsoft.Json; namespace WebAPI.Controllers { @@ -76,6 +78,61 @@ } #endregion + #region 鍣ㄥ叿缁翠慨娲惧伐鍗曟煡璇� + [Route("Sc_MouldRepairSendWorkBill/GetMouldRepairSendWorkBillListPage")] + [HttpGet] + public object GetMouldRepairSendWorkBillListPage(string sWhere, string user, int page, int size) + { + try + { + List<object> columnNameList = new List<object>(); + if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairSendWorkBillList", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("exec h_p_Sc_MouldRepairSendWorkBill " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldRepairSendWorkBill"); + } + else + { + sWhere = sWhere.Replace("'", "''"); + ds = oCN.RunProcReturn("exec h_p_Sc_MouldRepairSendWorkBill " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldRepairSendWorkBill"); + } + + + //娣诲姞鍒楀悕 + 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 = CodeConstant.SUCCEED; + objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #region 鍣ㄥ叿缁翠慨娲惧伐鍗� 娣诲姞/淇敼 [Route("Sc_MouldRepairSendWorkBill/AddBill")] [HttpPost] @@ -109,9 +166,8 @@ string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString(); - int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d - int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 - string msg4 = sArray[4].ToString(); + int OperationType = int.Parse(sArray[2].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼 + string msg4 = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairSendWorkBill_Edit", 1, false, msg4)) @@ -183,10 +239,10 @@ " where HInterID=" + omodel.HInterID.ToString()); //鍒犻櫎瀛愯〃 - oCN.RunProc("delete from Sc_MouldRepairSendWorkBillSub where HInterID='" + omodel.HInterID.ToString() + "' and HEntryID='" + hentryid + "'"); + oCN.RunProc("delete from Sc_MouldRepairSendWorkBillSub where HInterID='" + omodel.HInterID.ToString() + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, hentryid); + objJsonResult = AddBillSub(msg3); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -212,7 +268,7 @@ } } - public json AddBillSub(string msg3, int hentryid) + public json AddBillSub(string msg3) { DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_MouldRepairWorkBillSub>>(msg3); int i = 1; @@ -224,7 +280,7 @@ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ",HRepairID,HRepairExplanation,HManagerID,HMoney" + ") values(" - + omodel.HInterID.ToString() + "," + (hentryid == -1 ? i : hentryid) + ",'" + oSub.HCloseMan + "','" + DateTime.Now + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + + omodel.HInterID.ToString() + "," + (i) + ",'" + oSub.HCloseMan + "','" + DateTime.Now + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HRepairID.ToString() + ",'" + oSub.HRepairExplanation + "'," + oSub.HManagerID.ToString() + "," + oSub.HMoney.ToString() + ") "); -- Gitblit v1.9.1