zhangxiaofeng 8 months ago
commit bb06fe2bd1

@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Myshipping.Application.EDI
@ -31,6 +32,7 @@ namespace Myshipping.Application.EDI
if (str == "DAAE") return "DELMAS";
if (str == "UASC") return "UASC";
if (str == "COSU") return "COSCO";
if (str == "OOLU") return "OOCL";
else return "";
}
public static string GetBillNum(string str)
@ -186,6 +188,9 @@ namespace Myshipping.Application.EDI
/// <returns></returns>
public static string formatEdiStr(string fileType, string str)
{
if (str == null)
str = string.Empty;
if (fileType == "txt")
{
return str.Replace("?", "??").Replace(":", "?:").Replace("+", "?+").Replace("'", "?'");
@ -288,14 +293,14 @@ namespace Myshipping.Application.EDI
if (InttrEdi.filetype == "B")
{
if (InttrEdi.UseForWarderCode)
{
if (string.IsNullOrEmpty(InttrEdi.ForWarderCode))
{ error = error + "<br />货代代码不能为空"; }
//if (InttrEdi.UseForWarderCode)
//{
// if (string.IsNullOrEmpty(InttrEdi.ForWarderCode))
// { error = error + "<br />货代代码不能为空"; }
if (string.IsNullOrEmpty(InttrEdi.ForWarderName))
{ error = error + "<br />货代称呼不能为空"; }
}
// if (string.IsNullOrEmpty(InttrEdi.ForWarderName))
// { error = error + "<br />货代称呼不能为空"; }
//}
}
@ -340,7 +345,7 @@ namespace Myshipping.Application.EDI
if (headData.CARGOID == "D" || headData.SERVICE == "DOOR-DOOR" || headData.SERVICE == "DOOR-CY" || headData.SERVICE == "CY-DOOR")
{
if (headData.CARRIER != "YML")
if (headData.CARRIERID != "YML")
{
if (string.IsNullOrEmpty(headData.EDIATTN))
{ error = error + "<br />EDI信息联系人不能为空"; }
@ -771,7 +776,7 @@ namespace Myshipping.Application.EDI
r.WriteLine("UNH+" + bill.ORDERNO + "+IFTMBF:D:99B:UN'");
icount = icount + 2;
if (bill.CARRIEREDICODE == "HLCU")
if (bill.CARRIERID == "HLCU")
{
if (InttrEdi.filerole == "9")
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+9'");
@ -795,15 +800,15 @@ namespace Myshipping.Application.EDI
r.WriteLine("DTM+137:" + DateTime.Now.ToString("yyyyMMddHHmm") + ":203'");
icount = icount + 2;
if (bill.SERVICE.ToUpper() == "DOOR-DOOR")
if (bill.SERVICEEDICODE.ToUpper() == "DOOR-DOOR")
{
r.WriteLine("TSR+27+2'");
}
else if (bill.SERVICE.ToUpper() == "DOOR-CY")
else if (bill.SERVICEEDICODE.ToUpper() == "DOOR-CY")
{
r.WriteLine("TSR+28+2'");
}
else if (bill.SERVICE.ToUpper() == "CY-DOOR")
else if (bill.SERVICEEDICODE.ToUpper() == "CY-DOOR")
{
r.WriteLine("TSR+29+2'");
}
@ -818,7 +823,7 @@ namespace Myshipping.Application.EDI
if (bill.BLFRT.IndexOf("COLLECT") >= 0)
str_pay = bill.PAYABLEAT;
/* 2024-04-08 JHQ
if (bill.CARRIEREDICODE == "HLCU")
{
r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + bill.SERVICE + " " + bill.CONTRACTNO + " "
@ -834,17 +839,34 @@ namespace Myshipping.Application.EDI
r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + bill.SERVICE + " "
+ bill.PKGS.ToString() + bill.KINDPKGS + " " + formatEdiStr("txt", bill.EDIREMARK.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ")) + "'");
}
icount = icount + 2;
*/
icount = icount + 1;
var Shipping = "";
Shipping = formatEdiStr("txt", bill.EDIREMARK);
Shipping = Shipping.Replace("\n", "\\");
Shipping = Shipping.Replace("\r", " ");
string[] EdiRemarkList = Shipping.Split('\\');
if (EdiRemarkList.Length != 0)
{
for (var i = 0; i < EdiRemarkList.Length; i++)
{
r.WriteLine("FTX+AAI+++" + EdiRemarkList[i] + "'");
icount = icount + 1;
}
}
/*件重尺*/
r.WriteLine("CNT+7:" + Math.Round(Convert.ToDecimal(bill.KGS), 3) + ":KGM'");//按照四舍五入的国际标准
r.WriteLine("CNT+7:" + bill.KGS.ToString("0.###") + ":KGM'");//按照四舍五入的国际标准
r.WriteLine("CNT+11:" + bill.PKGS.ToString() + "'");
r.WriteLine("CNT+15:" + Math.Round(Convert.ToDecimal(bill.CBM), 3) + ":MTQ'");
r.WriteLine("CNT+15:" + bill.CBM.ToString("0.###") + ":MTQ'");
icount = icount + 3;
if (bill.CARRIEREDICODE == "UASC")
//2024-04-08 这里看2.0文档显示不使用 CNT
if (bill.CARRIERID == "UASC")
{
if (bill.CTNLIST.Count > 0)
{
@ -861,7 +883,7 @@ namespace Myshipping.Application.EDI
if (bill.BLFRT == "FREIGHT COLLECT")
{
if (bill.PAYABLEAT != "")
if (!string.IsNullOrWhiteSpace(bill.PAYABLEAT))
{
r.WriteLine("LOC+57+" + bill.PREPARDATID + "::6:" + bill.PAYABLEAT + "'");
icount = icount + 1;
@ -924,17 +946,25 @@ namespace Myshipping.Application.EDI
r.WriteLine("TDT+20+" + voyno + "+1++" + bill.CARRIEREDICODE + "+++:::" + bill.VESSEL + "'");
r.WriteLine("LOC+9+" + bill.PORTLOADID + ":139:6:" + bill.PORTLOAD + "'");
r.WriteLine("DTM+133:" + Convert.ToDateTime(bill.ETD).ToString("yyyyMMdd") + ":102'");//yyyyMMddHHmm
r.WriteLine("LOC+88+" + bill.PORTLOADID + ":139:6:" + bill.PORTLOAD + "'");
if (!string.IsNullOrEmpty(bill.PLACERECEIPTID))
r.WriteLine("LOC+88+" + bill.PLACERECEIPTID + ":139:6:" + bill.PLACERECEIPT + "'");
else
r.WriteLine("LOC+88+" + bill.PORTLOADID + ":139:6:" + bill.PORTLOAD + "'");
r.WriteLine("LOC+11+" + bill.PORTDISCHARGEID + ":139:6:" + bill.PORTDISCHARGE + "'");
icount = icount + 5;
if (bill.DESTINATION != "")
if (!string.IsNullOrWhiteSpace(bill.DESTINATIONID))
{
r.WriteLine("LOC+7+" + bill.DESTINATIONID + ":139:6:" + bill.DESTINATION + "'");
icount = icount + 1;
}
var Shipping = "";
var DescriptionShipper = "";
//处理发货人
Shipping = string.Empty;
var DescriptionShipper = string.Empty;
Shipping = formatEdiStr("txt", bill.SHIPPER);
List<System.String> ShippingList = formatlengthStr(Shipping, 35);
@ -957,6 +987,7 @@ namespace Myshipping.Application.EDI
}
else
Shipping = Shipping + ":" + ShippingList[i];
if (bill.CARRIEREDICODE == "HLCU")
{
Shipping = Shipping + "-";
@ -1008,6 +1039,7 @@ namespace Myshipping.Application.EDI
}
else
Shipping = Shipping + ":" + ShippingList[i];
if (bill.CARRIEREDICODE == "HLCU")
{
Shipping = Shipping + "--";
@ -1061,7 +1093,6 @@ namespace Myshipping.Application.EDI
if (ShippingList.Count != 0 && Shipping.Length > 0)
{
for (var i = 0; i < ShippingList.Count; i++)
{
if (i == 0) Shipping = "NAD+NI+++" + ShippingList[0] + "+";
@ -1109,10 +1140,10 @@ namespace Myshipping.Application.EDI
}
else if (bill.BYCOUNTRY == "BRAZIL")
{
if (bill.NOTIFYPARTYCOUNTRY != "")
if (!string.IsNullOrWhiteSpace(bill.NOTIFYPARTYCOUNTRY))
Shipping = Shipping + "++++" + bill.NOTIFYPARTYCOUNTRY;
r.WriteLine(Shipping + "'");
if (bill.NOTIFYPARTYTAXNO != "")
if (!string.IsNullOrWhiteSpace(bill.NOTIFYPARTYTAXNO))
{
r.WriteLine("RFF+GN:" + bill.NOTIFYPARTYTAXNO + "'");
icount = icount + 1;
@ -1125,7 +1156,7 @@ namespace Myshipping.Application.EDI
r.WriteLine("NAD+CA+" + bill.CARRIEREDICODE + ":160:86++" + GetCarrierName(bill.CARRIEREDICODE) + "'");
icount = icount + 1;
if (bill.SERVICE == "DOOR-DOOR")
if (bill.SERVICEEDICODE == "DOOR-DOOR")
{
Shipping = formatEdiStr("txt", bill.SHIPPER);
ShippingList = formatlengthStr(Shipping, 35);
@ -1208,7 +1239,7 @@ namespace Myshipping.Application.EDI
}
if (bill.WEITUO != "")
if (!string.IsNullOrWhiteSpace(bill.WEITUO))
{
if (bill.WEITUO.Length > 35)
r.WriteLine("NAD+FW+++" + formatEdiStr("txt", bill.WEITUO.Substring(0, 35)) + "+" + formatEdiStr("txt", bill.WEITUO.Substring(35)) + "'");
@ -1258,7 +1289,7 @@ namespace Myshipping.Application.EDI
icount = icount + 8;
if (bill.HSCODE != "")
if (!string.IsNullOrWhiteSpace(bill.HSCODE))
{
r.WriteLine("PIA+5+" + bill.HSCODE + ":HS'");
icount = icount + 1;
@ -1278,27 +1309,27 @@ namespace Myshipping.Application.EDI
}
}
if (DescriptionShipper != "")
if (!string.IsNullOrWhiteSpace(DescriptionShipper))
{
r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'");
icount = icount + 1;
}
if (DescriptionConsignee != "")
if (!string.IsNullOrWhiteSpace(DescriptionConsignee))
{
r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'");
icount = icount + 1;
}
if (DescriptionNotifyparty != "")
if (!string.IsNullOrWhiteSpace(DescriptionNotifyparty))
{
r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'");
icount = icount + 1;
}
r.WriteLine("MEA+AAE+WT+KGM:" + Math.Round(Convert.ToDecimal(bill.KGS), 3) + "'");
r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Convert.ToDecimal(bill.CBM), 3) + "'");
r.WriteLine("MEA+AAE+WT+KGM:" + bill.KGS.ToString("0.###") + "'");
r.WriteLine("MEA+AAE+AAW+MTQ:" + bill.CBM.ToString("0.###") + "'");
icount = icount + 2;
Shipping = formatEdiStr("txt", bill.MARKS);
@ -1316,6 +1347,7 @@ namespace Myshipping.Application.EDI
}
}
//危险品
if (bill.CARGOID == "D")
{
r.WriteLine("DGS+IMD+" + bill.DCLASS + "+" + bill.DUNNO + "'");
@ -1336,6 +1368,7 @@ namespace Myshipping.Application.EDI
isfind = true;
}
});
if (!isfind)
{
var ctnnum = new MsOpSeaeCtnEDIBaseModel();
@ -1350,16 +1383,41 @@ namespace Myshipping.Application.EDI
r.WriteLine("EQD+CN++" + ctn.CTNALLCODE + "+1'");
else
r.WriteLine("EQD+CN++" + ctn.CTNALLCODE + "+2'");
r.WriteLine("EQN+" + ctn.CTNNUM.ToString() + "'");
icount = icount + 2;
if (bill.CARGOID == "R")
{
if (bill.REEFERF != "")
if (!string.IsNullOrWhiteSpace(bill.REEFERF))
r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'");
if (bill.HUMIDITY != "")
if (!string.IsNullOrWhiteSpace(bill.HUMIDITY))
r.WriteLine("MEA+AAE+AAO+HMD:" + bill.HUMIDITY + "'");
r.WriteLine("TMP+2+" + bill.TEMPSET + ":CEL'");
//温度这里如果是带小数点的值,会导致错误,这里需要慎重
var tempset = bill.TEMPSET;
if (!string.IsNullOrWhiteSpace(tempset))
{
var fuhao = "";
if (tempset.IndexOf("-") == 0)
{
fuhao = "-";
tempset = tempset.Replace("-", "");
}
if (tempset.Length < 3)
{
for (int i = 0; i < 3 - tempset.Length + 1; i++)
{
tempset = "0" + tempset;
}
}
tempset = fuhao + tempset;
}
else
{
tempset = "000";
}
r.WriteLine("TMP+2+" + tempset + ":CEL'");
icount = icount + 2;
@ -1405,15 +1463,15 @@ namespace Myshipping.Application.EDI
if (bill.SERVICE.ToUpper() == "DOOR-DOOR")
if (bill.SERVICEEDICODE.ToUpper() == "DOOR-DOOR")
{
r.WriteLine("TSR+27+2'");
}
else if (bill.SERVICE.ToUpper() == "DOOR-CY")
else if (bill.SERVICEEDICODE.ToUpper() == "DOOR-CY")
{
r.WriteLine("TSR+28+2'");
}
else if (bill.SERVICE.ToUpper() == "CY-DOOR")
else if (bill.SERVICEEDICODE.ToUpper() == "CY-DOOR")
{
r.WriteLine("TSR+29+2'");
}
@ -1423,11 +1481,11 @@ namespace Myshipping.Application.EDI
}
var str_pay = "";
if (bill.BLFRT.IndexOf("PREPAID") >= 0)
if (bill.BLFRTEDICODE.IndexOf("PREPAID") >= 0)
str_pay = bill.PREPARDAT;
if (bill.BLFRT.IndexOf("COLLECT") >= 0)
if (bill.BLFRTEDICODE.IndexOf("COLLECT") >= 0)
str_pay = bill.PAYABLEAT;
r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + bill.SERVICE + " "
r.WriteLine("FTX+AAI+++" + bill.BLFRTEDICODE + " Payable at " + str_pay + " " + bill.SERVICEEDICODE + " "
+ bill.PKGS.ToString() + bill.KINDPKGS + "'");
icount = icount + 5;
@ -1593,8 +1651,6 @@ namespace Myshipping.Application.EDI
}
var DescriptionShipper = "";
Shipping = formatEdiStr("txt", bill.SHIPPER);
@ -1715,6 +1771,7 @@ namespace Myshipping.Application.EDI
else r.WriteLine(Shipping + "'");
icount = icount + 1;
/*2024-04-08 JHQ 2.0
if (!string.IsNullOrEmpty(bill.WEITUO))
{
if (bill.WEITUO.Length > 35)
@ -1739,10 +1796,11 @@ namespace Myshipping.Application.EDI
r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME + "'");
}
}
icount++;
*/
icount++;
Shipping = formatEdiStr("txt", bill.NOTIFYPARTY);
@ -1813,6 +1871,7 @@ namespace Myshipping.Application.EDI
else r.WriteLine(Shipping + "'");
icount = icount + 1;
/* 2024-04-08 JHQ 2.0
Shipping = formatEdiStr("txt", bill.NOTIFYPARTY2);
ShippingList = formatlengthStr(Shipping, 35);
if (ShippingList.Count != 0 && Shipping.Length > 0)
@ -1826,10 +1885,11 @@ namespace Myshipping.Application.EDI
}
r.WriteLine(Shipping + "'");
}
*/
r.WriteLine("NAD+CA+" + bill.CARRIEREDICODE + ":160:86++" + GetCarrierName(bill.CARRIEREDICODE) + "'");
icount = icount + 1;
if (InttrEdi.SENDNAME.Length > 35)
r.WriteLine("NAD+HI+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME.Substring(0, 35) + "+" + InttrEdi.SENDNAME.Substring(35) + "'");
@ -1853,7 +1913,8 @@ namespace Myshipping.Application.EDI
}
}
else if (bill.ISSUETYPE == "海运单" || bill.ISSUETYPE.ToUpper() == "SEAWAY" || bill.ISSUETYPE.ToUpper() == "SEAWAY BILL" || bill.ISSUETYPE.ToUpper() == "WAYBILL" || bill.ISSUETYPE.ToUpper() == "SWB正本" || bill.ISSUETYPE.ToUpper() == "SWB无正本")
else if (bill.ISSUETYPE == "海运单" || bill.ISSUETYPE.ToUpper() == "SEAWAY" || bill.ISSUETYPE.ToUpper() == "SEAWAY BILL" || bill.ISSUETYPE.ToUpper() == "WAYBILL" || bill.ISSUETYPE.ToUpper() == "SWB正本"
|| bill.ISSUETYPE.ToUpper() == "SWB无正本")
{
r.WriteLine("DOC+710+++" + GetBillNum(bill.NOBILL) + "'");
icount = icount + 1;
@ -2016,9 +2077,9 @@ namespace Myshipping.Application.EDI
}
//MEA+AAE+WT+KGM:3000'
//MEA+AAE+AAW+MTQ:110.11'
r.WriteLine("MEA+AAE+WT+KGM:" + Math.Round(Convert.ToDecimal(ctngood.KGS), 3) + "'");
r.WriteLine("MEA+AAE+WT+KGM:" + ctngood.KGS.ToString("0.###") + "'");
icount++;
r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Convert.ToDecimal(ctngood.CBM), 3) + "'");
r.WriteLine("MEA+AAE+AAW+MTQ:" + ctngood.CBM.ToString("0.###") + "'");
icount++;
//PCI++MARKS AND NUMBERS:FOR MATERIAL 1: OUR PONUMBER: PO_123456'
//if (isbill != 1)

@ -7216,7 +7216,7 @@ namespace Myshipping.Application
//ESL、PIL、WY、YML、YT 需要付费方式映射EDI代码
if (ediRouteEnum == EDIRouteEnum.ESL || ediRouteEnum == EDIRouteEnum.PIL || ediRouteEnum == EDIRouteEnum.WY
|| ediRouteEnum == EDIRouteEnum.YML || ediRouteEnum == EDIRouteEnum.YT)
|| ediRouteEnum == EDIRouteEnum.YML || ediRouteEnum == EDIRouteEnum.YT || ediRouteEnum == EDIRouteEnum.INTTRA)
{
//付费方式基础数据
var baseFrtList = _cache.GetAllCodeFrt().GetAwaiter().GetResult();
@ -8783,7 +8783,7 @@ namespace Myshipping.Application
strCheck = Regex.Replace(strCheck, "\\<br\\s{1,}/\\>", "\n");
}
throw Oops.Bah($"发送{EDIRouteEnum.ESL.ToString()}校验失败,{strCheck}");
throw Oops.Bah($"发送{EDIRouteEnum.INTTRA.ToString()}校验失败,{strCheck}");
}
CommonWebApiResult currRlt = new CommonWebApiResult();

@ -1062,7 +1062,7 @@ namespace Myshipping.Application
DateTime nowDate = DateTime.Now;
var hisInfo = _bookingSlotCompareRepository.AsQueryable().First(a => a.COMPARE_BATCHNO == reqBatchNo);
var hisInfo = _bookingSlotCompareRepository.AsQueryable().Filter(null, true).First(a => a.COMPARE_BATCHNO == reqBatchNo);
if (hisInfo == null)
{
@ -1180,7 +1180,7 @@ namespace Myshipping.Application
[HttpGet("/BookingSlot/GetSlotCompareResult")]
public async Task<List<CompareResultDetailInfo>> GetSlotCompareResult([FromQuery] long id, [FromQuery] string batchNo)
{
var compareInfo = await _bookingSlotCompareRepository.AsQueryable()
var compareInfo = await _bookingSlotCompareRepository.AsQueryable().Filter(null, true)
.FirstAsync(t => t.SLOT_ID == id && t.COMPARE_BATCHNO == batchNo);
if (compareInfo == null)
@ -1543,13 +1543,14 @@ namespace Myshipping.Application
/// 检索舱位对应的订舱订单(BY 订舱编号)
/// </summary>
/// <param name="slotBookingNo">订舱编号</param>
/// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingSlot/SearchBookingSlotWithOrderByNo")]
public async Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo)
public async Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId)
{
BookingSlotWithOrderDto dto = null;
var slotInfo = await _repBase.AsQueryable().FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo);
var slotInfo = await _repBase.AsQueryable().Filter(null,true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId);
if (slotInfo == null)
{
@ -1558,7 +1559,7 @@ namespace Myshipping.Application
return dto;
}
var list = _repAllocation.AsQueryable().Where(a => a.BOOKING_SLOT_ID == slotInfo.Id).ToList();
var list = _repAllocation.AsQueryable().Filter(null, true).Where(a => a.BOOKING_SLOT_ID == slotInfo.Id && a.TenantId == tenantId).ToList();
dto = new BookingSlotWithOrderDto
{
@ -1568,7 +1569,7 @@ namespace Myshipping.Application
if (list.Count > 0)
{
dto.HasBookingOrder = true;
dto.BookingOrderList = list.Select(x => x.Id).ToList();
dto.BookingOrderList = list.Select(x => x.BOOKING_ID).ToList();
}
return dto;

@ -110,9 +110,10 @@ namespace Myshipping.Application
/// 检索舱位对应的订舱订单(BY 订舱编号)
/// </summary>
/// <param name="slotBookingNo">订舱编号</param>
/// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns>
Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo);
Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo,long tenantId);
/// <summary>
/// 校验是否可以生成订舱订单

