From 30a69d2d1005db334c052de3be975eff881d564e Mon Sep 17 00:00:00 2001
From: wanghaomei <86whm@163.com>
Date: Wed, 3 Jul 2024 16:12:36 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=AE=A2=E8=88=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../EDI/ZhongYuanSoApiHelper.cs | 2 +-
.../Enum/BookingFeedback.cs | 6 +
.../Event/BookingSyncSubscriber.cs | 104 +++++
.../Helper/CustomerBookingSyncHelper.cs | 11 +
.../BookingCustomerOrderService.cs | 387 ++++++++++--------
.../Service/BookingCustomerOrder/Dto/Dtos.cs | 47 ++-
6 files changed, 384 insertions(+), 173 deletions(-)
diff --git a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs
index 2b0f90e5..e22dd14c 100644
--- a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs
+++ b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs
@@ -407,7 +407,7 @@ namespace Myshipping.Application.EDI
var bookingNo = jdata.GetStringValue("bookingNo");
if (!string.IsNullOrEmpty(bookingNo))
{
- extObj["BookingNO"] = bookingNo;
+ extObj["CustNO"] = bookingNo;
custOrder.ExtendData = extObj.ToJsonString();
await repCustOrder.AsUpdateable(custOrder).UpdateColumns(x => new { x.ExtendData }).ExecuteCommandAsync();
Log.Information($"回写CC号:{bookingNo} {custOrder.Id} {custOrder.BOOKINGNO}");
diff --git a/Myshipping.Application/Enum/BookingFeedback.cs b/Myshipping.Application/Enum/BookingFeedback.cs
index 9b8b8b1e..09df5029 100644
--- a/Myshipping.Application/Enum/BookingFeedback.cs
+++ b/Myshipping.Application/Enum/BookingFeedback.cs
@@ -50,5 +50,11 @@ namespace Myshipping.Application.Enum
///
[Description("作废")]
CancelBook = 70,
+
+ ///
+ /// 一票生成多票
+ ///
+ [Description("一票生成多票")]
+ OneToMulti = 80,
}
}
diff --git a/Myshipping.Application/Event/BookingSyncSubscriber.cs b/Myshipping.Application/Event/BookingSyncSubscriber.cs
index 4dcc37c9..883f9e88 100644
--- a/Myshipping.Application/Event/BookingSyncSubscriber.cs
+++ b/Myshipping.Application/Event/BookingSyncSubscriber.cs
@@ -420,6 +420,110 @@ namespace Myshipping.Application.Event
}
}
+
+
+ //推送订舱批量订舱编号到客户订舱系统
+ [EventSubscribe("SendToCustomer:MultiCustNO")]
+ public async Task SendCustomerMultiCustNOSync(EventHandlerExecutingContext context)
+ {
+ _logger.LogInformation($"收到推送订舱批量订舱编号到客户订舱系统请求:{context.Source.Payload}");
+
+ var dto = context.Source.Payload as BookingCustomerMultiCustNODto;
+
+ using var scope = _services.CreateScope();
+ var repoCutomerOrder = scope.ServiceProvider.GetRequiredService>();
+ var repoOrder = scope.ServiceProvider.GetRequiredService>();
+ var repoCtn = scope.ServiceProvider.GetRequiredService>();
+ //var repoFile = scope.ServiceProvider.GetRequiredService>();
+ var servCustOrder = scope.ServiceProvider.GetRequiredService();
+
+ //var repoStaLog = scope.ServiceProvider.GetRequiredService>();
+ //var repoStaLogDetail = scope.ServiceProvider.GetRequiredService>();
+ //var repoGoodsSta = scope.ServiceProvider.GetRequiredService>();
+ //var repoGoodsStaCfg = scope.ServiceProvider.GetRequiredService>();
+ //var repoLog = scope.ServiceProvider.GetRequiredService>();
+ //var repoLogDetail = scope.ServiceProvider.GetRequiredService>();
+
+ //var cacheService = scope.ServiceProvider.GetRequiredService();
+
+ var custOrder = await repoCutomerOrder.AsQueryable().Filter(null, true).FirstAsync(x => x.BSNO == dto.Id);
+ if (custOrder == null) //非客户订舱系统过来的数据
+ {
+ _logger.LogInformation($"ID为 {dto.Id} 的数据并非来自客户订舱系统,不继续处理数据回推");
+ return;
+ }
+
+ var ctns = await repoCtn.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.BILLID == custOrder.Id).ToListAsync();
+
+ if (string.IsNullOrEmpty(custOrder.FeedbackUrl))
+ {
+ _logger.LogInformation($"ID为 {dto.Id} 的数据未提供回推接口URL,不继续处理数据回推");
+ return;
+ }
+
+ var feedbackObj = new BookingFeedbackDto(BookingFeedbackType.OneToMulti.ToString());
+ feedbackObj.JsonContent = dto.ToJsonString();
+
+ //回推回执
+ _logger.LogInformation($"准备发送多订舱编号数据同步:{feedbackObj.ToJsonString()},URL:{custOrder.FeedbackUrl}");
+
+ var rtn = await custOrder.FeedbackUrl
+ .SetHeaders(new Dictionary {
+ { CommonConst.API_USER_HEADER_KEY, custOrder.FeedbackKey},
+ { CommonConst.API_USER_HEADER_SECRET, custOrder.FeedbackSecret}
+ })
+ .SetBody(feedbackObj, "application/x-www-form-urlencoded")
+ .PostAsStringAsync();
+
+ _logger.LogInformation($"回推多订舱编号返回:{rtn}");
+
+ var jobjRtn = JObject.Parse(rtn);
+ if (jobjRtn.GetIntValue("code") != 200)
+ {
+ throw Oops.Bah(jobjRtn.GetStringValue("message"));
+ }
+ else
+ {
+ var dataResp = jobjRtn.GetJArrayValue("data");
+
+ foreach (JObject item in dataResp)
+ {
+ //生成id并插入客户订舱数据
+ custOrder.Id = YitIdHelper.NextId();
+ custOrder.BOOKINGNO = item.GetStringValue("BookingNO");
+ custOrder.BSNO = item.GetStringValue("CustOrderId");
+ JObject jobjExt = null;
+ if (!string.IsNullOrEmpty(custOrder.ExtendData))
+ {
+ jobjExt = JObject.Parse(custOrder.ExtendData);
+ }
+ else
+ {
+ jobjExt = new JObject();
+ }
+
+ jobjExt["CustNO"] = item.GetStringValue("CustNO");
+
+ await repoCutomerOrder.InsertAsync(custOrder);
+
+ foreach (var ctn in ctns)
+ {
+ ctn.Id = YitIdHelper.NextId();
+ ctn.BILLID = custOrder.Id;
+ await repoCtn.InsertAsync(ctn);
+ }
+
+ _logger.LogInformation($"根据客户订舱反馈数据 {custOrder.BSNO} 生成了相同的数据 {custOrder.Id}");
+
+ //插入订舱台账
+ var ordId = await servCustOrder.CustomerToOrder(custOrder);
+
+ _logger.LogInformation($"生成了订舱台账数据 {ordId}");
+
+ }
+ }
+
+ }
#endregion
#region 客户端事件
diff --git a/Myshipping.Application/Helper/CustomerBookingSyncHelper.cs b/Myshipping.Application/Helper/CustomerBookingSyncHelper.cs
index 9406879e..97241b6f 100644
--- a/Myshipping.Application/Helper/CustomerBookingSyncHelper.cs
+++ b/Myshipping.Application/Helper/CustomerBookingSyncHelper.cs
@@ -3,6 +3,7 @@ using Furion.EventBus;
using Furion.Logging;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
+using Newtonsoft.Json.Linq;
namespace Myshipping.Application.Helper
{
@@ -34,5 +35,15 @@ namespace Myshipping.Application.Helper
var evtPub = App.GetService();
await evtPub.PublishAsync(new ChannelEventSource("SyncGoodStatus:Book", dto));
}
+
+ ///
+ /// 推送订舱批量订舱编号到客户订舱系统
+ ///
+ public async static void SendCustomerMultiCustNOSync(BookingCustomerMultiCustNODto dto)
+ {
+ Log.Information($"发送推送订舱批量订舱编号到客户订舱系统系统事件:{dto.ToJsonString()}");
+ var evtPub = App.GetService();
+ await evtPub.PublishDelayAsync(new ChannelEventSource("SendToCustomer:MultiCustNO", dto), 2000);
+ }
}
}
diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs
index 6712467b..6b348d9b 100644
--- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs
+++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs
@@ -27,7 +27,9 @@ using Myshipping.Core.Service;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.PTG;
+using NPOI.XWPF.UserModel;
using RabbitMQ.Client;
+using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Data;
@@ -854,120 +856,6 @@ namespace Myshipping.Application
}
}
- ///
- /// 查询船期数据EMC(即将作废,用QueryShipInfo接口替代)
- ///
- ///
- [HttpGet("/BookingCustomerOrder/QueryShipInfoEMC")]
- public async Task 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 (mapDestination == null)
- {
- throw Oops.Bah($"未找到目的地映射信息:{custOrder.DESTINATIONCODE}");
- }
-
- //箱型转换
- var disCtnCode = ctns.Select(x => x.CTNCODE).Distinct().ToList();
- var mapCtnCode = new List();
- 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.AddDays(-7).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;
- }
- }
-
///
/// 查询船期数据
///
@@ -1291,49 +1179,50 @@ namespace Myshipping.Application
//进入客户订舱系统的订舱台账
if (recModel.Accept)
{
- var bkOrder = model.Adapt();
- bkOrder.Id = YitIdHelper.NextId();
- bkOrder.BSSTATUS = "已录入";
- bkOrder.ParentId = 0;
- bkOrder.LANENAME = bkOrder.LANECODE;
- await _repOrder.InsertAsync(bkOrder);
-
- model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
- bookingId = bkOrder.Id;
- await _rep.UpdateAsync(model);
-
- var bkEdiExt = new BookingEDIExt();
- bkEdiExt.Id = YitIdHelper.NextId();
- bkEdiExt.BookingId = bkOrder.Id;
- bkEdiExt.SalerCode = model.SaleCode;
- await _repEdiExt.InsertAsync(bkEdiExt);
-
- var ctnList = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == model.Id).ToListAsync();
- foreach (var ctn in ctnList)
- {
- ctn.Id = YitIdHelper.NextId();
- ctn.BILLID = bkOrder.Id;
- await _repCtn.InsertAsync(ctn);
- }
-
- //服务项目
- var servList = await _repServiceItem.Where(x => x.BookingId == model.Id).ToListAsync();
- foreach (var serv in servList)
- {
- serv.Id = YitIdHelper.NextId();
- serv.BookingId = bkOrder.Id;
- await _repServiceItem.InsertAsync(serv);
- }
-
- //附件
- var files = await _repFile.AsQueryable().Filter(null, true).Where(x => x.BookingId == model.Id && x.IsDeleted == false).ToListAsync();
- foreach (var file in files)
- {
- file.Id = YitIdHelper.NextId();
- file.BookingId = bkOrder.Id;
-
- await _repFile.InsertAsync(file);
- }
+ bookingId = await CustomerToOrder(model);
+ //var bkOrder = model.Adapt();
+ //bkOrder.Id = YitIdHelper.NextId();
+ //bkOrder.BSSTATUS = "已录入";
+ //bkOrder.ParentId = 0;
+ //bkOrder.LANENAME = bkOrder.LANECODE;
+ //await _repOrder.InsertAsync(bkOrder);
+
+ //model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
+ //bookingId = bkOrder.Id;
+ //await _rep.UpdateAsync(model);
+
+ //var bkEdiExt = new BookingEDIExt();
+ //bkEdiExt.Id = YitIdHelper.NextId();
+ //bkEdiExt.BookingId = bkOrder.Id;
+ //bkEdiExt.SalerCode = model.SaleCode;
+ //await _repEdiExt.InsertAsync(bkEdiExt);
+
+ //var ctnList = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == model.Id).ToListAsync();
+ //foreach (var ctn in ctnList)
+ //{
+ // ctn.Id = YitIdHelper.NextId();
+ // ctn.BILLID = bkOrder.Id;
+ // await _repCtn.InsertAsync(ctn);
+ //}
+
+ ////服务项目
+ //var servList = await _repServiceItem.Where(x => x.BookingId == model.Id).ToListAsync();
+ //foreach (var serv in servList)
+ //{
+ // serv.Id = YitIdHelper.NextId();
+ // serv.BookingId = bkOrder.Id;
+ // await _repServiceItem.InsertAsync(serv);
+ //}
+
+ ////附件
+ //var files = await _repFile.AsQueryable().Filter(null, true).Where(x => x.BookingId == model.Id && x.IsDeleted == false).ToListAsync();
+ //foreach (var file in files)
+ //{
+ // file.Id = YitIdHelper.NextId();
+ // file.BookingId = bkOrder.Id;
+
+ // await _repFile.InsertAsync(file);
+ //}
}
@@ -1769,9 +1658,125 @@ namespace Myshipping.Application
}
#endregion
+ #region 多订舱编号
+ else if (feedbackType == BookingFeedbackType.OneToMulti.ToString())
+ {
+ var recModel = JsonConvert.DeserializeObject(jsonContent);
+
+ var id = Convert.ToInt64(recModel.Id);
+ var model = _rep.AsQueryable().Filter(null, true).First(x => x.Id == id);
+ if (model == null)
+ {
+ throw Oops.Bah("未找到数据");
+ }
+
+ var lstResp = new List();
+
+ var ctns = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == id && x.IsDeleted == false).ToListAsync();
+ foreach (var bookNO in recModel.ListCustNO)
+ {
+ var respDtO = new BookingCustomerMultiCustNORespDto();
+ lstResp.Add(respDtO);
+
+ //生成id并插入客户订舱数据
+ model.Id = YitIdHelper.NextId();
+ model.BOOKINGNO = $"BK{YitIdHelper.NextId()}";
+ JObject jobjExt = null;
+ if (!string.IsNullOrEmpty(model.ExtendData))
+ {
+ jobjExt = JObject.Parse(model.ExtendData);
+ }
+ else
+ {
+ jobjExt = new JObject();
+ }
+
+ jobjExt["CustNO"] = bookNO;
+
+ await _rep.InsertAsync(model);
+
+ foreach (var ctn in ctns)
+ {
+ ctn.Id = YitIdHelper.NextId();
+ ctn.BILLID = model.Id;
+ await _repCtn.InsertAsync(ctn);
+ }
+
+ respDtO.CustOrderId = model.Id;
+ respDtO.BookingNO = model.BOOKINGNO;
+ respDtO.CustNO = bookNO;
+
+ _logger.LogInformation($"根据客户订舱 {recModel.Id} 生成了相同的数据 {model.Id}");
+
+ //插入订舱台账
+ var ordId = await CustomerToOrder(model);
+ respDtO.OrderId = ordId;
+
+ _logger.LogInformation($"生成了订舱台账数据 {ordId}");
+
+ }
+
+ _logger.LogInformation($"反馈给运营端生成的数据 {lstResp.ToJsonString()}");
+
+ return lstResp;
+ }
+ #endregion
return null;
}
+ ///
+ /// 客户订舱数据生成订舱台账
+ ///
+ ///
+ [NonAction]
+ public async Task CustomerToOrder(BookingCustomerOrder custOrd)
+ {
+ var bkOrder = custOrd.Adapt();
+ bkOrder.Id = YitIdHelper.NextId();
+ bkOrder.BSSTATUS = "已录入";
+ bkOrder.ParentId = 0;
+ bkOrder.LANENAME = bkOrder.LANECODE;
+ await _repOrder.InsertAsync(bkOrder);
+
+ custOrd.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联
+ await _rep.UpdateAsync(custOrd);
+
+ var bkEdiExt = new BookingEDIExt();
+ bkEdiExt.Id = YitIdHelper.NextId();
+ bkEdiExt.BookingId = bkOrder.Id;
+ bkEdiExt.SalerCode = custOrd.SaleCode;
+ await _repEdiExt.InsertAsync(bkEdiExt);
+
+ var ctnList = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == custOrd.Id).ToListAsync();
+ foreach (var ctn in ctnList)
+ {
+ ctn.Id = YitIdHelper.NextId();
+ ctn.BILLID = bkOrder.Id;
+ await _repCtn.InsertAsync(ctn);
+ }
+
+ //服务项目
+ var servList = await _repServiceItem.Where(x => x.BookingId == custOrd.Id).ToListAsync();
+ foreach (var serv in servList)
+ {
+ serv.Id = YitIdHelper.NextId();
+ serv.BookingId = bkOrder.Id;
+ await _repServiceItem.InsertAsync(serv);
+ }
+
+ //附件
+ var files = await _repFile.AsQueryable().Filter(null, true).Where(x => x.BookingId == custOrd.Id && x.IsDeleted == false).ToListAsync();
+ foreach (var file in files)
+ {
+ file.Id = YitIdHelper.NextId();
+ file.BookingId = bkOrder.Id;
+
+ await _repFile.InsertAsync(file);
+ }
+
+ return bkOrder.Id;
+ }
+
///
/// 导入
///
@@ -2300,7 +2305,8 @@ namespace Myshipping.Application
}
catch (Exception ex)
{
- _logger.LogWarning($"自动订舱失败:{ord},错误信息:{ex.Message}");
+ _logger.LogError($"自动订舱失败:{ord},错误信息:{ex.Message}");
+ _logger.LogError(ex.StackTrace);
await AuditBooking(ord.Id, false, ex.Message);
}
@@ -2443,28 +2449,41 @@ namespace Myshipping.Application
extObj = JObject.Parse(model.ExtendData);
if (model.CARRIERID == "COSCO")
{
- var bookingNO = extObj.GetStringValue("BookingNO");
- bkOrder.CUSTNO = bookingNO;
- await _repOrder.AsUpdateable(bkOrder).UpdateColumns(x => new { x.CUSTNO }).ExecuteCommandAsync();
- CustomerBookingSyncHelper.SendCustomerBookingSync((long)id, BookingOrderSyncTypeEnum.CC.ToString());
- _logger.LogInformation($"回写订舱号并回推客户端:{id} {bookingNO}");
+ var custNO = extObj.GetStringValue("CustNO");
+ if (!string.IsNullOrEmpty(custNO))
+ {
+ bkOrder.CUSTNO = custNO;
+ await _repOrder.AsUpdateable(bkOrder).UpdateColumns(x => new { x.CUSTNO }).ExecuteCommandAsync();
+ CustomerBookingSyncHelper.SendCustomerBookingSync(id, BookingOrderSyncTypeEnum.CC.ToString());
+ _logger.LogInformation($"回写订舱号并回推客户端:{id} {custNO}");
+ }
}
else if (model.CARRIERID == "EMC")
{
- var bookingNOArr = extObj.GetJArrayValue("BookingNO");
- if (bookingNOArr.Count == 1)
+ var custNOArr = extObj.GetJArrayValue("CustNO");
+ if (custNOArr.Count > 0)
{
- bkOrder.CUSTNO = bookingNOArr.First().ToString();
+ var custNO = custNOArr.First().ToString();
+ bkOrder.CUSTNO = custNO;
await _repOrder.AsUpdateable(bkOrder).UpdateColumns(x => new { x.CUSTNO }).ExecuteCommandAsync();
- CustomerBookingSyncHelper.SendCustomerBookingSync((long)id, BookingOrderSyncTypeEnum.CC.ToString());
+ CustomerBookingSyncHelper.SendCustomerBookingSync(id, BookingOrderSyncTypeEnum.CC.ToString());
_logger.LogInformation($"回写订舱号并回推客户端:{id} {bkOrder.CUSTNO}");
+
+ //有多票订舱编号,后台自动创建数据并对应
+ custNOArr.RemoveAt(0);
+ if (custNOArr.Count > 0)
+ {
+ CustomerBookingSyncHelper.SendCustomerMultiCustNOSync(new BookingCustomerMultiCustNODto()
+ {
+ Id = model.BSNO,
+ ListCustNO = custNOArr.Select(x => x.ToString()).ToList()
+ });
+ }
}
}
}
-
}
-
//扣费
if (accept)
{
@@ -2472,6 +2491,24 @@ namespace Myshipping.Application
}
}
+ ///
+ /// 测试多票订舱编号
+ ///
+ ///
+ [HttpGet("/BookingCustomerOrder/TestMultiBookingNO"), AllowAnonymous]
+ public async Task TestMultiBookingNO(long id)
+ {
+ JArray bookingNOArr = new JArray
+ {
+ "Test001",
+ "Test002"
+ };
+ CustomerBookingSyncHelper.SendCustomerMultiCustNOSync(new BookingCustomerMultiCustNODto()
+ {
+ Id = id.ToString(),
+ ListCustNO = bookingNOArr.Select(x => x.ToString()).ToList()
+ });
+ }
///
/// 接收客户订舱系统取消提交的数据
@@ -2684,8 +2721,16 @@ namespace Myshipping.Application
{
var staLog = new BookingStatusLog();
staLog.Status = status;
- staLog.CreatedUserId = UserManager.UserId;
- staLog.CreatedUserName = UserManager.Name;
+ if (App.User.FindFirst(ClaimConst.CLAINM_USERID) == null)
+ {
+ staLog.CreatedUserId = 0;
+ staLog.CreatedUserName = "系统";
+ }
+ else
+ {
+ staLog.CreatedUserId = UserManager.UserId;
+ staLog.CreatedUserName = UserManager.Name;
+ }
staLog.CreatedTime = DateTime.Now;
staLog.OpTime = DateTime.Now;
staLog.BookingId = bookId;
diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs
index 38ccc84b..4286e49e 100644
--- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs
+++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs
@@ -1,4 +1,5 @@
-using Myshipping.Application.Entity;
+using MathNet.Numerics.Distributions;
+using Myshipping.Application.Entity;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
using SqlSugar;
@@ -1428,4 +1429,48 @@ namespace Myshipping.Application
public dynamic ShipData { get; set; }
}
+
+
+ ///
+ /// 多订舱编号回推
+ ///
+ public class BookingCustomerMultiCustNODto
+ {
+ ///
+ /// 客户订舱系统中的ID
+ ///
+ public string Id { get; set; }
+
+ ///
+ /// 订舱编号列表
+ ///
+ public List ListCustNO { get; set; }
+
+ }
+
+ ///
+ /// 多订舱编号回推时客户端的反馈数据
+ ///
+ public class BookingCustomerMultiCustNORespDto
+ {
+ ///
+ /// 客户订舱ID
+ ///
+ public long CustOrderId { get; set; }
+
+ ///
+ /// 订舱台账ID
+ ///
+ public long OrderId { get; set; }
+
+ ///
+ /// 系统编号
+ ///
+ public string BookingNO { get; set; }
+
+ ///
+ /// 订舱编号
+ ///
+ public string CustNO { get; set; }
+ }
}