| | |
| | | using MES.Service.Modes; |
| | | using MES.Service.util; |
| | | using SqlSugar; |
| | | using System.Data; |
| | | |
| | | namespace MES.Service.service.QC; |
| | | |
| | |
| | | number = no.ToString().PadLeft(4, '0'); |
| | | } |
| | | |
| | | return "SJN" + date.Replace("-", "") + number; |
| | | return "SJ" + date.Replace("-", "") + number; |
| | | } |
| | | |
| | | //获取所有数据分页 |
| | |
| | | .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)) |
| | |
| | | |
| | | 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); |
| | | |
| | | // 定义输入参数,固定FLAG为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); |
| | | } |
| | | } |
| | | } |