change - 结束计划接口改绑PlanID

main
SoulStar 1 month ago
parent 7484048f1a
commit 62ce3f6eb9

@ -306,23 +306,23 @@ namespace Admin.Core.Api.Controllers.Business
int weightResult = 0;
MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>();
string materialName = _hw_BarrelService.GetMaterialNameByBarrelID(barrelBarcode.Trim());
if (string.IsNullOrEmpty(materialName))
string planID = _hw_BarrelService.GetPlanIDByBarrelID(barrelBarcode.Trim());
if (string.IsNullOrEmpty(planID))
{
weightResult = 1;
//return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的物料ID!");
//return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的PlanID!");
}
if (materialName == "-1")
if (planID == "-1")
{
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>();
List<LR_weigh> wlist = _lr_weighService.GetRecentWeightList(planID);
if (wlist.Count == 0 || wlist == null)
{
weightResult = 3;
}
List<LR_weigh_BatchCode> list = new List<LR_weigh_BatchCode>();
foreach (LR_weigh weigh in wlist)
{
LR_weigh_BatchCode record = new LR_weigh_BatchCode();
@ -363,7 +363,7 @@ namespace Admin.Core.Api.Controllers.Business
if (weightResult == 0)
WeightString = "称量信息查询成功";
if (weightResult == 1)
WeightString = "查询不到罐号对应的物料ID!";
WeightString = "查询不到罐号对应的PlanID!";
if (weightResult == 2)
WeightString = "查询不到罐号!";
if (weightResult == 3)

@ -1,4 +1,4 @@
{
{
"AllowedHosts": "*",
"Logging": {
"LogLevel": {
@ -162,7 +162,7 @@
{
"Id": 1,
"EquipName": "小料PLC",
"IP": "192.168.10.130",
"IP": "192.168.10.100",
"Port": 102
},
{

@ -13,10 +13,10 @@ namespace Admin.Core.IService.IService_New
public interface IHw_BarrelServices : IBaseServices<Hw_Barrel>
{
/// <summary>
/// 根据罐号获取料罐ID
/// 根据罐号获取PlanID
/// </summary>
/// <param name="barrelBarcode"></param>
/// <returns></returns>
string GetMaterialNameByBarrelID(string barrelBarcode);
string GetPlanIDByBarrelID(string barrelBarcode);
}
}

@ -10,9 +10,9 @@ namespace Admin.Core.IService
public interface ILR_weighServices :IBaseServices<LR_weigh>
{
/// <summary>
/// 通过物料名称获取最近一次的称量列表
/// 通过PlanID称获取最近一次的称量列表
/// </summary>
/// <returns></returns>
List<LR_weigh> GetRecentWeightList(string MaterialName);
List<LR_weigh> GetRecentWeightList(string PlanID);
}
}

@ -22,12 +22,12 @@ namespace Admin.Core.Service.Service_New
base.BaseDal = dal;
}
public string GetMaterialNameByBarrelID(string barrelBarcode)
public string GetPlanIDByBarrelID(string barrelBarcode)
{
try
{
string materialName = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().MaterialName;
return materialName;
string planId = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().PlanId;
return planId;
}
catch(Exception ex)
{

@ -17,18 +17,14 @@ namespace Admin.Core.Service
base.BaseDal = dal;
}
public List<LR_weigh> GetRecentWeightList(string MaterialName)
public List<LR_weigh> GetRecentWeightList(string planID)
{
try
{
List<LR_weigh> list = _dal.Query(x => x.Material_Name == MaterialName).ToList();
if (list == null && list.Count == 0)
{
return new List<LR_weigh>();
}
int maxMainID = list.Max(x => x.MainId);
List<LR_weigh> groupList = list.Where(x => x.MainId == maxMainID).ToList();
return groupList;
List<LR_weigh> list = _dal.Query(x => x.Plan_ID == planID).ToList();
//int maxMainID = list.Max(x => x.MainId);
//List<LR_weigh> groupList = list.Where(x => x.MainId == maxMainID).ToList();
return list;
}
catch
{

Loading…
Cancel
Save