change - 上辅机校验逻辑完善

master
Wen JY 10 months ago
parent 15435b64d2
commit 060fec29c6

@ -1,6 +1,7 @@
using System.Text.Json; using System.Text.Json;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SlnMesnac.Config; using SlnMesnac.Config;
using SlnMesnac.Model.domain;
using SlnMesnac.Model.dto; using SlnMesnac.Model.dto;
using SlnMesnac.Plc; using SlnMesnac.Plc;
using SlnMesnac.Repository.service; using SlnMesnac.Repository.service;
@ -49,17 +50,39 @@ public class IngCheckController
var result = new ApiResponse(); var result = new ApiResponse();
try try
{ {
if (ingredientInfo != null) do
{
if (ingredientInfo == null)
{ {
result.SetSuccess($"上辅机校验失败,缺少必要参数,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
break;
}
_logger.LogInformation($"上辅机验证参数:{JsonSerializer.Serialize(ingredientInfo)}"); _logger.LogInformation($"上辅机验证参数:{JsonSerializer.Serialize(ingredientInfo)}");
var mcsInfo = _mcsBinToMaterService.GetMcsBinToMaterByBinNo(1, ingredientInfo.CanNumber);
if (mcsInfo != null) McsBinToMater mcsInfo = _mcsBinToMaterService.GetMcsBinToMaterByBinNo(1, ingredientInfo.CanNumber);
if (mcsInfo == null)
{
result.SetFailure($"上辅机校验失败,根据料罐获取对应信息为空,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
break;
}
WmsTaskOut wmsInfo = _wmsTaskOutService.GetWmsTaskOutBySerialNum(ingredientInfo.MaterialBarcode);
if (wmsInfo == null)
{ {
var wmsInfo = _wmsTaskOutService.GetWmsTaskOutBySerialNum(ingredientInfo.MaterialBarcode); result.SetFailure($"上辅机校验失败,根据物料条码获取物料信息为空,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
break;
}
if (mcsInfo.MatCode.Contains(wmsInfo.MaterNo)) if (mcsInfo.MatCode.Contains(wmsInfo.MaterNo))
{ {
result.SetSuccess($"上辅机校验成功,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); result.SetSuccess($"上辅机校验成功,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
else
{
result.SetFailure($"上辅机校验失败,物料不匹配,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
break;
}
if (ingredientInfo.IsOpen == 1) if (ingredientInfo.IsOpen == 1)
{ {
@ -67,30 +90,18 @@ public class IngCheckController
if (openFlag) if (openFlag)
{ {
_logger.LogInformation($"上辅机开仓指令下发成功!"); _logger.LogInformation($"上辅机开仓指令下发成功!");
result.SetSuccess($"上辅机校验成功,开仓指令下发成功,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
} }
else else
{ {
_logger.LogError("上辅机开仓指令下发失败"); _logger.LogError("上辅机开仓指令下发失败");
result.SetSuccess($"上辅机校验成功,开仓指令下发失败,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
break;
} }
} }
//保存数据 //保存数据
} } while (false);
else
{
result.SetFailure($"上辅机校验失败,物料不匹配,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
else
{
result.SetFailure($"上辅机校验失败,根据料罐获取对应信息为空,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
else
{
result.SetSuccess($"上辅机校验失败,缺少必要参数,时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
} }
catch (Exception e) catch (Exception e)

Loading…
Cancel
Save