From ab53de1796ab995bb7b82becb3587867aa1e3c8d Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Tue, 12 Nov 2024 19:37:47 +0800 Subject: [PATCH] 1 --- WCS.BLL/DbModels/StoreInfo.cs | 8 +++++- .../Services/Service/SingleLightService.cs | 6 ++++- WCS.BLL/Tool/Helper.cs | 25 ++++++++++++++++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/WCS.BLL/DbModels/StoreInfo.cs b/WCS.BLL/DbModels/StoreInfo.cs index ac83cbb..f404109 100644 --- a/WCS.BLL/DbModels/StoreInfo.cs +++ b/WCS.BLL/DbModels/StoreInfo.cs @@ -122,9 +122,15 @@ namespace WCS.DAL.DbModels /// /// 区域 /// - [SugarColumn(ColumnName = "area", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")] + [SugarColumn(ColumnName = "area", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的区域 用于煤科院按区域灭灯")] public string Area { get; set; } + /// + /// 单灯每个库位灯的个数 + /// + [SugarColumn(ColumnName = "single_light_number", IsNullable = false, DefaultValue = "1", ColumnDescription = "单灯货架灯的个数,用于煤科院大库位灯")] + public int SingleLightNumber { get; set; } + /// /// 序号 /// diff --git a/WCS.BLL/Services/Service/SingleLightService.cs b/WCS.BLL/Services/Service/SingleLightService.cs index c506dfc..415d166 100644 --- a/WCS.BLL/Services/Service/SingleLightService.cs +++ b/WCS.BLL/Services/Service/SingleLightService.cs @@ -75,7 +75,10 @@ namespace WCS.BLL.Services.Service { var shelfModel = new SingleLightShelfModel(); //报警灯 - shelfModel.WarningLightMode = request.LightMode; + if(shelf.LightId > 0) + { + shelfModel.WarningLightMode = request.LightMode; + } shelfModel.WarningLightColor = request.ColorMode; shelfModel.WarningBoardId = shelf.LightId; shelfModel.ClientIp = shelf.ClientIp; @@ -86,6 +89,7 @@ namespace WCS.BLL.Services.Service BoardId = t.BoardId, LightMode = request.LightMode, LightColor = request.ColorMode, + LightNumber = t.SingleLightNumber, }).ToList(); shelfModels.Add(shelfModel); diff --git a/WCS.BLL/Tool/Helper.cs b/WCS.BLL/Tool/Helper.cs index c08f1d1..5eda82b 100644 --- a/WCS.BLL/Tool/Helper.cs +++ b/WCS.BLL/Tool/Helper.cs @@ -376,9 +376,12 @@ namespace WCS.BLL.Tool { foreach (var store in shelf.StoreList) { - var singleLightData = GenerateSingleLightData(store.BoardId, store.LightMode, store.LightColor); - lightCount++; - dataBase = dataBase.Concat(singleLightData).ToArray(); + for (int i = 0; i < store.LightNumber; i++) + { + var singleLightData = GenerateSingleLightData(store.BoardId + i, store.LightMode, store.LightColor); + lightCount++; + dataBase = dataBase.Concat(singleLightData).ToArray(); + } } } } @@ -408,7 +411,7 @@ namespace WCS.BLL.Tool { public string ClientIp { get; set; } = string.Empty; public int WarningBoardId { get; set; } - public int WarningLightMode { get; set; } + public int WarningLightMode { get; set; } = -1; public int WarningBuzzerMode { get; set; } public int WarningLightColor { get; set; } public List StoreList { get; set; } = new List(); @@ -419,6 +422,11 @@ namespace WCS.BLL.Tool public int BoardId { get; set; } public int LightMode { get; set; } public int LightColor { get; set; } + + /// + /// 单灯存在大库位灯 每个库位可能不止一个灯 故加此字段 + /// + public int LightNumber { get; set; } = 1; } //单灯货架全部灭灯 @@ -433,6 +441,15 @@ namespace WCS.BLL.Tool dataBase[5] = 0xff; dataBase[6] = 0x00; dataBase[7] = 0x00; + //byte[] dataBase = new byte[6]; + //dataBase[0] = 0xff; + //dataBase[1] = 0x00; + //dataBase[2] = 0x00; + //dataBase[3] = 0x08; + //dataBase[4] = 0x02; + //dataBase[5] = 0x01; + //dataBase[6] = 0x00; + //dataBase[7] = 0x00; byte[] dataWithCRC = Crc16(dataBase, dataBase.Length, true); return dataWithCRC; }