|
|
|
@ -27,6 +27,7 @@ using DS.WMS.Core.Map.Interface;
|
|
|
|
|
using Org.BouncyCastle.Ocsp;
|
|
|
|
|
using DS.WMS.Core.Invoice.Dtos;
|
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
|
using DS.WMS.Core.Info.Interface;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
@ -41,6 +42,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
private readonly IConfigService configService;
|
|
|
|
|
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
private readonly IMappingCarrierService _mappingCarrierService;
|
|
|
|
|
private readonly IClientInfoService _clientInfoService;
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE = "CARGOO_DATA";
|
|
|
|
|
|
|
|
|
@ -54,6 +56,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
seaComService = _serviceProvider.GetRequiredService<ISeaExportCommonService>();
|
|
|
|
|
configService = _serviceProvider.GetRequiredService<IConfigService>();
|
|
|
|
|
_mappingCarrierService = _serviceProvider.GetRequiredService<IMappingCarrierService>();
|
|
|
|
|
_clientInfoService = _serviceProvider.GetRequiredService<IClientInfoService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 发送Cargoo
|
|
|
|
@ -80,7 +83,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
if (bookingInfo == null)
|
|
|
|
|
return DataResult<CargooShipmentResultDto>.Failed("订单信息获取失败,订单ID错误或数据已作废");
|
|
|
|
|
|
|
|
|
|
if (bookingInfo.ParentId != null || bookingInfo.ParentId > 0)
|
|
|
|
|
if (bookingInfo.ParentId != null && bookingInfo.ParentId > 0)
|
|
|
|
|
{
|
|
|
|
|
return DataResult<CargooShipmentResultDto>.Failed("当前订单不是主单不能发送");
|
|
|
|
|
}
|
|
|
|
@ -477,44 +480,42 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
if (IsWSLFOB)
|
|
|
|
|
{
|
|
|
|
|
var tmpList = tenantDb.Queryable<SeaExportShippingBillTemplate>()
|
|
|
|
|
.WhereIF(order.ShipperId.HasValue && order.ShipperId.Value > 0, x => x.Id == order.ShipperId.Value)
|
|
|
|
|
.WhereIF(order.ConsigneeId.HasValue && order.ConsigneeId.Value > 0, x => x.Id == order.ConsigneeId.Value)
|
|
|
|
|
.WhereIF(order.NotifyPartyId.HasValue && order.NotifyPartyId.Value > 0, x => x.Id == order.NotifyPartyId.Value).ToList();
|
|
|
|
|
//var tmpList = tenantDb.Queryable<SeaExportShippingBillTemplate>()
|
|
|
|
|
// .WhereIF(order.ShipperId.HasValue && order.ShipperId.Value > 0, x => x.Id == order.ShipperId.Value)
|
|
|
|
|
// .WhereIF(order.ConsigneeId.HasValue && order.ConsigneeId.Value > 0, x => x.Id == order.ConsigneeId.Value)
|
|
|
|
|
// .WhereIF(order.NotifyPartyId.HasValue && order.NotifyPartyId.Value > 0, x => x.Id == order.NotifyPartyId.Value).ToList();
|
|
|
|
|
|
|
|
|
|
if (order.ShipperId.HasValue && order.ShipperId.Value > 0)
|
|
|
|
|
dto.parties.Add(new CargooShipmentPartyDto
|
|
|
|
|
{
|
|
|
|
|
var currTmp = tmpList.FirstOrDefault(a => a.Id == order.ShipperId.Value);
|
|
|
|
|
type = "CZ",
|
|
|
|
|
name = "SUNNINESS LOGISTICS CO.,LTD."
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dto.parties.Add(new CargooShipmentPartyDto
|
|
|
|
|
{
|
|
|
|
|
type = "CZ",
|
|
|
|
|
name = currTmp.TemplateName
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//取委托客户下面所有的联系人列表
|
|
|
|
|
var djyCustomerInfo = _clientInfoService.GetClientInfoWithContact(new Info.Dtos.QueryClientInfo { ClientId = order.CustomerId, IsController = true }).GetAwaiter().GetResult().Data;
|
|
|
|
|
|
|
|
|
|
if (order.ConsigneeId.HasValue && order.ConsigneeId.Value > 0)
|
|
|
|
|
if (djyCustomerInfo == null)
|
|
|
|
|
{
|
|
|
|
|
var currTmp = tmpList.FirstOrDefault(a => a.Id == order.ConsigneeId.Value);
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"委托单位{order.CustomerName} 获取失败,委托单位不存在或已作废 bookingId={order.Id}");
|
|
|
|
|
|
|
|
|
|
dto.parties.Add(new CargooShipmentPartyDto
|
|
|
|
|
{
|
|
|
|
|
type = "CN",
|
|
|
|
|
name = currTmp.TemplateName
|
|
|
|
|
});
|
|
|
|
|
//委托单位{0} 获取失败,委托单位不存在或已作废
|
|
|
|
|
return DataResult<CargooShipmentDto>.Failed($"委托单位{order.CustomerName} 获取失败,委托单位不存在或已作废");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (order.NotifyPartyId.HasValue && order.NotifyPartyId.Value > 0)
|
|
|
|
|
if(string.IsNullOrWhiteSpace(djyCustomerInfo.EnFullName))
|
|
|
|
|
return DataResult<CargooShipmentDto>.Failed($"委托单位{djyCustomerInfo.ShortName} 未维护客户英文全称");
|
|
|
|
|
|
|
|
|
|
dto.parties.Add(new CargooShipmentPartyDto
|
|
|
|
|
{
|
|
|
|
|
var currTmp = tmpList.FirstOrDefault(a => a.Id == order.NotifyPartyId.Value);
|
|
|
|
|
type = "CN",
|
|
|
|
|
name = djyCustomerInfo.EnFullName,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dto.parties.Add(new CargooShipmentPartyDto
|
|
|
|
|
{
|
|
|
|
|
type = "NI",
|
|
|
|
|
name = currTmp.TemplateName
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dto.parties.Add(new CargooShipmentPartyDto
|
|
|
|
|
{
|
|
|
|
|
type = "NI",
|
|
|
|
|
name = djyCustomerInfo.EnFullName,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -831,7 +832,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
if (bookingInfo == null)
|
|
|
|
|
return DataResult<string>.Failed("订单信息获取失败,订单ID错误或数据已作废");
|
|
|
|
|
|
|
|
|
|
if (bookingInfo.ParentId != null || bookingInfo.ParentId > 0)
|
|
|
|
|
if (bookingInfo.ParentId != null && bookingInfo.ParentId > 0)
|
|
|
|
|
{
|
|
|
|
|
return DataResult<string>.Failed("当前订单不是主单不能发送");
|
|
|
|
|
}
|
|
|
|
|