料架功能修改,亮灯看板功能修改

This commit is contained in:
赵正易 2025-02-06 09:09:53 +08:00
parent 9efae261f4
commit 0f403387ed
8 changed files with 219 additions and 33 deletions

View File

@ -17,8 +17,15 @@ public class BigScreenController : BaseController
{
this._BigScreenService = _BigScreenService;
}
//TODO 综合查询料架情况
[HttpGet("SearchBigScreenInformation")]
public IActionResult SearchBigScreenInformation()
{
var response = _BigScreenService.SearchBigScreenInformation();
return SUCCESS(response);
}
//TODO 查询料架灯 亮和灭 情况
[HttpGet("searchShelfLightInfomation")]
public IActionResult SearchShelfLightInfomation()

View File

@ -113,5 +113,43 @@ namespace DOAN.Admin.WebApi.Controllers.PBL
return ToResponse(_StoragelocationService.Delete(idArr));
}
/// <summary>
/// 获取料架下拉数据
/// </summary>
/// <returns></returns>
[HttpGet("GetRackCodeOptions")]
[AllowAnonymous]
public IActionResult GetRackCodeOptions()
{
var response = _StoragelocationService.GetRackCodeOptions();
return SUCCESS(response);
}
/// <summary>
/// 获取BOM中的零件号下拉
/// </summary>
/// <returns></returns>
[HttpGet("GetPartNumberOptions")]
[AllowAnonymous]
public IActionResult GetPartNumberOptions()
{
var response = _StoragelocationService.GetPartNumberOptions();
return SUCCESS(response);
}
/// <summary>
/// 修改料架的零件号
/// </summary>
/// <returns></returns>
[HttpGet("UpdateRackPartNumber")]
[AllowAnonymous]
public IActionResult UpdateRackPartNumber(string rackCode, int layerNum, string partnumber)
{
var response = _StoragelocationService.UpdateRackPartNumber(rackCode,layerNum,partnumber);
return SUCCESS(response);
}
}
}

View File

