From 3f7693504fdb48ab76fd41029859d84774b42a28 Mon Sep 17 00:00:00 2001 From: xwt <2740516069@qq.com> Date: 星期日, 03 八月 2025 13:38:42 +0800 Subject: [PATCH] 首检巡检修改 --- StandardInterface/MES.Service/service/QC/SJService.cs | 76 ++++++++++++++++++++++++++++++++++++- 1 files changed, 73 insertions(+), 3 deletions(-) diff --git a/StandardInterface/MES.Service/service/QC/SJService.cs b/StandardInterface/MES.Service/service/QC/SJService.cs index cdd8865..dcc7beb 100644 --- a/StandardInterface/MES.Service/service/QC/SJService.cs +++ b/StandardInterface/MES.Service/service/QC/SJService.cs @@ -3,6 +3,7 @@ using MES.Service.Modes; using MES.Service.util; using SqlSugar; +using System.Data; namespace MES.Service.service.QC; @@ -30,7 +31,7 @@ number = no.ToString().PadLeft(4, '0'); } - return "SJN" + date.Replace("-", "") + number; + return "SJ" + date.Replace("-", "") + number; } //鑾峰彇鎵�鏈夋暟鎹垎椤� @@ -52,11 +53,11 @@ .WhereIF( StringUtil.IsNotNullOrEmpty(queryObj.Result) && "鏈畬鎴�".Equals(queryObj.Result), - a => a.Result == queryObj.Result) + a => a.Fsubmit == 0) .WhereIF( StringUtil.IsNotNullOrEmpty(queryObj.Result) && !"鏈畬鎴�".Equals(queryObj.Result), - a => a.Result != "鏈畬鎴�"); + a => a.Fsubmit == 1); // 鏂板鐨勫姩鎬佹悳绱㈤�昏緫 if (!string.IsNullOrEmpty(queryObj.SearchValue) && !string.IsNullOrEmpty(queryObj.searchField)) @@ -501,4 +502,73 @@ return withOracle; } + //鍒锋柊妫�楠岄」鐩� + public (int result, string message) GenUpdate(decimal? id, string? no, string? user) + { + var outputResult = new SugarParameter("PO_RESULT", null, System.Data.DbType.Int32, ParameterDirection.Output, 4000); + var outputMessage = new SugarParameter("PO_TEXT", null, System.Data.DbType.String, ParameterDirection.Output, 4000); + + var parameters = new List<SugarParameter> + { + new("P_ID", id, System.Data.DbType.Decimal, ParameterDirection.Input), + new("P_NO", no, System.Data.DbType.String, ParameterDirection.Input), + new("P_USER", user, System.Data.DbType.String, ParameterDirection.Input), + outputResult, + outputMessage + }; + + var db = SqlSugarHelper.GetInstance(); + db.Ado.ExecuteCommand( + "BEGIN PRC_GEN_UPDATE(:P_ID, :P_NO, :P_USER, :PO_RESULT, :PO_TEXT); END;", + parameters.ToArray()); + + int result = outputResult.Value == null ? -1 : Convert.ToInt32(outputResult.Value); + string message = outputMessage.Value?.ToString() ?? ""; + + return (result, message); + } + + public bool SjSubmit(SJDto dto) + { + try + { + // 瀹氫箟杈撳嚭鍙傛暟 + var outputResult = new SugarParameter("c_res", null, + System.Data.DbType.Int32, ParameterDirection.Output, + 4000); + + var outputMessage = new SugarParameter("c_msg", null, + System.Data.DbType.String, + ParameterDirection.Output, 4000); + + // 瀹氫箟杈撳叆鍙傛暟锛屽浐瀹欶LAG涓�1锛堝鏍革級 + var parameters = new List<SugarParameter> + { + new("P_ID", dto.id, System.Data.DbType.Decimal, ParameterDirection.Input), + new("P_FLAG", 1, System.Data.DbType.Int32, ParameterDirection.Input), + new("P_USER", dto.userNo, System.Data.DbType.String, ParameterDirection.Input), + outputResult, + outputMessage + }; + + var db = SqlSugarHelper.GetInstance(); + + // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼ + db.Ado.ExecuteCommand( + "BEGIN PRC_WOMDAA_SJ_UPDATE_RES(:P_ID, :P_FLAG, :P_USER, :c_res, :c_msg); END;", + parameters.ToArray()); + + // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� + var resultValue = outputResult.Value?.ToString(); + var messageValue = outputMessage.Value?.ToString(); + + if ("1".Equals(resultValue)) throw new Exception(messageValue); + + return true; + } + catch (Exception ex) + { + throw new Exception(ex.Message); + } + } } \ No newline at end of file -- Gitblit v1.9.3