查询料架亮灯

This commit is contained in:
qianhao.xu
2024-11-01 17:00:01 +08:00
parent ced8e31bd4
commit a008a174a9
6 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Repository;
using DOAN.Service.PBL.IService;
namespace DOAN.Service.PBL
{
[AppService(ServiceType = typeof(IBigScreenService), ServiceLifetime = LifeTime.Transient)]
public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
{
/// <summary>
/// 查询料架灯 亮和灭 情况
/// </summary>
/// <returns></returns>
public List<BIgScreenDto> SearchShelfLightInfomation()
{
List<BIgScreenDto> result = new List<BIgScreenDto>();
// 1 查询所有料架
string[] RackCodeArray= Context.Queryable<Storagelocation>().GroupBy(it=>it.RackCode).Select(it=>it.RackCode).OrderBy(it=>it).ToArray();
List<Storagelocation> DataSoure= Context.Queryable<Storagelocation>().ToList();
//2 查询每个料架层
for (int i = 0; i < RackCodeArray.Length; i++)
{
BIgScreenDto RackCodeObject = new BIgScreenDto();
RackCodeObject.RackCode = RackCodeArray[i];
List<Storagelocation> LayerSheelfList= DataSoure.Where(it => it.RackCode == RackCodeArray[i]).ToList();
LayerObject[] LayerObjectfArray =new LayerObject[LayerSheelfList.Count];
if (LayerSheelfList != null && LayerSheelfList.Count > 0)
{
for (int j = 0; j < LayerSheelfList.Count; j++)
{
LayerObjectfArray[j].LayerNum=LayerSheelfList[j].LayerNum;
LayerObjectfArray[j].Partnumber=LayerSheelfList[j].Partnumber;
LayerObjectfArray[j].MaxCapacity=LayerSheelfList[j].MaxCapacity;
LayerObjectfArray[j].PackageNum=LayerSheelfList[j].PackageNum;
LayerObjectfArray[j].isLight=LayerSheelfList[j].IsLight==1?true:false;
}
for (int j = 0; j < LayerSheelfList.Count; j++)
{
RackCodeObject.isLight = false;
if (LayerSheelfList[j].IsLight == 1)
{
RackCodeObject.isLight = true;
break;
}
}
}
RackCodeObject.LayerObjectArray= LayerObjectfArray;
result.Add(RackCodeObject);
}
return result;
}
}
}

View File

@@ -0,0 +1,9 @@
using DOAN.Model.PBL;
using DOAN.Model.PBL.Dto;
namespace DOAN.Service.PBL.IService;
public interface IBigScreenService : IBaseService<Storagelocation>
{
List<BIgScreenDto> SearchShelfLightInfomation();
}