@ -1,11 +1,30 @@
namespace DOAN.Model.PBL.Dto;
/// <summary>
/// 综合料架信息
/// </summary>
public class BigScreenDto
{
// 标题
public string Title { get; set; }
// 料架号
public string RackCode { get; set; }
// 箱子数组
public LayerObject[] LayerObjectArray { get; set; }
// 是否亮灯
public bool IsLight { get; set; }
// 料架是否使用
public bool IsInUse { get; set; }
// 是否缺料
public bool IsFeedingMaterial { get; set; }
}
public class BIgScreenDtoLightPickupDto
{
//料架号
public string RackCode { get; set; }
//
//
public LayerObject[] LayerObjectArray { get; set; }
//是否亮灯
@ -17,7 +36,7 @@ public class BigSreeenDtoFeedingMaterial
//料架号
public string RackCode { get; set; }
//
//
public LayerFeedingMaterialObject[] LayerObjectArray { get; set; }
//是否补料
@ -26,20 +45,22 @@ public class BigSreeenDtoFeedingMaterial
public class LayerObject
{
// 零件号
public string Partnumber { get; set; }
// 层号
public int LayerNum { get; set; }
// 零件号
public string Partnumber { get; set; }
// 最大容量
public int MaxCapacity { get; set; }
// 箱子数
public int? PackageNum { get; set; }
// 当前箱子数
public int PackageNum { get; set; }
//是否亮灯
public bool isLight { get; set; }
public bool IsLight { get; set; }
// 最低安全库存
public int AlarmNum { get; set; }
// 是否启用报警
public int IsLackAlarm { get; set; }
//是否缺料
public bool IsFeedingMaterial { get; set; }
}
public class LayerFeedingMaterialObject
@ -47,15 +68,15 @@ public class LayerFeedingMaterialObject
// 层号
public int LayerNum { get; set; }
// 零件号
// 零件号
public string Partnumber { get; set; }
// 最大容量
public int MaxCapacity { get; set; }
// 箱子数
// 箱子数
public int? PackageNum { get; set; }
//是否亮灯
public bool isFeedingMaterial { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DOAN.Model.PBL.Dto
{
public class SelectOptionsDto
{
public string Key { get; set; }
public string Label { get; set; }
public string Value { get; set; }
}
}

View File

@ -9,7 +9,7 @@ namespace DOAN.Service.PBL;
public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
{
/// <summary>
/// 查询料架灯 亮和灭 情况
/// 查询料架灯 亮和灭 情况 (功能迁移至SearchBigScreenInfomation新增最低安全库存等功能)
/// </summary>
/// <returns></returns>
public List<BIgScreenDtoLightPickupDto> SearchShelfLightInfomation()
@ -17,7 +17,10 @@ public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
var result = new List<BIgScreenDtoLightPickupDto>();
// 1 查询所有料架
var RackCodeArray = Context.Queryable<Storagelocation>().GroupBy(it => it.RackCode).Select(it => it.RackCode)
var RackCodeArray = Context
.Queryable<Storagelocation>()
.GroupBy(it => it.RackCode)
.Select(it => it.RackCode)
.ToArray();
var DataSoure = Context.Queryable<Storagelocation>().ToList();
@ -37,8 +40,8 @@ public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
LayerObject.LayerNum = LayerSheelfList[j].LayerNum;
LayerObject.Partnumber = LayerSheelfList[j].Partnumber;
LayerObject.MaxCapacity = LayerSheelfList[j].MaxCapacity;
LayerObject.PackageNum = LayerSheelfList[j].PackageNum;
LayerObject.isLight = LayerSheelfList[j].IsLight == 1 ? true : false;
LayerObject.PackageNum = LayerSheelfList[j].PackageNum ?? 0;
LayerObject.IsLight = LayerSheelfList[j].IsLight == 1 ? true : false;
LayerObjectfArray[j] = LayerObject;
}
@ -57,18 +60,21 @@ public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
result.Add(RackCodeObject);
}
return result.OrderBy(it => it.RackCode).ToList();
}
/// <summary>
/// (功能迁移至SearchBigScreenInfomation新增最低安全库存等功能)
/// </summary>
/// <returns></returns>
public List<BigSreeenDtoFeedingMaterial> SearchfeedingMaterialInfomation()
{
var result = new List<BigSreeenDtoFeedingMaterial>();
// 1 查询所有料架
var RackCodeArray = Context.Queryable<Storagelocation>().GroupBy(it => it.RackCode).Select(it => it.RackCode)
var RackCodeArray = Context
.Queryable<Storagelocation>()
.GroupBy(it => it.RackCode)
.Select(it => it.RackCode)
.ToArray();
var DataSoure = Context.Queryable<Storagelocation>().ToList();
@ -89,7 +95,8 @@ public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
LayerObject.Partnumber = LayerSheelfList[j].Partnumber;
LayerObject.MaxCapacity = LayerSheelfList[j].MaxCapacity;
LayerObject.PackageNum = LayerSheelfList[j].PackageNum;
LayerObject.isFeedingMaterial = LayerSheelfList[j].PackageNum <= 2 ? true : false;
LayerObject.isFeedingMaterial =
LayerSheelfList[j].PackageNum <= 2 ? true : false;
LayerObjectfArray[j] = LayerObject;
}
@ -108,9 +115,47 @@ public class BigScreenService : BaseService<Storagelocation>, IBigScreenService
result.Add(RackCodeObject);
}
return result.OrderBy(it => it.RackCode).ToList();
}
}
/// <summary>
/// 看板综合信息查询
/// </summary>
/// <returns></returns>
public List<BigScreenDto> SearchBigScreenInformation()
{
// 一次性获取所有数据并按RackCode分组
var rackGroups = Context.Queryable<Storagelocation>()
.ToList()
.GroupBy(sl => sl.RackCode)
.OrderBy(g => g.Key);
var result = new List<BigScreenDto>();
foreach (var group in rackGroups)
{
var layers = group.ToList();
var layerObjects = layers.Select(layer => new LayerObject
{
LayerNum = layer.LayerNum,
Partnumber = layer.Partnumber,
MaxCapacity = layer.MaxCapacity,
AlarmNum = layer.AlarmNum ?? 2, // 确认默认值
PackageNum = layer.PackageNum ?? 0,
IsLight = layer.IsLight == 1,
IsFeedingMaterial = (layer.PackageNum ?? 0) <= (layer.AlarmNum ?? 2) && layer.IsLackAlarm == 1
}).ToArray();
var rackDto = new BigScreenDto
{
Title = group.Key,
RackCode = group.Key,
IsLight = layers.Any(l => l.IsLight == 1),
IsInUse = layers.Any(l => l.IsLackAlarm == 1),
IsFeedingMaterial = layers.Any(l => (l.PackageNum ?? 0) <= (l.AlarmNum ?? 2) && l.IsLackAlarm == 1),
LayerObjectArray = layerObjects
};
result.Add(rackDto);
}
return result;
}
}

