中远订舱调整

master
wanghaomei 7 months ago
parent b098313ee6
commit 4aed54aeeb

@ -1,4 +1,6 @@
using Furion; using Furion;
using Furion.Logging;
using Furion.RemoteRequest.Extensions;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
@ -8,6 +10,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Myshipping.Application.EDI namespace Myshipping.Application.EDI
@ -42,16 +45,35 @@ namespace Myshipping.Application.EDI
} }
var sysConfigList = await cache.GetAllSysConfig(); var sysConfigList = await cache.GetAllSysConfig();
var sCfgSpiderUrl = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderUrl" && x.GroupCode == "DJY_CONST");
if (sCfgSpiderUrl == null)
{
return new KeyValuePair<bool, string>(false, "中远订舱API的爬虫URL地址未配置请联系管理员");
}
var sCfgUserKey = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderKey" && x.GroupCode == "DJY_CONST"); var sCfgUserKey = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderKey" && x.GroupCode == "DJY_CONST");
var sCfgUserSecret = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderSecret" && x.GroupCode == "DJY_CONST"); var sCfgUserSecret = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderSecret" && x.GroupCode == "DJY_CONST");
if (sCfgUserKey == null || sCfgUserSecret == null) if (sCfgUserKey == null || sCfgUserSecret == null)
{ {
return new KeyValuePair<bool, string>(false, "中远订舱API的KEY和密钥为配置请联系管理员"); return new KeyValuePair<bool, string>(false, "中远订舱API的KEY和密钥配置,请联系管理员");
} }
BookingSoTemplate template = null; BookingSoTemplate template = null;
DjyCustomerContact custContact = null; DjyCustomerContact custContact = null;
var postModel = new ZhongYuanSoApiModel();
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
var extObj = JObject.Parse(custOrder.ExtendData);
postModel.webAccount = extObj.GetStringValue("Account");
postModel.webPassword = extObj.GetStringValue("Password");
}
else
{
return new KeyValuePair<bool, string>(false, "未找到订舱账号信息");
}
//查找模板: //查找模板:
//1.根据客户订舱信息中的BookingUserId和BookingTenantId去客户信息中根据CustSysId查找客户公司及联系人员工信息 //1.根据客户订舱信息中的BookingUserId和BookingTenantId去客户信息中根据CustSysId查找客户公司及联系人员工信息
//2.根据找到的客户及联系人信息,查找中远订舱模板 //2.根据找到的客户及联系人信息,查找中远订舱模板
@ -67,32 +89,26 @@ namespace Myshipping.Application.EDI
return new KeyValuePair<bool, string>(false, "未找到客户及联系人信息"); return new KeyValuePair<bool, string>(false, "未找到客户及联系人信息");
} }
template = await repTemplate.AsQueryable().FirstAsync(x => x.CarrierId == custOrder.CARRIERID && x.UserId == custContact.Id && x.IsEnable); //根据:用户+船司+船司账号+约号,找到启用的模板
template = await repTemplate.AsQueryable().FirstAsync(x => x.CarrierId == custOrder.CARRIERID && x.UserId == custContact.Id && x.ContractNO == custOrder.CONTRACTNO && x.BookingAccount == postModel.webAccount && x.IsEnable);
if (template == null) if (template == null)
{ {
return new KeyValuePair<bool, string>(false, "未找到订舱模板"); return new KeyValuePair<bool, string>(false, "未找到订舱模板");
} }
} }
else
{
return new KeyValuePair<bool, string>(false, "未找到客户端公司和用户ID");
}
var mappingCtn = await cache.GetAllMappingCtn(); var mappingCtn = await cache.GetAllMappingCtn();
var mappingFrt = await cache.GetAllMappingFrt(); var mappingFrt = await cache.GetAllMappingFrt();
var mappingPortLoad = await cache.GetAllMappingPortLoad(); var mappingPortLoad = await cache.GetAllMappingPortLoad();
var mappingPort = await cache.GetAllMappingPort(); var mappingPort = await cache.GetAllMappingPort();
var postModel = new ZhongYuanSoApiModel();
postModel.userKey = sCfgUserKey.Value; postModel.userKey = sCfgUserKey.Value;
postModel.userSecret = sCfgUserSecret.Value; postModel.userSecret = sCfgUserSecret.Value;
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
var extObj = JObject.Parse(custOrder.ExtendData);
postModel.webAccount = extObj.GetStringValue("Account");
postModel.webPassword = extObj.GetStringValue("Password");
}
else
{
return new KeyValuePair<bool, string>(false, "未找到订舱账号信息");
}
postModel.uploadType = template.Category; //DRAFT, TEMPLATE, BOOKING分别对应草稿, 模板, 订舱 postModel.uploadType = template.Category; //DRAFT, TEMPLATE, BOOKING分别对应草稿, 模板, 订舱
postModel.saveName = template.TemplateName; postModel.saveName = template.TemplateName;
@ -109,6 +125,21 @@ namespace Myshipping.Application.EDI
return new KeyValuePair<bool, string>(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}"); return new KeyValuePair<bool, string>(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}");
} }
//运输条款
var mappingService = await cacheService.GetAllMappingService();
var mappService = mappingService.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.SERVICE);
if (mappService == null)
{
return new KeyValuePair<bool, string>(false, $"未找到运输条款映射信息:{custOrder.SERVICE}");
}
if (!Regex.IsMatch(mappService.MapCode, "^[A-Za-z]+-[A-Za-z]+$"))
{
return new KeyValuePair<bool, string>(false, $"映射配置不正确:{mappService.MapCode}");
}
var mapServArr = mappService.MapCode.Split('-');
postModel.routes = new ZhongYuanSoApiRoute() postModel.routes = new ZhongYuanSoApiRoute()
{ {
originCity = mapPortLoad.MapCode, originCity = mapPortLoad.MapCode,
@ -117,9 +148,37 @@ namespace Myshipping.Application.EDI
voyageNumber = custOrder.VOYNO, voyageNumber = custOrder.VOYNO,
serviceCode = custOrder.LANECODE, serviceCode = custOrder.LANECODE,
sailSchedulePriority = template.Priority.Split(',').ToList(), sailSchedulePriority = template.Priority.Split(',').ToList(),
outboundHaulage = mapServArr[0],
inboundHaulage = mapServArr[1],
}; };
#region 收发通及货代 #region 收发通及货代
//发货人
ZhongYuanSoApiPhone shipperPhone = null;
if (string.IsNullOrEmpty(template.ShipperName))
{
shipperPhone = new ZhongYuanSoApiPhone()
{
countryCode = custOrder.ShipperPhoneCountryCode,
areaCode = custOrder.ShipperPhoneCode,
number = custOrder.ShipperPhone
};
}
else
{
shipperPhone = new ZhongYuanSoApiPhone()
{
countryCode = template.ShipperPhoneCountryCode,
areaCode = template.ShipperPhoneCode,
number = template.ShipperPhone
};
}
shipperPhone.countryCode = shipperPhone.countryCode == null ? "" : shipperPhone.countryCode;
shipperPhone.areaCode = shipperPhone.areaCode == null ? "" : shipperPhone.areaCode;
shipperPhone.number = shipperPhone.number == null ? "" : shipperPhone.number;
postModel.shipperInfo = new ZhongYuanSoApiSFT() postModel.shipperInfo = new ZhongYuanSoApiSFT()
{ {
firstName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperFirstName : template.ShipperFirstName, firstName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperFirstName : template.ShipperFirstName,
@ -129,10 +188,35 @@ namespace Myshipping.Application.EDI
city = string.IsNullOrEmpty(template.ShipperCity) ? custOrder.ShipperCity : template.ShipperCity, city = string.IsNullOrEmpty(template.ShipperCity) ? custOrder.ShipperCity : template.ShipperCity,
partyName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperName : template.ShipperName, partyName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperName : template.ShipperName,
addressDes = string.IsNullOrEmpty(template.ShipperAddress) ? custOrder.ShipperAddress : template.ShipperAddress, addressDes = string.IsNullOrEmpty(template.ShipperAddress) ? custOrder.ShipperAddress : template.ShipperAddress,
phone = string.IsNullOrEmpty(template.ShipperName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.ShipperPhoneCountryCode, areaCode = custOrder.ShipperPhoneCode, number = custOrder.ShipperPhone } : new ZhongYuanSoApiPhone() { countryCode = template.ShipperPhoneCountryCode, areaCode = template.ShipperPhoneCode, number = template.ShipperPhone }, phone = shipperPhone,
postalCode = string.IsNullOrEmpty(template.ShipperPostCode) ? custOrder.ShipperPostCode : template.ShipperPostCode postalCode = string.IsNullOrEmpty(template.ShipperPostCode) ? custOrder.ShipperPostCode : template.ShipperPostCode
}; };
//收货人
ZhongYuanSoApiPhone consigneePhone = null;
if (string.IsNullOrEmpty(template.ConsigneeName))
{
consigneePhone = new ZhongYuanSoApiPhone()
{
countryCode = custOrder.ConsigneePhoneCountryCode,
areaCode = custOrder.ConsigneePhoneCode,
number = custOrder.ConsigneePhone
};
}
else
{
consigneePhone = new ZhongYuanSoApiPhone()
{
countryCode = template.ConsigneePhoneCountryCode,
areaCode = template.ConsigneePhoneCode,
number = template.ConsigneePhone
};
}
consigneePhone.countryCode = consigneePhone.countryCode == null ? "" : consigneePhone.countryCode;
consigneePhone.areaCode = consigneePhone.areaCode == null ? "" : consigneePhone.areaCode;
consigneePhone.number = consigneePhone.number == null ? "" : consigneePhone.number;
postModel.consigneeInfo = new ZhongYuanSoApiSFT() postModel.consigneeInfo = new ZhongYuanSoApiSFT()
{ {
firstName = string.IsNullOrEmpty(template.ConsigneeFirstName) ? custOrder.ConsigneeFirstName : template.ConsigneeFirstName, firstName = string.IsNullOrEmpty(template.ConsigneeFirstName) ? custOrder.ConsigneeFirstName : template.ConsigneeFirstName,
@ -142,10 +226,35 @@ namespace Myshipping.Application.EDI
city = string.IsNullOrEmpty(template.ConsigneeCity) ? custOrder.ConsigneeCity : template.ConsigneeCity, city = string.IsNullOrEmpty(template.ConsigneeCity) ? custOrder.ConsigneeCity : template.ConsigneeCity,
partyName = string.IsNullOrEmpty(template.ConsigneeName) ? custOrder.ConsigneeName : template.ConsigneeName, partyName = string.IsNullOrEmpty(template.ConsigneeName) ? custOrder.ConsigneeName : template.ConsigneeName,
addressDes = string.IsNullOrEmpty(template.ConsigneeAddress) ? custOrder.ConsigneeAddress : template.ConsigneeAddress, addressDes = string.IsNullOrEmpty(template.ConsigneeAddress) ? custOrder.ConsigneeAddress : template.ConsigneeAddress,
phone = string.IsNullOrEmpty(template.ConsigneeName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.ConsigneePhoneCountryCode, areaCode = custOrder.ConsigneePhoneCode, number = custOrder.ConsigneePhone } : new ZhongYuanSoApiPhone() { countryCode = template.ConsigneePhoneCountryCode, areaCode = template.ConsigneePhoneCode, number = template.ConsigneePhone }, phone = consigneePhone,
postalCode = string.IsNullOrEmpty(template.ConsigneePostCode) ? custOrder.ConsigneePostCode : template.ConsigneePostCode postalCode = string.IsNullOrEmpty(template.ConsigneePostCode) ? custOrder.ConsigneePostCode : template.ConsigneePostCode
}; };
//通知人
ZhongYuanSoApiPhone notifyPhone = null;
if (string.IsNullOrEmpty(template.NotifypartName))
{
notifyPhone = new ZhongYuanSoApiPhone()
{
countryCode = custOrder.NotifypartPhoneCountryCode,
areaCode = custOrder.NotifypartPhoneCode,
number = custOrder.NotifypartPhone
};
}
else
{
notifyPhone = new ZhongYuanSoApiPhone()
{
countryCode = template.NotifypartPhoneCountryCode,
areaCode = template.NotifypartPhoneCode,
number = template.NotifypartPhone
};
}
notifyPhone.countryCode = notifyPhone.countryCode == null ? "" : notifyPhone.countryCode;
notifyPhone.areaCode = notifyPhone.areaCode == null ? "" : notifyPhone.areaCode;
notifyPhone.number = notifyPhone.number == null ? "" : notifyPhone.number;
postModel.notifyInfo = new ZhongYuanSoApiSFT() postModel.notifyInfo = new ZhongYuanSoApiSFT()
{ {
firstName = string.IsNullOrEmpty(template.NotifypartFirstName) ? custOrder.NotifypartFirstName : template.NotifypartFirstName, firstName = string.IsNullOrEmpty(template.NotifypartFirstName) ? custOrder.NotifypartFirstName : template.NotifypartFirstName,
@ -155,10 +264,36 @@ namespace Myshipping.Application.EDI
city = string.IsNullOrEmpty(template.NotifypartCity) ? custOrder.NotifypartCity : template.NotifypartCity, city = string.IsNullOrEmpty(template.NotifypartCity) ? custOrder.NotifypartCity : template.NotifypartCity,
partyName = string.IsNullOrEmpty(template.NotifypartName) ? custOrder.NotifypartName : template.NotifypartName, partyName = string.IsNullOrEmpty(template.NotifypartName) ? custOrder.NotifypartName : template.NotifypartName,
addressDes = string.IsNullOrEmpty(template.NotifypartAddress) ? custOrder.NotifypartAddress : template.NotifypartAddress, addressDes = string.IsNullOrEmpty(template.NotifypartAddress) ? custOrder.NotifypartAddress : template.NotifypartAddress,
phone = string.IsNullOrEmpty(template.NotifypartName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.NotifypartPhoneCountryCode, areaCode = custOrder.NotifypartPhoneCode, number = custOrder.NotifypartPhone } : new ZhongYuanSoApiPhone() { countryCode = template.NotifypartPhoneCountryCode, areaCode = template.NotifypartPhoneCode, number = template.NotifypartPhone }, phone = notifyPhone,
postalCode = string.IsNullOrEmpty(template.NotifypartPostCode) ? custOrder.NotifypartPostCode : template.NotifypartPostCode postalCode = string.IsNullOrEmpty(template.NotifypartPostCode) ? custOrder.NotifypartPostCode : template.NotifypartPostCode
}; };
//货代
ZhongYuanSoApiPhone forwarderPhone = null;
if (string.IsNullOrEmpty(template.BookingName))
{
forwarderPhone = new ZhongYuanSoApiPhone()
{
countryCode = custOrder.BookingPhoneCountryCode,
areaCode = custOrder.BookingPhoneCode,
number = custOrder.BookingPhone
};
}
else
{
forwarderPhone = new ZhongYuanSoApiPhone()
{
countryCode = template.BookingPhoneCountryCode,
areaCode = template.BookingPhoneCode,
number = template.BookingPhone
};
}
forwarderPhone.countryCode = forwarderPhone.countryCode == null ? "" : forwarderPhone.countryCode;
forwarderPhone.areaCode = forwarderPhone.areaCode == null ? "" : forwarderPhone.areaCode;
forwarderPhone.number = forwarderPhone.number == null ? "" : forwarderPhone.number;
postModel.forwarderInfo = new ZhongYuanSoApiSFT() postModel.forwarderInfo = new ZhongYuanSoApiSFT()
{ {
firstName = string.IsNullOrEmpty(template.BookingFirstName) ? custOrder.BookingFirstName : template.BookingFirstName, firstName = string.IsNullOrEmpty(template.BookingFirstName) ? custOrder.BookingFirstName : template.BookingFirstName,
@ -168,7 +303,7 @@ namespace Myshipping.Application.EDI
city = string.IsNullOrEmpty(template.BookingCity) ? custOrder.BookingCity : template.BookingCity, city = string.IsNullOrEmpty(template.BookingCity) ? custOrder.BookingCity : template.BookingCity,
partyName = string.IsNullOrEmpty(template.BookingName) ? custOrder.BookingName : template.BookingName, partyName = string.IsNullOrEmpty(template.BookingName) ? custOrder.BookingName : template.BookingName,
addressDes = string.IsNullOrEmpty(template.BookingAddress) ? custOrder.BookingAddress : template.BookingAddress, addressDes = string.IsNullOrEmpty(template.BookingAddress) ? custOrder.BookingAddress : template.BookingAddress,
phone = string.IsNullOrEmpty(template.BookingName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.BookingPhoneCountryCode, areaCode = custOrder.BookingPhoneCode, number = custOrder.BookingPhone } : new ZhongYuanSoApiPhone() { countryCode = template.BookingPhoneCountryCode, areaCode = template.BookingPhoneCode, number = template.BookingPhone }, phone = forwarderPhone,
postalCode = string.IsNullOrEmpty(template.BookingPostCode) ? custOrder.BookingPostCode : template.BookingPostCode postalCode = string.IsNullOrEmpty(template.BookingPostCode) ? custOrder.BookingPostCode : template.BookingPostCode
}; };
#endregion #endregion
@ -218,13 +353,38 @@ namespace Myshipping.Application.EDI
paymentMethod = mapFrt.MapCode paymentMethod = mapFrt.MapCode
}; };
//大简云客户订舱接收BC邮箱
var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail");
var bcMail = custContact.Email;
if (djyBookMail != null)
{
bcMail += djyBookMail.Value;
}
postModel.special = new ZhongYuanSoApiSpecial() postModel.special = new ZhongYuanSoApiSpecial()
{ {
emailAddresses = custContact.Email, emailAddresses = bcMail,
remarksForEntireBooking = custOrder.SOREMARK remarksForEntireBooking = custOrder.SOREMARK
}; };
return new KeyValuePair<bool, string>(); Log.Information($"发送API数据给爬虫{sCfgSpiderUrl.Value}{postModel.ToJsonString()}");
var rtn = await sCfgSpiderUrl.Value.SetBody(postModel)
.PostAsStringAsync();
Log.Information($"爬虫返回:{rtn}");
var jobjRtn = JObject.Parse(rtn);
if (jobjRtn.GetIntValue("code") == 200)
{
return new KeyValuePair<bool, string>(true, "发送成功");
}
else
{
return new KeyValuePair<bool, string>(false, jobjRtn.GetStringValue("msg"));
}
} }
/// <summary> /// <summary>
@ -372,6 +532,16 @@ namespace Myshipping.Application.EDI
/// 船期选择优先级 /// 船期选择优先级
/// </summary> /// </summary>
public List<string> sailSchedulePriority { get; set; } public List<string> sailSchedulePriority { get; set; }
/// <summary>
/// 出发地运输条款
/// </summary>
public string outboundHaulage { get; set; }
/// <summary>
/// 目的地运输条款
/// </summary>
public string inboundHaulage { get; set; }
} }
/// <summary> /// <summary>

