change - 结束计划接口改绑PlanID

main
SoulStar 2 months ago
parent 7484048f1a
commit 62ce3f6eb9

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

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

@ -13,10 +13,10 @@ namespace Admin.Core.IService.IService_New
public interface IHw_BarrelServices : IBaseServices<Hw_Barrel> public interface IHw_BarrelServices : IBaseServices<Hw_Barrel>
{ {
/// <summary> /// <summary>
/// 根据罐号获取料罐ID /// 根据罐号获取PlanID
/// </summary> /// </summary>
/// <param name="barrelBarcode"></param> /// <param name="barrelBarcode"></param>
/// <returns></returns> /// <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> public interface ILR_weighServices :IBaseServices<LR_weigh>
{ {
/// <summary> /// <summary>
/// 通过物料名称获取最近一次的称量列表 /// 通过PlanID称获取最近一次的称量列表
/// </summary> /// </summary>
/// <returns></returns> /// <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; base.BaseDal = dal;
} }
public string GetMaterialNameByBarrelID(string barrelBarcode) public string GetPlanIDByBarrelID(string barrelBarcode)
{ {
try try
{ {
string materialName = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().MaterialName; string planId = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().PlanId;
return materialName; return planId;
} }
catch(Exception ex) catch(Exception ex)
{ {

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

Loading…
Cancel
Save