提交修改

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

@ -146,7 +146,67 @@ namespace WCS.BLL.Services.Service
}
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>()
{