View File

@ -5,8 +5,13 @@ namespace DOAN.Service.PBL.IService;
public interface IBigScreenService : IBaseService<Storagelocation>
{
List<BIgScreenDtoLightPickupDto> SearchShelfLightInfomation();
/// <summary>
/// 查询料架相关的基本信息
/// </summary>
/// <returns></returns>
List<BigScreenDto> SearchBigScreenInformation();
List<BigSreeenDtoFeedingMaterial> SearchfeedingMaterialInfomation();
List<BIgScreenDtoLightPickupDto> SearchShelfLightInfomation();
}
List<BigSreeenDtoFeedingMaterial> SearchfeedingMaterialInfomation();
}

View File

@ -8,6 +8,19 @@ namespace DOAN.Service.PBL.IService
/// </summary>
public interface IStoragelocationService : IBaseService<Storagelocation>
{
/// <summary>
/// 获取料架下拉数据
/// </summary>
/// <returns></returns>
List<SelectOptionsDto> GetRackCodeOptions();
/// <summary>
/// 获取BOM中的零件号下拉
/// </summary>
/// <returns></returns>
List<SelectOptionsDto> GetPartNumberOptions();
PagedInfo<StoragelocationDto> GetList(StoragelocationQueryDto parm);
Storagelocation GetInfo(int Id);
@ -22,5 +35,11 @@ namespace DOAN.Service.PBL.IService
/// <param name="parm"></param>
/// <returns></returns>
List<StoragelocationPartNumberGroupDto> GetPartNumberList();
/// <summary>
/// 修改料架的零件号
/// </summary>
/// <returns></returns>
int UpdateRackPartNumber(string rackCode,int layerNum,string partnumber);
}
}

View File

@ -96,6 +96,42 @@ namespace DOAN.Service.PBL
return predicate;
}
public List<SelectOptionsDto> GetRackCodeOptions()
{
var response = Queryable()
.GroupBy(it => it.RackCode)
.OrderBy(it => it.RackCode)
.Select(it => new SelectOptionsDto()
{
Key = SqlFunc.AggregateMax(it.Id).ToString(),
Label = SqlFunc.AggregateMax(it.RackCode),
Value = SqlFunc.AggregateMax(it.RackCode)
})
.OrderBy(it => it.Key)
.ToList();
return response;
}
public List<SelectOptionsDto> GetPartNumberOptions()
{
var response = Context.Queryable<Billofmaterials>()
.Select(it => new SelectOptionsDto()
{
Key = it.Id.ToString(),
Label = it.Productname + it.Productcode + " " + it.MirrorshellName + it.MirrorshellCode,
Value = it.MirrorshellCode
})
.OrderBy(it => it.Key)
.ToList();
return response;
}
public int UpdateRackPartNumber(string rackCode, int layerNum, string partnumber)
{
return Context.Updateable<Storagelocation>()
.SetColumns(it => it.Partnumber == partnumber )
.Where(it => it.RackCode == rackCode && it.LayerNum == layerNum)
.ExecuteCommand();
}
}
}