优化接口

This commit is contained in:
tongfei
2023-11-22 09:57:00 +08:00
parent b1c557c876
commit 935963aa18
8 changed files with 60 additions and 5 deletions

View File

@@ -95,10 +95,15 @@ namespace WMS.Web.Domain.Services
var tagBox = targetBoxInventorys.Where(x => x.BoxId == dto.TargetBoxId).FirstOrDefault();
if (tagBox == null)
{
var newTagBox = new BoxInventory();
newTagBox.BoxId = dto.TargetBoxId;
newTagBox.Details =_mapper.Map<List<BoxInventoryDetails>>(dto.Details);
add_entitys.Add(newTagBox);
if (!string.IsNullOrEmpty(dto.StockCode) && dto.SubStockId.HasValue)
{
var newTagBox = new BoxInventory();
newTagBox.StockCode = dto.StockCode;
newTagBox.SubStockId = dto.SubStockId.Value;
newTagBox.BoxId = dto.TargetBoxId;
newTagBox.Details = _mapper.Map<List<BoxInventoryDetails>>(dto.Details);
add_entitys.Add(newTagBox);
}
}
else
{

View File

@@ -153,13 +153,18 @@ namespace WMS.Web.Domain.Services
//1.先判断:箱号已经绑定了入库任务单中;备注:业务说法就是箱是否收货了
var tast = await _inStockTaskRepositories.GetBy(boxBillNo);
if (tast == null)
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
//2.找到箱对应的物料信息
var box = await _boxRepositories.GetByNo(boxBillNo);
if (box == null)
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.BoxNoData);
//2.1判断箱是否上架过了
var isExist = await _inStockRepositories.IsExistBy(box.Id);
if(isExist)
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.BoxIsTrueShelf);
//3.组装返回数据
var result = _mapper.Map<InStockTaskInfoDto>(tast);
result.BoxId = box.Id;