|
|
|
@ -301,20 +301,28 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("传入参数为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = await _xl_materialService.BindBarrel(barrelBarcode.Trim());
|
|
|
|
|
int taskResult = await _xl_materialService.BindBarrel(barrelBarcode.Trim());
|
|
|
|
|
|
|
|
|
|
int weightResult = 0;
|
|
|
|
|
|
|
|
|
|
MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>();
|
|
|
|
|
string materialName = _hw_BarrelService.GetMaterialNameByBarrelID(barrelBarcode.Trim());
|
|
|
|
|
if (string.IsNullOrEmpty(materialName))
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的物料ID!");
|
|
|
|
|
weightResult = 1;
|
|
|
|
|
//return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的物料ID!");
|
|
|
|
|
}
|
|
|
|
|
if (materialName == "-1")
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("查询不到罐号!");
|
|
|
|
|
weightResult = 2;
|
|
|
|
|
//return Failed<List<LR_weigh_BatchCode>>("查询不到罐号!");
|
|
|
|
|
}
|
|
|
|
|
List<LR_weigh> wlist = _lr_weighService.GetRecentWeightList(materialName);
|
|
|
|
|
List<LR_weigh_BatchCode> list = new List<LR_weigh_BatchCode>();
|
|
|
|
|
if (wlist.Count == 0 || wlist == null)
|
|
|
|
|
{
|
|
|
|
|
weightResult = 3;
|
|
|
|
|
}
|
|
|
|
|
foreach (LR_weigh weigh in wlist)
|
|
|
|
|
{
|
|
|
|
|
LR_weigh_BatchCode record = new LR_weigh_BatchCode();
|
|
|
|
@ -322,39 +330,46 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
record.BatchCode = _binFeedingReportServices.GetBatchNumberByMaterialAndBinID(weigh.Material_ID, weigh.Bin_Serial ?? -1);
|
|
|
|
|
list.Add(record);
|
|
|
|
|
}
|
|
|
|
|
if (list != null && list.Count != 0)
|
|
|
|
|
{
|
|
|
|
|
if (result == 0)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:未查询到正在执行的计划!");
|
|
|
|
|
if (result == 1)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:未查询到桶!");
|
|
|
|
|
if (result == 2)
|
|
|
|
|
return Success(list, $"查询成功,任务结束失败,原因:未查询到[{barrelBarcode}]桶信息!");
|
|
|
|
|
if (result == 3)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:该桶已经绑定物料,请联系系统管理员处理!");
|
|
|
|
|
if (result == 6)
|
|
|
|
|
|
|
|
|
|
string taskString = "";
|
|
|
|
|
string WeightString = "";
|
|
|
|
|
|
|
|
|
|
if (taskResult == 0)
|
|
|
|
|
taskString = "任务结束失败 原因:未查询到正在执行的计划!";
|
|
|
|
|
if (taskResult == 1)
|
|
|
|
|
taskString = "任务结束失败 原因:未查询到桶!";
|
|
|
|
|
if (taskResult == 2)
|
|
|
|
|
taskString = $"任务结束失败 原因:未查询到[{barrelBarcode}]桶信息!";
|
|
|
|
|
if (taskResult == 3)
|
|
|
|
|
taskString = "任务结束失败 原因:该桶已经绑定物料,请联系系统管理员处理!";
|
|
|
|
|
if (taskResult == 6)
|
|
|
|
|
{
|
|
|
|
|
log.Info("任务结束成功");
|
|
|
|
|
return Success(list, "任务结束成功,计划信息查询成功");
|
|
|
|
|
}
|
|
|
|
|
if (result == 7)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:称重未完成!");
|
|
|
|
|
if (result == 8)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:PLC连接失败,请检查PLC或者联系管理员处理!");
|
|
|
|
|
if (result == 10)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:未知异常,请查看错误日志!");
|
|
|
|
|
if (result == 99)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:保存处理数据失败!");
|
|
|
|
|
if (result == 100)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:处理中....!");
|
|
|
|
|
if (result == 110)
|
|
|
|
|
return Success(list, "查询成功,任务结束失败,原因:执行批次未获取!");
|
|
|
|
|
return Success(list, "查询成功,任务结束失败");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("称量信息查询失败!查询不到称量信息!任务未结束");
|
|
|
|
|
}
|
|
|
|
|
taskString = "任务结束成功";
|
|
|
|
|
}
|
|
|
|
|
if (taskResult == 7)
|
|
|
|
|
taskString = "任务结束失败 原因:称重未完成!";
|
|
|
|
|
if (taskResult == 8)
|
|
|
|
|
taskString = "任务结束失败 原因:PLC连接失败,请检查PLC或者联系管理员处理!";
|
|
|
|
|
if (taskResult == 10)
|
|
|
|
|
taskString = "任务结束失败 原因:未知异常,请查看错误日志!";
|
|
|
|
|
if (taskResult == 99)
|
|
|
|
|
taskString = "任务结束失败 原因:保存处理数据失败!";
|
|
|
|
|
if (taskResult == 100)
|
|
|
|
|
taskString = "任务结束失败 原因:处理中....!";
|
|
|
|
|
if (taskResult == 110)
|
|
|
|
|
taskString = "任务结束失败 原因:执行批次未获取!";
|
|
|
|
|
|
|
|
|
|
if (weightResult == 0)
|
|
|
|
|
WeightString = "称量信息查询成功";
|
|
|
|
|
if (weightResult == 1)
|
|
|
|
|
WeightString = "查询不到罐号对应的物料ID!";
|
|
|
|
|
if (weightResult == 2)
|
|
|
|
|
WeightString = "查询不到罐号!";
|
|
|
|
|
if (weightResult == 3)
|
|
|
|
|
WeightString = "查询不到该罐号对应的最近一次物料的称量信息!";
|
|
|
|
|
|
|
|
|
|
return Success(list, $"{WeightString} {taskString}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|