调整接口

This commit is contained in:
tongfei
2023-12-13 14:10:24 +08:00
parent 20fff099fd
commit 988190a13c
14 changed files with 267 additions and 160 deletions

View File

@@ -56,7 +56,7 @@ namespace WMS.Web.Domain.Services
/// <param name="type"></param>
/// <param name="loginInfo"></param>
/// <returns></returns>
public async Task<Result> BackShelf(SaveBackRecordRequest dto, BackRecordType type, LoginInDto loginInfo)
public async Task<Result> BackShelf(BackRecordOnOffRequest dto, BackRecordType type, LoginInDto loginInfo)
{
IDbContextTransaction _transaction = _basicsRepositories.GetTransaction();
bool isRollback = false;
@@ -67,22 +67,18 @@ namespace WMS.Web.Domain.Services
return Result.ReFailure(ResultCodes.ErpStockNoData);
var entity = new BackRecord();
entity.Method =(InventoryInOutMethod)dto.Method;
entity.OrgCode = dto.OrgCode;
entity.StockCode = dto.StockCode;
entity.SubStockId = dto.SubStockId;
entity.Type = type;
entity.Details = _mapper.Map<List<BackRecordDetails>>(dto.Details);
entity.Details.ForEach(x =>
{
var stock = stocks.Where(t => t.Code == x.StockCode).FirstOrDefault();
if (stock != null)
x.OrgCode = stock.ErpOrgCode;
});
entity.Create(loginInfo.UserInfo.StaffId);
entity = await _backRecordRepositories.Add(entity, isTransaction);
if (entity == null)
return Result.ReFailure(ResultCodes.DateWriteError);
//保存成功后:序列号跟踪流程添加
var serialNumber_result = await _serialNumberService.BackRecord(entity, loginInfo, isTransaction);
if (!serialNumber_result.IsSuccess)
@@ -90,7 +86,7 @@ namespace WMS.Web.Domain.Services
#region
//获取目标箱和原箱信息
var current_box_about = dto.Details.GroupBy(x => new { x.BoxId, x.SubStockId, x.StockCode }).Select(x => new { x.Key.BoxId, x.Key.SubStockId, x.Key.StockCode }).ToList();
var current_box_about = dto.Details.GroupBy(x => new { x.BoxId }).Select(x => new { x.Key.BoxId }).ToList();
var current_sernub_box = dto.Details.GroupBy(x => x.SerialNumberBoxId).Select(x => x.Key).ToList();
//要改箱的数据集合
@@ -106,7 +102,7 @@ namespace WMS.Web.Domain.Services
var changeBox = new SaveChangeBoxRecordRequest();
changeBox.SrcBoxId = serBoxId;
changeBox.DestBoxId = boxAbout.BoxId;
changeBox.SubStockId = boxAbout.SubStockId;
changeBox.SubStockId = entity.SubStockId;
ganenrateChangeBoxs.Add(changeBox);
}
}
@@ -135,9 +131,7 @@ namespace WMS.Web.Domain.Services
#endregion
//保存成功后:变更库存
var entitys = new List<BackRecord>();
entitys.Add(entity);
var boxInventoryResult = await _boxInventoryService.GenerateBackBox(entitys, isTransaction);
var boxInventoryResult = await _boxInventoryService.GenerateBackBox(entity, isTransaction);
if (!boxInventoryResult.IsSuccess)
return boxInventoryResult;