jianghaiqing 6 months ago
commit dc2c5be096

@ -1,10 +1,12 @@
using Furion;
using Furion.FriendlyException;
using Furion.Logging;
using Furion.RemoteRequest.Extensions;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Entity;
using Myshipping.Core.Service;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@ -47,17 +49,17 @@ namespace Myshipping.Application.EDI
}
var sysConfigList = await cache.GetAllSysConfig();
var sCfgSpiderUrl = sysConfigList.FirstOrDefault(x => x.Code == "EMCApiSpiderUrl" && x.GroupCode == "DJY_CONST");
var sCfgSpiderUrl = sysConfigList.FirstOrDefault(x => x.Code == "BookingPostApiServerAddr" && x.GroupCode == "DJY_CONST");
if (sCfgSpiderUrl == null)
{
return new KeyValuePair<bool, string>(false, "EMC订舱API的爬虫URL地址未配置请联系管理员");
return new KeyValuePair<bool, string>(false, "订舱API的爬虫URL地址未配置请联系管理员");
}
var sCfgUserKey = sysConfigList.FirstOrDefault(x => x.Code == "EMCApiSpiderKey" && x.GroupCode == "DJY_CONST");
var sCfgUserSecret = sysConfigList.FirstOrDefault(x => x.Code == "EMCApiSpiderSecret" && x.GroupCode == "DJY_CONST");
var sCfgUserKey = sysConfigList.FirstOrDefault(x => x.Code == "BookingPostApiKey" && x.GroupCode == "DJY_CONST");
var sCfgUserSecret = sysConfigList.FirstOrDefault(x => x.Code == "BookingPostApiSecret" && x.GroupCode == "DJY_CONST");
if (sCfgUserKey == null || sCfgUserSecret == null)
{
return new KeyValuePair<bool, string>(false, "EMC订舱API的KEY和密钥未配置请联系管理员");
return new KeyValuePair<bool, string>(false, "订舱API的KEY和密钥未配置请联系管理员");
}
@ -65,17 +67,8 @@ namespace Myshipping.Application.EDI
DjyCustomerContact custContact = null;
var postModel = new EMCSoApiModel();
JObject extObj = null;
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
extObj = JObject.Parse(custOrder.ExtendData);
postModel.webAccount = extObj.GetStringValue("Account");
postModel.webPassword = extObj.GetStringValue("Password");
}
else
{
return new KeyValuePair<bool, string>(false, "未找到订舱账号信息");
}
postModel.webAccount = custOrder.BookingAccount;
postModel.webPassword = custOrder.BookingPassword;
//查找模板:
//1.根据客户订舱信息中的BookingUserId和BookingTenantId去客户信息中根据CustSysId查找客户公司及联系人员工信息
@ -115,18 +108,32 @@ namespace Myshipping.Application.EDI
postModel.uploadType = template.Category; //DRAFT, TEMPLATE, BOOKING分别对应草稿, 模板, 订舱
//收货地
var mapPlaceReceipt = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PLACERECEIPTCODE);
if (mapPlaceReceipt == null)
{
throw Oops.Bah($"未找到收货地映射信息:{custOrder.PLACERECEIPTCODE}");
}
//起运港
var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PORTLOADCODE);
if (mapPortLoad == null)
{
return new KeyValuePair<bool, string>(false, $"未找到起运港映射信息:{custOrder.PORTLOADCODE}");
throw Oops.Bah($"未找到起运港映射信息:{custOrder.PORTLOADCODE}");
}
//卸货港
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PORTDISCHARGECODE);
if (mapPort == null)
{
throw Oops.Bah($"未找到卸货港映射信息:{custOrder.PORTDISCHARGECODE}");
}
//目的地
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.DESTINATIONCODE);
var mapDestination = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.DESTINATIONCODE);
if (mapPort == null)
{
return new KeyValuePair<bool, string>(false, $"未找到目的地映射信息:{custOrder.DESTINATIONCODE}");
throw Oops.Bah($"未找到目的地映射信息:{custOrder.DESTINATIONCODE}");
}
////运输条款
@ -150,12 +157,12 @@ namespace Myshipping.Application.EDI
postModel.routes = new EMCSoApiRoute()
{
searchConditionDate = custOrder.ETD.Value.AddDays(startDay).ToString("yyyy-MM-dd"),
originName = mapPortLoad.MapCode,
destinationName = mapPort.MapCode,
polPortName = extObj?.GetStringValue("PolPortName"),
podPortName = extObj?.GetStringValue("PodPortName"),
serviceType = extObj?.GetStringValue("YSFS"),
serviceMode = extObj?.GetStringValue("YSXT"),
originName = mapPlaceReceipt.MapCode,
destinationName = mapDestination.MapCode,
polPortName = mapPortLoad.MapCode,
podPortName = mapPort.MapCode,
serviceType = custOrder.ServiceType,
serviceMode = custOrder.ServiceMode,
};
//货物信息(箱信息)
@ -189,7 +196,32 @@ namespace Myshipping.Application.EDI
postModel.cargoInfos.Add(apiBox);
}
//合约信息
postModel.contractInfo = new EMCSoApiContractInfo()
{
bookingOffice = template.BookingAddress,
issuePlace = custOrder.BillSignLoc,
billNum = custOrder.BillCount
};
//船期数据
if (string.IsNullOrEmpty(custOrder.ExtendData))
{
return new KeyValuePair<bool, string>(false, $"船期数据信息不存在");
}
var extData = JObject.Parse(custOrder.ExtendData);
postModel.shipInfo = extData.GetJObjectValue("shipInfo");
//订舱公司详情
postModel.companyInfo = new EMCSoApiCompanyInfo()
{
receiveBookingNotice = template.NotifyNext ? "YES" : "NO",
referenceNO = template.CustomerInnerCode
};
#region 收发通及货代
var companyName = "";
var telCountryCode = "";
var telAreaCode = "";
var telNumber = "";
@ -197,37 +229,57 @@ namespace Myshipping.Application.EDI
//发货人
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;
}
var bcMail = "";
if (!string.IsNullOrEmpty(custOrder.OpMail)) //优先使用东胜上传的邮箱
{
bcMail = custOrder.OpMail;
}
else if (!string.IsNullOrEmpty(custContact.Email))
{
bcMail = custContact.Email;
}
else
{
bcMail = template.BcReceiveEmail;
}
postModel.shipperInfo = new EMCSoApiSFTInfo()
{
companyName = "",
contactTitle = "",
contactLName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperFirstName : template.ShipperFirstName,
companyName = companyName,
contactTitle = template.ShipperSex,
contactLName = string.IsNullOrEmpty(template.ShipperFirstName) ? custOrder.ShipperFirstName : template.ShipperFirstName,
contactFName = string.IsNullOrEmpty(template.ShipperLastName) ? custOrder.ShipperLastName : template.ShipperLastName,
tel1 = telCountryCode,
tel2 = telAreaCode,
tel3 = telNumber,
referenceNO = template.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;
@ -235,24 +287,27 @@ namespace Myshipping.Application.EDI
postModel.consigneeInfo = new EMCSoApiSFTInfo()
{
companyName = "",
contactTitle = "",
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
};
//通知人
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;
@ -260,68 +315,56 @@ namespace Myshipping.Application.EDI
postModel.notifyInfo = new EMCSoApiSFTInfo()
{
companyName = "",
contactTitle = "",
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
};
//货代
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;
}
var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail");
postModel.forwarderInfo = new EMCSoApiSFTInfo()
{
companyName = "",
contactTitle = "",
companyName = companyName,
contactTitle = template.BookingSex,
contactLName = string.IsNullOrEmpty(template.BookingFirstName) ? custOrder.BookingFirstName : template.BookingFirstName,
contactFName = string.IsNullOrEmpty(template.BookingLastName) ? custOrder.BookingLastName : template.BookingLastName,
tel1 = telCountryCode,
tel2 = telAreaCode,
tel3 = telNumber,
referenceNO = template.BookingInnerCode,
email = djyBookMail.Value
};
#endregion
var apiUrl = sCfgSpiderUrl.Value;
if (!apiUrl.EndsWith("/"))
{
apiUrl += "/";
}
apiUrl += "v1/emc/booking/auto";
////大简云客户订舱接收BC邮箱
//var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail");
//var bcMail = custContact.Email;
//if (extObj != null) //优先使用东胜上传的邮箱
//{
// var opMail = extObj.GetStringValue("OpMail");
// if (!string.IsNullOrEmpty(opMail))
// {
// bcMail = opMail;
// }
//}
//if (djyBookMail != null)
//{
// bcMail += ";" + djyBookMail.Value;
//}
//postModel.special = new EMCSoApiSpecial()
//{
// emailAddresses = bcMail,
// remarksForEntireBooking = custOrder.SOREMARK
//};
Log.Information($"发送API数据给爬虫{sCfgSpiderUrl.Value}{postModel.ToJsonString()}");
var rtn = await sCfgSpiderUrl.Value.SetBody(postModel)
Log.Information($"发送API数据给爬虫{apiUrl}{postModel.ToJsonString()}");
var rtn = await apiUrl.SetBody(postModel)
.PostAsStringAsync();
Log.Information($"爬虫返回:{rtn}");
@ -335,8 +378,6 @@ namespace Myshipping.Application.EDI
return new KeyValuePair<bool, string>(false, jobjRtn.GetStringValue("msg"));
}
}
}
@ -390,7 +431,7 @@ namespace Myshipping.Application.EDI
/// <summary>
/// 船期数据
/// </summary>
public EMCSoApiShipInfo shipInfo { get; set; }
public dynamic shipInfo { get; set; }
/// <summary>
/// 订舱公司详情
@ -601,113 +642,113 @@ namespace Myshipping.Application.EDI
public int? billNum { get; set; } = 1;
}
/// <summary>
/// 船期数据
/// 船期查询的结果总选择的数据集, 原样上传
/// </summary>
public class EMCSoApiShipInfo
{
/// <summary>
/// 收货地
/// </summary>
public string originName { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string destinationName { get; set; }
/// <summary>
/// 本地截止时间
/// </summary>
public string cutOffLocalDate { get; set; }
/// <summary>
/// 开航时间
/// </summary>
public string departureDate { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string serviceCode { get; set; }
/// <summary>
/// 船名
/// </summary>
public string vesselName { get; set; }
/// <summary>
/// 航次
/// </summary>
public string voyageNumber { get; set; }
/// <summary>
/// 下一段航线代码
/// </summary>
public string nextServiceCode { get; set; }
/// <summary>
/// 总航程
/// </summary>
public string estimatedTransitTimeInDays { get; set; }
/// <summary>
/// 详情参数, 订舱时需要原样上传
/// </summary>
public string paramsText { get; set; }
/// <summary>
/// 后续请求需要使用, 原样上传即可
/// </summary>
public string buttonText { get; set; }
/// <summary>
/// 航线详情
/// </summary>
public EMCSoApiShipInfoOceanLegs oceanLegs { get; set; }
}
/// <summary>
/// 航线详情
/// </summary>
public class EMCSoApiShipInfoOceanLegs
{
/// <summary>
/// 起运港
/// </summary>
public string polPortName { get; set; }
/// <summary>
/// 目的港
/// </summary>
public string podPortName { get; set; }
/// <summary>
/// ETD
/// </summary>
public string polETD { get; set; }
/// <summary>
/// ETA
/// </summary>
public string podETA { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string serviceCode { get; set; }
/// <summary>
/// 船名航线字符
/// </summary>
public string vesselAndVoyage { get; set; }
/// <summary>
/// 航程
/// </summary>
public string days { get; set; }
}
///// <summary>
///// 船期数据
///// 船期查询的结果总选择的数据集, 原样上传
///// </summary>
//public class EMCSoApiShipInfo
//{
// /// <summary>
// /// 收货地
// /// </summary>
// public string originName { get; set; }
// /// <summary>
// /// 交货地
// /// </summary>
// public string destinationName { get; set; }
// /// <summary>
// /// 本地截止时间
// /// </summary>
// public string cutOffLocalDate { get; set; }
// /// <summary>
// /// 开航时间
// /// </summary>
// public string departureDate { get; set; }
// /// <summary>
// /// 航线代码
// /// </summary>
// public string serviceCode { get; set; }
// /// <summary>
// /// 船名
// /// </summary>
// public string vesselName { get; set; }
// /// <summary>
// /// 航次
// /// </summary>
// public string voyageNumber { get; set; }
// /// <summary>
// /// 下一段航线代码
// /// </summary>
// public string nextServiceCode { get; set; }
// /// <summary>
// /// 总航程
// /// </summary>
// public string estimatedTransitTimeInDays { get; set; }
// /// <summary>
// /// 详情参数, 订舱时需要原样上传
// /// </summary>
// public string paramsText { get; set; }
// /// <summary>
// /// 后续请求需要使用, 原样上传即可
// /// </summary>
// public string buttonText { get; set; }
// /// <summary>
// /// 航线详情
// /// </summary>
// public List<EMCSoApiShipInfoOceanLegs> oceanLegs { get; set; }
//}
///// <summary>
///// 航线详情
///// </summary>
//public class EMCSoApiShipInfoOceanLegs
//{
// /// <summary>
// /// 起运港
// /// </summary>
// public string polPortName { get; set; }
// /// <summary>
// /// 目的港
// /// </summary>
// public string podPortName { get; set; }
// /// <summary>
// /// ETD
// /// </summary>
// public string polETD { get; set; }
// /// <summary>
// /// ETA
// /// </summary>
// public string podETA { get; set; }
// /// <summary>
// /// 航线代码
// /// </summary>
// public string serviceCode { get; set; }
// /// <summary>
// /// 船名航线字符
// /// </summary>
// public string vesselAndVoyage { get; set; }
// /// <summary>
// /// 航程
// /// </summary>
// public string days { get; set; }
//}
/// <summary>
/// 订舱公司详情
@ -782,4 +823,5 @@ namespace Myshipping.Application.EDI
/// </summary>
public string email { get; set; }
}
}

@ -63,17 +63,20 @@ namespace Myshipping.Application.EDI
DjyCustomerContact custContact = null;
var postModel = new ZhongYuanSoApiModel();
JObject extObj = null;
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
extObj = JObject.Parse(custOrder.ExtendData);
postModel.webAccount = extObj.GetStringValue("Account");
postModel.webPassword = extObj.GetStringValue("Password");
}
else
{
return new KeyValuePair<bool, string>(false, "未找到订舱账号信息");
}
//JObject extObj = null;
//if (!string.IsNullOrEmpty(custOrder.ExtendData))
//{
// extObj = JObject.Parse(custOrder.ExtendData);
// postModel.webAccount = extObj.GetStringValue("Account");
// postModel.webPassword = extObj.GetStringValue("Password");
//}
//else
//{
// return new KeyValuePair<bool, string>(false, "未找到订舱账号信息");
//}
postModel.webAccount = custOrder.BookingAccount;
postModel.webPassword = custOrder.BookingPassword;
//查找模板:
//1.根据客户订舱信息中的BookingUserId和BookingTenantId去客户信息中根据CustSysId查找客户公司及联系人员工信息
@ -150,8 +153,8 @@ namespace Myshipping.Application.EDI
{
originCity = mapPortLoad.MapCode,
destinationCity = mapPort.MapCode,
polPortName = extObj?.GetStringValue("PolPortName"),
podPortName = extObj?.GetStringValue("PodPortName"),
polPortName = custOrder.PolPortName,
podPortName = custOrder.PodPortName,
vesselName = custOrder.VESSEL,
voyageNumber = custOrder.VOYNO,
serviceCode = custOrder.LANECODE,
@ -373,14 +376,18 @@ namespace Myshipping.Application.EDI
//大简云客户订舱接收BC邮箱
var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail");
var bcMail = custContact.Email;
if (extObj != null) //优先使用东胜上传的邮箱
var bcMail = "";
if (!string.IsNullOrEmpty(custOrder.OpMail)) //优先使用东胜上传的邮箱
{
var opMail = extObj.GetStringValue("OpMail");
if (!string.IsNullOrEmpty(opMail))
{
bcMail = opMail;
}
bcMail = custOrder.OpMail;
}
else if (!string.IsNullOrEmpty(custContact.Email))
{
bcMail = custContact.Email;
}
else
{
bcMail = template.BcReceiveEmail;
}
if (djyBookMail != null)
@ -409,8 +416,6 @@ namespace Myshipping.Application.EDI
return new KeyValuePair<bool, string>(false, jobjRtn.GetStringValue("msg"));
}
}
/// <summary>

