diff --git a/DOAN.Admin.WebApi/Controllers/PBL/BigScreenController.cs b/DOAN.Admin.WebApi/Controllers/PBL/BigScreenController.cs index 5c47e34..31f55da 100644 --- a/DOAN.Admin.WebApi/Controllers/PBL/BigScreenController.cs +++ b/DOAN.Admin.WebApi/Controllers/PBL/BigScreenController.cs @@ -11,5 +11,22 @@ namespace DOAN.Admin.WebApi.Controllers.PBL; public class BigScreenController : BaseController { + private readonly IBigScreenService _BigScreenService; + + public BigScreenController(IBigScreenService _BigScreenService) + { + this._BigScreenService = _BigScreenService; + } + + + //TODO 查询料架灯 亮和灭 情况 + public IActionResult SearchShelfLightInfomation() + { + var response = _BigScreenService.SearchShelfLightInfomation(); + return SUCCESS(response); + } + + + } \ No newline at end of file diff --git a/DOAN.Model/PBL/Dto/BIgScreenDto.cs b/DOAN.Model/PBL/Dto/BIgScreenDto.cs new file mode 100644 index 0000000..2c43175 --- /dev/null +++ b/DOAN.Model/PBL/Dto/BIgScreenDto.cs @@ -0,0 +1,30 @@ +namespace DOAN.Model.PBL.Dto; + +public class BIgScreenDto +{ + //料架号 + public string RackCode { get; set; } + + // + public LayerObject[] LayerObjectArray { get; set; } + + //是否亮灯 + public bool isLight { get; set; } +} + +public class LayerObject +{ + // 层号 + public int LayerNum { get; set; } + + // 零件号 + public string Partnumber { get; set; } + // 最大容量 + public int MaxCapacity { get; set; } + + // 箱子数 + public int? PackageNum { get; set; } + + //是否亮灯 + public bool isLight { get; set; } +} \ No newline at end of file diff --git a/DOAN.Model/PBL/Dto/StoragelocationDto.cs b/DOAN.Model/PBL/Dto/StoragelocationDto.cs index b8d5e8f..e212fe4 100644 --- a/DOAN.Model/PBL/Dto/StoragelocationDto.cs +++ b/DOAN.Model/PBL/Dto/StoragelocationDto.cs @@ -31,6 +31,12 @@ namespace DOAN.Model.PBL.Dto public int MaxCapacity { get; set; } public int? PackageNum { get; set; } + + + /// + /// 箱子数 + /// + public int? IsLight { get; set; } public string CreatedBy { get; set; } diff --git a/DOAN.Model/PBL/Storagelocation.cs b/DOAN.Model/PBL/Storagelocation.cs index c33fe6d..6d6f2e7 100644 --- a/DOAN.Model/PBL/Storagelocation.cs +++ b/DOAN.Model/PBL/Storagelocation.cs @@ -40,6 +40,12 @@ namespace DOAN.Model.PBL /// [SugarColumn(ColumnName = "package_num")] public int? PackageNum { get; set; } + + /// + /// 箱子数 + /// + [SugarColumn(ColumnName = "is_light")] + public int? IsLight { get; set; } /// /// 创建人 diff --git a/DOAN.Service/PBL/BigScreenService.cs b/DOAN.Service/PBL/BigScreenService.cs new file mode 100644 index 0000000..d2f340e --- /dev/null +++ b/DOAN.Service/PBL/BigScreenService.cs @@ -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, IBigScreenService + { + /// + /// 查询料架灯 亮和灭 情况 + /// + /// + + public List SearchShelfLightInfomation() + { + List result = new List(); + + // 1 查询所有料架 + string[] RackCodeArray= Context.Queryable().GroupBy(it=>it.RackCode).Select(it=>it.RackCode).OrderBy(it=>it).ToArray(); + + List DataSoure= Context.Queryable().ToList(); + //2 查询每个料架层 + for (int i = 0; i < RackCodeArray.Length; i++) + { + BIgScreenDto RackCodeObject = new BIgScreenDto(); + RackCodeObject.RackCode = RackCodeArray[i]; + + List 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; + } + } + +} diff --git a/DOAN.Service/PBL/IService/IBigScreenService.cs b/DOAN.Service/PBL/IService/IBigScreenService.cs new file mode 100644 index 0000000..20a845f --- /dev/null +++ b/DOAN.Service/PBL/IService/IBigScreenService.cs @@ -0,0 +1,9 @@ +using DOAN.Model.PBL; +using DOAN.Model.PBL.Dto; + +namespace DOAN.Service.PBL.IService; + +public interface IBigScreenService : IBaseService +{ + List SearchShelfLightInfomation(); +} \ No newline at end of file