|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using SlnMesnac.Config;
|
|
|
|
|
using SlnMesnac.Model.dto;
|
|
|
|
|
using SlnMesnac.Repository.service;
|
|
|
|
|
|
|
|
|
@ -13,16 +14,18 @@ namespace SlnMesnac.Controllers;
|
|
|
|
|
public class IngCheckController
|
|
|
|
|
{
|
|
|
|
|
private ILogger<IngCheckController> _logger;
|
|
|
|
|
private AppConfig _appConfig;
|
|
|
|
|
private IMcsBinToMaterService _mcsBinToMaterService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="logger"></param>
|
|
|
|
|
public IngCheckController(ILogger<IngCheckController> logger,IMcsBinToMaterService mcsBinToMaterService)
|
|
|
|
|
public IngCheckController(ILogger<IngCheckController> logger,IMcsBinToMaterService mcsBinToMaterService,AppConfig appConfig)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_mcsBinToMaterService = mcsBinToMaterService;
|
|
|
|
|
_appConfig = appConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -31,17 +34,14 @@ public class IngCheckController
|
|
|
|
|
/// <param name="ingredientInfo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("BigMaterial")]
|
|
|
|
|
public ApiResponse BigMaterialCheck(IngredientInfo ingredientInfo)
|
|
|
|
|
public ApiResponse BigMaterialCheck(IngredientInfo? ingredientInfo)
|
|
|
|
|
{
|
|
|
|
|
var result = new ApiResponse();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (ingredientInfo != null)
|
|
|
|
|
{
|
|
|
|
|
string json = JsonSerializer.Serialize(ingredientInfo);
|
|
|
|
|
_logger.LogInformation($"大料验证参数:{json}");
|
|
|
|
|
_logger.LogInformation($"大料验证参数:{JsonSerializer.Serialize(ingredientInfo)}");
|
|
|
|
|
var info = _mcsBinToMaterService.GetMcsBinToMaterByBinNo(ingredientInfo.EquipId, ingredientInfo.CanNumber);
|
|
|
|
|
if (info != null)
|
|
|
|
|
{
|
|
|
|
@ -55,6 +55,10 @@ public class IngCheckController
|
|
|
|
|
result.SetFailure($"大料校验失败,物料不匹配,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.SetFailure($"大料校验失败,根据料罐获取对应信息异常,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -66,7 +70,7 @@ public class IngCheckController
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
result.SetException(e,"大料投料校验异常");
|
|
|
|
|
_logger.LogError("大料投料校验异常",e);
|
|
|
|
|
_logger.LogError($"大料投料校验异常:{e.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
@ -78,7 +82,7 @@ public class IngCheckController
|
|
|
|
|
/// <param name="ingredientInfo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("SmallMaterial")]
|
|
|
|
|
public ApiResponse SmallMaterialCheck(IngredientInfo ingredientInfo)
|
|
|
|
|
public ApiResponse SmallMaterialCheck(IngredientInfo? ingredientInfo)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = new ApiResponse();
|
|
|
|
@ -87,20 +91,19 @@ public class IngCheckController
|
|
|
|
|
{
|
|
|
|
|
if (ingredientInfo != null)
|
|
|
|
|
{
|
|
|
|
|
string json = JsonSerializer.Serialize(ingredientInfo);
|
|
|
|
|
_logger.LogInformation($"小料验证参数:{json}");
|
|
|
|
|
result.SetSuccess($"校验成功,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
_logger.LogInformation($"小料验证参数:{JsonSerializer.Serialize(ingredientInfo)}");
|
|
|
|
|
result.SetSuccess($"小料校验成功,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.SetSuccess($"校验失败,缺少必要参数,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
result.SetSuccess($"小料校验失败,缺少必要参数,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(e);
|
|
|
|
|
result.SetException(e,"小料投料校验异常");
|
|
|
|
|
_logger.LogError($"小料投料校验异常:{e.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|