@ -689,7 +689,7 @@ namespace Myshipping.Application.Entity
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
public string PLACERECEIPT { get; set; }
/// <summary>
/// 收货地唯一代码
@ -700,6 +700,197 @@ namespace Myshipping.Application.Entity
/// 收货地代码
/// </summary>
public string PLACERECEIPTID { get; set; }
/// <summary>
/// 订舱账号
/// </summary>
[SugarColumn(ColumnName = "BookingAccount")]
[Description("订舱账号")]
public string BookingAccount { get; set; }
/// <summary>
/// 订舱密码
/// </summary>
[SugarColumn(ColumnName = "BookingPassword")]
[Description("订舱密码")]
public string BookingPassword { get; set; }
/// <summary>
/// 操作邮箱
/// </summary>
[SugarColumn(ColumnName = "OpMail")]
[Description("操作邮箱")]
public string OpMail { get; set; }
/// <summary>
/// 起始港名
/// </summary>
[SugarColumn(ColumnName = "PolPortName")]
[Description("起始港名")]
public string PolPortName { get; set; }
/// <summary>
/// 目的港名
/// </summary>
[SugarColumn(ColumnName = "PodPortName")]
[Description("目的港名")]
public string PodPortName { get; set; }
/// <summary>
/// 合约类型
/// </summary>
[SugarColumn(ColumnName = "ContractType")]
[Description("合约类型")]
public string ContractType { get; set; }
/// <summary>
/// 运送方式
/// </summary>
[SugarColumn(ColumnName = "ServiceType")]
[Description("运送方式")]
public string ServiceType { get; set; }
/// <summary>
/// 运送形态
/// </summary>
[SugarColumn(ColumnName = "ServiceMode")]
[Description("运送形态")]
public string ServiceMode { get; set; }
/// <summary>
/// 联系人
/// </summary>
[SugarColumn(ColumnName = "ContactName")]
[Description("联系人")]
public string ContactName { get; set; }
/// <summary>
/// 联系电话
/// </summary>
[SugarColumn(ColumnName = "ContactTel")]
[Description("联系电话")]
public string ContactTel { get; set; }
/// <summary>
/// 订舱网点
/// </summary>
[SugarColumn(ColumnName = "BookingAddr")]
[Description("订舱网点")]
public string BookingAddr { get; set; }
/// <summary>
/// 提单签发地
/// </summary>
[SugarColumn(ColumnName = "BillSignLoc")]
[Description("提单签发地")]
public string BillSignLoc { get; set; }
/// <summary>
/// 提单数量
/// </summary>
[SugarColumn(ColumnName = "BillCount")]
[Description("提单数量")]
public int? BillCount { get; set; }
/// <summary>
/// 是否接收订舱通知
/// </summary>
[SugarColumn(ColumnName = "AcceptNotify")]
[Description("是否接收订舱通知")]
public bool AcceptNotify { get; set; }
/// <summary>
/// 发货人性别
/// </summary>
[SugarColumn(ColumnName = "ShipperSex")]
[Description("发货人性别")]
public string ShipperSex { get; set; }
/// <summary>
/// 收货人性别
/// </summary>
[SugarColumn(ColumnName = "ConsigneeSex")]
[Description("收货人性别")]
public string ConsigneeSex { get; set; }
/// <summary>
/// 通知人性别
/// </summary>
[SugarColumn(ColumnName = "NotifypartSex")]
[Description("通知人性别")]
public string NotifypartSex { get; set; }
/// <summary>
/// 订舱公司性别
/// </summary>
[SugarColumn(ColumnName = "BookingSex")]
[Description("订舱公司性别")]
public string BookingSex { get; set; }
/// <summary>
/// 发货人内参号码
/// </summary>
[SugarColumn(ColumnName = "ShipperInnerCode")]
[Description("发货人内参号码")]
public string ShipperInnerCode { get; set; }
/// <summary>
/// 收货人内参号码
/// </summary>
[SugarColumn(ColumnName = "ConsigneeInnerCode")]
[Description("收货人内参号码")]
public string ConsigneeInnerCode { get; set; }
/// <summary>
/// 通知人内参号码
/// </summary>
[SugarColumn(ColumnName = "NotifypartInnerCode")]
[Description("通知人内参号码")]
public string NotifypartInnerCode { get; set; }
/// <summary>
/// 订舱公司内参号码
/// </summary>
[SugarColumn(ColumnName = "BookingInnerCode")]
[Description("订舱公司内参号码")]
public string BookingInnerCode { get; set; }
/// <summary>
/// 订舱客户内参号码
/// </summary>
[SugarColumn(ColumnName = "CustomerInnerCode")]
[Description("订舱客户内参号码")]
public string CustomerInnerCode { get; set; }
/// <summary>
/// 发货人邮箱
/// </summary>
[SugarColumn(ColumnName = "ShipperEmail")]
[Description("发货人邮箱")]
public string ShipperEmail { get; set; }
/// <summary>
/// 收货人邮箱
/// </summary>
[SugarColumn(ColumnName = "ConsigneeEmail")]
[Description("收货人邮箱")]
public string ConsigneeEmail { get; set; }
/// <summary>
/// 通知人邮箱
/// </summary>
[SugarColumn(ColumnName = "NotifypartEmail")]
[Description("通知人邮箱")]
public string NotifypartEmail { get; set; }
/// <summary>
/// 订舱公司邮箱
/// </summary>
[SugarColumn(ColumnName = "BookingEmail")]
[Description("订舱公司邮箱")]
public string BookingEmail { get; set; }
}
/// <summary>

