1.增加手动自检功能,主页增加状态显示
This commit is contained in:
@ -7,6 +7,7 @@ using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.SelfCheck;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
@ -42,5 +43,76 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"货架{string.Join(",", request.ShelfCodes)}已开始自检!",
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> StartSelfCheckByGroupName(List<string> GroupNames)
|
||||
{
|
||||
if (GroupNames == null || GroupNames.Count == 0)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"参数为空!",
|
||||
};
|
||||
}
|
||||
//获取货架
|
||||
var shelfs = ShelfManager.Shelves
|
||||
.Where(t => GroupNames.Contains(t.GroupName))
|
||||
.ToList();
|
||||
var cleintIps = shelfs.Select(t => t.ClientIp).Distinct().ToList();
|
||||
|
||||
foreach (var ip in cleintIps)
|
||||
{
|
||||
var currentIdShelfs = shelfs.Where(t => t.ClientIp == ip)
|
||||
.ToList();
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach(var shelf in currentIdShelfs)
|
||||
{
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var warningModel = new WebSocketMessageModel()
|
||||
{
|
||||
IsWarning = false,
|
||||
ClientIsReceived = true,
|
||||
WarningType = WarningTypeEnum.通知自检进度,
|
||||
StoreId = 0,
|
||||
StoreCode = "",
|
||||
ShelfCode = shelf.ShelfCode,
|
||||
ShelfId = shelf.ShelfId,
|
||||
ClientIp = shelf.WebSocketIpAddress,
|
||||
WarningMessage = $"货架【{shelf.ShelfCode}】开始自检"
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
});
|
||||
|
||||
shelf.ShelfCheck();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var warningModel = new WebSocketMessageModel()
|
||||
{
|
||||
IsWarning = false,
|
||||
ClientIsReceived = true,
|
||||
WarningType = WarningTypeEnum.通知自检进度,
|
||||
StoreId = 0,
|
||||
StoreCode = "",
|
||||
ShelfCode = shelf.ShelfCode,
|
||||
ShelfId = shelf.ShelfId,
|
||||
ClientIp = shelf.WebSocketIpAddress,
|
||||
WarningMessage = $"货架【{shelf.ShelfCode}】已完成自检"
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
});
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
});
|
||||
}
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"已成功开始自检!",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user