diff --git a/Admin.Core.Api/Controllers/Business/WarehouseController.cs b/Admin.Core.Api/Controllers/Business/WarehouseController.cs
index 5e893bc..52d18da 100644
--- a/Admin.Core.Api/Controllers/Business/WarehouseController.cs
+++ b/Admin.Core.Api/Controllers/Business/WarehouseController.cs
@@ -75,7 +75,7 @@ namespace Admin.Core.Api.Controllers.Business
///
///
///
- public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService,
+ public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService,
IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService, IBinFeedingReportServices binFeedingReportServices, Ixl_materialServices xl_materialService) : base(sysUserService)
{
_sysUserService = sysUserService;
@@ -301,20 +301,28 @@ namespace Admin.Core.Api.Controllers.Business
return Failed>("传入参数为空!");
}
- var result = await _xl_materialService.BindBarrel(barrelBarcode.Trim());
+ int taskResult = await _xl_materialService.BindBarrel(barrelBarcode.Trim());
+
+ int weightResult = 0;
MessageModel> messageModel = new MessageModel>();
string materialName = _hw_BarrelService.GetMaterialNameByBarrelID(barrelBarcode.Trim());
if (string.IsNullOrEmpty(materialName))
{
- return Failed>("查询不到罐号对应的物料ID!");
+ weightResult = 1;
+ //return Failed>("查询不到罐号对应的物料ID!");
}
if (materialName == "-1")
{
- return Failed>("查询不到罐号!");
+ weightResult = 2;
+ //return Failed>("查询不到罐号!");
}
List wlist = _lr_weighService.GetRecentWeightList(materialName);
List list = new List();
+ 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)
- {
- 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
+
+ string taskString = "";
+ string WeightString = "";
+
+ if (taskResult == 0)
+ taskString = "任务结束失败 原因:未查询到正在执行的计划!";
+ if (taskResult == 1)
+ taskString = "任务结束失败 原因:未查询到桶!";
+ if (taskResult == 2)
+ taskString = $"任务结束失败 原因:未查询到[{barrelBarcode}]桶信息!";
+ if (taskResult == 3)
+ taskString = "任务结束失败 原因:该桶已经绑定物料,请联系系统管理员处理!";
+ if (taskResult == 6)
{
- return Failed>("称量信息查询失败!查询不到称量信息!任务未结束");
+ log.Info("任务结束成功");
+ 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
diff --git a/Admin.Core.Service/Service_New/LR_weighServices.cs b/Admin.Core.Service/Service_New/LR_weighServices.cs
index b6aee05..2ec4b18 100644
--- a/Admin.Core.Service/Service_New/LR_weighServices.cs
+++ b/Admin.Core.Service/Service_New/LR_weighServices.cs
@@ -22,13 +22,17 @@ namespace Admin.Core.Service
try
{
List list = _dal.Query(x => x.Material_Name == MaterialName).ToList();
+ if (list == null && list.Count == 0)
+ {
+ return new List();
+ }
int maxMainID = list.Max(x => x.MainId);
List groupList = list.Where(x => x.MainId == maxMainID).ToList();
return groupList;
}
catch
{
- throw;
+ return new List();
}
}
}
diff --git a/Admin.Core.Service/Service_New/xl_materialServices.cs b/Admin.Core.Service/Service_New/xl_materialServices.cs
index e91fc8c..0c44f21 100644
--- a/Admin.Core.Service/Service_New/xl_materialServices.cs
+++ b/Admin.Core.Service/Service_New/xl_materialServices.cs
@@ -375,7 +375,7 @@ namespace Admin.Core.Service
barrel.Weight = tcheckWeight;
barrel.CreateDateTime = DateTime.Now;
- int tcheckBatch = GetTcheckBatch(plcList);//当前执行的车次
+ int tcheckBatch = plcList.plc.ReadInt16("DB110.DBW212"); //当前执行的车次
log.Info("批次:" + tcheckBatch.ToString());
if (tcheckBatch > 0)
{
@@ -393,14 +393,14 @@ namespace Admin.Core.Service
//total_Error = total_Error;
if (batch == 0) //完成
{
- log.Info($"no1>>剩余批次:{batch}>计划批次:{exec.Plan_Num}》当前批次》{tcheckBatch}");
+ log.Info($"no1>>剩余批次:{batch} > 计划批次:{exec.Plan_Num}》当前批次》{tcheckBatch}");
await _hw_BarrelRepository.UpdateAsync(barrel);
var r = await UpdatePlanCompletedQuantity(plcList, exec.Plan_Id, tcheckBatch, 8, DateTime.Now, total_Weight, total_Error);
//log.Info("称量完成:" + r);
if (r)
{
//判断上位机判断当前值与配方总重,满足要求时,置“2”
- plcList.plc.WriteInt32("DB110.DBW88", 2);//2:上位机完成,实点位为DB110.DBW90
+ plcList.plc.WriteInt32("DB110.DBW88", 2); //2:上位机完成,实点位为DB110.DBW90
return 6;
}
else