调整接口
This commit is contained in:
@@ -29,6 +29,8 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> Delete(ProductInventoryType type, bool isTransaction = true);
|
||||
Task<bool> EditEntityList(List<ProductInventory> entitys, bool isTransaction = true);
|
||||
Task<List<ProductInventory>> GetEntityList(ProductInventoryType type);
|
||||
/// <summary>
|
||||
/// 列表-分页
|
||||
/// </summary>
|
||||
|
||||
17
src/WMS.Web.Domain/Mappers/ProductInventoryMapper.cs
Normal file
17
src/WMS.Web.Domain/Mappers/ProductInventoryMapper.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
public class ProductInventoryMapper : Profile
|
||||
{
|
||||
public ProductInventoryMapper()
|
||||
{
|
||||
CreateMap<ProductInventory, ProductInventory>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,9 @@ namespace WMS.Web.Domain.Services
|
||||
.Select(s => s.WarehouseCodeOfJushuitan)
|
||||
.ToList();
|
||||
if (listNames.Count() <= 0) return Result.ReSuccess();
|
||||
//获取原数据
|
||||
var yList = await _repositories.GetEntityList(ProductInventoryType.JushuiTan);
|
||||
|
||||
//获取领星仓库
|
||||
var resStock = await _juShuiTanService.GetStock();
|
||||
if (!resStock.IsSuccess) return resStock;
|
||||
@@ -139,6 +142,8 @@ namespace WMS.Web.Domain.Services
|
||||
var resInventory = await _juShuiTanService.GetInventory(ids);
|
||||
if (!resInventory.IsSuccess) return resStock;
|
||||
|
||||
|
||||
|
||||
//物料
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
List<ErpMaterialDto> materials = new List<ErpMaterialDto>();
|
||||
@@ -146,6 +151,7 @@ namespace WMS.Web.Domain.Services
|
||||
materials = materials_result.Data.ToList();
|
||||
|
||||
List<ProductInventory> inventoryList = new List<ProductInventory>();
|
||||
List<ProductInventory> update_List = new List<ProductInventory>();
|
||||
foreach (var item in resInventory.Data)
|
||||
{
|
||||
//如果物料不匹配 过滤
|
||||
@@ -167,7 +173,17 @@ namespace WMS.Web.Domain.Services
|
||||
Qty = item.ky_qty,
|
||||
BeforeQty = item.qty ?? 0
|
||||
};
|
||||
inventoryList.Add(entity);
|
||||
|
||||
var old_Entity = yList.FirstOrDefault(f => f.MaterialNumber.Equals(entity.MaterialNumber) &&
|
||||
f.OrgCode.Equals(entity.OrgCode) && f.StockCode.Equals(entity.StockCode));
|
||||
if (old_Entity != null)
|
||||
{
|
||||
old_Entity.Qty = entity.Qty;
|
||||
old_Entity.BeforeQty = entity.BeforeQty;
|
||||
update_List.Add(old_Entity);
|
||||
}
|
||||
else
|
||||
inventoryList.Add(entity);
|
||||
}
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
Result res_Rollback = Result.ReSuccess();
|
||||
@@ -176,7 +192,7 @@ namespace WMS.Web.Domain.Services
|
||||
//先删除之前的再添加
|
||||
if (res_Rollback.IsSuccess)
|
||||
{
|
||||
isSuccess = await _repositories.Delete(ProductInventoryType.LingXing, false);
|
||||
isSuccess = await _repositories.EditEntityList(update_List, false);
|
||||
if (isSuccess == false) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
if (res_Rollback.IsSuccess)
|
||||
@@ -283,7 +299,7 @@ namespace WMS.Web.Domain.Services
|
||||
_logger.LogInformation($"同步成品仓库存->开始 {DateTime.Now}");
|
||||
|
||||
var res = await this.Erp();
|
||||
if(!res.IsSuccess)return res;
|
||||
if (!res.IsSuccess) return res;
|
||||
|
||||
res = await this.JuShuiTan();
|
||||
if (!res.IsSuccess) return res;
|
||||
|
||||
Reference in New Issue
Block a user