xwt
2025-06-09 8b24ad8df638deaa3fec77c1533c12ce6129eb71
llj紧急放行接口
已修改4个文件
148 ■■■■■ 文件已修改
StandardInterface/MES.Service/Modes/LtsLlj.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/Modes/MesQaItemsDetect01.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/service/QC/LljService.cs 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MESApplication/Controllers/QC/LljController.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/Modes/LtsLlj.cs
@@ -201,4 +201,8 @@
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public string? NewFngDesc { get; set; }
    /// <summary>
    ///     紧急放行标识
    /// </summary>
    public int EMERGENCY { get; set; }
}
StandardInterface/MES.Service/Modes/MesQaItemsDetect01.cs
@@ -459,4 +459,10 @@
    /// </summary>
    [SugarColumn(ColumnName = "MANAGER_USER")]
    public string? ManagerUser { get; set; }
    /// <summary>
    ///     经理审核人
    /// </summary>
    [SugarColumn(ColumnName = "MANAGER_USER")]
    public int EMERGENCY { get; set; }
}
StandardInterface/MES.Service/service/QC/LljService.cs
@@ -52,8 +52,7 @@
                        .Contains(queryObj.SearchValue.ToLower()))
            .OrderByDescending(a => a.Id)
            .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
            var emergencyValues = pageList.Select(item => item.EMERGENCY).ToList();
        return (pageList, totalCount);
    }
@@ -103,6 +102,92 @@
    }
    //紧急放行
    public string[] EmergencyRelease(int id)
    {
        var db = SqlSugarHelper.GetInstance();
        int emergencyStatus = db.Queryable<MesQaItemsDetect01>()
                                .Where(t => t.Id == id)
                                .Select(t => t.EMERGENCY)
                                .First();
        if (emergencyStatus != 0)
        {
            return new string[] { "1", "非紧急状态,无法执行紧急放行" };
        }
        var outputResult = new SugarParameter("PO_RESULT", null,
            DbType.Int32, ParameterDirection.Output, 4000);
        var outputMessage = new SugarParameter("PO_MSG", null,
            DbType.String, ParameterDirection.Output, 4000);
        var parameters = new List<SugarParameter>
    {
        new("P_ID", id, DbType.Int32, ParameterDirection.Input),
        outputResult,
        outputMessage
    };
        db.Ado.ExecuteCommand(
            "BEGIN prc_MES_QA_ITEMS_update1(:P_ID, :PO_RESULT, :PO_MSG); END;",
            parameters.ToArray());
        var lotNo1 = db.Queryable<MesQaItemsDetect01>()
                   .Where(t => t.Id == id)
                   .Select(t => t.LotNo1)
                   .First();
        var resultValue = outputResult.Value?.ToString();
        var messageValue = outputMessage.Value?.ToString();
        return new string[] { resultValue, messageValue, lotNo1?.ToString() ?? "" };
    }
    public string[] WithdrawEmergencyRelease(int id)
    {
        var db = SqlSugarHelper.GetInstance();
        int emergencyStatus = db.Queryable<MesQaItemsDetect01>()
                                .Where(t => t.Id == id)
                                .Select(t => t.EMERGENCY)
                                .First();
        if (emergencyStatus != 0)
        {
            return new string[] { "1", "非紧急状态,无需撤回" };
        }
        var outputResult = new SugarParameter("PO_RESULT", null,
            DbType.Int32, ParameterDirection.Output, 4000);
        var outputMessage = new SugarParameter("PO_MSG", null,
            DbType.String, ParameterDirection.Output, 4000);
        var parameters = new List<SugarParameter>
    {
        new("P_ID", id, DbType.Int32, ParameterDirection.Input),
        outputResult,
        outputMessage
    };
        db.Ado.ExecuteCommand(
            "BEGIN prc_MES_QA_ITEMS_update2(:P_ID, :PO_RESULT, :PO_MSG); END;",
            parameters.ToArray());
        var lotNo1 = db.Queryable<MesQaItemsDetect01>()
                   .Where(t => t.Id == id)
                   .Select(t => t.LotNo1)
                   .First();
        var resultValue = outputResult.Value?.ToString();
        var messageValue = outputMessage.Value?.ToString();
        return new string[] { resultValue, messageValue, lotNo1?.ToString() ?? "" };
    }
    private string ExtractSubstring(string input, char startChar, char endChar)
    {
        var startIndex = input.IndexOf(startChar);
@@ -194,7 +279,8 @@
                a.FreQty,
                a.CheckQyt,
                a.FcheckResu,
                a.FcheckItemDesc
                a.FcheckItemDesc,
                a.Funit
            }).Select((a, b) => new MesQaItemsDetectDetail5
            {
                Id = a.Id,
@@ -215,7 +301,8 @@
                FenterQty = SqlFunc.AggregateCount(b.Id),
                FcheckResu = a.FcheckResu,
                // FcheckItemDesc = a.FcheckItemDesc
                FcheckItemDesc = a.FspecRequ
                FcheckItemDesc = a.FspecRequ,
                Funit = a.Funit
            }).ToList();
    }
StandardInterface/MESApplication/Controllers/QC/LljController.cs
@@ -273,4 +273,47 @@
            return ResponseResult.ResponseError(ex);
        }
    }
    [HttpPost("EmergencyRelease")]
    public ResponseResult EmergencyRelease([FromBody] JObject data)
    {
        var id = Convert.ToInt32(data["id"].ToString());
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new LljService().EmergencyRelease(id);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    [HttpPost("WithdrawEmergencyRelease")]
    public ResponseResult WithdrawEmergencyRelease([FromBody] JObject data)
    {
        var id = Convert.ToInt32(data["id"].ToString());
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new LljService().WithdrawEmergencyRelease(id);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
}