@ -551,26 +551,26 @@ namespace Myshipping.Application.Entity
[Description("签约方")]
public string SignType { get; set; }
/// <summary>
/// 退舱网点
/// </summary>
[SugarColumn(ColumnName = "CancelAddr")]
[Description("退舱网点")]
public string CancelAddr { get; set; }
/// <summary>
/// 提单签发地
/// </summary>
[SugarColumn(ColumnName = "BillSignLoc")]
[Description("提单签发地")]
public string BillSignLoc { get; set; }
/// <summary>
/// 提单数量
/// </summary>
[SugarColumn(ColumnName = "BillCount")]
[Description("提单数量")]
public int? BillCount { get; set; }
///// <summary>
///// 订舱网点
///// </summary>
//[SugarColumn(ColumnName = "BookingAddr")]
//[Description("订舱网点")]
//public string BookingAddr { get; set; }
///// <summary>
///// 提单签发地
///// </summary>
//[SugarColumn(ColumnName = "BillSignLoc")]
//[Description("提单签发地")]
//public string BillSignLoc { get; set; }
///// <summary>
///// 提单数量
///// </summary>
//[SugarColumn(ColumnName = "BillCount")]
//[Description("提单数量")]
//public int? BillCount { get; set; }
/// <summary>
/// 发货人性别
@ -628,5 +628,12 @@ namespace Myshipping.Application.Entity
[Description("订舱公司内参号码")]
public string BookingInnerCode { get; set; }
/// <summary>
/// 订舱客户内参号码
/// </summary>
[SugarColumn(ColumnName = "CustomerInnerCode")]
[Description("订舱客户内参号码")]
public string CustomerInnerCode { get; set; }
}
}

