修改邮件账单

dev
jianghaiqing 2 weeks ago
parent 7b91a8b4f6
commit 3ea83ef540

@ -25,6 +25,9 @@
<None Update="appsettings.json"> <None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -157,11 +157,19 @@ namespace DS.WMS.FeeBillRecvService
var booking = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).First(a => a.MBLNO == blno && a.Deleted == false && (a.IsRefund == null || a.IsRefund.Value == false) var booking = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).First(a => a.MBLNO == blno && a.Deleted == false && (a.IsRefund == null || a.IsRefund.Value == false)
&& (a.IsChangeETD == null || a.IsChangeETD.Value == false)); && (a.IsChangeETD == null || a.IsChangeETD.Value == false));
var ctnList = tenantDb.Queryable<OpCtn>().ClearFilter(typeof(IOrgId)).Where(a => a.BSNO == booking.Id.ToString() && a.Deleted == false).ToList();
_logger.LogInformation($"提取订单完成 GID={model.GID} BookingBill={model.BookingBill} Order={JsonConvert.SerializeObject(booking)}"); _logger.LogInformation($"提取订单完成 GID={model.GID} BookingBill={model.BookingBill} Order={JsonConvert.SerializeObject(booking)}");
if (booking != null) if (booking != null)
{ {
DateTime etd = DateTime.MinValue;
if (booking.ETD.HasValue)
etd = booking.ETD.Value;
DateTime nowDate = DateTime.Now; DateTime nowDate = DateTime.Now;
var custTypeDict = DS.Module.Core.EnumUtil.GetEnumDictionaryWithKey(typeof(CustomerTypeEnum)); var custTypeDict = DS.Module.Core.EnumUtil.GetEnumDictionaryWithKey(typeof(CustomerTypeEnum));
@ -246,6 +254,18 @@ namespace DS.WMS.FeeBillRecvService
newfee.Currency = currCurrCode.CodeName; newfee.Currency = currCurrCode.CodeName;
if (fee.CustFeeStandard.Equals("箱"))
{
var ctnSumList = ctnList.GroupBy(a => a.Ctn)
.Select(a => new { Key = a.Key, Code = a.ToList().FirstOrDefault().CtnCode, Num = a.Sum(b => b.CtnNum.HasValue ? b.CtnNum.Value : 1) }).ToList();
if (fee.Quantity.HasValue && ctnSumList.Count == 1)
{
newfee.Unit = ctnSumList.FirstOrDefault().Code;
newfee.UnitText = ctnSumList.FirstOrDefault().Key;
}
}
if (!fee.UnitPrice.HasValue) if (!fee.UnitPrice.HasValue)
{ {
if (fee.Quantity.HasValue && fee.Amount.HasValue) if (fee.Quantity.HasValue && fee.Amount.HasValue)
@ -264,6 +284,27 @@ namespace DS.WMS.FeeBillRecvService
newfee.TaxUnitPrice = fee.UnitPrice.Value; newfee.TaxUnitPrice = fee.UnitPrice.Value;
} }
if (newfee.Currency.Equals("RMB", StringComparison.OrdinalIgnoreCase) || newfee.Currency.Equals("CNY", StringComparison.OrdinalIgnoreCase))
{
newfee.ExchangeRate = 1;
}
else
{
if (etd != DateTime.MinValue)
{
var exchangeInfo = tenantDb.Queryable<FeeCurrencyExchange>().ClearFilter(typeof(IOrgId))
.First(x => x.CurrencyCode == newfee.Currency && x.OrgId == booking.OrgId
&& x.StartDate.Value <= etd && x.EndDate.Value >= etd && x.LocalCurrency == "RMB");
if (exchangeInfo != null)
{
newfee.ExchangeRate = exchangeInfo.CRValue;
}
}
}
newfee.Quantity = fee.Quantity.HasValue ? fee.Quantity.Value : 0; newfee.Quantity = fee.Quantity.HasValue ? fee.Quantity.Value : 0;
newfee.Amount = fee.Amount.HasValue ? fee.Amount.Value : 0; newfee.Amount = fee.Amount.HasValue ? fee.Amount.Value : 0;

Loading…
Cancel
Save