提交修改

This commit is contained in:
hehaibing-1996
2024-11-12 13:33:40 +08:00
parent 6282ecc0c1
commit 7427b804f6
5 changed files with 103 additions and 1 deletions

View File

@ -119,6 +119,12 @@ namespace WCS.DAL.DbModels
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")] [SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
public string GroupName { get; set; } public string GroupName { get; set; }
/// <summary>
/// 区域
/// </summary>
[SugarColumn(ColumnName = "area", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
public string Area { get; set; }
/// <summary> /// <summary>
/// 序号 /// 序号
/// </summary> /// </summary>

View File

@ -15,5 +15,11 @@ namespace WCS.BLL.Services.IService
public interface ISingleLightService public interface ISingleLightService
{ {
public Task<ResponseCommon<object>> SingleLightControl(SingleLightControlRequest request); public Task<ResponseCommon<object>> SingleLightControl(SingleLightControlRequest request);
/// <summary>
/// 按区域一键灭灯
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<ResponseCommon<object>> TurnoffLightByArea(TurnoffLightByAreaRequest request);
} }
} }

View File

@ -146,7 +146,67 @@ namespace WCS.BLL.Services.Service
} }
catch (Exception ex) catch (Exception ex)
{ {
//操作失败
return new ResponseCommon<object>()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
public async Task<ResponseCommon<object>> TurnoffLightByArea(TurnoffLightByAreaRequest request)
{
try
{
//传入数据校验
if (string.IsNullOrEmpty(request.Area))
{
return new ResponseCommon<object>()
{
Code = 201,
Message = "操作失败参数传入错误Area为空",
};
}
//库位
var stores = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.Area == request.Area)
.ToList();
if (stores == null || stores.Count == 0)
{
return new ResponseCommon<object>
{
Code = 201,
Message = $"操作失败:所选区域不存在库位!"
};
}
//对应货架获取TCP和报警灯ID
var shelfIds = stores.Select(t => t.ShelfId).Distinct().ToList();
var shelfs = DbHelp.db.Queryable<ShelfInfo>().Where(t => shelfIds.Contains(t.Id))
.ToList();
//获取对应货架所有IP
var clientIPs = shelfs.Select(t => t.ClientIp)
.Distinct()
.ToList();
//挨个发关灯指令
foreach (var clientIP in clientIPs)
{
}
//返回成功
return new ResponseCommon<object>()
{
Code = 200,
Message = "success",
};
}
catch (Exception ex)
{
//操作失败 //操作失败
return new ResponseCommon<object>() return new ResponseCommon<object>()
{ {

View File

@ -0,0 +1,12 @@

using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.SingleLight
{
public class TurnoffLightByAreaRequest : RequestBase
{
public string Area { get; set; } = string.Empty;
}
}

View File

@ -44,5 +44,23 @@ namespace WCS.WebApi.Controllers
} }
} }
[Route("turnoffLightByArea")]
[HttpPost(Name = "turnoffLightByArea")]
public async Task<ResponseBase> TurnoffLightByArea(TurnoffLightByAreaRequest request)
{
try
{
return await _singleLightService.TurnoffLightByArea(request);
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = "操作失败:" + ex.Message,
};
}
}
} }
} }