@ -95,8 +95,9 @@ namespace Myshipping.Application
/// 同步舱位变更
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SyncBookingSlotChange(string taskPKId);
Task<TaskManageOrderResultDto> SyncBookingSlotChange(string taskPKId,long tenantId);
/// <summary>
/// 重新处理BC任务

@ -1558,7 +1558,7 @@ namespace Myshipping.Application
*/
//读取订舱数据
var bookingOrderEntity = _bookingOrderRepository.AsQueryable()
var bookingOrderEntity = _bookingOrderRepository.AsQueryable().Filter(null, true)
.First(a => a.Id == taskBCInfo.BOOKING_ORDER_ID);
@ -1574,6 +1574,7 @@ namespace Myshipping.Application
throw Oops.Oh($"订舱的委托客户不能为空");
}
var djyCustomerInfo = _djyCustomerService.Detail(new GetDjyCustomerInput { Id = bookingOrderEntity.CUSTOMERID.Value })
.GetAwaiter().GetResult();
@ -1591,7 +1592,7 @@ namespace Myshipping.Application
//订舱OP的邮箱
string opEmail = string.Empty;
var bookingContactList = _bookingOrderContactRepository.AsQueryable()
var bookingContactList = _bookingOrderContactRepository.AsQueryable().Filter(null, true)
.Where(a => a.BookingId == taskBCInfo.BOOKING_ORDER_ID).ToList();
if (bookingContactList == null || bookingContactList.Count == 0)
@ -1605,7 +1606,7 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(bookingOrderEntity.OPID))
{
var opId = long.Parse(bookingOrderEntity.OPID);
var opUser = _sysUserRepository.AsQueryable().First(a => a.Id == opId);
var opUser = _sysUserRepository.AsQueryable().Filter(null, true).First(a => a.Id == opId);
if (opUser != null && !string.IsNullOrWhiteSpace(opUser.Email))
{
@ -1620,13 +1621,13 @@ namespace Myshipping.Application
if(usePersonalEmailSend)
{
publicMailAccount = _djyUserMailAccount.FirstOrDefault(x => x.CreatedUserId == UserManager.UserId
publicMailAccount = _djyUserMailAccount.AsQueryable().Filter(null, true).First(x => x.CreatedUserId == UserManager.UserId
&& x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != "");
}
else
{
//这个是公共邮箱配置
publicMailAccount = _djyUserMailAccount.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID && x.ShowName == "PublicSend"
publicMailAccount = _djyUserMailAccount.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ShowName == "PublicSend"
&& x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != "");
}
@ -1644,7 +1645,7 @@ namespace Myshipping.Application
SysUser opUserInfo = null;
if (!string.IsNullOrWhiteSpace(bookingOrderEntity.OPID) && Regex.IsMatch(bookingOrderEntity.OPID, "[0-9]+"))
opUserInfo = _sysUserRepository.AsQueryable().First(u => u.Id == long.Parse(bookingOrderEntity.OPID));
opUserInfo = _sysUserRepository.AsQueryable().Filter(null, true).First(u => u.Id == long.Parse(bookingOrderEntity.OPID));
if (taskBCInfo.BUSI_TYPE == "BookingAmendment")
{
@ -1669,12 +1670,12 @@ namespace Myshipping.Application
if (bcTaskInfo.TASK_BASE_TYPE == TaskBaseTypeEnum.BC.ToString())
{
fileInfo = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_NOTICE"))
fileInfo = _taskFileRepository.AsQueryable().Filter(null, true).Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_NOTICE"))
.OrderByDescending(a => a.CreatedTime).First();
}
else if (bcTaskInfo.TASK_BASE_TYPE == TaskBaseTypeEnum.BC_MODIFY.ToString())
{
fileInfo = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_MODIFY_NOTICE"))
fileInfo = _taskFileRepository.AsQueryable().Filter(null, true).Where(a => a.TASK_PKID == taskBCInfo.TASK_ID && a.FILE_CATEGORY.Contains("BC_MODIFY_NOTICE"))
.OrderByDescending(a => a.CreatedTime).First();
}
@ -2268,13 +2269,13 @@ namespace Myshipping.Application
if (string.IsNullOrWhiteSpace(taskPKId))
throw Oops.Oh($"BC任务主键不能为空");
var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId);
var bcTaskInfo = await _taskBaseRepository.AsQueryable().Filter(null,true).FirstAsync(u => u.PK_ID == taskPKId);
if (bcTaskInfo == null)
{
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
}
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == bcTaskInfo.PK_ID);
var bcOrder = _taskBCInfoRepository.AsQueryable().Filter(null, true).First(a => a.TASK_ID == bcTaskInfo.PK_ID);
if (bcOrder == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息");
@ -2295,13 +2296,13 @@ namespace Myshipping.Application
if (string.IsNullOrWhiteSpace(taskPKId))
throw Oops.Oh($"BC任务主键不能为空");
var bcTaskInfo = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId);
var bcTaskInfo = await _taskBaseRepository.AsQueryable().Filter(null,true).FirstAsync(u => u.PK_ID == taskPKId);
if (bcTaskInfo == null)
{
throw Oops.Oh($"任务主键{taskPKId}无法获取业务信息");
}
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == bcTaskInfo.PK_ID);
var bcOrder = _taskBCInfoRepository.AsQueryable().Filter(null, true).First(a => a.TASK_ID == bcTaskInfo.PK_ID);
if (bcOrder == null)
throw Oops.Oh($"任务主键{taskPKId}无法获取BC业务信息");
@ -2315,9 +2316,10 @@ namespace Myshipping.Application
/// 同步舱位变更
/// </summary>
/// <param name="taskPKId">BC任务主键</param>
/// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns>
[HttpGet("/TaskManageBC/SyncBookingSlotChange")]
public async Task<TaskManageOrderResultDto> SyncBookingSlotChange(string taskPKId)
public async Task<TaskManageOrderResultDto> SyncBookingSlotChange(string taskPKId, long tenantId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -2336,11 +2338,11 @@ namespace Myshipping.Application
*/
try
{
var baseTask = await _taskBaseRepository.AsQueryable().FirstAsync(u => u.PK_ID == taskPKId);
var baseTask = _taskBaseRepository.AsQueryable().Filter(null, true).First(u => u.PK_ID == taskPKId && u.TenantId == tenantId);
if (baseTask == null)
throw Oops.Oh($"主任务获取失败,不存在或已作废");
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskPKId);
var bcOrder = _taskBCInfoRepository.AsQueryable().Filter(null, true).First(a => a.TASK_ID == taskPKId && a.TenantId == tenantId);
if (bcOrder == null)
throw Oops.Oh($"BC任务获取失败不存在或已作废");
@ -2348,7 +2350,7 @@ namespace Myshipping.Application
if (!bcOrder.BOOKING_SLOT_ID.HasValue || bcOrder.BOOKING_SLOT_ID.Value == 0)
{
var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
var slotModel = server.SearchBookingSlotWithOrderByNo(bcOrder.MBL_NO).GetAwaiter().GetResult();
var slotModel = server.SearchBookingSlotWithOrderByNo(bcOrder.MBL_NO, bcOrder.TenantId.Value).GetAwaiter().GetResult();
if (slotModel != null && slotModel.BookingSlotId > 0)
{
@ -2416,6 +2418,30 @@ namespace Myshipping.Application
}
}
//去关联的订舱ID
if(bcOrder.BOOKING_ORDER_ID == null || bcOrder.BOOKING_ORDER_ID.Value == 0)
{
var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
var slotModel = server.SearchBookingSlotWithOrderByNo(bcOrder.MBL_NO, bcOrder.TenantId.Value).GetAwaiter().GetResult();
if (slotModel.HasBookingOrder)
{
bcOrder.BOOKING_ORDER_ID = slotModel.BookingOrderList.FirstOrDefault();
bcOrder.UpdatedTime = DateTime.Now;
bcOrder.UpdatedUserId = UserManager.UserId;
bcOrder.UpdatedUserName = UserManager.Name;
await _taskBCInfoRepository.AsUpdateable(bcOrder).UpdateColumns(it => new
{
it.BOOKING_ORDER_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
}
DjyTenantParamValueOutput paramConfig = null;
DjyTenantParamValueOutput dingdingConfig = null;
@ -2523,7 +2549,7 @@ namespace Myshipping.Application
if (!taskBCInfo.BOOKING_SLOT_ID.HasValue)
{
//var server = _namedBookingSlotServiceProvider.GetService<ITransient>(nameof(BookingSlotService));
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo, taskBCInfo.TenantId.Value);
if (slotInfo == null)
throw Oops.Oh($"提单号{mblNo}未提取有效的舱位信息");
@ -2566,7 +2592,7 @@ namespace Myshipping.Application
//对应订舱订单
if (!taskBCInfo.BOOKING_ORDER_ID.HasValue)
{
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo);
var slotInfo = await server.SearchBookingSlotWithOrderByNo(mblNo, taskBCInfo.TenantId.Value);
if (slotInfo == null)
throw Oops.Oh($"提单号{mblNo}未提取有效的舱位信息");
@ -2767,7 +2793,7 @@ namespace Myshipping.Application
//没有舱位先要匹配舱位,才能比对
if (!bcTaskInfo.BOOKING_SLOT_ID.HasValue)
{
var searchInfo = await server.SearchBookingSlotWithOrderByNo(bcTaskInfo.MBL_NO);
var searchInfo = await server.SearchBookingSlotWithOrderByNo(bcTaskInfo.MBL_NO, bcTaskInfo.TenantId.Value);
if (searchInfo != null)
{

@ -815,7 +815,7 @@ namespace Myshipping.Application
var name = _namedTaskManageBCServiceProvider
.GetService<ITransient>(nameof(TaskManageBCService));
await name.SyncBookingSlotChange(bcInfo.TASK_ID);
await name.SyncBookingSlotChange(bcInfo.TASK_ID, bcInfo.TenantId.Value);
}
}
#endregion
@ -5688,7 +5688,7 @@ namespace Myshipping.Application
/// <param name="modifyFile">BC变更内容后文件</param>
/// <param name="jsonData">BC任务详情JSON</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskManage/CreateBCTaskJob"), ApiUser(ApiCode = "BCTaskManage")]
[HttpPost("/TaskManage/CreateBCTaskJob"), AllowAnonymous, ApiUser(ApiCode = "BCTaskManage")]
public async Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();

@ -196,14 +196,14 @@ namespace Myshipping.Core.Service
{
Log.Information($"查询客户详情:{input.Id}");
_logger.LogInformation($"查询客户详情:{input.Id}");
var cust = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
var cust = await _rep.AsQueryable().Filter(null,true).FirstAsync(u => u.Id == input.Id);
if (cust == null)
{
throw Oops.Oh(ErrorCode.D1002);
}
var custOut = cust.Adapt<DjyCustomerOutput>();
custOut.Contacts = _repContact.Where(x => x.CustomerId == input.Id).OrderBy(x => x.Sort).ToList().Adapt<List<DjyCustomerContactOutput>>();
custOut.Addrs = _repAddr.Where(x => x.CustomerId == input.Id).ToList().Adapt<List<DjyCustomerAddrInput>>();
custOut.Contacts = _repContact.AsQueryable().Filter(null, true).Where(x => x.CustomerId == input.Id).OrderBy(x => x.Sort).ToList().Adapt<List<DjyCustomerContactOutput>>();
custOut.Addrs = _repAddr.AsQueryable().Filter(null, true).Where(x => x.CustomerId == input.Id).ToList().Adapt<List<DjyCustomerAddrInput>>();
return custOut;
}

@ -26,12 +26,49 @@ namespace ServiceProjectSyncWin.Entities
public Nullable<DateTime> SI_CUT_DATE { get; set; }
/// <summary>
/// 截关时间
/// </summary>
public Nullable<DateTime> CLOSING_DATE { get; set; }
public Nullable<DateTime> ETD { get; set; }
public Nullable<DateTime> ETA { get; set; }
public Nullable<DateTime> VGM_CUTOFF_TIME { get; set; }
/// <summary>
/// 截单时间
/// </summary>
public Nullable<DateTime> CUT_SINGLE_TIME { get; set; }
/// <summary>
/// 舱单截止时间
/// </summary>
public Nullable<DateTime> MANIFEST_CUT_DATE { get; set; }
/// <summary>
/// MDGF提交截止时间
/// </summary>
public Nullable<DateTime> MDGF_CUT_DATE { get; set; }
/// <summary>
/// 截港时间
/// </summary>
public Nullable<DateTime> CY_CUTOFF_TIME { get; set; }
public string TASK_ID { get; set; }
public bool IsDeleted { get; set; }
/// <summary>
/// 租户id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedTime { get; set; }
}
}

@ -0,0 +1,47 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServiceProjectSyncWin.Entities
{
[Tenant("db_master")]
[SugarTable("task_file")]
public class TaskFileEntities
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true)]
public string PK_ID { get; set; }
/// <summary>
/// 任务主键(父主键)
/// </summary>
public string TASK_PKID { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string FILE_PATH { get; set; }
/// <summary>
/// 文件类型
/// </summary>
public string FILE_TYPE { get; set; }
/// <summary>
/// 文件名
/// </summary>
public string FILE_NAME { get; set; }
/// <summary>
/// 附件类型代码 BC-Booking Confirmation
/// </summary>
public string FILE_CATEGORY { get; set; }
/// <summary>
/// 附件类型名称 BC-Booking Confirmation
/// </summary>
public string FILE_CATEGORY_NAME { get; set; }
}
}