@ -0,0 +1,47 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
using NPOI.SS.UserModel;
namespace Myshipping.Application.Entity
{
/// <summary>
/// 任务API配置
/// </summary>
[SugarTable("task_api_info")]
[Description("任务主表")]
public class TaskAPIInfo : TaskManageDbEntity
{
/// <summary>
/// API名称
/// </summary>
public string APIName { get; set; }
/// <summary>
/// 请求地址
/// </summary>
public string URL { get; set; }
/// <summary>
/// 请求方式
/// </summary>
public string RequestMethod { get; set; }
/// <summary>
/// 请求key
/// </summary>
public string Key { get; set; }
/// <summary>
/// 请求密钥
/// </summary>
public string SecretKey { get; set; }
/// <summary>
/// 平台代码
/// </summary>
public string SYSTEM_CODE { get; set; }
/// <summary>
/// 平台名称
/// </summary>
public string SYSTEM_NAME { get; set; }
}
}

@ -0,0 +1,31 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
using NPOI.SS.UserModel;
namespace Myshipping.Application.Entity
{
/// <summary>
/// 任务租户流程配置
/// </summary>
[SugarTable("task_flow_tenant")]
[Description("租户任务流程配置 ")]
public class TaskFlowTenant : TaskManageDbEntity
{
/// <summary>
/// 任务APIID
/// </summary>
public string TaskApiId { get; set; }
/// <summary>
/// 平台代码
/// </summary>
public string SYSTEM_CODE { get; set; }
/// <summary>
/// 平台名称
/// </summary>
public string SYSTEM_NAME { get; set; }
}
}

