zyf
2025-04-12 b2be3b6939b4382f9165c78857a072f1aa7b01d0
MES.Service/service/QC/SJService.cs
@@ -3,6 +3,8 @@
using MES.Service.Modes;
using MES.Service.util;
using SqlSugar;
using System.Data;
using DbType = System.Data.DbType;
namespace MES.Service.service.QC;
@@ -468,4 +470,50 @@
        return withOracle;
    }
    public bool QaSubmit(LLJDto dto)
    {
        try
        {
            // 定义输出参数
            var outputResult = new SugarParameter("C_RES", null,
                DbType.Int32, ParameterDirection.Output,
                4000);
            var outputMessage = new SugarParameter("C_MSG", null,DbType.String,
                ParameterDirection.Output, 4000);
            // 定义输入参数
            var parameters = new List<SugarParameter>
            {
                new("P_ID", dto.id, DbType.String,
                    ParameterDirection.Input),
                new("P_USER", dto.userNo, DbType.String,
                    ParameterDirection.Input),
                outputResult,
                outputMessage
            };
            var db = SqlSugarHelper.GetInstance();
            // 使用 SqlSugar 执行存储过程
            db.Ado.ExecuteCommand(
                "BEGIN PRC_FPI_OK_GEN_IPI(:P_ID, :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);
        }
    }
}