接口优化
This commit is contained in:
@@ -198,44 +198,59 @@ namespace WMS.Web.Domain.Services
|
|||||||
//需要同步金蝶
|
//需要同步金蝶
|
||||||
|
|
||||||
entity = await _inStockRepositories.Add(entity, isTransaction);
|
entity = await _inStockRepositories.Add(entity, isTransaction);
|
||||||
|
if (entity == null)
|
||||||
if (entity != null)
|
|
||||||
{
|
|
||||||
//保存成功后:序列号跟踪流程添加
|
|
||||||
var serialNumber_result = await _serialNumberService.InStock(entity, loginInfo, isTransaction);
|
|
||||||
if (!serialNumber_result.IsSuccess)
|
|
||||||
return serialNumber_result;
|
|
||||||
|
|
||||||
//保存成功后:变更箱库存
|
|
||||||
var boxInventoryGenerateDto = dto.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
|
|
||||||
{
|
|
||||||
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
|
|
||||||
InventoryInOutType = (int)InventoryInOutType.In,
|
|
||||||
BoxId = x.Key.BoxId,
|
|
||||||
StockCode = x.Key.StockCode,
|
|
||||||
SubStockId = x.Key.SubStockId
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
foreach (var item in dto.Details)
|
|
||||||
{
|
|
||||||
var current = boxInventoryGenerateDto.Where(x => x.BoxId == item.BoxId).FirstOrDefault();
|
|
||||||
if (current != null)
|
|
||||||
{
|
|
||||||
var detail = new BoxInventoryGenerateDetailsDto();
|
|
||||||
detail.MaterialId = item.MaterialId;
|
|
||||||
detail.Qty = item.Qty;
|
|
||||||
detail.SerialNumbers = item.SerialNumbers;
|
|
||||||
current.Details.Add(detail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
|
|
||||||
if (!boxInventoryResult.IsSuccess)
|
|
||||||
return boxInventoryResult;
|
|
||||||
|
|
||||||
return Result.ReSuccess();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|
||||||
|
//同步金蝶后,反写任务单的已交数量
|
||||||
|
var taskId= dto.Details.GroupBy(x => x.TaskId).Select(x=>x.Key).FirstOrDefault();
|
||||||
|
var task= await _inStockTaskRepositories.Get(taskId);
|
||||||
|
if (task != null)
|
||||||
|
{
|
||||||
|
task.Details.ForEach(x =>
|
||||||
|
{
|
||||||
|
var current_dto_det = dto.Details.Where(x => x.MaterialId == x.MaterialId).FirstOrDefault();
|
||||||
|
if (current_dto_det != null)
|
||||||
|
x.DeliveredQty = current_dto_det.Qty;
|
||||||
|
});
|
||||||
|
task=await _inStockTaskRepositories.Update(task);
|
||||||
|
if(task==null)
|
||||||
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存成功后:序列号跟踪流程添加
|
||||||
|
var serialNumber_result = await _serialNumberService.InStock(entity, loginInfo, isTransaction);
|
||||||
|
if (!serialNumber_result.IsSuccess)
|
||||||
|
return serialNumber_result;
|
||||||
|
|
||||||
|
//保存成功后:变更箱库存
|
||||||
|
var boxInventoryGenerateDto = dto.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
|
||||||
|
{
|
||||||
|
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
|
||||||
|
InventoryInOutType = (int)InventoryInOutType.In,
|
||||||
|
BoxId = x.Key.BoxId,
|
||||||
|
StockCode = x.Key.StockCode,
|
||||||
|
SubStockId = x.Key.SubStockId
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
foreach (var item in dto.Details)
|
||||||
|
{
|
||||||
|
var current = boxInventoryGenerateDto.Where(x => x.BoxId == item.BoxId).FirstOrDefault();
|
||||||
|
if (current != null)
|
||||||
|
{
|
||||||
|
var detail = new BoxInventoryGenerateDetailsDto();
|
||||||
|
detail.MaterialId = item.MaterialId;
|
||||||
|
detail.Qty = item.Qty;
|
||||||
|
detail.SerialNumbers = item.SerialNumbers;
|
||||||
|
current.Details.Add(detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
|
||||||
|
if (!boxInventoryResult.IsSuccess)
|
||||||
|
return boxInventoryResult;
|
||||||
|
|
||||||
|
return Result.ReSuccess();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 非采购上架-保存
|
/// 非采购上架-保存
|
||||||
@@ -256,7 +271,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
entity.Type = task.Type;
|
entity.Type = task.Type;
|
||||||
entity.Details = new List<InStockDetails>();
|
entity.Details = new List<InStockDetails>();
|
||||||
|
|
||||||
var temps=new List<InStockDetails>();
|
var temps = new List<InStockDetails>();
|
||||||
//3.遍历:box信息,并拼装入库单明细
|
//3.遍历:box信息,并拼装入库单明细
|
||||||
foreach (var box in dto.Boxs)
|
foreach (var box in dto.Boxs)
|
||||||
{
|
{
|
||||||
@@ -271,7 +286,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
item.SubStockId = dto.SubStockId;
|
item.SubStockId = dto.SubStockId;
|
||||||
item.StockCode = dto.StockCode;
|
item.StockCode = dto.StockCode;
|
||||||
|
|
||||||
var taskDet= task.Details.Where(x => x.MaterialId == item.MaterialId).FirstOrDefault();
|
var taskDet = task.Details.Where(x => x.MaterialId == item.MaterialId).FirstOrDefault();
|
||||||
item.SupplierId = taskDet.SupplierId;
|
item.SupplierId = taskDet.SupplierId;
|
||||||
item.OrgId = taskDet.OrgId;
|
item.OrgId = taskDet.OrgId;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
{
|
{
|
||||||
//2.1.2修改数量
|
//2.1.2修改数量
|
||||||
item.AccruedQty = erp_data.Qty;
|
item.AccruedQty = erp_data.Qty;
|
||||||
item.DeliveredQty = erp_data.DeliveredQty;
|
item.DeliveredQty = erp_data.DeliveredQty> item.DeliveredQty? erp_data.DeliveredQty: item.DeliveredQty;
|
||||||
erp_remove_billNo.Add(data.SourceBillNo);
|
erp_remove_billNo.Add(data.SourceBillNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user