@ -125,6 +125,10 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), x => x.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
.WhereIF(!string.IsNullOrEmpty(input.CARRIERID), x => x.CARRIERID == input.CARRIERID)
.WhereIF(!string.IsNullOrEmpty(input.CARRIER), x => x.CARRIER.Contains(input.CARRIER))
.WhereIF(!string.IsNullOrEmpty(input.ShipperName), x => x.ShipperName.Contains(input.ShipperName))
.WhereIF(!string.IsNullOrEmpty(input.ConsigneeName), x => x.ConsigneeName.Contains(input.ConsigneeName))
.WhereIF(!string.IsNullOrEmpty(input.NotifypartName), x => x.NotifypartName.Contains(input.NotifypartName))
.WhereIF(!string.IsNullOrEmpty(input.BookingName), x => x.BookingName.Contains(input.BookingName))
.WhereIF(!string.IsNullOrEmpty(input.BookingTenantName), x => x.BookingTenantName.Contains(input.BookingTenantName))
.WhereIF(input.ETDStart.HasValue, x => x.ETD >= input.ETDStart)
.WhereIF(input.ETDEnd.HasValue, x => x.ETD < input.ETDEnd.Value.Date.AddDays(1))
@ -306,6 +310,21 @@ namespace Myshipping.Application
//日志动态
SaveAuditLog(input.Id == 0 ? "已录入" : "已修改", entity.Id);
//EMC需要保存船期原始数据
if (input.CARRIERID == "EMC" && input.ShipData != null)
{
_logger.LogInformation($"保存船期数据EMC{input.ShipData}");
JObject jobjExt = new JObject();
if (!string.IsNullOrEmpty(entity.ExtendData))
{
jobjExt = JObject.Parse(entity.ExtendData);
}
jobjExt["shipInfo"] = input.ShipData;
entity.ExtendData = jobjExt.ToString();
await _rep.AsUpdateable(entity).UpdateColumns(x => new { x.ExtendData }).ExecuteCommandAsync();
}
//返回给前端数据
var outModel = entity.Adapt<BookingCustomerOrderSaveOutput>();
@ -544,14 +563,15 @@ namespace Myshipping.Application
[HttpPost("/BookingCustomerOrder/Submit")]
public async Task<string> Submit(List<long> ids)
{
var recUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingRequestReceiveUrl");
var allSysConfig = await _cache.GetAllSysConfig();
var recUrl = allSysConfig.FirstOrDefault(x => x.Code == "DjyBookingRequestReceiveUrl");
if (recUrl == null || string.IsNullOrEmpty(recUrl.Value))
{
throw Oops.Bah("大简云接收订舱URL地址未配置请联系管理员");
}
var userId = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingReceiveUserId");
var userSecret = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingReceiveUserSecret");
var userId = allSysConfig.FirstOrDefault(x => x.Code == "DjyBookingReceiveUserId");
var userSecret = allSysConfig.FirstOrDefault(x => x.Code == "DjyBookingReceiveUserSecret");
if (userId == null || string.IsNullOrEmpty(userId.Value) || userSecret == null || string.IsNullOrEmpty(userSecret.Value))
{
throw Oops.Bah("大简云接收订舱用户key和秘钥未配置请联系管理员");
@ -602,6 +622,12 @@ namespace Myshipping.Application
throw Oops.Bah($"箱型箱量不能为空:\r\n{string.Join("\r\n", emptyCtnOrd)}\r\n请补充后重新发送");
}
var distinctCarr = orderList.Select(x => x.CARRIERID).Distinct().ToList();
if (distinctCarr.Count > 1)
{
throw Oops.Bah($"批量发送时,只能选择同一船司的数据");
}
var fileList = _repFile.AsQueryable().Filter(null, true).Where(x => ordIdList.Contains(x.BookingId)).ToList();
var serviceItemList = _repServiceItem.AsQueryable().Filter(null, true).Where(x => ordIdList.Contains(x.BookingId.Value)).ToList();
var sendList = new List<BookingCustomerSubmitDto>();
@ -614,7 +640,7 @@ namespace Myshipping.Application
}
//当前系统的url
var sysUrlCfg = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "SystemUrl");
var sysUrlCfg = allSysConfig.FirstOrDefault(x => x.Code == "SystemUrl");
var sysUrl = sysUrlCfg.Value;
if (!sysUrl.EndsWith("/"))
{
@ -628,6 +654,8 @@ namespace Myshipping.Application
throw Oops.Bah("回推数据接收接口授权未配置");
}
foreach (var order in orderList)
{
if (order.BSSTATUS != "已录入" && order.BSSTATUS != "已驳回")
@ -812,6 +840,139 @@ namespace Myshipping.Application
}
}
/// <summary>
/// 查询船期数据EMC
/// </summary>
/// <returns></returns>
[HttpGet("/BookingCustomerOrder/QueryShipInfoEMC")]
public async Task<dynamic> QueryShipInfoEMC(long custOrdId)
{
var allSysConfig = await _cache.GetAllSysConfig();
var sCfgSpiderUrl = allSysConfig.FirstOrDefault(x => x.Code == "BookingPostApiServerAddr" && x.GroupCode == "DJY_CONST");
if (sCfgSpiderUrl == null)
{
throw Oops.Bah("订舱API的爬虫URL地址未配置请联系管理员");
}
var sCfgUserKey = allSysConfig.FirstOrDefault(x => x.Code == "BookingPostApiKey" && x.GroupCode == "DJY_CONST");
var sCfgUserSecret = allSysConfig.FirstOrDefault(x => x.Code == "BookingPostApiSecret" && x.GroupCode == "DJY_CONST");
if (sCfgUserKey == null || sCfgUserSecret == null)
{
throw Oops.Bah("订舱API的KEY和密钥未配置请联系管理员");
}
var apiUrl = sCfgSpiderUrl.Value;
if (!apiUrl.EndsWith("/"))
{
apiUrl += "/";
}
apiUrl += "v1/emc/ship/query";
var custOrder = await _rep.AsQueryable().FirstAsync(x => x.Id == custOrdId);
var ctns = await _repCtn.AsQueryable().Where(x => x.BILLID == custOrdId).ToListAsync();
var mappingCtn = await _cache.GetAllMappingCtn();
var mappingPortLoad = await _cache.GetAllMappingPortLoad();
var mappingPort = await _cache.GetAllMappingPort();
//收货地
var mapPlaceReceipt = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PLACERECEIPTCODE);
if (mapPlaceReceipt == null)
{
throw Oops.Bah($"未找到收货地映射信息:{custOrder.PLACERECEIPTCODE}");
}
//起运港
var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PORTLOADCODE);
if (mapPortLoad == null)
{
throw Oops.Bah($"未找到起运港映射信息:{custOrder.PORTLOADCODE}");
}
//卸货港
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.PORTDISCHARGECODE);
if (mapPort == null)
{
throw Oops.Bah($"未找到卸货港映射信息:{custOrder.PORTDISCHARGECODE}");
}
//目的地
var mapDestination = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == custOrder.DESTINATIONCODE);
if (mapPort == null)
{
throw Oops.Bah($"未找到目的地映射信息:{custOrder.DESTINATIONCODE}");
}
//箱型转换
var disCtnCode = ctns.Select(x => x.CTNCODE).Distinct().ToList();
var mapCtnCode = new List<string>();
foreach (var ctnall in disCtnCode)
{
var mapCtn = mappingCtn.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "EMC" && x.Code == ctnall);
if (mapCtn == null)
{
throw Oops.Bah($"未找到箱型映射信息:{ctnall}");
}
mapCtnCode.Add(mapCtn.MapName);
}
var postModel = new
{
userKey = sCfgUserKey.Value,
userSecret = sCfgUserSecret.Value,
webAccount = custOrder.BookingAccount,
webPassword = custOrder.BookingPassword,
searchConditionDate = custOrder.ETD.Value.ToString("yyyy-MM-dd"),
originName = mapPlaceReceipt.MapName,
destinationName = mapDestination.MapName,
polPortName = mapPortLoad.MapName,
podPortName = mapPort.MapName,
serviceType = custOrder.ServiceType,
serviceMode = custOrder.ServiceMode,
bookingOffice = custOrder.BookingAddr,
isReefer = "N",
contractType = custOrder.ContractType,
contractNo = custOrder.CONTRACTNO,
containerTypeList = mapCtnCode
};
_logger.LogInformation($"发送查询API数据给爬虫{apiUrl}{postModel.ToJsonString()}");
var rtnQuery = await apiUrl.SetBody(postModel)
.PostAsStringAsync();
_logger.LogInformation($"爬虫返回:{rtnQuery}");
var jobjRtnQuery = JObject.Parse(rtnQuery);
if (jobjRtnQuery.GetIntValue("code") != 200)
{
throw Oops.Bah($"查询船期数据出错:{jobjRtnQuery.GetStringValue("msg")}");
}
else
{
var jarrVessel = jobjRtnQuery.GetJArrayValue("data");
return jarrVessel;
}
}
/// <summary>
/// 保存船期数据EMC
/// </summary>
/// <returns></returns>
[HttpPost("/BookingCustomerOrder/SaveShipInfoEMC")]
public async Task SaveShipInfoEMC(SaveShipInfoEMCDto dto)
{
_logger.LogInformation($"保存船期数据EMC{dto.ToJsonString()}");
var custOrder = await _rep.AsQueryable().FirstAsync(x => x.Id == dto.Id);
JObject jobjExt = new JObject();
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
jobjExt = JObject.Parse(custOrder.ExtendData);
}
jobjExt["shipInfo"] = dto.ShipData;
custOrder.ExtendData = jobjExt.ToString();
await _rep.AsUpdateable(custOrder).UpdateColumns(x => new { x.ExtendData }).ExecuteCommandAsync();
}
#region 客户订舱模板
/// <summary>
@ -1694,17 +1855,14 @@ namespace Myshipping.Application
custOrder.SOREMARK = data.Rows[idx]["备注 (其它注意事项)"].ToString();
//订舱账号、密码
var jobj = new JObject();
jobj["Account"] = data.Rows[idx]["EMC账号"].ToString();
jobj["Password"] = data.Rows[idx]["EMC密码"].ToString();
jobj["OpMail"] = data.Rows[idx]["订舱确认邮箱"].ToString();
jobj["ContactName"] = data.Rows[idx]["联系人"].ToString();
jobj["ContactTel"] = data.Rows[idx]["联系电话"].ToString();
jobj["YSFS"] = data.Rows[idx]["运送方式"].ToString();
jobj["YSXT"] = data.Rows[idx]["运送型态"].ToString();
jobj["ContractType"] = data.Rows[idx]["合约类型"].ToString();
custOrder.ExtendData = jobj.ToJsonString();
custOrder.BookingAccount = data.Rows[idx]["EMC账号"].ToString();
custOrder.BookingPassword = data.Rows[idx]["EMC密码"].ToString();
custOrder.OpMail = data.Rows[idx]["订舱确认邮箱"].ToString();
custOrder.ContactName = data.Rows[idx]["联系人"].ToString();
custOrder.ContactTel = data.Rows[idx]["联系电话"].ToString();
custOrder.ServiceType = data.Rows[idx]["运送方式"].ToString();
custOrder.ServiceMode = data.Rows[idx]["运送型态"].ToString();
custOrder.ContractType = data.Rows[idx]["合约类型"].ToString();
//箱信息
var ctnStr = data.Rows[idx]["SIZE"].ToString();
@ -1767,7 +1925,7 @@ namespace Myshipping.Application
var rtnList = new List<BookingSubmitResultModel>();
var ordIdList = new List<long>();
var ordOkList = new List<BookingCustomerOrder>();
foreach (var item in list)
{
var strId = item.Id.ToString();
@ -1804,7 +1962,7 @@ namespace Myshipping.Application
await _rep.UpdateAsync(order);
}
ordIdList.Add(order.Id);
ordOkList.Add(order);
//箱信息
await _repCtn.DeleteAsync(x => x.BILLID == order.Id);
@ -1864,28 +2022,33 @@ namespace Myshipping.Application
_logger.LogInformation($"找到客户端租户对应客户:{cust.FullName}");
var paraCallApiAuditAuto = await _repCustomerParamValue.AsQueryable().FirstAsync(x => x.CustomerId == cust.Id && x.ParaCode == "BookingCallApiAndAuditAuto");
if (paraCallApiAuditAuto != null && paraCallApiAuditAuto.ItemCode == "YES")
if (paraCallApiAuditAuto != null && !string.IsNullOrEmpty(paraCallApiAuditAuto.ItemCode))
{
foreach (var ordId in ordIdList)
foreach (var ord in ordOkList)
{
if (!paraCallApiAuditAuto.ItemCode.Contains(ord.CARRIERID))
{
continue;
}
var succ = false;
try
{
_logger.LogInformation($"自动订舱:{ordId}");
await PostApiSO(ordId);
_logger.LogInformation($"自动订舱:{ord}");
await PostApiSO(ord.Id);
succ = true;
}
catch (Exception ex)
{
_logger.LogWarning($"自动订舱失败:{ordId},错误信息:{ex.Message}");
await AuditBooking(ordId, false, ex.Message, notFeedback: true);
_logger.LogWarning($"自动订舱失败:{ord},错误信息:{ex.Message}");
await AuditBooking(ord.Id, false, ex.Message, notFeedback: true);
throw ex;
}
if (succ)
{
_logger.LogInformation($"自动审核:{ordId}");
await AuditBooking(ordId, true, "系统自动审核");
_logger.LogInformation($"自动审核:{ord}");
await AuditBooking(ord.Id, true, "系统自动审核");
}
}
}
@ -2543,6 +2706,10 @@ namespace Myshipping.Application
throw Oops.Bah("服务项目不能为空");
}
if (input.CARRIERID == "EMC" && string.IsNullOrEmpty(input.ShipInfoJson))
{
throw Oops.Bah($"长荣订舱需提供船期数据");
}
#endregion
var custOrder = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.TenantId == UserManager.TENANT_ID && x.BSNO == input.BSNO);
@ -2570,7 +2737,15 @@ namespace Myshipping.Application
ins = true;
}
//订舱船期数据
JObject jobjExt = new JObject();
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
jobjExt = JObject.Parse(custOrder.ExtendData);
}
jobjExt["shipInfo"] = JObject.Parse(input.ShipInfoJson);
custOrder.ExtendData = jobjExt.ToString();
//赋值根据唯一代码匹配后的代码、名称等信息
custOrder.CARRIER = carr.EnName;
@ -2610,19 +2785,6 @@ namespace Myshipping.Application
{custOrder.NotifypartLastName} {custOrder.NotifypartFirstName} {custOrder.NotifypartPhoneCountryCode} {custOrder.NotifypartPhoneCode} {custOrder.NotifypartPhone}".ToUpper();
}
//订舱账号、密码
var jobj = new JObject();
if (!string.IsNullOrEmpty(custOrder.ExtendData))
{
jobj = JObject.Parse(custOrder.ExtendData);
}
jobj["Account"] = input.BOOKINGACCOUNT;
jobj["Password"] = input.BOOKINGPASSWORD;
jobj["OpMail"] = input.OPMAIL;
jobj["PolPortName"] = input.PolPortName;
jobj["PodPortName"] = input.PodPortName;
custOrder.ExtendData = jobj.ToJsonString();
var ctns = input.CtnList.Adapt<List<BookingCtn>>();
foreach (var ctn in ctns)
@ -2700,14 +2862,25 @@ namespace Myshipping.Application
#region 发送订舱
/// <summary>
/// 发送Api订舱,目前只有中远
/// 发送Api订舱
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("/BookingCustomerOrder/PostApiSO")]
public async Task PostApiSO(long id)
{
var rtn = await ZhongYuanSoApiHelper.DoPost(id);
var order = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
KeyValuePair<bool, string> rtn = new KeyValuePair<bool, string>(false, "不支持的船司");
if (order.CARGOID == "COSCO")
{
rtn = await ZhongYuanSoApiHelper.DoPost(id);
}
else if (order.CARGOID == "EMC")
{
rtn = await EMCSoApiHelper.DoPost(id);
}
if (!rtn.Key)
{
SaveAuditLog("发送订舱", id, remark: rtn.Value);
@ -2716,6 +2889,9 @@ namespace Myshipping.Application
SaveAuditLog("发送订舱", id, remark: rtn.Value);
}
#endregion
}
}

