47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using WCS.BLL.Manager;
|
|
using WCS.BLL.Services.IService;
|
|
using WCS.Model;
|
|
using WCS.Model.ApiModel.SelfCheck;
|
|
|
|
namespace WCS.BLL.Services.Service
|
|
{
|
|
public class SelfCheckService : ISelfCheckService
|
|
{
|
|
public async Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request)
|
|
{
|
|
//获取货架
|
|
var shelfs = ShelfManager.Shelves
|
|
.Where(t => request.ShelfCodes.Contains(t.ShelfCode))
|
|
.ToList();
|
|
|
|
if (shelfs.Count < request.ShelfCodes.Count)
|
|
{
|
|
foreach (var shelf in shelfs)
|
|
{
|
|
request.ShelfCodes.RemoveAll(t => t == shelf.ShelfCode);
|
|
}
|
|
return new ResponseCommon()
|
|
{
|
|
Code = 201,
|
|
Message = $"货架{string.Join(",", request.ShelfCodes)}不存在!",
|
|
};
|
|
}
|
|
|
|
foreach (var shelf in shelfs)
|
|
{
|
|
shelf.ShelfCheck();
|
|
}
|
|
return new ResponseCommon()
|
|
{
|
|
Code = 200,
|
|
Message = $"货架{string.Join(",", request.ShelfCodes)}已开始自检!",
|
|
};
|
|
}
|
|
}
|
|
}
|