From 1b3db8f5683373dd8e179b006e7314783dd1f9db Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期三, 10 九月 2025 14:42:12 +0800 Subject: [PATCH] 文件补充 --- WebApi/Gs.JJGZ/MesAttanConController.cs | 91 +++++++++++++++++++++++++++------------------ 1 files changed, 55 insertions(+), 36 deletions(-) diff --git a/WebApi/Gs.JJGZ/MesAttanConController.cs b/WebApi/Gs.JJGZ/MesAttanConController.cs index 677ddbe..b442b58 100644 --- a/WebApi/Gs.JJGZ/MesAttanConController.cs +++ b/WebApi/Gs.JJGZ/MesAttanConController.cs @@ -1,14 +1,13 @@ -锘縰sing Gs.Toolbox; +锘縰sing System.Data; +using System.Data.SqlClient; +using System.Dynamic; +using System.Text; +using 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; @@ -19,6 +18,7 @@ private readonly IHttpContextAccessor _http; private readonly string _userCode, _userGuid, _orgFids; + public MesAttanConController(IHttpContextAccessor httpContextAccessor) { _http = httpContextAccessor; @@ -46,12 +46,15 @@ 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(); @@ -70,14 +73,16 @@ 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> @@ -92,12 +97,13 @@ 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; @@ -145,10 +151,12 @@ } } } - if (mObj.outSum <= 0) - return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg); - return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg); + if (mObj.outSum <= 0) + return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, + mObj.outMsg); + return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, + mObj.outMsg); } @@ -168,14 +176,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), @@ -200,10 +208,12 @@ } } } - if (mObj.outSum <= 0) - return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg); - return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg); + if (mObj.outSum <= 0) + return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, + mObj.outMsg); + return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, + mObj.outMsg); } /// <summary> @@ -224,8 +234,9 @@ try { // 鍋囪鎻愪氦灏辨槸鏇存柊鏌愪釜瀛楁 - 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); + 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); m.outSum = rows; m.outMsg = rows > 0 ? "鎿嶄綔鎴愬姛锛�" : "鏈洿鏂颁换浣曟暟鎹�"; } @@ -234,8 +245,10 @@ 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, "鎿嶄綔鎴愬姛锛�"); } @@ -248,12 +261,14 @@ public ReturnDto<ExpandoObject> GetTimeType([FromBody] dynamic model) { dynamic m = new ExpandoObject(); - string mainTable = "MES_JJGZ_TIMETYPE"; + var mainTable = "MES_JJGZ_TIMETYPE"; try { - string sqlMain = $"SELECT HourlyType 璁℃椂绫诲瀷,HourlySalary 璁℃椂鍗曚环 FROM MES_JJGZ_JSSALARY WHERE CHECK_STATUS = 1"; + var 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; @@ -263,8 +278,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, "璇诲彇澶辫触锛�"); } @@ -279,9 +296,11 @@ dynamic m = new ExpandoObject(); try { - string sqlMain = $"select line_no 浜х嚎,name 浜х嚎鍚嶇О from MES_WORKSHOP_LINE WHERE line_no IN (SELECT Line_No FROM Mes_DepartmentToLine )"; + var 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; @@ -291,10 +310,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