@ -501,5 +501,19 @@ namespace Myshipping.Application.Entity
[Description("租户名称")] [Description("租户名称")]
public string TenantName{ get; set; } public string TenantName{ get; set; }
/// <summary>
/// 合约号
/// </summary>
[SugarColumn(ColumnName = "ContractNO")]
[Description("合约号")]
public string ContractNO { get; set; }
/// <summary>
/// 订舱账号
/// </summary>
[SugarColumn(ColumnName = "BookingAccount")]
[Description("订舱账号")]
public string BookingAccount { get; set; }
} }
} }

@ -35,5 +35,9 @@ namespace Myshipping.Application.Entity
/// 提单号 /// 提单号
/// </summary> /// </summary>
public string MBLNO { get; set; } public string MBLNO { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
} }
} }

@ -928,6 +928,7 @@ namespace Myshipping.Application
bkOrder.Id = YitIdHelper.NextId(); bkOrder.Id = YitIdHelper.NextId();
bkOrder.BSSTATUS = "已录入"; bkOrder.BSSTATUS = "已录入";
bkOrder.ParentId = 0; bkOrder.ParentId = 0;
bkOrder.LANENAME = bkOrder.LANECODE;
await _repOrder.InsertAsync(bkOrder); await _repOrder.InsertAsync(bkOrder);
model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联 model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
@ -1547,6 +1548,7 @@ namespace Myshipping.Application
bkOrder.BSSTATUS = "已录入"; bkOrder.BSSTATUS = "已录入";
bkOrder.CUSTOMERNAME = model.BookingTenantName; bkOrder.CUSTOMERNAME = model.BookingTenantName;
bkOrder.ParentId = 0; bkOrder.ParentId = 0;
bkOrder.LANENAME = bkOrder.LANECODE;
await _repOrder.InsertAsync(bkOrder); await _repOrder.InsertAsync(bkOrder);
var bkEdiExt = new BookingEDIExt(); var bkEdiExt = new BookingEDIExt();
@ -1723,7 +1725,7 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 保存审核的日志动态(使用当前登录人信息) /// 保存审核的日志动态(使用当前登录人信息)
/// </summary> /// </summary>
private void SaveAuditLog(string status, long bookId) private void SaveAuditLog(string status, long bookId, string remark = null)
{ {
var staLog = new BookingStatusLog(); var staLog = new BookingStatusLog();
staLog.Status = status; staLog.Status = status;
@ -1733,6 +1735,7 @@ namespace Myshipping.Application
staLog.OpTime = DateTime.Now; staLog.OpTime = DateTime.Now;
staLog.BookingId = bookId; staLog.BookingId = bookId;
staLog.Category = StaLogCateAudit; staLog.Category = StaLogCateAudit;
staLog.Remark = remark;
_repStatuslog.Insert(staLog); _repStatuslog.Insert(staLog);
} }
@ -1980,6 +1983,31 @@ namespace Myshipping.Application
custOrder.SERVICE = service.Name; custOrder.SERVICE = service.Name;
custOrder.BLFRT = frt.EnName; custOrder.BLFRT = frt.EnName;
//2024年4月19日将分拆的收发通拼接到大文本的收发通中
if (string.IsNullOrEmpty(custOrder.SHIPPER) && !string.IsNullOrEmpty(custOrder.ShipperName))
{
custOrder.SHIPPER = @$"{custOrder.ShipperName}
{custOrder.ShipperAddress}
{custOrder.ShipperCountry} {custOrder.ShipperProvince} {custOrder.ShipperCity} {custOrder.ShipperCounty} {custOrder.ShipperPostCode}
{custOrder.ShipperLastName} {custOrder.ShipperFirstName} {custOrder.ShipperPhoneCountryCode} {custOrder.ShipperPhoneCode} {custOrder.ShipperPhone}".ToUpper();
}
if (string.IsNullOrEmpty(custOrder.CONSIGNEE) && !string.IsNullOrEmpty(custOrder.ConsigneeName))
{
custOrder.SHIPPER = @$"{custOrder.ConsigneeName}
{custOrder.ConsigneeAddress}
{custOrder.ConsigneeCountry} {custOrder.ConsigneeProvince} {custOrder.ConsigneeCity} {custOrder.ConsigneeCounty} {custOrder.ConsigneePostCode}
{custOrder.ConsigneeLastName} {custOrder.ConsigneeFirstName} {custOrder.ConsigneePhoneCountryCode} {custOrder.ConsigneePhoneCode} {custOrder.ConsigneePhone}".ToUpper();
}
if (string.IsNullOrEmpty(custOrder.NOTIFYPARTY) && !string.IsNullOrEmpty(custOrder.NotifypartName))
{
custOrder.SHIPPER = @$"{custOrder.NotifypartName}
{custOrder.NotifypartAddress}
{custOrder.NotifypartCountry} {custOrder.NotifypartProvince} {custOrder.NotifypartCity} {custOrder.NotifypartCounty} {custOrder.NotifypartPostCode}
{custOrder.NotifypartLastName} {custOrder.NotifypartFirstName} {custOrder.NotifypartPhoneCountryCode} {custOrder.NotifypartPhoneCode} {custOrder.NotifypartPhone}".ToUpper();
}
//订舱账号、密码 //订舱账号、密码
var jobj = new JObject(); var jobj = new JObject();
if (!string.IsNullOrEmpty(custOrder.ExtendData)) if (!string.IsNullOrEmpty(custOrder.ExtendData))
@ -2079,8 +2107,11 @@ namespace Myshipping.Application
var rtn = await ZhongYuanSoApiHelper.DoPost(id); var rtn = await ZhongYuanSoApiHelper.DoPost(id);
if (!rtn.Key) if (!rtn.Key)
{ {
SaveAuditLog("发送订舱", id, remark: rtn.Value);
throw Oops.Bah(rtn.Value); throw Oops.Bah(rtn.Value);
} }
SaveAuditLog("发送订舱", id, remark: rtn.Value);
} }
#endregion #endregion
} }

