70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
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;
|
|
}
|
|
}
|
|
|
|
}
|