提交修改
This commit is contained in:
@ -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>()
|
||||
{
|
||||
|
Reference in New Issue
Block a user