@ -766,7 +766,12 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 创建者名称 /// 创建者名称
/// </summary> /// </summary>
public virtual string CreatedUserName { get; set; } public string CreatedUserName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
} }

@ -83,10 +83,16 @@ namespace Myshipping.Application.Service
//同一用户,同一船公司,只允许生效一个模板。 //同一用户,同一船公司,只允许生效一个模板。
if (input.IsEnable) if (input.IsEnable)
{ {
var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.UserId == input.UserId && x.CarrierId == input.CarrierId && x.IsEnable && x.Id != input.Id); var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false
&& x.UserId == input.UserId
&& x.CarrierId == input.CarrierId
&& x.IsEnable
&& x.ContractNO == input.ContractNO
&& x.BookingAccount == input.BookingAccount
&& x.Id != input.Id);
if (c > 0) if (c > 0)
{ {
throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier} 已存在启用的模板"); throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier},合约号:{input.ContractNO},订舱账号:{input.BookingAccount} 已存在启用的模板");
} }
} }
@ -101,10 +107,15 @@ namespace Myshipping.Application.Service
//同一用户,同一船公司,只允许生效一个模板。 //同一用户,同一船公司,只允许生效一个模板。
if (input.IsEnable) if (input.IsEnable)
{ {
var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.UserId == input.UserId && x.CarrierId == input.CarrierId && x.IsEnable); var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false
&& x.UserId == input.UserId
&& x.CarrierId == input.CarrierId
&& x.IsEnable
&& x.ContractNO == input.ContractNO
&& x.BookingAccount == input.BookingAccount);
if (c > 0) if (c > 0)
{ {
throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier} 已存在启用的模板"); throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier},合约号:{input.ContractNO},订舱账号:{input.BookingAccount} 已存在启用的模板");
} }
} }

@ -357,6 +357,16 @@ namespace Myshipping.Application
/// </summary> /// </summary>
public string BcReceiveEmail { get; set; } public string BcReceiveEmail { get; set; }
/// <summary>
/// 合约号
/// </summary>
public string ContractNO { get; set; }
/// <summary>
/// 订舱账号
/// </summary>
public string BookingAccount { get; set; }
} }
/// <summary> /// <summary>

Loading…
Cancel
Save