change - 根据罐号查询称量信息更改为根据罐子绑定的物料ID查询

main
SoulStar 2 weeks ago
parent 4be709a6d9
commit 427309e2ce

@ -287,16 +287,16 @@ namespace Admin.Core.Api.Controllers.Business
return Failed<List<LR_weigh_BatchCode>>("传入参数为空!"); return Failed<List<LR_weigh_BatchCode>>("传入参数为空!");
} }
MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>(); MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>();
string planID = _hw_BarrelService.GetPlanIdByBarrelID(barrelBarcode.Trim()); string materialName = _hw_BarrelService.GetMaterialNameByBarrelID(barrelBarcode.Trim());
if (string.IsNullOrEmpty(planID)) if (string.IsNullOrEmpty(materialName))
{ {
return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的计划ID!"); return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的物料ID!");
} }
if (planID == "-1") if (materialName == "-1")
{ {
return Failed<List<LR_weigh_BatchCode>>("查询不到罐号!"); return Failed<List<LR_weigh_BatchCode>>("查询不到罐号!");
} }
List<LR_weigh> wlist = _lr_weighService.GetRecentWeightList(planID); List<LR_weigh> wlist = _lr_weighService.GetRecentWeightList(materialName);
List<LR_weigh_BatchCode> list = new List<LR_weigh_BatchCode>(); List<LR_weigh_BatchCode> list = new List<LR_weigh_BatchCode>();
foreach (LR_weigh weigh in wlist) foreach (LR_weigh weigh in wlist)
{ {

@ -80,8 +80,8 @@
"DBType": 1, "DBType": 1,
"Enabled": true, "Enabled": true,
"HitRate": 50, "HitRate": 50,
//"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", "Connection": "Data Source=127.0.0.1;Initial Catalog=cwss_xl;User ID=sa;Password=123456;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"Connection": "Data Source=119.45.202.115;Initial Catalog=cwss_xl;User ID=sa;Password=haiwei@123;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", //"Connection": "Data Source=119.45.202.115;Initial Catalog=cwss_xl;User ID=sa;Password=haiwei@123;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", //"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"ProviderName": "System.Data.SqlClient" "ProviderName": "System.Data.SqlClient"

@ -15,8 +15,8 @@ namespace Admin.Core.IService.IService_New
/// <summary> /// <summary>
/// 根据罐号获取料罐ID /// 根据罐号获取料罐ID
/// </summary> /// </summary>
/// <param name="barrelID"></param> /// <param name="barrelBarcode"></param>
/// <returns></returns> /// <returns></returns>
string GetPlanIdByBarrelID(string barrelBarcode); string GetMaterialNameByBarrelID(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>
/// 通过计划号获取最近一次的称量列表 /// 通过物料名称获取最近一次的称量列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
List<LR_weigh> GetRecentWeightList(string planCode); List<LR_weigh> GetRecentWeightList(string MaterialName);
} }
} }

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Admin.Core.Service.Service_New namespace Admin.Core.Service.Service_New
@ -21,12 +22,12 @@ namespace Admin.Core.Service.Service_New
base.BaseDal = dal; base.BaseDal = dal;
} }
public string GetPlanIdByBarrelID(string barrelBarcode) public string GetMaterialNameByBarrelID(string barrelBarcode)
{ {
try try
{ {
string planId = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().PlanId; string materialName = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().MaterialName;
return planId; return materialName;
} }
catch(Exception ex) catch(Exception ex)
{ {

@ -17,11 +17,11 @@ namespace Admin.Core.Service
base.BaseDal = dal; base.BaseDal = dal;
} }
public List<LR_weigh> GetRecentWeightList(string planCode) public List<LR_weigh> GetRecentWeightList(string MaterialName)
{ {
try try
{ {
List<LR_weigh> list = _dal.Query(x => x.Plan_ID == planCode).ToList(); List<LR_weigh> list = _dal.Query(x => x.Material_Name == MaterialName).ToList();
int maxMainID = list.Max(x => x.MainId); int maxMainID = list.Max(x => x.MainId);
List<LR_weigh> groupList = list.Where(x => x.MainId == maxMainID).ToList(); List<LR_weigh> groupList = list.Where(x => x.MainId == maxMainID).ToList();
return groupList; return groupList;

Loading…
Cancel
Save