|
|
|
@ -11,9 +11,12 @@ using Newtonsoft.Json.Linq;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Diagnostics.Contracts;
|
|
|
|
|
using System.Diagnostics.Metrics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.Encodings.Web;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
@ -190,7 +193,8 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
number = ctn.PKGS,
|
|
|
|
|
packageUnit = ctn.KINDPKGS,
|
|
|
|
|
measurements = ctn.CBM,
|
|
|
|
|
measurementUnit = "CBM"
|
|
|
|
|
measurementUnit = "CBM",
|
|
|
|
|
commodityName = custOrder.DESCRIPTION
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
postModel.cargoInfos.Add(apiBox);
|
|
|
|
@ -199,9 +203,12 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
//合约信息
|
|
|
|
|
postModel.contractInfo = new EMCSoApiContractInfo()
|
|
|
|
|
{
|
|
|
|
|
bookingOffice = template.BookingAddress,
|
|
|
|
|
bookingOffice = custOrder.BookingAddr,
|
|
|
|
|
issuePlace = custOrder.BillSignLoc,
|
|
|
|
|
billNum = custOrder.BillCount
|
|
|
|
|
billNum = custOrder.BillCount,
|
|
|
|
|
contractNo = custOrder.CONTRACTNO,
|
|
|
|
|
contractSelect = custOrder.ContractType,
|
|
|
|
|
contractParty = custOrder.SignType
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//船期数据
|
|
|
|
@ -216,8 +223,8 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
//订舱公司详情
|
|
|
|
|
postModel.companyInfo = new EMCSoApiCompanyInfo()
|
|
|
|
|
{
|
|
|
|
|
receiveBookingNotice = template.NotifyNext ? "YES" : "NO",
|
|
|
|
|
referenceNO = template.CustomerInnerCode
|
|
|
|
|
receiveBookingNotice = custOrder.AcceptNotify ? "Yes" : "No",
|
|
|
|
|
referenceNO = custOrder.CustomerInnerCode
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#region 收发通及货代
|
|
|
|
@ -227,20 +234,10 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
var telNumber = "";
|
|
|
|
|
|
|
|
|
|
//发货人
|
|
|
|
|
if (string.IsNullOrEmpty(template.ShipperName))
|
|
|
|
|
{
|
|
|
|
|
companyName = custOrder.ShipperName;
|
|
|
|
|
telCountryCode = custOrder.ShipperPhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.ShipperPhoneCode;
|
|
|
|
|
telNumber = custOrder.ShipperPhone;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
companyName = template.ShipperName;
|
|
|
|
|
telCountryCode = template.ShipperPhoneCountryCode;
|
|
|
|
|
telAreaCode = template.ShipperPhoneCode;
|
|
|
|
|
telNumber = template.ShipperPhone;
|
|
|
|
|
}
|
|
|
|
|
companyName = custOrder.ShipperName;
|
|
|
|
|
telCountryCode = custOrder.ShipperPhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.ShipperPhoneCode;
|
|
|
|
|
telNumber = custOrder.ShipperPhone;
|
|
|
|
|
|
|
|
|
|
var bcMail = "";
|
|
|
|
|
if (!string.IsNullOrEmpty(custOrder.OpMail)) //优先使用东胜上传的邮箱
|
|
|
|
@ -259,99 +256,75 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
postModel.shipperInfo = new EMCSoApiSFTInfo()
|
|
|
|
|
{
|
|
|
|
|
companyName = companyName,
|
|
|
|
|
contactTitle = template.ShipperSex,
|
|
|
|
|
contactLName = string.IsNullOrEmpty(template.ShipperFirstName) ? custOrder.ShipperFirstName : template.ShipperFirstName,
|
|
|
|
|
contactFName = string.IsNullOrEmpty(template.ShipperLastName) ? custOrder.ShipperLastName : template.ShipperLastName,
|
|
|
|
|
contactTitle = custOrder.ShipperSex,
|
|
|
|
|
contactLName = custOrder.ShipperFirstName,
|
|
|
|
|
contactFName = custOrder.ShipperLastName,
|
|
|
|
|
tel1 = telCountryCode,
|
|
|
|
|
tel2 = telAreaCode,
|
|
|
|
|
tel3 = telNumber,
|
|
|
|
|
referenceNO = template.ShipperInnerCode,
|
|
|
|
|
referenceNO = custOrder.ShipperInnerCode,
|
|
|
|
|
email = bcMail
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//收货人
|
|
|
|
|
if (string.IsNullOrEmpty(template.ConsigneeName))
|
|
|
|
|
{
|
|
|
|
|
companyName = custOrder.ConsigneeName;
|
|
|
|
|
telCountryCode = custOrder.ConsigneePhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.ConsigneePhoneCode;
|
|
|
|
|
telNumber = custOrder.ConsigneePhone;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
companyName = template.ConsigneeName;
|
|
|
|
|
telCountryCode = template.ConsigneePhoneCountryCode;
|
|
|
|
|
telAreaCode = template.ConsigneePhoneCode;
|
|
|
|
|
telNumber = template.ConsigneePhone;
|
|
|
|
|
}
|
|
|
|
|
companyName = custOrder.ConsigneeName;
|
|
|
|
|
telCountryCode = custOrder.ConsigneePhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.ConsigneePhoneCode;
|
|
|
|
|
telNumber = custOrder.ConsigneePhone;
|
|
|
|
|
|
|
|
|
|
postModel.consigneeInfo = new EMCSoApiSFTInfo()
|
|
|
|
|
if (!string.IsNullOrEmpty(companyName))
|
|
|
|
|
{
|
|
|
|
|
companyName = companyName,
|
|
|
|
|
contactTitle = template.ConsigneeSex,
|
|
|
|
|
contactLName = string.IsNullOrEmpty(template.ConsigneeFirstName) ? custOrder.ConsigneeFirstName : template.ConsigneeFirstName,
|
|
|
|
|
contactFName = string.IsNullOrEmpty(template.ConsigneeLastName) ? custOrder.ConsigneeLastName : template.ConsigneeLastName,
|
|
|
|
|
tel1 = telCountryCode,
|
|
|
|
|
tel2 = telAreaCode,
|
|
|
|
|
tel3 = telNumber,
|
|
|
|
|
referenceNO = template.ConsigneeInnerCode
|
|
|
|
|
};
|
|
|
|
|
postModel.consigneeInfo = new EMCSoApiSFTInfo()
|
|
|
|
|
{
|
|
|
|
|
companyName = companyName,
|
|
|
|
|
contactTitle = custOrder.ConsigneeSex,
|
|
|
|
|
contactLName = custOrder.ConsigneeFirstName,
|
|
|
|
|
contactFName = custOrder.ConsigneeLastName,
|
|
|
|
|
tel1 = telCountryCode,
|
|
|
|
|
tel2 = telAreaCode,
|
|
|
|
|
tel3 = telNumber,
|
|
|
|
|
referenceNO = custOrder.ConsigneeInnerCode
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通知人
|
|
|
|
|
if (string.IsNullOrEmpty(template.NotifypartName))
|
|
|
|
|
{
|
|
|
|
|
companyName = custOrder.NotifypartName;
|
|
|
|
|
telCountryCode = custOrder.NotifypartPhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.NotifypartPhoneCode;
|
|
|
|
|
telNumber = custOrder.NotifypartPhone;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
companyName = template.NotifypartName;
|
|
|
|
|
telCountryCode = template.NotifypartPhoneCountryCode;
|
|
|
|
|
telAreaCode = template.NotifypartPhoneCode;
|
|
|
|
|
telNumber = template.NotifypartPhone;
|
|
|
|
|
}
|
|
|
|
|
companyName = custOrder.NotifypartName;
|
|
|
|
|
telCountryCode = custOrder.NotifypartPhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.NotifypartPhoneCode;
|
|
|
|
|
telNumber = custOrder.NotifypartPhone;
|
|
|
|
|
|
|
|
|
|
postModel.notifyInfo = new EMCSoApiSFTInfo()
|
|
|
|
|
if (!string.IsNullOrEmpty(companyName))
|
|
|
|
|
{
|
|
|
|
|
companyName = companyName,
|
|
|
|
|
contactTitle = template.NotifypartSex,
|
|
|
|
|
contactLName = string.IsNullOrEmpty(template.NotifypartFirstName) ? custOrder.NotifypartFirstName : template.NotifypartFirstName,
|
|
|
|
|
contactFName = string.IsNullOrEmpty(template.NotifypartLastName) ? custOrder.NotifypartLastName : template.NotifypartLastName,
|
|
|
|
|
tel1 = telCountryCode,
|
|
|
|
|
tel2 = telAreaCode,
|
|
|
|
|
tel3 = telNumber,
|
|
|
|
|
referenceNO = template.NotifypartInnerCode
|
|
|
|
|
};
|
|
|
|
|
postModel.notifyInfo = new EMCSoApiSFTInfo()
|
|
|
|
|
{
|
|
|
|
|
companyName = companyName,
|
|
|
|
|
contactTitle = custOrder.NotifypartSex,
|
|
|
|
|
contactLName = custOrder.NotifypartFirstName,
|
|
|
|
|
contactFName = custOrder.NotifypartLastName,
|
|
|
|
|
tel1 = telCountryCode,
|
|
|
|
|
tel2 = telAreaCode,
|
|
|
|
|
tel3 = telNumber,
|
|
|
|
|
referenceNO = custOrder.NotifypartInnerCode
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//货代
|
|
|
|
|
if (string.IsNullOrEmpty(template.BookingName))
|
|
|
|
|
{
|
|
|
|
|
companyName = custOrder.BookingName;
|
|
|
|
|
telCountryCode = custOrder.BookingPhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.BookingPhoneCode;
|
|
|
|
|
telNumber = custOrder.BookingPhone;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
companyName = template.BookingName;
|
|
|
|
|
telCountryCode = template.BookingPhoneCountryCode;
|
|
|
|
|
telAreaCode = template.BookingPhoneCode;
|
|
|
|
|
telNumber = template.BookingPhone;
|
|
|
|
|
}
|
|
|
|
|
companyName = custOrder.BookingName;
|
|
|
|
|
telCountryCode = custOrder.BookingPhoneCountryCode;
|
|
|
|
|
telAreaCode = custOrder.BookingPhoneCode;
|
|
|
|
|
telNumber = custOrder.BookingPhone;
|
|
|
|
|
|
|
|
|
|
var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail");
|
|
|
|
|
postModel.forwarderInfo = new EMCSoApiSFTInfo()
|
|
|
|
|
{
|
|
|
|
|
companyName = companyName,
|
|
|
|
|
contactTitle = template.BookingSex,
|
|
|
|
|
contactLName = string.IsNullOrEmpty(template.BookingFirstName) ? custOrder.BookingFirstName : template.BookingFirstName,
|
|
|
|
|
contactFName = string.IsNullOrEmpty(template.BookingLastName) ? custOrder.BookingLastName : template.BookingLastName,
|
|
|
|
|
contactTitle = custOrder.BookingSex,
|
|
|
|
|
contactLName = custOrder.BookingFirstName,
|
|
|
|
|
contactFName = custOrder.BookingLastName,
|
|
|
|
|
tel1 = telCountryCode,
|
|
|
|
|
tel2 = telAreaCode,
|
|
|
|
|
tel3 = telNumber,
|
|
|
|
|
referenceNO = template.BookingInnerCode,
|
|
|
|
|
referenceNO = custOrder.BookingInnerCode,
|
|
|
|
|
email = djyBookMail.Value
|
|
|
|
|
};
|
|
|
|
|
#endregion
|
|
|
|
@ -363,8 +336,10 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
}
|
|
|
|
|
apiUrl += "v1/emc/booking/auto";
|
|
|
|
|
|
|
|
|
|
Log.Information($"发送API数据给爬虫({apiUrl}):{postModel.ToJsonString()}");
|
|
|
|
|
var rtn = await apiUrl.SetBody(postModel)
|
|
|
|
|
var jsonStr = JsonConvert.SerializeObject(postModel, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
|
|
|
|
|
|
|
|
|
|
Log.Information($"发送API数据给爬虫({apiUrl}):{jsonStr}");
|
|
|
|
|
var rtn = await apiUrl.SetBody(jsonStr, "application/json")
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
Log.Information($"爬虫返回:{rtn}");
|
|
|
|
@ -537,10 +512,10 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string containerType { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 称重方式 E: 每个, T: 总和
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string containerWeightMode { get; set; }
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 称重方式 E: 每个, T: 总和
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public string containerWeightMode { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重量 最多两位小数
|
|
|
|
@ -599,13 +574,13 @@ namespace Myshipping.Application.EDI
|
|
|
|
|
/// 当合约类型为SC时, 这个参数生效,且合约号生效, 默认SC
|
|
|
|
|
/// SC, HT, LT, SQ, RS, HV, LM, HM, TV, LV, EM
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string contractSelect { get; set; } = "SC";
|
|
|
|
|
public string contractSelect { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 合约类型
|
|
|
|
|
/// 当类型为TR时,合约号不生效
|
|
|
|
|
/// SC, TR
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string contractType { get; set; }
|
|
|
|
|
public string contractType { get; set; } = "SC";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 合约号
|
|
|
|
|
/// </summary>
|
|
|
|
|