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.JJGZ/MesAttanConController.cs | 91 ++++++++++++++++++---------------------------
1 files changed, 36 insertions(+), 55 deletions(-)
diff --git a/WebApi/Gs.JJGZ/MesAttanConController.cs b/WebApi/Gs.JJGZ/MesAttanConController.cs
index b442b58..677ddbe 100644
--- a/WebApi/Gs.JJGZ/MesAttanConController.cs
+++ b/WebApi/Gs.JJGZ/MesAttanConController.cs
@@ -1,13 +1,14 @@
-锘縰sing System.Data;
-using System.Data.SqlClient;
-using System.Dynamic;
-using System.Text;
-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.JJGZ;
@@ -18,7 +19,6 @@
private readonly IHttpContextAccessor _http;
private readonly string _userCode, _userGuid, _orgFids;
-
public MesAttanConController(IHttpContextAccessor httpContextAccessor)
{
_http = httpContextAccessor;
@@ -46,15 +46,12 @@
m.list3 = new List<dynamic>();
try
{
- var parameters = new[]
- {
- new SqlParameter("@inLineNo", lineNo),
- new SqlParameter("@inDate", date),
- new SqlParameter("@inOrgId", orgId)
- };
- var dsMain = DbHelperSQL.Query(
- "EXEC prc_AttanCon_lst @inLineNo, @inDate, @inOrgId",
- parameters);
+ var parameters = new[] {
+ new SqlParameter("@inLineNo", lineNo),
+ new SqlParameter("@inDate", date),
+ new SqlParameter("@inOrgId", orgId)
+ };
+ var dsMain = DbHelperSQL.Query("EXEC prc_AttanCon_lst @inLineNo, @inDate, @inOrgId", parameters);
if (dsMain != null && dsMain.Tables.Count > 0)
{
var _tb = dsMain.Tables[0].TableToDynamicList();
@@ -73,16 +70,14 @@
catch (Exception ex)
{
LogHelper.Debug(ToString(), ex.Message);
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
- "璇诲彇澶辫触锛�");
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
}
-
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
"璇诲彇鎴愬姛锛�");
}
/// <summary>
- /// 淇敼
+ /// 淇敼
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
@@ -97,13 +92,12 @@
foreach (var m in model.list)
{
var _line = m.GUID + _split
- + m.Hour + _split
- + m.Reason;
+ + m.Hour + _split
+ + m.Reason;
if (_sb.Length > 0)
_sb.Append("~");
_sb.Append(_line);
}
-
dynamic mObj = new ExpandoObject();
mObj.outMsg = "";
mObj.outSum = -1;
@@ -151,12 +145,10 @@
}
}
}
-
if (mObj.outSum <= 0)
- return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception,
- mObj.outMsg);
- return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success,
- mObj.outMsg);
+ return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg);
+ return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg);
+
}
@@ -176,14 +168,14 @@
mObj.outMsg = "";
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
+
using (var cmd = new SqlCommand("[prc_AttanCon_count]", conn))
{
try
{
conn.Open();
cmd.CommandType = CommandType.StoredProcedure;
- var parameters = new[]
- {
+ var parameters = new[] {
new SqlParameter("@inLineNo", lineNo),
new SqlParameter("@inDate", date),
new SqlParameter("@inOrgId", orgId),
@@ -208,12 +200,10 @@
}
}
}
-
if (mObj.outSum <= 0)
- return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception,
- mObj.outMsg);
- return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success,
- mObj.outMsg);
+ return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg);
+ return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg);
+
}
/// <summary>
@@ -234,9 +224,8 @@
try
{
// 鍋囪鎻愪氦灏辨槸鏇存柊鏌愪釜瀛楁
- var sql =
- $"UPDATE MES_JJGZ_KQHZ SET check_status='{_inFieldValue}',check_date = getdate(), check_user='{_userGuid}' WHERE Line_No='{lineNo}' and attenDate = '{attenDate}'";
- var rows = DbHelperSQL.ExecuteSql(sql);
+ string sql = $"UPDATE MES_JJGZ_KQHZ SET check_status='{_inFieldValue}',check_date = getdate(), check_user='{_userGuid}' WHERE Line_No='{lineNo}' and attenDate = '{attenDate}'";
+ int rows = DbHelperSQL.ExecuteSql(sql);
m.outSum = rows;
m.outMsg = rows > 0 ? "鎿嶄綔鎴愬姛锛�" : "鏈洿鏂颁换浣曟暟鎹�";
}
@@ -245,10 +234,8 @@
LogHelper.Debug(ToString(), "EditModelSubmit error锛�" + ex.Message);
m.outMsg = ex.Message;
m.outSum = -1;
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
- ex.Message);
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, ex.Message);
}
-
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
}
@@ -261,14 +248,12 @@
public ReturnDto<ExpandoObject> GetTimeType([FromBody] dynamic model)
{
dynamic m = new ExpandoObject();
- var mainTable = "MES_JJGZ_TIMETYPE";
+ string mainTable = "MES_JJGZ_TIMETYPE";
try
{
- var sqlMain =
- "SELECT HourlyType 璁℃椂绫诲瀷,HourlySalary 璁℃椂鍗曚环 FROM MES_JJGZ_JSSALARY WHERE CHECK_STATUS = 1";
+ string sqlMain = $"SELECT HourlyType 璁℃椂绫诲瀷,HourlySalary 璁℃椂鍗曚环 FROM MES_JJGZ_JSSALARY WHERE CHECK_STATUS = 1";
var dsMain = DbHelperSQL.Query(sqlMain);
- if (dsMain != null && dsMain.Tables.Count > 0 &&
- dsMain.Tables[0].Rows.Count > 0)
+ if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0)
{
var _tb = dsMain.Tables[0].TableToDynamicList();
m.list = _tb;
@@ -278,10 +263,8 @@
{
LogHelper.Debug(ToString(), ex.Message);
}
-
if (m != null)
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
- "璇诲彇鎴愬姛锛�");
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "璇诲彇鎴愬姛锛�");
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
}
@@ -296,11 +279,9 @@
dynamic m = new ExpandoObject();
try
{
- var sqlMain =
- "select line_no 浜х嚎,name 浜х嚎鍚嶇О from MES_WORKSHOP_LINE WHERE line_no IN (SELECT Line_No FROM Mes_DepartmentToLine )";
+ string sqlMain = $"select line_no 浜х嚎,name 浜х嚎鍚嶇О from MES_WORKSHOP_LINE WHERE line_no IN (SELECT Line_No FROM Mes_DepartmentToLine )";
var dsMain = DbHelperSQL.Query(sqlMain);
- if (dsMain != null && dsMain.Tables.Count > 0 &&
- dsMain.Tables[0].Rows.Count > 0)
+ if (dsMain != null && dsMain.Tables.Count > 0 && dsMain.Tables[0].Rows.Count > 0)
{
var _tb = dsMain.Tables[0].TableToDynamicList();
m.list = _tb;
@@ -310,10 +291,10 @@
{
LogHelper.Debug(ToString(), ex.Message);
}
-
if (m != null)
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
- "璇诲彇鎴愬姛锛�");
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "璇诲彇鎴愬姛锛�");
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
}
+
+
}
\ No newline at end of file
--
Gitblit v1.9.3