From 94d0b18fa47a92a1cb4d1fef4520d35ef2c2c322 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期二, 16 十二月 2025 21:56:49 +0800
Subject: [PATCH] 产能排产相关后端更新
---
WebApi/Gs.Ww/WWGDManager.cs | 210 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 144 insertions(+), 66 deletions(-)
diff --git a/WebApi/Gs.Ww/WWGDManager.cs b/WebApi/Gs.Ww/WWGDManager.cs
index de5b16c..f9a15cc 100644
--- a/WebApi/Gs.Ww/WWGDManager.cs
+++ b/WebApi/Gs.Ww/WWGDManager.cs
@@ -1,12 +1,14 @@
-锘縰sing System.Data;
-using System.Data.SqlClient;
-using System.Dynamic;
-using Gs.Toolbox;
+锘縰sing Gs.Toolbox;
using Gs.Toolbox.ApiCore.Abstract.Mvc;
using Gs.Toolbox.ApiCore.Common.Mvc;
using Gs.Toolbox.ApiCore.Group;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System.Data;
+using System.Data.SqlClient;
+using System.Dynamic;
+using System.Text;
using static Gs.Toolbox.UtilityHelper;
namespace Gs.Ww
@@ -23,6 +25,142 @@
_http = httpContextAccessor;
(_userCode, _userGuid, _orgFids) =
GetUserGuidAndOrgGuid(_http);
+ }
+
+ /// <summary>
+ /// 鏍规嵁绾夸綋鎴栬溅闂磇d锛岃鍙栧伐鍗�
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [RequestMethod(RequestMethods.POST)]
+ public ReturnDto<PageList<dynamic>> SelectWwgd([FromBody] dynamic model)
+ {
+ int currentPage = model.currentPage;
+ int everyPageSize = model.everyPageSize;
+ string sortName = model.sortName;
+ string keyWhere = model.keyWhere;
+ string suppId = model.suppId;
+ string ckId = model.ckId;
+ var dset = new DataSet();
+ try
+ {
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("[prc_WW_GD_select]", conn))
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@inCurrentPage", currentPage),
+ new("@inEveryPageSize", everyPageSize),
+ new("@inSortName", sortName),
+ new("@inSortOrder", ""),
+ new("@inQueryWhere", keyWhere),
+ new("@suppId", suppId),
+ new("@inP1", ckId),
+ new("@inP2", "")
+ };
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ using (var dt = new SqlDataAdapter(cmd))
+ {
+ dt.Fill(dset, "0");
+ }
+ }
+
+ conn.Close();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Debug(ToString(), "prc_wom_pba_select error锛�" + ex.Message);
+ return ReturnDto<PageList<dynamic>>.QuickReturn(default(PageList<dynamic>), ReturnCode.Exception, "璇诲彇澶辫触");
+ }
+
+ var _pglist = new PageList<dynamic>
+ {
+ total = 0,
+ everyPageSize = 0,
+ pages = 0,
+ list = new List<dynamic>()
+ };
+ if (dset != null && dset.Tables.Count > 0 &&
+ dset.Tables[0].Rows.Count > 0) //鏈夋暟鎹�
+ {
+ var intTotal =
+ int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString());
+ var pages = intTotal % everyPageSize != 0
+ ? intTotal / everyPageSize + 1
+ : intTotal / everyPageSize;
+ _pglist.total = intTotal;
+ _pglist.everyPageSize = everyPageSize;
+ _pglist.pages = pages;
+ var _dy = dset.Tables[0].TableToDynamicList();
+ _pglist.list = _dy;
+ }
+
+ return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
+ ReturnCode.Success, "璇诲彇鎴愬姛");
+ }
+
+ /// <summary>
+ /// 鏍规嵁鐢ㄦ埛閫夋嫨鐨勯噰璐槑缁唃uid锛岃鍙栭渶瑕佷綔鍏ュ簱鍒拌揣鍗曠殑鏄庣粏
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ [RequestMethod(RequestMethods.POST)]
+ public ReturnDto<List<dynamic>> SelectWwgdToView(
+ JArray guidList)
+ {
+ var intArray = guidList.ToObject<string[]>();
+ var sbLine = new StringBuilder();
+ foreach (var str in intArray)
+ {
+ if (sbLine.Length > 0)
+ sbLine.Append(",");
+ sbLine.Append(str);
+ }
+
+ var lst = new List<dynamic>();
+ var dset = new DataSet();
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd =
+ new SqlCommand("[prc_WW_GD_select_to_grid]", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@inP1", sbLine.ToString())
+ };
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ using (var dt = new SqlDataAdapter(cmd))
+ {
+ dt.Fill(dset, "0");
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Debug(ToString(),
+ "prc_WW_GD_select_to_grid error锛�" + ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+
+ if (dset != null && dset.Tables.Count > 0 &&
+ dset.Tables[0].Rows.Count > 0) //鏈夋暟鎹�
+ lst = dset.Tables[0].TableToDynamicList();
+ return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
+ "璇诲彇鎴愬姛锛�");
}
/// <summary>
@@ -119,8 +257,8 @@
m = dr.RowToDynamic();
var _tb = dset.Tables[1].TableToDynamicList();
m.list = _tb;
- var _tb2 = dset.Tables[2].TableToDynamicList();
- m.list2 = _tb2;
+ //var _tb2 = dset.Tables[2].TableToDynamicList();
+ //m.list2 = _tb2;
}
}
catch (Exception ex)
@@ -190,66 +328,6 @@
}
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
- }
-
- /// <summary>
- /// 鍒犻櫎涓昏〃鎴栨槑缁�
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- [RequestMethod(RequestMethods.POST)]
- public ReturnDto<int?> DeleteModelOrMx([FromBody] dynamic model)
- {
- int? rtnInt = (int)ReturnCode.Default;
- Guid? guid = model.guid;
- string mxGuid = model.mxGuid;
- var _outMsg = "";
- var _outSum = -1;
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("[prc_ww_gd_del]", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@outMsg", SqlDbType.NVarChar, 300),
- new("@outSum", SqlDbType.Int),
- new("@inOrderGuid",
- UtilityHelper.CheckGuid(guid)
- ? guid
- : DBNull.Value),
- new("@inEdtUserGuid", _userGuid),
- new("@inMxGuid", mxGuid)
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Direction = ParameterDirection.Output;
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
- _outMsg = parameters[0].Value.ToString();
- _outSum = int.Parse(parameters[1].Value.ToString());
- }
- catch (Exception ex)
- {
- LogHelper.Debug(ToString(),
- "prc_ww_gd_del error锛�" + ex.Message);
- _outMsg = ex.Message;
- _outSum = -1;
- }
- finally
- {
- conn.Close();
- }
- }
- }
-
- if (_outSum <= 0)
- return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception, _outMsg);
- return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success, _outMsg);
}
}
--
Gitblit v1.9.3