|
|
|
@ -21,13 +21,15 @@ public class CwssIngCheckController
|
|
|
|
|
private IWmsTaskOutService _wmsTaskOutService;
|
|
|
|
|
private ICwssBinToMaterService _cwssBinToMaterService;
|
|
|
|
|
private ICwssMaterialInfoService _cwssMaterialInfoService;
|
|
|
|
|
private IInputRecordService _inputRecordService;
|
|
|
|
|
|
|
|
|
|
public CwssIngCheckController(ILogger<CwssIngCheckController> logger,
|
|
|
|
|
AppConfig appConfig,
|
|
|
|
|
IWmsTaskOutService wmsTaskOutService,
|
|
|
|
|
PlcPool plcPool,
|
|
|
|
|
ICwssBinToMaterService cwssBinToMaterService,
|
|
|
|
|
ICwssMaterialInfoService cwssMaterialInfoService)
|
|
|
|
|
ICwssMaterialInfoService cwssMaterialInfoService,
|
|
|
|
|
IInputRecordService inputRecordService)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_appConfig = appConfig;
|
|
|
|
@ -35,6 +37,7 @@ public class CwssIngCheckController
|
|
|
|
|
_plcPool = plcPool;
|
|
|
|
|
_cwssBinToMaterService = cwssBinToMaterService;
|
|
|
|
|
_cwssMaterialInfoService = cwssMaterialInfoService;
|
|
|
|
|
_inputRecordService = inputRecordService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -138,8 +141,8 @@ public class CwssIngCheckController
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存数据
|
|
|
|
|
SaveInputRecord(ingredientInfo, 1, "");
|
|
|
|
|
} while (false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -152,6 +155,48 @@ public class CwssIngCheckController
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取Cwss投料记录
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="apiRequestParam"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("GetCwssInputRecord")]
|
|
|
|
|
public ApiResponse GetCwssInputRecord(ApiRequestParam? apiRequestParam)
|
|
|
|
|
{
|
|
|
|
|
var result = new ApiResponse();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
var cwssInputRecordList = _inputRecordService.GetCwssInputRecordList();
|
|
|
|
|
|
|
|
|
|
if (cwssInputRecordList != null)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(apiRequestParam.MaterialBarcode))
|
|
|
|
|
cwssInputRecordList = cwssInputRecordList.Where(x => x.MaterialBarcode == apiRequestParam.MaterialBarcode)
|
|
|
|
|
.ToList();
|
|
|
|
|
if (!string.IsNullOrEmpty(apiRequestParam.CanNumber))
|
|
|
|
|
cwssInputRecordList = cwssInputRecordList.Where(x => x.CanNumber == apiRequestParam.CanNumber).ToList();
|
|
|
|
|
if (!string.IsNullOrEmpty(apiRequestParam.beginTime))
|
|
|
|
|
cwssInputRecordList = cwssInputRecordList.Where(x => x.RecordTime >= Convert.ToDateTime(apiRequestParam.beginTime)).ToList();
|
|
|
|
|
if (!string.IsNullOrEmpty(apiRequestParam.endTime))
|
|
|
|
|
cwssInputRecordList = cwssInputRecordList.Where(x => x.RecordTime <= Convert.ToDateTime(apiRequestParam.endTime)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string matStr = JsonSerializer.Serialize(cwssInputRecordList);
|
|
|
|
|
result.SetSuccess(matStr);
|
|
|
|
|
_logger.LogInformation($"获取Cwss投料记录成功:{matStr},时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
|
|
|
|
|
|
|
|
|
} while (false);
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
result.SetException(e, "获取Cwss投料记录异常");
|
|
|
|
|
_logger.LogError($"获取Cwss投料记录异常:{e.Message}");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发Cwss开仓指令
|
|
|
|
|
/// </summary>
|
|
|
|
@ -201,4 +246,44 @@ public class CwssIngCheckController
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存投料记录
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SaveInputRecord(IngredientInfo info,int isFlag,string remark)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CwssInputRecord cwssInputRecord = new CwssInputRecord()
|
|
|
|
|
{
|
|
|
|
|
MaterialBarcode = info.MaterialBarcode,
|
|
|
|
|
CanNumber = info.CanNumber,
|
|
|
|
|
EquipId = info.EquipId,
|
|
|
|
|
InputQuantity = info.InputQuantity,
|
|
|
|
|
InputWeight = info.InputWeight,
|
|
|
|
|
IsRemainder = info.IsRemainder,
|
|
|
|
|
RemainderQuantity = info.RemainderQuantity,
|
|
|
|
|
RemainderWeight = info.RemainderWeight,
|
|
|
|
|
IsOpen = info.IsOpen,
|
|
|
|
|
IsFlag = isFlag,
|
|
|
|
|
Remark = remark,
|
|
|
|
|
RecordTime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool result = _inputRecordService.SaveCwssInputRecord(cwssInputRecord);
|
|
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"投料记录:{JsonSerializer.Serialize(cwssInputRecord)}保存成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"投料记录:{JsonSerializer.Serialize(cwssInputRecord)}保存失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"投料记录保存异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|