|
|
@ -3,7 +3,9 @@ using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Win_in.Sfs.Auth.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
|
|
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
|
|
@ -18,7 +20,8 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
private readonly string billtype = "1003"; |
|
|
|
private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; |
|
|
|
private readonly IOutgoingToExternalManager _outgoingToExternalManager; |
|
|
|
// private readonly IUserDepartmentAppService _departmentAppService;
|
|
|
|
private readonly IDepartmentAppService _departmentAppService; |
|
|
|
private readonly IConfiguration _configuration; |
|
|
|
private readonly IObjectMapper _objectMapper; |
|
|
|
private readonly ISalePriceSheetAppService _salePriceSheetAppService; |
|
|
|
|
|
|
@ -26,13 +29,14 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
IOutgoingFromWmsManager outgoingFromWmsManager |
|
|
|
, IOutgoingToExternalManager outgoingToExternalManager |
|
|
|
, IObjectMapper objectMapper, |
|
|
|
ISalePriceSheetAppService salePriceSheetAppService |
|
|
|
) |
|
|
|
ISalePriceSheetAppService salePriceSheetAppService, IConfiguration configuration, IDepartmentAppService departmentAppService) |
|
|
|
{ |
|
|
|
_outgoingFromWmsManager = outgoingFromWmsManager; |
|
|
|
_outgoingToExternalManager = outgoingToExternalManager; |
|
|
|
_objectMapper = objectMapper; |
|
|
|
_salePriceSheetAppService = salePriceSheetAppService; |
|
|
|
_configuration = configuration; |
|
|
|
_departmentAppService = departmentAppService; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -52,6 +56,10 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
var wmsReceipt = JsonSerializer.Deserialize<DeliverNoteDTO>(outgoingFromWms.DataContent); |
|
|
|
#region 明细
|
|
|
|
var WipDetails = wmsReceipt.Details.GroupBy(r => new { r.Number, r.ItemCode, r.FromLocationErpCode }).Select(p => new DeliverNoteDetailExchangeDto { Qty = p.Sum(itm => itm.Qty), Number = p.Key.Number, ItemCode = p.Key.ItemCode, FromLocationErpCode = p.Key.FromLocationErpCode }); |
|
|
|
|
|
|
|
var department = await _departmentAppService.GetByUsernameAsync(wmsReceipt.Worker).ConfigureAwait(false); |
|
|
|
var departmentCode = department == null ? "" : department.Code; |
|
|
|
|
|
|
|
foreach (var detail in WipDetails) |
|
|
|
{ |
|
|
|
var item= await _salePriceSheetAppService.GetByItemCodeAndCustomerCode(detail.ItemCode, wmsReceipt.CustomerCode); |
|
|
@ -85,7 +93,7 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
if (flag) |
|
|
|
{ |
|
|
|
var exchangeReceipt = _objectMapper.Map<DeliverNoteDTO, DeliverNoteExchangeDto>(wmsReceipt); |
|
|
|
var purchaseOrder = BuildDataInterface(exchangeReceipt, tyrpNumber); |
|
|
|
var purchaseOrder = BuildDataInterface(exchangeReceipt, tyrpNumber, departmentCode); |
|
|
|
var outgoingToExternal = new OutgoingToExternal() |
|
|
|
{ |
|
|
|
DataType = EnumOutgoingDataType.Deliver.ToString(), |
|
|
@ -125,7 +133,7 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
/// </summary>
|
|
|
|
/// <param name="exchangeOrder"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private Wmsoutm BuildDataInterface(DeliverNoteExchangeDto exchangeOrder,string tyrpNumber) |
|
|
|
private Wmsoutm BuildDataInterface(DeliverNoteExchangeDto exchangeOrder,string tyrpNumber,string departmentCode) |
|
|
|
{ |
|
|
|
|
|
|
|
var ret = new Wmsoutm() |
|
|
@ -136,7 +144,7 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
wmsoutm_stat = "Y", |
|
|
|
wmsoutm_tyrp_dt = "", |
|
|
|
wmsoutm_user = "WMS", |
|
|
|
wmsoutm_dept = "", |
|
|
|
wmsoutm_dept = departmentCode, |
|
|
|
// wmsoutm_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"),
|
|
|
|
wmsoutm_date = DateTime.Now.ToString("yyyyMMdd"), |
|
|
|
wmsoutm_cust = exchangeOrder.CustomerCode ?? "", |
|
|
@ -150,6 +158,7 @@ public class DeliverNoteConverter : IOutgoingConverter |
|
|
|
wmsoutm_id = 0,//明细中最大scmsend_id
|
|
|
|
wmsoutm_open_qty = 0, |
|
|
|
}; |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|