@ -1,8 +1,10 @@
using Myshipping.Application.Entity;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -91,6 +93,26 @@ namespace Myshipping.Application
/// 订舱租户名称
/// </summary>
public string BookingTenantName { get; set; }
/// <summary>
/// 发货人名称
/// </summary>
public string ShipperName { get; set; }
/// <summary>
/// 收货人名称
/// </summary>
public string ConsigneeName { get; set; }
/// <summary>
/// 通知人名称
/// </summary>
public string NotifypartName { get; set; }
/// <summary>
/// 订舱公司名称
/// </summary>
public string BookingName { get; set; }
}
//dto
@ -606,6 +628,143 @@ namespace Myshipping.Application
/// 收货地代码
/// </summary>
public string PLACERECEIPTID { get; set; }
/// <summary>
/// 订舱账号
/// </summary>
public string BookingAccount { get; set; }
/// <summary>
/// 订舱密码
/// </summary>
public string BookingPassword { get; set; }
/// <summary>
/// 操作邮箱
/// </summary>
public string OpMail { get; set; }
/// <summary>
/// 起始港名
/// </summary>
public string PolPortName { get; set; }
/// <summary>
/// 目的港名
/// </summary>
public string PodPortName { get; set; }
/// <summary>
/// 合约类型
/// </summary>
public string ContractType { get; set; }
/// <summary>
/// 运送方式
/// </summary>
public string ServiceType { get; set; }
/// <summary>
/// 运送形态
/// </summary>
public string ServiceMode { get; set; }
/// <summary>
/// 联系人
/// </summary>
public string ContactName { get; set; }
/// <summary>
/// 联系电话
/// </summary>
public string ContactTel { get; set; }
/// <summary>
/// 订舱网点
/// </summary>
public string BookingAddr { get; set; }
/// <summary>
/// 提单签发地
/// </summary>
public string BillSignLoc { get; set; }
/// <summary>
/// 提单数量
/// </summary>
public int? BillCount { get; set; }
/// <summary>
/// 是否接收订舱通知
/// </summary>
public bool AcceptNotify { get; set; }
/// <summary>
/// 发货人性别
/// </summary>
public string ShipperSex { get; set; }
/// <summary>
/// 收货人性别
/// </summary>
public string ConsigneeSex { get; set; }
/// <summary>
/// 通知人性别
/// </summary>
public string NotifypartSex { get; set; }
/// <summary>
/// 订舱公司性别
/// </summary>
public string BookingSex { get; set; }
/// <summary>
/// 发货人内参号码
/// </summary>
public string ShipperInnerCode { get; set; }
/// <summary>
/// 收货人内参号码
/// </summary>
public string ConsigneeInnerCode { get; set; }
/// <summary>
/// 通知人内参号码
/// </summary>
public string NotifypartInnerCode { get; set; }
/// <summary>
/// 订舱公司内参号码
/// </summary>
public string BookingInnerCode { get; set; }
/// <summary>
/// 订舱客户内参号码
/// </summary>
public string CustomerInnerCode { get; set; }
/// <summary>
/// 发货人邮箱
/// </summary>
public string ShipperEmail { get; set; }
/// <summary>
/// 收货人邮箱
/// </summary>
public string ConsigneeEmail { get; set; }
/// <summary>
/// 通知人邮箱
/// </summary>
public string NotifypartEmail { get; set; }
/// <summary>
/// 订舱公司邮箱
/// </summary>
public string BookingEmail { get; set; }
}
//保存dto
@ -630,6 +789,11 @@ namespace Myshipping.Application
/// 服务项目
/// </summary>
public List<BookingServiceItemCustomerDto> ServiceItemList { get; set; }
/// <summary>
/// 船期数据EMC需要
/// </summary>
public dynamic ShipData { get; set; }
}
//台账返回dto
@ -1232,13 +1396,19 @@ namespace Myshipping.Application
public string OPMAIL { get; set; }
/// <summary>
/// 起始港名
/// 船期数据JSON
/// </summary>
public string PolPortName { get; set; }
public string ShipInfoJson { get; set; }
/// <summary>
/// 目的港名
/// </summary>
public string PodPortName { get; set; }
}
/// <summary>
/// 保存船期数据EMC DTO
/// </summary>
public class SaveShipInfoEMCDto
{
public long Id { get; set; }
public dynamic ShipData { get; set; }
}
}