@ -5,13 +5,18 @@ using Furion.DistributedIDGenerator;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Furion.RemoteRequest.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ServiceProjectSyncWin;
using ServiceProjectSyncWin.Entities;
using SqlSugar;
using System.Collections.Specialized;
using System.ComponentModel.DataAnnotations;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using static System.Net.Mime.MediaTypeNames;
Serve.RunGeneric(additional: services =>
@ -426,9 +431,903 @@ public class SyncHisRecord: ISyncHisRecord,ITransient
1
2
*/
//_db.Queryable<TaskBCEntity>().Max(a => a.ORG_STATUS_ID);
var taskList = _db.Queryable<TaskBCEntity>().Where(a => (a.BUSI_TYPE == "BookingConfirmation" || a.BUSI_TYPE == "BookingAmendment") && a.TASK_ID == "08dc56ae-e1bd-4650-818e-85447143df67")
.OrderBy(t=>t.CreatedTime)
.ToList();
string batchNo = Guid.NewGuid().ToString();
_logger.LogInformation($"批次={batchNo} 提取待处理任务 num={taskList.Count}");
string bcReadUrl = "http://localhost:5110/api/TaskBCParser/ExcuteBCFileRead";
string amendReadUrl = "http://localhost:5110/api/TaskBookingAmendmentParser/ExcuteBookingAmendmentRead";
//foreach (var task in taskList)
for(int i=0;i<taskList.Count;i++)
{
var task = taskList[i];
//BookingConfirmation、BookingAmendment
if (task.BUSI_TYPE == "BookingConfirmation")
{
_logger.LogInformation($"批次={batchNo} 处理任务 No={i} MBLNO={task.MBL_NO} 开始");
var fileInfo = _db.Queryable<TaskFileEntities>().Where(a => a.TASK_PKID == task.TASK_ID && a.FILE_CATEGORY == "BC").First();
if (fileInfo != null)
{
_logger.LogInformation($"批次={batchNo} 提取待处理任务 MBLNO={task.MBL_NO} 取到文件");
string bcFileFullPath = $"D:\\djy\\backend\\wwwroot\\{fileInfo.FILE_PATH}";
var bcFileName = Path.GetFileName(bcFileFullPath);
TaskBCInfoReadDto BCReadInfo = GetBCReaderInfo(bcFileFullPath, bcFileName, task.TenantId.Value, task.TASK_ID, bcReadUrl).GetAwaiter().GetResult();
_logger.LogInformation($"批次={batchNo} 提取待处理任务 MBLNO={task.MBL_NO} 识别完文件 BCReadInfo={JSON.Serialize(BCReadInfo)}");
if (BCReadInfo != null)
{
//SI_CUT_DATE
if (BCReadInfo.SICutDate.HasValue)
{
if (task.SI_CUT_DATE.HasValue && task.SI_CUT_DATE.Value == BCReadInfo.SICutDate.Value)
{
}
task.SI_CUT_DATE = BCReadInfo.SICutDate.Value;
}
else
{
task.SI_CUT_DATE = null;
}
//VGM_CUTOFF_TIME
if (BCReadInfo.VGMCutoffTime.HasValue)
{
task.VGM_CUTOFF_TIME = BCReadInfo.VGMCutoffTime.Value;
}
else
{
task.VGM_CUTOFF_TIME = null;
}
//MANIFEST_CUT_DATE
if (BCReadInfo.ManifestCutDate.HasValue)
{
task.MANIFEST_CUT_DATE = BCReadInfo.ManifestCutDate.Value;
}
else
{
task.MANIFEST_CUT_DATE = null;
}
//CY_CUTOFF_TIME
if (BCReadInfo.CYCutoffTime.HasValue)
{
task.CY_CUTOFF_TIME = BCReadInfo.CYCutoffTime.Value;
}
else
{
task.CY_CUTOFF_TIME = null;
}
//MDGF_CUT_DATE
if (BCReadInfo.MDGFCutDate.HasValue)
{
task.MDGF_CUT_DATE = BCReadInfo.MDGFCutDate.Value;
}
else
{
task.MDGF_CUT_DATE = null;
}
//CLOSING_DATE
if (BCReadInfo.ClosingDate.HasValue)
{
task.CLOSING_DATE = BCReadInfo.ClosingDate.Value;
}
else
{
task.CLOSING_DATE = null;
}
_db.Updateable<TaskBCEntity>(task).UpdateColumns(it => new
{
it.SI_CUT_DATE,
it.VGM_CUTOFF_TIME,
it.MANIFEST_CUT_DATE,
it.CY_CUTOFF_TIME,
it.MDGF_CUT_DATE,
it.CLOSING_DATE
}).ExecuteCommand();
}
}
}
else if (task.BUSI_TYPE == "BookingAmendment")
{
var fileInfo = _db.Queryable<TaskFileEntities>().Where(a => a.TASK_PKID == task.TASK_ID && a.FILE_CATEGORY == "BC_MODIFY").First();
if (fileInfo != null)
{
string bcFileFullPath = $"D:\\djy\\backend\\wwwroot\\{fileInfo.FILE_PATH}";
var bcFileName = Path.GetFileName(bcFileFullPath);
TaskBCInfoReadDto BCReadInfo = GetBCReaderInfo(bcFileFullPath, bcFileName, task.TenantId.Value, task.TASK_ID, amendReadUrl).GetAwaiter().GetResult();
if (BCReadInfo != null)
{
//SI_CUT_DATE
if (BCReadInfo.SICutDate.HasValue)
{
task.SI_CUT_DATE = BCReadInfo.SICutDate.Value;
}
else
{
task.SI_CUT_DATE = null;
}
//VGM_CUTOFF_TIME
if (BCReadInfo.VGMCutoffTime.HasValue)
{
task.VGM_CUTOFF_TIME = BCReadInfo.VGMCutoffTime.Value;
}
else
{
task.VGM_CUTOFF_TIME = null;
}
//MANIFEST_CUT_DATE
if (BCReadInfo.ManifestCutDate.HasValue)
{
task.MANIFEST_CUT_DATE = BCReadInfo.ManifestCutDate.Value;
}
else
{
task.MANIFEST_CUT_DATE = null;
}
//CY_CUTOFF_TIME
if (BCReadInfo.CYCutoffTime.HasValue)
{
task.CY_CUTOFF_TIME = BCReadInfo.CYCutoffTime.Value;
}
else
{
task.CY_CUTOFF_TIME = null;
}
//MDGF_CUT_DATE
if (BCReadInfo.MDGFCutDate.HasValue)
{
task.MDGF_CUT_DATE = BCReadInfo.MDGFCutDate.Value;
}
else
{
task.MDGF_CUT_DATE = null;
}
//CLOSING_DATE
if (BCReadInfo.ClosingDate.HasValue)
{
task.CLOSING_DATE = BCReadInfo.ClosingDate.Value;
}
else
{
task.CLOSING_DATE = null;
}
_db.Updateable<TaskBCEntity>(task).UpdateColumns(it => new
{
it.SI_CUT_DATE,
it.VGM_CUTOFF_TIME,
it.MANIFEST_CUT_DATE,
it.CY_CUTOFF_TIME,
it.MDGF_CUT_DATE,
it.CLOSING_DATE
}).ExecuteCommand();
}
}
}
Thread.Sleep(500);
}
}
#region 读BC详情详情
/// <summary>
/// 读BC详情详情
/// </summary>
/// <param name="attachFullName">文件完整路径</param>
/// <param name="fileName">文件名称</param>
/// <param name="tenantId">所属租户</param>
/// <param name="taskPKId">任务ID</param>
/// <param name="url">请求URL</param>
/// <returns></returns>
private async Task<TaskBCInfoReadDto> GetBCReaderInfo(string attachFullName, string fileName, long tenantId, string taskPKId, string url)
{
TaskBCInfoReadDto taskBCInfoReadDto = null;
try
{
DateTime nowDate = DateTime.Now;
EmailBCReadMessageInfo messageInfo = new EmailBCReadMessageInfo
{
Head = new TaskMessageHead
{
GID = IDGen.NextID().ToString(),
MessageType = "BOOKING_AMENDMENT",
SenderId = "DJY",
SenderName = "新大简云",
ReceiverId = "RulesEngine",
ReceiverName = "大简云规则引擎",
Version = "1.0",
RequestDate = nowDate.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "ReadFile",
},
Main = new EmailBCReadMessageMainInfo
{
TenantId = tenantId > 0 ? tenantId.ToString() : ""
}
};
NameValueCollection par = new NameValueCollection();
par.Add("jsonData", JSON.Serialize(messageInfo));
//解析BookingAmendment
var compareRlt = await ExcuteReadFile(par, url, new
{
file = "file",
fileName = fileName,
fileBytes = File.ReadAllBytes(attachFullName)
});
_logger.LogInformation($"读取BC附件详情 taskPKId={taskPKId}compareRlt={JSON.Serialize(compareRlt)}");
if (compareRlt.succ)
{
taskBCInfoReadDto = JSON.Deserialize<TaskBCInfoReadDto>(JSON.Serialize(compareRlt.extra));
}
}
catch (Exception ex)
{
_logger.LogError($"读取BC附件详情异常原因{ex.Message}");
}
return taskBCInfoReadDto;
}
#endregion
#region 请求BookingAmendment解析
/// <summary>
/// 请求BookingAmendment解析
/// </summary>
/// <param name="nameValueCollection">请求参数</param>
/// <param name="url">请求url</param>
/// <param name="fileInfo">文件</param>
/// <param name="contentType">请求类型</param>
/// <returns>返回回执</returns>
[NonAction]
private async Task<ParserReaderExcuteResultDto> ExcuteReadFile(NameValueCollection nameValueCollection, string url, dynamic fileInfo,
string contentType = "application/json")
{
ParserReaderExcuteResultDto model = null;
var result = string.Empty;
using (var httpClient = new HttpClient())
{
try
{
using (var reduceAttach = new MultipartFormDataContent())
{
string[] allKeys = nameValueCollection.AllKeys;
foreach (string key in allKeys)
{
var dataContent = new ByteArrayContent(Encoding.UTF8.GetBytes(nameValueCollection[key]));
dataContent.Headers.ContentDisposition = new ContentDispositionHeaderValue($"form-data")
{
Name = key
};
reduceAttach.Add(dataContent);
}
#region 文件参数
if (fileInfo != null)
{
var Content = new ByteArrayContent(fileInfo.fileBytes);
//Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
//{
// Name = fileInfo.file.ToString(),
// FileName = fileInfo.fileName.ToString(),
//};
Content.Headers.Add("Content-Type", contentType);
reduceAttach.Add(Content, fileInfo.file.ToString(), HttpUtility.UrlEncode(fileInfo.fileName.ToString()));
}
#endregion
//httpClient.DefaultRequestHeaders.Add("USER_KEY", App.Configuration["ApiUserKey"]);
//httpClient.DefaultRequestHeaders.Add("USER_SECRET", App.Configuration["ApiUserSecret"]);
//请求
var response = httpClient.PostAsync(url, reduceAttach).Result;
result = response.Content.ReadAsStringAsync().Result;
model = JSON.Deserialize<ParserReaderExcuteResultDto>(result);
}
}
catch (Exception ex)
{
_logger.LogInformation("请求读取BC附件详情读取详情异常原因{error}", ex.Message);
throw Oops.Oh($"请求读取BC附件详情读取详情异常原因{ex.Message}");
}
}
return model;
}
#endregion
public class EmailBCReadMessageInfo
{
/// <summary>
/// 表头
/// </summary>
public TaskMessageHead Head { get; set; }
/// <summary>
/// 表体
/// </summary>
public EmailBCReadMessageMainInfo Main { get; set; }
}
public class EmailBCReadMessageMainInfo
{
/// <summary>
/// 所属租户ID
/// </summary>
public string TenantId { get; set; }
}
public class TaskMessageHead : WebAPIHeadBase
{
}
public class WebAPIHeadBase
{
/// <summary>
/// 报文惟一主键
/// </summary>
/// <example>08dab66c-96a1-4f90-8606-2626e06202ad</example>
[Required(ErrorMessage = "必填")]
public string GID { get; set; }
/// <summary>
/// 报文类型 BUSI_RULE-业务规则校验
/// </summary>
/// <example>BUSI_RULE</example>
[Required(ErrorMessage = "必填")]
public string MessageType { get; set; }
/// <summary>
/// 发送方代码
/// </summary>
/// <example>CUSTOMER1</example>
[Required(ErrorMessage = "必填")]
public string SenderId { get; set; }
/// <summary>
/// 发送方名称
/// </summary>
/// <example>企业A</example>
[Required(ErrorMessage = "必填")]
public string SenderName { get; set; }
/// <summary>
/// 接收方代码
/// </summary>
/// <example>RulesEngine</example>
[Required(ErrorMessage = "必填")]
public string ReceiverId { get; set; }
/// <summary>
/// 接收方名称
/// </summary>
/// <example>大简云规则引擎</example>
[Required(ErrorMessage = "必填")]
public string ReceiverName { get; set; }
/// <summary>
/// 请求方登录TOKEN可以是真实的登录人TOKEN或者是服务模拟登录人TOKEN
/// </summary>
/// <example>eyJhbGciOiJSUzI1NiIsImtpZCI6IkQ1RTkxMDI5OUU0RURFNUZEM0EwNTJBMEFDRDUzMUQzIiwidHlwIjoiYXQrand0In0</example>
public string Token { get; set; }
/// <summary>
/// 版本号 默认1.0
/// </summary>
/// <example>1.0</example>
[Required(ErrorMessage = "必填")]
public string Version { get; set; } = "1.0";
/// <summary>
/// 请求时间
/// </summary>
/// <example>2022-10-10 10:00:00</example>
public string RequestDate { get; set; }
/// <summary>
/// 请求操作类型
/// </summary>
/// <example>Add</example>
[Required(ErrorMessage = "必填")]
public string RequestAction { get; set; } = "Add";
}
}
public class ParserReaderExcuteResultDto
{
/// <summary>
/// 是否成功 true=成功 false=失败
/// </summary>
public bool succ { get; set; } = false;
/// <summary>
/// 状态 0-成功
/// </summary>
public int status { get; set; } = 0;
/// <summary>
/// 返回消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录数
/// </summary>
public int total { get; set; }
/// <summary>
/// 当前页列表数据
/// </summary>
public object rows { get; set; }
/// <summary>
/// 合计信息
/// </summary>
public object summary { get; set; }
/// <summary>
/// 扩展信息
/// </summary>
public object extra { get; set; }
/// <summary>
/// 扩展信息2
/// </summary>
public object extra2 { get; set; }
/// <summary>
/// 扩展信息场站统计
/// </summary>
public object yardStatInfo { get; set; }
/// <summary>
/// 是否异常
/// </summary>
public bool exceptionflag { get; set; }
/// <summary>
/// 生成HTML
/// </summary>
public string ResultHtml { get; set; }
}
/// <summary>
///
/// </summary>
public class TaskBCInfoReadDto
{
/// <summary>
/// 订舱单位
/// </summary>
public string BookingParty { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string Shipper { get; set; }
/// <summary>
/// 收货人
/// </summary>
public string Consignee { get; set; }
/// <summary>
/// 通知人
/// </summary>
public string NotifyParty { get; set; }
/// <summary>
/// BC更新次数
/// </summary>
public Nullable<int> BCModifyTimes { get; set; }
/// <summary>
/// BC更新时间
/// </summary>
public Nullable<DateTime> BCModifyDate { get; set; }
/// <summary>
/// 主单号
/// </summary>
public string MBLNo { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VoyNo { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PlaceReceipt { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string Portload { get; set; }
/// <summary>
/// 截关时间
/// </summary>
public Nullable<DateTime> ClosingDate { get; set; }
/// <summary>
/// 截VGM时间
/// </summary>
public Nullable<DateTime> VGMCutoffTime { get; set; }
/// <summary>
/// ETA(预计到港时间)
/// </summary>
public Nullable<DateTime> ETA { get; set; }
/// <summary>
/// ETD(预计离港时间)
/// </summary>
public Nullable<DateTime> ETD { get; set; }
/// <summary>
/// 目的港ETA
/// </summary>
public Nullable<DateTime> PODETA { get; set; }
/// <summary>
/// 截单时间
/// </summary>
public Nullable<DateTime> CutSingleTime { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PortDischarge { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PlaceDelivery { get; set; }
/// <summary>
/// 装运方式
/// </summary>
public string ShippingMethod { get; set; }
/// <summary>
/// 运输条款
/// </summary>
public string Service { get; set; }
/// <summary>
/// 港前运输形态
/// </summary>
public string PreTransMode { get; set; }
/// <summary>
/// 品名
/// </summary>
public string Description { get; set; }
/// <summary>
/// 签单地点
/// </summary>
public string IssuePlace { get; set; }
/// <summary>
/// 集港码头
/// </summary>
public string CollectionTerminal { get; set; }
/// <summary>
/// 约号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 预付地点
/// </summary>
public string PrepardAT { get; set; }
/// <summary>
/// 船代
/// </summary>
public string ShipAgent { get; set; }
/// <summary>
/// 场站
/// </summary>
public string Yard { get; set; }
/// <summary>
/// 场站联系人
/// </summary>
public string YardContactUserName { get; set; }
/// <summary>
/// 场站联系电话
/// </summary>
public string YardContactTel { get; set; }
/// <summary>
/// 一代客服姓名
/// </summary>
public string FstCustomerSerUserName { get; set; }
/// <summary>
/// 一代客服电话
/// </summary>
public string FstCustomerSerUserTel { get; set; }
/// <summary>
/// 一代客服邮箱
/// </summary>
public string FstCustomerSerUserEmail { get; set; }
/// <summary>
/// 备注1
/// </summary>
public string Remark1 { get; set; }
/// <summary>
/// 截港时间
/// </summary>
public Nullable<DateTime> CYCutoffTime { get; set; }
/// <summary>
/// 状态 TEMP-暂存 SUCC-已对应 ERROR-异常
/// </summary>
public string Status { get; set; }
/// <summary>
/// 文件MD5
/// </summary>
public string FileMD5 { get; set; }
/// <summary>
/// 最后对应时间,最后关联到订舱日期
/// </summary>
public Nullable<DateTime> LastToBookingDate { get; set; }
/// <summary>
/// 来源邮箱
/// </summary>
public string FromEmail { get; set; }
/// <summary>
/// 接收邮箱
/// </summary>
public string RecvEmail { get; set; }
/// <summary>
/// 订舱ID对应成功后订舱ID写入
/// </summary>
public Nullable<long> BookingOrderId { get; set; }
/// <summary>
/// 集装箱列表
/// </summary>
public List<TaskBCInfoReadCtnDto> CtnList { get; set; }
/// <summary>
/// 顺序号
/// </summary>
public int Indx { get; set; }
/// <summary>
/// 对应订舱序号
/// </summary>
public int BKOrderIndx { get; set; }
/// <summary>
/// 舱位主键
/// </summary>
public Nullable<long> BookingSlotId { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public string CarrierId { get; set; }
/// <summary>
/// 航线代码(船公司)
/// </summary>
public string LaneCode { get; set; }
/// <summary>
/// 航线名称(船公司)
/// </summary>
public string LaneName { get; set; }
/// <summary>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
public string CarriageType { get; set; }
/// <summary>
/// 承运方式名称 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
public string CarriageTypeName { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public string BookingSlotType { get; set; }
/// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public string BookingSlotTypeName { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
public string CtnStat { get; set; }
/// <summary>
/// 所在周数
/// </summary>
public string WeekAt { get; set; }
/// <summary>
/// 箱使天数
/// </summary>
public int DetensionFreeDays { get; set; }
/// <summary>
/// 样单截止日期
/// </summary>
public Nullable<DateTime> SICutDate { get; set; }
/// <summary>
/// 舱单截止时间
/// </summary>
public Nullable<DateTime> ManifestCutDate { get; set; }
/// <summary>
/// MDGF提交截止时间
/// </summary>
public Nullable<DateTime> MDGFCutDate { get; set; }
/// <summary>
/// 中转港1
/// </summary>
public string TransferPort1 { get; set; }
/// <summary>
/// 中转港2
/// </summary>
public string TransferPort2 { get; set; }
/// <summary>
/// 二程船名
/// </summary>
public string SecondVessel { get; set; }
/// <summary>
/// 二程航次
/// </summary>
public string SecondVoyno { get; set; }
/// <summary>
/// 二程ETD
/// </summary>
public Nullable<DateTime> SecondETD { get; set; }
/// <summary>
/// 二程ETA
/// </summary>
public Nullable<DateTime> SecondETA { get; set; }
/// <summary>
/// 订舱确认时间
/// </summary>
public Nullable<DateTime> BookingConfirmDate { get; set; }
}
/// <summary>
/// 任务BC集装箱
/// </summary>
public class TaskBCInfoReadCtnDto
{
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string CtnALL { get; set; }
/// <summary>
/// 箱量
/// </summary>
public Nullable<int> CTNNUM { get; set; }
/// <summary>
/// 件数
/// </summary>
public Nullable<int> PKGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public Nullable<decimal> CBM { get; set; }
/// <summary>
/// 毛重
/// </summary>
public Nullable<decimal> KGS { get; set; }
/// <summary>
/// 皮重
/// </summary>
public Nullable<decimal> TareWeight { get; set; }
/// <summary>
/// 危品票标示
/// </summary>
public string IODGT { get; set; }
/// <summary>
/// 特殊装载需求
/// </summary>
public string SpecialLoadingRequire { get; set; }
/// <summary>
/// 提箱场站
/// </summary>
public string TakeCTNYard { get; set; }
/// <summary>
/// 提箱时间
/// </summary>
public Nullable<DateTime> TakeCTNTime { get; set; }
/// <summary>
/// 还箱场站
/// </summary>
public string ReturnCTNYard { get; set; }
}

@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"db_master": "Data Source=rm-m5e0s0o35bo87087b3o.mysql.rds.aliyuncs.com;Database=booking_hechuan;User ID=hechuan;Password=HcDjy@123;pooling=true;port=3306;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;"
"db_master": "Data Source=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=booking_data;User ID=rulesengine_admin;Password=Rule1qaz2wsx!QAZ;pooling=true;port=3306;sslmode=none;CharSet=utf8;"
},
"ServiceStatusPushUrl": "http://47.104.85.216:12345/api/ServiceWorkFlowManage/PushStatus"
}
Loading…
Cancel
Save