Merge remote-tracking branch 'origin/煤科院货架液晶显示屏' into 煤科院货架液晶显示屏
This commit is contained in:
@ -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>
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,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>()
|
||||||
{
|
{
|
||||||
|
12
WCS.Model/ApiModel/SingleLight/TurnoffLightByAreaRequest.cs
Normal file
12
WCS.Model/ApiModel/SingleLight/TurnoffLightByAreaRequest.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user