Files
wcs/WCS.BLL/Services/Service/SelfCheckService.cs
hehaibing-1996 aaf7c17562 提交代码
2024-04-23 08:31:37 +08:00

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)}已开始自检!",
};
}
}
}