From d462f3a5f4cb746a5d034a907166b6f1c354c4d0 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 02 二月 2024 18:17:48 +0800 Subject: [PATCH] 月度计划 --- WebAPI/Controllers/SCGL/Sc_WorkBillMonthPlanController.cs | 245 +++++++++++++++++++++++++++++++++++++++++++++++++ WebAPI/WebAPI.csproj | 2 2 files changed, 247 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/SCGL/Sc_WorkBillMonthPlanController.cs b/WebAPI/Controllers/SCGL/Sc_WorkBillMonthPlanController.cs new file mode 100644 index 0000000..d0f89bf --- /dev/null +++ b/WebAPI/Controllers/SCGL/Sc_WorkBillMonthPlanController.cs @@ -0,0 +1,245 @@ +锘縰sing Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.Http; +using WebAPI.Models; +using Newtonsoft.Json; + +namespace WebAPI.Controllers.SCGL +{ + public class Sc_WorkBillMonthPlanController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public WebServer webserver = new WebServer(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 鏈堝害璁″垝 鏌ヨ鐢熶骇璁㈠崟淇℃伅 + [Route("Sc_WorkBillMonthPlan/Sc_WorkBillMonthPlan")] + [HttpGet] + public object Sc_WorkBillMonthPlan(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBillQuery", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from h_v_SC_ICMOBillPlanList where 1=1" + sWhere + "order by 鏃ユ湡 desc ", "h_v_SC_ICMOBillPlanList"); + + //娣诲姞鍒楀悕 + 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) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鏈堝害璁″垝 鏌ヨ宸叉淳鍗曟湀搴﹁鍒掍俊鎭� + [Route("Sc_WorkBillMonthPlan/Sc_WorkBillMonthPlanList")] + [HttpGet] + public object Sc_WorkBillMonthPlanList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBillQuery", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from h_v_SC_WorkBillMonthPlanList where 1=1" + sWhere + "order by 鏃ユ湡 desc ", "h_v_SC_WorkBillMonthPlanList"); + + //娣诲姞鍒楀悕 + 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) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鏈堝害璁″垝 鎺掑崟 + [Route("Sc_WorkBillMonthPlan/Add_WorkBillMonthPlanList")] + [HttpPost] + public object Add_WorkBillMonthPlanList([FromBody] JObject msg) + { + try + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); //鐢熶骇璁㈠崟id + string msg3 = sArray[1].ToString(); //閮ㄩ棬 + string user = sArray[2].ToString(); //鐢ㄦ埛 + + string[] data = msg2.Split(','); + + for (int i = 0; i < data.Length; i++) + { + oCN.BeginTran(); + + string[] datas = data[i].Split('_'); + string HInterID = datas[0]; + string HEntryID = datas[1]; + + ds = oCN.RunProcReturn("select * from h_v_SC_ICMOBillPlanList where HInterID=" + HInterID + " and HEntryID=" + HEntryID, "h_v_SC_ICMOBillPlanList"); + + if (ds.Tables[0].Rows.Count > 0) + { + Int64 HInterIDs = DBUtility.ClsPub.CreateBillID("3703", ref DBUtility.ClsPub.sExeReturnInfo); + string HBillNo = DBUtility.ClsPub.CreateBillCode("3703", ref DBUtility.ClsPub.sExeReturnInfo, true); + int HDeptID = int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString()); + int HMaterID = int.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString()); + int HUnitID = int.Parse(ds.Tables[0].Rows[0]["HUnitID"].ToString()); + DateTime HPlanBeginDate = DateTime.Parse(ds.Tables[0].Rows[0]["HPlanBeginDate"].ToString()); + DateTime HPlanEndDate = DateTime.Parse(ds.Tables[0].Rows[0]["HPlanEndDate"].ToString()); + double HPlanQty = double.Parse(ds.Tables[0].Rows[0]["鏁伴噺"].ToString()); + string HICMOStatus = ds.Tables[0].Rows[0]["HSTATUS"].ToString(); + string HICMOInterID = ds.Tables[0].Rows[0]["HInterID"].ToString(); + string HICMOEntryID = ds.Tables[0].Rows[0]["HEntryID"].ToString(); + string HICMOBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + string HSeOrderBillNo = ds.Tables[0].Rows[0]["HSeOrderBillNo"].ToString(); + string HSeOrderInterID = ds.Tables[0].Rows[0]["HSeOrderInterID"].ToString(); + string HSeOrderEntryID = ds.Tables[0].Rows[0]["HSeOrderEntryID"].ToString(); + + oCN.RunProc($@"insert into Sc_WorkBillMonthPlanBillMain(HInterID,HBillNo,HDate,HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HMaker,HMakeDate +, HDeptID, HMaterID, HUnitID, HPlanBeginDate, HPlanEndDate, HPlanQty +, HICMOStatus, HICMOInterID, HICMOEntryID, HICMOBillNo, HSeOrderBillNo, HSeOrderInterID, HSeOrderEntryID) +values({HInterIDs}, '{HBillNo}', GETDATE(), year(GETDATE()), month(GETDATE()), '3703', '3703', '1', '{user}', GETDATE(), +{HDeptID}, {HMaterID}, {HUnitID}, '{HPlanBeginDate}', '{HPlanEndDate}', {HPlanQty} +, '{HICMOStatus}', {HICMOInterID},{HICMOEntryID}, '{HICMOBillNo}', '{HSeOrderBillNo}', {HSeOrderInterID}, {HSeOrderEntryID})"); + + oCN.Commit(); + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绗�"+(i+1)+"琛�,鐢熶骇璁㈠崟鏌ユ棤鏁版嵁!"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鏈堝害璁″垝 鍙栨秷鎺掑崟 + [Route("Sc_WorkBillMonthPlan/DelWorkBillMonthPlanList")] + [HttpGet] + public object DelWorkBillMonthPlanList(string HInterID,string user) + { + try + { + string[] data = HInterID.Split(','); + + for (int i = 0; i < data.Length; i++) + { + oCN.BeginTran(); + + string HInterIDs = data[i]; + + ds = oCN.RunProcReturn("select * from h_v_SC_WorkBillMonthPlanList where HInterID=" + HInterIDs, "h_v_SC_WorkBillMonthPlanList"); + + if (ds.Tables[0].Rows.Count > 0) + { + oCN.RunProc("delete from Sc_WorkBillMonthPlanBillMain where HInterID=" + HInterIDs); + + oCN.Commit(); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绗�" + (i + 1) + "琛�,鏈堝害璁″垝鏌ユ棤鏁版嵁!"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 609fcda..094a555 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -426,6 +426,7 @@ <Compile Include="Controllers\SCGL\Sc_ICMOBillWorkQtyStatus_TmpController.cs" /> <Compile Include="Controllers\SCGL\Sc_ICMOChangeBillController.cs" /> <Compile Include="Controllers\SCGL\Sc_MyTicketController.cs" /> + <Compile Include="Controllers\SCGL\Sc_WorkBillMonthPlanController.cs" /> <Compile Include="Controllers\SCGL\鏃ヨ鍒掔鐞哱DataHelper.cs" /> <Compile Include="Controllers\SCGL\鏃ヨ鍒掔鐞哱JIT_Cg_PODemandPlanBillController.cs" /> <Compile Include="Controllers\SCGL\Sc_CallGoodsBackRequestBillController.cs" /> @@ -1070,6 +1071,7 @@ <Folder Include="Views\Sc_ProcExchSendWorkBill\" /> <Folder Include="Views\Sc_ProcExchWWSendWorkBill\" /> <Folder Include="Views\Sc_WorkBillAutoSortBillMain\" /> + <Folder Include="Views\Sc_WorkBillMonthPlan\" /> <Folder Include="Views\Sc_WorkBillSortBill\" /> <Folder Include="Views\Sc_WorkDemandPlanBill\" /> <Folder Include="Views\Sup_AskPriceBill\" /> -- Gitblit v1.9.1