Merge branch 'v1.0.5' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api into v1.0.5
This commit is contained in:
@@ -5,9 +5,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Customer;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.OutStock;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.OutStockTask;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
@@ -16,6 +21,7 @@ using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Services.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
@@ -32,10 +38,13 @@ namespace WMS.Web.Domain.Services
|
||||
private readonly IOutStockTaskRepositories _outStockTaskRepositories;
|
||||
private readonly IErpOpsSyncDateRepositories _erpOpsSyncDateRepositories;
|
||||
private readonly RedisClientService _redisClientService;
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
public OutStockTaskService(IMapper mapper, IErpService erpService, ILoginService loginService,
|
||||
IBasicsRepositories transactionRepositories,
|
||||
IOutStockRepositories outStockRepositories, IOutStockTaskRepositories outStockTaskRepositories, IErpOpsSyncDateRepositories erpOpsSyncDateRepositories,
|
||||
RedisClientService redisClientService)
|
||||
RedisClientService redisClientService, IErpBasicDataExtendService erpBasicDataExtendService,
|
||||
ISingleDataService singleDataService)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_erpService = erpService;
|
||||
@@ -45,6 +54,8 @@ namespace WMS.Web.Domain.Services
|
||||
_outStockTaskRepositories = outStockTaskRepositories;
|
||||
_erpOpsSyncDateRepositories = erpOpsSyncDateRepositories;
|
||||
_redisClientService = redisClientService;
|
||||
_erpBasicDataExtendService = erpBasicDataExtendService;
|
||||
_singleDataService = singleDataService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -435,6 +446,70 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取出库任务单详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result<OutStockTaskInfoResponse>> GetInfo(int id, LoginInDto loginInfo)
|
||||
{
|
||||
var entity = await _outStockTaskRepositories.Get(id);
|
||||
if (entity == null)
|
||||
return Result<OutStockTaskInfoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
|
||||
//获取任务单对应出库信息
|
||||
var outStockList = await _outStockRepositories.GetByTaskId(id);
|
||||
|
||||
//取组织
|
||||
var org_result = await _erpService.BillQueryForOrg();
|
||||
List<ErpOrgDto> orgs = new List<ErpOrgDto>();
|
||||
if (org_result.IsSuccess)
|
||||
orgs = org_result.Data.ToList();
|
||||
|
||||
//取客户
|
||||
var customer_result = await _erpService.BillQueryForCustomer();
|
||||
List<ErpCustomerDto> customers = new List<ErpCustomerDto>();
|
||||
if (customer_result.IsSuccess)
|
||||
customers = customer_result.Data.ToList();
|
||||
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
List<ErpMaterialDto> materials = new List<ErpMaterialDto>();
|
||||
if (materials_result.IsSuccess)
|
||||
materials = materials_result.Data.ToList();
|
||||
|
||||
OutStockTaskInfoResponse response = new OutStockTaskInfoResponse()
|
||||
{
|
||||
Id = entity.Id,
|
||||
BillNo = entity.BillNo,
|
||||
SourceBillNo = string.Join(",", entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.SourceBillNo)),
|
||||
CreateTime = entity.CreateTime.DateToStringSeconds(),
|
||||
Status = entity.Status.GetRemark(),
|
||||
Type = entity.Type.GetRemark(),
|
||||
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, entity.DeliveryOrgId),
|
||||
ReceiptCustomer = entity.Type == OutStockType.Sal
|
||||
? _erpBasicDataExtendService.GetCustomerName(customers, entity.ReceiptCustomerId)
|
||||
: _erpBasicDataExtendService.GetOrgName(orgs, entity.DeliveryOrgId),
|
||||
};
|
||||
var details = outStockList.SelectMany(s => s.Details).ToList();
|
||||
var boxDetails = outStockList.SelectMany(s => s.Details).SelectMany(s => s.BoxsDetails).ToList();
|
||||
foreach (var b in boxDetails)
|
||||
{
|
||||
var detail = details.FirstOrDefault(f => f.Id == b.DetailId);
|
||||
var outStock = outStockList.FirstOrDefault(f => f.Id == detail.Fid);
|
||||
OutStockTaskInfoDetailsResponse infoDetail = new OutStockTaskInfoDetailsResponse()
|
||||
{
|
||||
BoxBillNo = b.BoxId.ToString(),
|
||||
Qty = b.Qty,
|
||||
SerialNumbers = string.Join(",", b.SerialNumbers),
|
||||
Method = outStock.Method.GetRemark(),
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, loginInfo.UserInfo.CompanyId, outStock.CreatorId),
|
||||
CreateTime = outStock.CreateTime.DateToStringSeconds(),
|
||||
MaterialNumber = detail.MaterialNumber,
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, detail.MaterialNumber),
|
||||
AccruedQty = entity.Details.FirstOrDefault(f => f.MaterialNumber == detail.MaterialNumber)?.AccruedQty ?? 0
|
||||
};
|
||||
}
|
||||
|
||||
return Result<OutStockTaskInfoResponse>.ReSuccess(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user