@ -395,9 +395,9 @@ namespace Myshipping.Application
public string SignType { get; set; }
/// <summary>
/// 退舱网点
/// 舱网点
/// </summary>
public string CancelAddr { get; set; }
public string BookingAddr { get; set; }
/// <summary>
/// 提单签发地

@ -0,0 +1,80 @@
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class TaskAPIBase
{
/// <summary>
/// API名称
/// </summary>
public string APIName { get; set; }
/// <summary>
/// 请求地址
/// </summary>
public string URL { get; set; }
/// <summary>
/// 请求方式
/// </summary>
public string RequestMethod { get; set; }
/// <summary>
/// 请求key
/// </summary>
public string Key { get; set; }
/// <summary>
/// 请求密钥
/// </summary>
public string SecretKey { get; set; }
/// <summary>
/// 平台代码
/// </summary>
public string SYSTEM_CODE { get; set; }
/// <summary>
/// 平台名称
/// </summary>
public string SYSTEM_NAME { get; set; }
}
public class TaskAPIInput:PageInputBase
{
}
public class AddTaskAPIInput : TaskAPIBase
{
}
public class DeleteTaskAPIInput
{
/// <summary>
/// 主键
/// </summary>
public string PK_ID { get; set; }
}
public class UpdateTaskAPIInput: TaskAPIBase
{
/// <summary>
/// 主键
/// </summary>
public string PK_ID { get; set; }
}
public class GetTaskApiInfoInput
{
/// <summary>
/// 主键
/// </summary>
public string PK_ID { get; set; }
}
}

@ -0,0 +1,72 @@
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class TaskFlowTenantBase
{
/// <summary>
/// 任务APIId
/// </summary>
public string TaskApiId { get; set; }
/// <summary>
/// 平台代码
/// </summary>
public string SYSTEM_CODE { get; set; }
/// <summary>
/// 平台名称
/// </summary>
public string SYSTEM_NAME { get; set; }
}
public class TaskFlowTenantInput : PageInputBase
{
/// <summary>
/// 任务APIId
/// </summary>
public string TaskApiId { get; set; }
}
public class AddTaskFlowTenantInput : TaskFlowTenantBase
{
}
public class DeleteTaskFlowTenantInput
{
/// <summary>
/// 主键
/// </summary>
public string PK_ID { get; set; }
}
public class UpdateTaskFlowTenantInput : TaskFlowTenantBase
{
/// <summary>
/// 主键
/// </summary>
public string PK_ID { get; set; }
}
public class GetTaskFlowTenantInfoInput
{
/// <summary>
/// 主键
/// </summary>
public string PK_ID { get; set; }
}
}

@ -0,0 +1,128 @@
using Furion;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Myshipping.Core.Service;
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Myshipping.Application.Entity;
using Myshipping.Application.Service.Fee.Dto;
using Mapster;
using Furion.DistributedIDGenerator;
namespace Myshipping.Application.Service.TaskManagePlat
{
/// <summary>
/// 任务API配置
/// </summary>
[ApiDescriptionSettings("Application", Name = "TaskAPI", Order = 10)]
public class TaskAPIService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<TaskAPIInfo> _rep;
public TaskAPIService(SqlSugarRepository<TaskAPIInfo> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询任务API配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<TaskAPIInfo>> Page(TaskAPIInput input)
{
var query = _rep.AsQueryable()
.Select(u => new TaskAPIInfo
{
PK_ID = u.PK_ID,
APIName = u.APIName,
URL = u.URL,
RequestMethod = u.RequestMethod,
Key = u.Key,
SecretKey = u.SecretKey,
SYSTEM_CODE = u.SYSTEM_CODE,
SYSTEM_NAME = u.SYSTEM_NAME
});
return await query.ToPagedListAsync(input.PageNo, input.PageSize);
}
/// <summary>
/// 增加任务API配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Add")]
public async Task Add(AddTaskAPIInput input)
{
var entity = input.Adapt<TaskAPIInfo>();
entity.PK_ID = IDGen.NextID().ToString();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 删除任务API配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteTaskAPIInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.PK_ID == input.PK_ID) ?? throw Oops.Oh("数据不存在");
entity.IsDeleted = true;
await _rep.UpdateAsync(entity);
}
/// <summary>
/// 更新任务API配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdateTaskAPIInput input)
{
var entity = input.Adapt<TaskAPIInfo>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取任务API配置详情
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<TaskAPIInfo> Get(GetTaskApiInfoInput input)
{
return await _rep.FirstOrDefaultAsync(u => u.PK_ID == input.PK_ID);
}
/// <summary>
/// 获取任务API配置列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<TaskAPIInfo>> List([FromQuery] TaskAPIInput input)
{
return await _rep.AsQueryable().Select<TaskAPIInfo>().ToListAsync();
}
}
}

@ -0,0 +1,118 @@
using Furion.DependencyInjection;
using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Myshipping.Application.Entity;
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.TaskManagePlat
{
/// <summary>
/// 租户任务流程配置
/// </summary>
[ApiDescriptionSettings("Application", Name = "TaskFlowTenant", Order = 10)]
public class TaskFlowTenantService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<TaskFlowTenant> _rep;
public TaskFlowTenantService(SqlSugarRepository<TaskFlowTenant> rep)
{
_rep = rep;
}
/// <summary>
/// 分页查询租户任务流程配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<TaskFlowTenant>> Page(TaskFlowTenantInput input)
{
var query = _rep.AsQueryable()
.Select(u => new TaskFlowTenant
{
PK_ID = u.PK_ID,
TaskApiId = u.TaskApiId,
SYSTEM_CODE = u.SYSTEM_CODE,
SYSTEM_NAME = u.SYSTEM_NAME
});
return await query.ToPagedListAsync(input.PageNo, input.PageSize);
}
/// <summary>
/// 增加租户任务流程配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Add")]
public async Task Add(AddTaskFlowTenantInput input)
{
var entity = input.Adapt<TaskFlowTenant>();
entity.PK_ID = IDGen.NextID().ToString();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 删除租户任务流程配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Delete")]
public async Task Delete(DeleteTaskFlowTenantInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.PK_ID == input.PK_ID) ?? throw Oops.Oh("数据不存在");
entity.IsDeleted = true;
await _rep.UpdateAsync(entity);
}
/// <summary>
/// 更新租户任务流程配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Update")]
public async Task Update(UpdateTaskFlowTenantInput input)
{
var entity = input.Adapt<TaskFlowTenant>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取租户任务流程配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[ApiDescriptionSettings(Name = "Detail")]
public async Task<TaskFlowTenant> Get(GetTaskFlowTenantInfoInput input)
{
return await _rep.FirstOrDefaultAsync(u => u.PK_ID == input.PK_ID);
}
/// <summary>
/// 获取租户任务流程配置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[ApiDescriptionSettings(Name = "List")]
public async Task<List<TaskFlowTenant>> List([FromQuery] TaskFlowTenantInput input)
{
return await _rep.AsQueryable().Select<TaskFlowTenant>().ToListAsync();
}
}
}

@ -45,5 +45,13 @@ namespace Myshipping.Core.Entity
[SugarColumn(ColumnName = "Sort")]
[Description("排序")]
public int Sort { get; set; }
/// <summary>
/// 是否多选
/// </summary>
[SugarColumn(ColumnName = "MultiSelect")]
[Description("是否多选")]
public bool MultiSelect { get; set; }
}
}

@ -2230,6 +2230,11 @@
排序
</summary>
</member>
<member name="P:Myshipping.Core.Entity.DjyCustomerParam.MultiSelect">
<summary>
是否多选
</summary>
</member>
<member name="T:Myshipping.Core.Entity.DjyCustomerParamItem">
<summary>
客户参数定义
@ -11656,6 +11661,11 @@
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyCustomerParamDto.MultiSelect">
<summary>
是否多选
</summary>
</member>
<member name="T:Myshipping.Core.Service.DjyCustomerParamListOutput">
<summary>
列表输出

@ -39,6 +39,12 @@ namespace Myshipping.Core.Service
/// </summary>
[Description("排序")]
public int Sort { get; set; }
/// <summary>
/// 是否多选
/// </summary>
[Description("是否多选")]
public bool MultiSelect { get; set; }
}

@ -55,11 +55,11 @@ namespace Myshipping.Core.Service
[HttpPost("/DjyWebsiteAccountConfig/add")]
public async Task<long> Add(AddDjyWebsiteAccountConfigInput input)
{
var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId && !x.IsTenant);
if (cc > 0)
{
throw Oops.Bah("已存在同类型账号");
}
//var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId && !x.IsTenant);
//if (cc > 0)
//{
// throw Oops.Bah("已存在同类型账号");
//}
var entity = input.Adapt<DjyWebsiteAccountConfig>();
entity.IsTenant = false;
@ -75,11 +75,11 @@ namespace Myshipping.Core.Service
[HttpPost("/DjyWebsiteAccountConfig/edit")]
public async Task<long> Update(UpdateDjyWebsiteAccountConfigInput input)
{
var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId && !x.IsTenant && x.Id != input.Id);
if (cc > 0)
{
throw Oops.Bah("已存在同类型账号");
}
//var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId && !x.IsTenant && x.Id != input.Id);
//if (cc > 0)
//{
// throw Oops.Bah("已存在同类型账号");
//}
var entity = input.Adapt<DjyWebsiteAccountConfig>();
entity.IsTenant = false;

Loading…
Cancel
Save