jianghaiqing 7 months ago
commit 1714a2cffd

@ -114,16 +114,18 @@ namespace Myshipping.Application.EDI
postModel.uploadType = template.Category; //DRAFT, TEMPLATE, BOOKING分别对应草稿, 模板, 订舱 postModel.uploadType = template.Category; //DRAFT, TEMPLATE, BOOKING分别对应草稿, 模板, 订舱
postModel.saveName = template.TemplateName; postModel.saveName = template.TemplateName;
//起运港
var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTLOADCODE); var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTLOADCODE);
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTDISCHARGECODE);
if (mapPortLoad == null) if (mapPortLoad == null)
{ {
return new KeyValuePair<bool, string>(false, $"未找到起运港映射信息:{custOrder.PORTLOADCODE}"); return new KeyValuePair<bool, string>(false, $"未找到起运港映射信息:{custOrder.PORTLOADCODE}");
} }
//目的地2024-5-9衣国豪需求由目的港改为目的地
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.DESTINATIONCODE);
if (mapPort == null) if (mapPort == null)
{ {
return new KeyValuePair<bool, string>(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}"); return new KeyValuePair<bool, string>(false, $"未找到目的地映射信息:{custOrder.DESTINATIONCODE}");
} }
//运输条款 //运输条款
@ -148,6 +150,8 @@ namespace Myshipping.Application.EDI
{ {
originCity = mapPortLoad.MapCode, originCity = mapPortLoad.MapCode,
destinationCity = mapPort.MapCode, destinationCity = mapPort.MapCode,
polPortName = extObj?.GetStringValue("PolPortName"),
podPortName = extObj?.GetStringValue("PodPortName"),
vesselName = custOrder.VESSEL, vesselName = custOrder.VESSEL,
voyageNumber = custOrder.VOYNO, voyageNumber = custOrder.VOYNO,
serviceCode = custOrder.LANECODE, serviceCode = custOrder.LANECODE,
@ -540,6 +544,16 @@ namespace Myshipping.Application.EDI
/// </summary> /// </summary>
public string destinationCity { get; set; } public string destinationCity { get; set; }
/// <summary>
/// 起始港名
/// </summary>
public string polPortName { get; set; }
/// <summary>
/// 目的港名
/// </summary>
public string podPortName { get; set; }
/// <summary> /// <summary>
/// 船名 /// 船名
/// </summary> /// </summary>

@ -686,6 +686,20 @@ namespace Myshipping.Application.Entity
[Description("订舱公司分机号")] [Description("订舱公司分机号")]
public string BookingPhoneExtension { get; set; } public string BookingPhoneExtension { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 收货地唯一代码
/// </summary>
public string PLACERECEIPTCODE { get; set; }
/// <summary>
/// 收货地代码
/// </summary>
public string PLACERECEIPTID { get; set; }
} }
/// <summary> /// <summary>

@ -251,5 +251,39 @@ namespace Myshipping.Application
[SugarColumn(ColumnName = "TenantName")] [SugarColumn(ColumnName = "TenantName")]
public string TenantName{ get; set; } public string TenantName{ get; set; }
/// <summary>
/// 客户名称
/// </summary>
public string CUSTOMERNAME { get; set; }
/// <summary>
/// 客服名称
/// </summary>
public string CUSTSERVICE { get; set; }
/// <summary>
/// 销售名称
/// </summary>
public string SALE { get; set; }
/// <summary>
/// 销售日期
/// </summary>
public DateTime? SALE_TIME { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string SHIPPER { get; set; }
/// <summary>
/// 品名
/// </summary>
public string GOODSNAME { get; set; }
/// <summary>
/// 卖价
/// </summary>
public decimal? SELLING_PRICE { get; set; }
} }
} }

@ -360,5 +360,17 @@ namespace Myshipping.Application
[SugarColumn(ColumnName = "CUSTOM_SI_CUT_DATE")] [SugarColumn(ColumnName = "CUSTOM_SI_CUT_DATE")]
[Description("客户样单截止日期")] [Description("客户样单截止日期")]
public Nullable<DateTime> CUSTOM_SI_CUT_DATE { get; set; } public Nullable<DateTime> CUSTOM_SI_CUT_DATE { get; set; }
/// <summary>
/// 备注
/// </summary>
[Description("备注")]
public string REMARK { get; set; }
/// <summary>
/// 计费日期
/// </summary>
[Description("计费日期")]
public DateTime? PRICE_CALCULATION_DATE { get; set; }
} }
} }

@ -64,10 +64,6 @@ namespace Myshipping.Application.Event
&& x.PLACERECEIPT == paraObj.PLACERECEIPT) && x.PLACERECEIPT == paraObj.PLACERECEIPT)
.OrderByDescending(x => x.UpdatedTime) .OrderByDescending(x => x.UpdatedTime)
.ToListAsync(); .ToListAsync();
if (!baseList.Any())
{
return;
}
var stockObj = await _repStock.AsQueryable() var stockObj = await _repStock.AsQueryable()
.Filter(null, true) .Filter(null, true)
@ -79,6 +75,15 @@ namespace Myshipping.Application.Event
&& x.CARRIERID == paraObj.CARRIERID && x.CARRIERID == paraObj.CARRIERID
&& x.PLACEDELIVERY == paraObj.PLACEDELIVERY && x.PLACEDELIVERY == paraObj.PLACEDELIVERY
&& x.PLACERECEIPT == paraObj.PLACERECEIPT); && x.PLACERECEIPT == paraObj.PLACERECEIPT);
if (!baseList.Any())
{
// 从库存表删除这7项维度的库存数据
return;
}
if (stockObj == null) if (stockObj == null)
{ {
stockObj = new BookingSlotStock(); stockObj = new BookingSlotStock();
@ -222,5 +227,10 @@ namespace Myshipping.Application.Event
/// 交货地 /// 交货地
/// </summary> /// </summary>
public string PLACEDELIVERY { get; set; } public string PLACEDELIVERY { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public long? TenantId { get; set; }
} }
} }

@ -2087,6 +2087,8 @@ namespace Myshipping.Application
// throw Oops.Bah("目的港代码和名称不能为空"); // throw Oops.Bah("目的港代码和名称不能为空");
//} //}
//起运港校验
if (string.IsNullOrEmpty(input.PORTLOADCODE)) if (string.IsNullOrEmpty(input.PORTLOADCODE))
{ {
throw Oops.Bah("起运港代码不能为空"); throw Oops.Bah("起运港代码不能为空");
@ -2098,6 +2100,8 @@ namespace Myshipping.Application
throw Oops.Bah($"未找到匹配的起运港:{input.PORTLOADCODE}"); throw Oops.Bah($"未找到匹配的起运港:{input.PORTLOADCODE}");
} }
//目的港校验
if (string.IsNullOrEmpty(input.PORTDISCHARGECODE)) if (string.IsNullOrEmpty(input.PORTDISCHARGECODE))
{ {
throw Oops.Bah("目的港代码不能为空"); throw Oops.Bah("目的港代码不能为空");
@ -2109,6 +2113,32 @@ namespace Myshipping.Application
throw Oops.Bah($"未找到匹配的目的港:{input.PORTDISCHARGECODE}"); throw Oops.Bah($"未找到匹配的目的港:{input.PORTDISCHARGECODE}");
} }
////收货地校验
//if (string.IsNullOrEmpty(input.PLACERECEIPTCODE))
//{
// throw Oops.Bah("收货地代码不能为空");
//}
var placereceipt = portLoadList.FirstOrDefault(x => x.Code == input.PLACERECEIPTCODE);
//if (placereceipt == null)
//{
// throw Oops.Bah($"未找到匹配的收货地:{input.PLACERECEIPTCODE}");
//}
//目的地校验
if (string.IsNullOrEmpty(input.DESTINATIONCODE))
{
throw Oops.Bah("目的地代码不能为空");
}
var destination = portDestList.FirstOrDefault(x => x.Code == input.DESTINATIONCODE);
if (destination == null)
{
throw Oops.Bah($"未找到匹配的目的地:{input.DESTINATIONCODE}");
}
if (string.IsNullOrEmpty(input.SERVICECODE)) if (string.IsNullOrEmpty(input.SERVICECODE))
{ {
throw Oops.Bah("运输条款代码不能为空"); throw Oops.Bah("运输条款代码不能为空");
@ -2227,7 +2257,6 @@ namespace Myshipping.Application
} }
var destination = portDestList.FirstOrDefault(x => x.Code == input.DESTINATIONCODE);
//赋值根据唯一代码匹配后的代码、名称等信息 //赋值根据唯一代码匹配后的代码、名称等信息
custOrder.CARRIER = carr.EnName; custOrder.CARRIER = carr.EnName;
@ -2236,8 +2265,10 @@ namespace Myshipping.Application
custOrder.PORTDISCHARGE = portDest.EnName; custOrder.PORTDISCHARGE = portDest.EnName;
custOrder.PORTDISCHARGEID = portDest.EdiCode; custOrder.PORTDISCHARGEID = portDest.EdiCode;
custOrder.SERVICE = service.Name; custOrder.SERVICE = service.Name;
custOrder.DESTINATION = destination?.EnName; custOrder.PLACERECEIPT = placereceipt?.EnName;
custOrder.DESTINATIONID = destination?.EdiCode; custOrder.PLACERECEIPTID = placereceipt?.EdiCode;
custOrder.DESTINATION = destination.EnName;
custOrder.DESTINATIONID = destination.EdiCode;
custOrder.BLFRT = frt.EnName; custOrder.BLFRT = frt.EnName;
//2024年4月19日将分拆的收发通拼接到大文本的收发通中 //2024年4月19日将分拆的收发通拼接到大文本的收发通中
@ -2275,6 +2306,8 @@ namespace Myshipping.Application
jobj["Account"] = input.BOOKINGACCOUNT; jobj["Account"] = input.BOOKINGACCOUNT;
jobj["Password"] = input.BOOKINGPASSWORD; jobj["Password"] = input.BOOKINGPASSWORD;
jobj["OpMail"] = input.OPMAIL; jobj["OpMail"] = input.OPMAIL;
jobj["PolPortName"] = input.PolPortName;
jobj["PodPortName"] = input.PodPortName;
custOrder.ExtendData = jobj.ToJsonString(); custOrder.ExtendData = jobj.ToJsonString();
var ctns = input.CtnList.Adapt<List<BookingCtn>>(); var ctns = input.CtnList.Adapt<List<BookingCtn>>();

@ -591,6 +591,21 @@ namespace Myshipping.Application
/// 订舱公司分机号 /// 订舱公司分机号
/// </summary> /// </summary>
public string BookingPhoneExtension { get; set; } public string BookingPhoneExtension { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 收货地唯一代码
/// </summary>
public string PLACERECEIPTCODE { get; set; }
/// <summary>
/// 收货地代码
/// </summary>
public string PLACERECEIPTID { get; set; }
} }
//保存dto //保存dto
@ -1215,5 +1230,15 @@ namespace Myshipping.Application
/// 操作邮箱 /// 操作邮箱
/// </summary> /// </summary>
public string OPMAIL { get; set; } public string OPMAIL { get; set; }
/// <summary>
/// 起始港名
/// </summary>
public string PolPortName { get; set; }
/// <summary>
/// 目的港名
/// </summary>
public string PodPortName { get; set; }
} }
} }

@ -1498,8 +1498,8 @@ namespace Myshipping.Application
//条件限制 重复限制 //条件限制 重复限制
if (!string.IsNullOrWhiteSpace(input.MBLNO) && input.ParentId == 0) if (!string.IsNullOrWhiteSpace(input.MBLNO) && input.ParentId == 0)
{ {
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync(); var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id);
if (et != null) if (et)
{ {
throw Oops.Bah("当前主提单号已存在,请勿重复录入!"); throw Oops.Bah("当前主提单号已存在,请勿重复录入!");
} }
@ -1520,8 +1520,8 @@ namespace Myshipping.Application
//查询表中是否有当前输入的分单号 //查询表中是否有当前输入的分单号
if (input.ParentId > 0) //分单 if (input.ParentId > 0) //分单
{ {
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.HBLNO == input.HBLNO && x.TenantId == UserManager.TENANT_ID && x.Id != input.Id && x.Id != input.ParentId).FirstAsync(); var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.HBLNO == input.HBLNO && x.TenantId == UserManager.TENANT_ID && x.Id != input.Id && x.Id != input.ParentId);
if (et != null) if (et)
{ {
throw Oops.Bah("当前分提单号已存在,请勿重复录入!"); throw Oops.Bah("当前分提单号已存在,请勿重复录入!");
} }
@ -1541,8 +1541,8 @@ namespace Myshipping.Application
//陈冠宇提订舱编号不允许重复 //陈冠宇提订舱编号不允许重复
if (!string.IsNullOrWhiteSpace(input.CUSTNO)) if (!string.IsNullOrWhiteSpace(input.CUSTNO))
{ {
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync(); var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id);
if (et != null) if (et)
{ {
throw Oops.Bah("当前订舱编号已存在,请勿重复录入!"); throw Oops.Bah("当前订舱编号已存在,请勿重复录入!");
} }
@ -1551,12 +1551,46 @@ namespace Myshipping.Application
//孙晓飞提PONO不允许重复 //孙晓飞提PONO不允许重复
if (!string.IsNullOrWhiteSpace(input.PONO)) if (!string.IsNullOrWhiteSpace(input.PONO))
{ {
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.PONO == input.PONO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync(); var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.PONO == input.PONO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id);
if (et != null) if (et)
{ {
throw Oops.Bah("当前PONO已存在,请勿重复录入!"); throw Oops.Bah("当前PONO已存在,请勿重复录入!");
} }
} }
// 陈冠宇提真提单号不允许重复
if (!string.IsNullOrWhiteSpace(input.TMBLNO))
{
// 主单
if (input.ParentId == 0)
{
// 在其它主单、其它分单中判断是否有重复
if (await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.TMBLNO == input.TMBLNO
&& x.IsDeleted == false
&& x.TenantId == UserManager.TENANT_ID
&& (x.ParentId == 0 || (x.ParentId != 0 && x.ParentId != input.Id))
&& x.Id != input.Id))
{
throw Oops.Bah("当前真提单号已存在,请勿重复录入!");
}
}
else
// 分单
{
// 在除"所在主单与兄弟分单"的所有订舱中判断是否有重复
if (await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.TMBLNO == input.TMBLNO
&& x.IsDeleted == false
&& x.TenantId == UserManager.TENANT_ID
&& x.ParentId != input.ParentId // 过滤:因为同一主单的其它分单真提单号可以重复
&& x.Id != input.ParentId // 过滤:因为主单可以与分单的真题单号重复
&& x.Id != input.Id))
{
throw Oops.Bah("当前真提单号已存在,请勿重复录入!");
}
}
}
//版本号避免多人同时操作数据错乱 //版本号避免多人同时操作数据错乱
//if (!string.IsNullOrWhiteSpace(input.VERSION) && input.Id != 0) //if (!string.IsNullOrWhiteSpace(input.VERSION) && input.Id != 0)
//{ //{
@ -11891,7 +11925,8 @@ namespace Myshipping.Application
x.VESSEL, x.VESSEL,
x.VOYNO, x.VOYNO,
x.PLACERECEIPT, x.PLACERECEIPT,
x.PLACEDELIVERY x.PLACEDELIVERY,
x.TenantId
}).ToListAsync(); }).ToListAsync();
if (slotList.Count > 0) if (slotList.Count > 0)
@ -11924,7 +11959,8 @@ namespace Myshipping.Application
VESSEL = item.VESSEL, VESSEL = item.VESSEL,
VOYNO = item.VOYNO, VOYNO = item.VOYNO,
PLACERECEIPT = item.PLACERECEIPT, PLACERECEIPT = item.PLACERECEIPT,
PLACEDELIVERY = item.PLACEDELIVERY PLACEDELIVERY = item.PLACEDELIVERY,
TenantId = item.TenantId
})); }));
} }
} }

@ -144,8 +144,36 @@ namespace Myshipping.Application
input.Adapt(model); input.Adapt(model);
// 1.判断新的舱位信息的7个库存统计维度是否发生变化
// 2.如果有变化,则需要更新旧的库存信息
bool isNeedUpdateOldStock = false;
if (oldObj.VESSEL != model.VESSEL
|| oldObj.VOYNO != model.VOYNO
|| oldObj.BOOKING_SLOT_TYPE != model.BOOKING_SLOT_TYPE
|| oldObj.CARRIERID != model.CARRIERID
|| oldObj.PLACERECEIPT != model.PLACERECEIPT
|| oldObj.PLACEDELIVERY != model.PLACEDELIVERY)
{
isNeedUpdateOldStock = true;
}
await _repBase.UpdateAsync(model); await _repBase.UpdateAsync(model);
if (isNeedUpdateOldStock)
{
//更新库存
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
{
BOOKING_SLOT_TYPE = oldObj.BOOKING_SLOT_TYPE,
CARRIERID = oldObj.CARRIERID,
CONTRACT_NO = oldObj.CONTRACT_NO,
VESSEL = oldObj.VESSEL,
VOYNO = oldObj.VOYNO,
PLACERECEIPT = oldObj.PLACERECEIPT,
PLACEDELIVERY = oldObj.PLACEDELIVERY,
TenantId = model.TenantId
}));
}
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id); await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
foreach (var ctn in input.CtnList) foreach (var ctn in input.CtnList)
{ {
@ -185,7 +213,8 @@ namespace Myshipping.Application
VESSEL = model.VESSEL, VESSEL = model.VESSEL,
VOYNO = model.VOYNO, VOYNO = model.VOYNO,
PLACERECEIPT = model.PLACERECEIPT, PLACERECEIPT = model.PLACERECEIPT,
PLACEDELIVERY = model.PLACEDELIVERY PLACEDELIVERY = model.PLACEDELIVERY,
TenantId = model.TenantId
})); }));
return await Detail(model.Id); return await Detail(model.Id);
@ -323,6 +352,59 @@ namespace Myshipping.Application
}); });
} }
// 解析收货地,得到装货港名称及代码
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT))
{
var portEnName = dto.DataObj.PLACERECEIPT.Split(',')[0]?.Trim();
if (!string.IsNullOrWhiteSpace(portEnName))
{
var portInfo = (await _cache.GetAllCodePortLoad()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null)
{
dto.DataObj.PORTLOAD = portInfo.EnName;
dto.DataObj.PORTLOADID = portInfo.EdiCode;
}
else
{
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("收货地分割后得到的城市名称为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("收货地为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
// 解析交货地,得到为卸货港名称及代码
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY))
{
var portEnName = dto.DataObj.PLACEDELIVERY.Split(',')[0]?.Trim();
if (!string.IsNullOrWhiteSpace(portEnName))
{
var portInfo = (await _cache.GetAllCodePort()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null)
{
dto.DataObj.PORTDISCHARGE = portInfo.EnName;
dto.DataObj.PORTDISCHARGEID = portInfo.EdiCode;
}
else
{
_logger.LogInformation("通过交货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("交货地分割后得到的城市名称为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("交货地为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
BookingSlotBase model = null; BookingSlotBase model = null;
if (dto.OpType == "add") if (dto.OpType == "add")
{ {
@ -431,7 +513,37 @@ namespace Myshipping.Application
var oldObj = model.Adapt<BookingSlotBaseApiSaveDto>(); var oldObj = model.Adapt<BookingSlotBaseApiSaveDto>();
dto.DataObj.Adapt(model); dto.DataObj.Adapt(model);
// 1.判断新的舱位信息的7个库存统计维度是否发生变化
// 2.如果有变化,则需要更新旧的库存信息
bool isNeedUpdateOldStock = false;
if (oldObj.VESSEL != model.VESSEL
|| oldObj.VOYNO != model.VOYNO
|| oldObj.BOOKING_SLOT_TYPE != model.BOOKING_SLOT_TYPE
|| oldObj.CARRIERID != model.CARRIERID
|| oldObj.PLACERECEIPT != model.PLACERECEIPT
|| oldObj.PLACEDELIVERY != model.PLACEDELIVERY)
{
isNeedUpdateOldStock = true;
}
await _repBase.UpdateAsync(model); await _repBase.UpdateAsync(model);
if (isNeedUpdateOldStock)
{
//更新库存
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
{
BOOKING_SLOT_TYPE = oldObj.BOOKING_SLOT_TYPE,
CARRIERID = oldObj.CARRIERID,
CONTRACT_NO = oldObj.CONTRACT_NO,
VESSEL = oldObj.VESSEL,
VOYNO = oldObj.VOYNO,
PLACERECEIPT = oldObj.PLACERECEIPT,
PLACEDELIVERY = oldObj.PLACEDELIVERY,
TenantId = model.TenantId
}));
}
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id); await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
foreach (var ctn in dto.DataObj.CtnList) foreach (var ctn in dto.DataObj.CtnList)
{ {
@ -550,7 +662,8 @@ namespace Myshipping.Application
VESSEL = model.VESSEL, VESSEL = model.VESSEL,
VOYNO = model.VOYNO, VOYNO = model.VOYNO,
PLACERECEIPT = model.PLACERECEIPT, PLACERECEIPT = model.PLACERECEIPT,
PLACEDELIVERY = model.PLACEDELIVERY PLACEDELIVERY = model.PLACEDELIVERY,
TenantId = model.TenantId
})); }));
} }
else else
@ -935,7 +1048,8 @@ namespace Myshipping.Application
VESSEL = latestSlot.VESSEL, VESSEL = latestSlot.VESSEL,
VOYNO = latestSlot.VOYNO, VOYNO = latestSlot.VOYNO,
PLACERECEIPT = latestSlot.PLACERECEIPT, PLACERECEIPT = latestSlot.PLACERECEIPT,
PLACEDELIVERY = latestSlot.PLACEDELIVERY PLACEDELIVERY = latestSlot.PLACEDELIVERY,
TenantId = latestSlot.TenantId,
})); }));
} }
} }
@ -994,6 +1108,35 @@ namespace Myshipping.Application
var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>(); var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>();
// 查询舱位绑定的销售信息,赋值到舱位对象中
var slotIds = result.Items.Select(x => x.Id);
if (slotIds.Any())
{
List<BookingSlotSaleInfoDto> allocationInfoList = await _repAllocation.AsQueryable()
.Where(x => slotIds.Contains(x.BOOKING_SLOT_ID))
.Select(x => new BookingSlotSaleInfoDto
{
BOOKING_SLOT_ID = x.BOOKING_SLOT_ID,
CUSTOMERNAME = x.CUSTOMERNAME,
CUSTSERVICE = x.CUSTSERVICE,
SALE = x.SALE,
SALE_TIME = x.SALE_TIME,
SHIPPER = x.SHIPPER,
GOODSNAME = x.GOODSNAME,
SELLING_PRICE = x.SELLING_PRICE
}).ToListAsync();
var group = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
foreach (var item in group)
{
var slot = result.Items.FirstOrDefault(x => x.Id == item.Key);
if (slot != null)
{
slot.BookingSlotSaleInfoList = item.ToList();
}
}
}
return result.XnPagedResult(); return result.XnPagedResult();
} }
#endregion #endregion
@ -1056,7 +1199,7 @@ namespace Myshipping.Application
TimeSpan ts = eDate.Subtract(bDate); TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds; var timeDiff = ts.TotalMilliseconds;
if(compareResult != null) if (compareResult != null)
{ {
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败"); _logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
} }
@ -1177,7 +1320,7 @@ namespace Myshipping.Application
{ {
_logger.LogInformation("推送BC比对异常原因{error}", ex.Message); _logger.LogInformation("推送BC比对异常原因{error}", ex.Message);
// throw Oops.Oh($"推送BC比对异常原因{ex.Message}"); // throw Oops.Oh($"推送BC比对异常原因{ex.Message}");
} }
} }
@ -1208,7 +1351,7 @@ namespace Myshipping.Application
throw Oops.Oh($"获取舱位变更比对结果错误,比对内容不存在"); throw Oops.Oh($"获取舱位变更比对结果错误,比对内容不存在");
} }
if(!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT)) if (!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT))
{ {
return JSON.Deserialize<List<CompareResultDetailInfo>>(compareInfo.COMPARE_RLT); return JSON.Deserialize<List<CompareResultDetailInfo>>(compareInfo.COMPARE_RLT);
} }
@ -1348,7 +1491,7 @@ namespace Myshipping.Application
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE, CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE, CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE, CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
CUSTSERVICEID = generateModel.CustServiceId.HasValue? generateModel.CustServiceId.Value.ToString():null, CUSTSERVICEID = generateModel.CustServiceId.HasValue ? generateModel.CustServiceId.Value.ToString() : null,
CUSTSERVICE = generateModel.CustServiceName, CUSTSERVICE = generateModel.CustServiceName,
ctnInputs = new List<BookingCtnDto>() ctnInputs = new List<BookingCtnDto>()
}; };
@ -1567,7 +1710,7 @@ namespace Myshipping.Application
{ {
BookingSlotWithOrderDto dto = null; BookingSlotWithOrderDto dto = null;
var slotInfo = await _repBase.AsQueryable().Filter(null,true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false); var slotInfo = await _repBase.AsQueryable().Filter(null, true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false);
if (slotInfo == null) if (slotInfo == null)
{ {

@ -328,6 +328,18 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
[Description("客户样单截止日期")] [Description("客户样单截止日期")]
public Nullable<DateTime> CUSTOM_SI_CUT_DATE { get; set; } public Nullable<DateTime> CUSTOM_SI_CUT_DATE { get; set; }
/// <summary>
/// 备注
/// </summary>
[Description("备注")]
public string REMARK { get; set; }
/// <summary>
/// 计费日期
/// </summary>
[Description("计费日期")]
public DateTime? PRICE_CALCULATION_DATE { get; set; }
} }
/// <summary> /// <summary>
@ -441,6 +453,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// 修改者名称 /// 修改者名称
/// </summary> /// </summary>
public string UpdatedUserName { get; set; } public string UpdatedUserName { get; set; }
/// <summary>
/// 舱位关联的订舱信息
/// </summary>
public List<BookingSlotSaleInfoDto> BookingSlotSaleInfoList { get; set; }
} }
/// <summary> /// <summary>
@ -462,12 +479,12 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// <summary> /// <summary>
/// 操作类型add 新增、update 更新、del 删除取消 /// 操作类型add 新增、update 更新、del 删除取消
/// </summary> /// </summary>
public string OpType { get; set; } public string OpType { get; set; }
/// <summary> /// <summary>
/// 数据对象 /// 数据对象
/// </summary> /// </summary>
public BookingSlotBaseApiSaveDto DataObj { get; set; } public BookingSlotBaseApiSaveDto DataObj { get; set; }
/// <summary> /// <summary>
/// 批次号 /// 批次号
@ -478,7 +495,7 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// <summary> /// <summary>
/// 舱位基础信息含箱信息列表Dto /// 舱位基础信息含箱信息列表Dto
/// </summary> /// </summary>
public class BookingSlotBaseWithCtnDto: BookingSlotBaseDto public class BookingSlotBaseWithCtnDto : BookingSlotBaseDto
{ {
/// <summary> /// <summary>
/// Id /// Id
@ -490,4 +507,50 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
public List<BookingSlotCtnDto> CtnList { get; set; } public List<BookingSlotCtnDto> CtnList { get; set; }
} }
/// <summary>
/// 舱位销售信息
/// </summary>
public class BookingSlotSaleInfoDto
{
/// <summary>
/// 舱位主键
/// </summary>
public long BOOKING_SLOT_ID { get; set; }
/// <summary>
/// 客户名称
/// </summary>
public string CUSTOMERNAME { get; set; }
/// <summary>
/// 客服名称
/// </summary>
public string CUSTSERVICE { get; set; }
/// <summary>
/// 销售名称
/// </summary>
public string SALE { get; set; }
/// <summary>
/// 销售日期
/// </summary>
public DateTime? SALE_TIME { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string SHIPPER { get; set; }
/// <summary>
/// 品名
/// </summary>
public string GOODSNAME { get; set; }
/// <summary>
/// 卖价
/// </summary>
public decimal? SELLING_PRICE { get; set; }
}
} }

@ -378,7 +378,7 @@ namespace Myshipping.Application
string statusDesc = $"{STATUS_SEND}(单号:{waybillNo}"; string statusDesc = $"{STATUS_SEND}(单号:{waybillNo}";
// 不需要等待的任务,并且不会因为异常导致当前请求终止 // 不需要等待的任务,并且不会因为异常导致当前请求终止
_ = Task.Run(async () => _ = Task.Run(() =>
{ {
#region 添加快递动态 #region 添加快递动态
try try
@ -390,7 +390,7 @@ namespace Myshipping.Application
StatusCode = "DJY03", StatusCode = "DJY03",
StatusDesc = statusDesc StatusDesc = statusDesc
}; };
await _statusRep.InsertAsync(status); _statusRep.Insert(status);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -401,8 +401,8 @@ namespace Myshipping.Application
#region 为与快递关联的订舱添加动态 #region 为与快递关联的订舱添加动态
try try
{ {
List<string> mblnoList = await _businessRep.AsQueryable(b => b.PId == Id).Select(b => b.MBLNO).ToListAsync(); List<string> mblnoList = _businessRep.AsQueryable(b => b.PId == Id).Select(b => b.MBLNO).ToList();
_ = InsertNewBookingStatusWithMblnoList(mblnoList, statusDesc); _= InsertNewBookingStatusWithMblnoList(mblnoList, statusDesc);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -413,9 +413,9 @@ namespace Myshipping.Application
#region 维护地址簿 #region 维护地址簿
try try
{ {
if (!await _addressRep.IsExistsAsync(a => a.People == order.SJPeople && a.Tel == order.SJTel)) if (!_addressRep.IsExists(a => a.People == order.SJPeople && a.Tel == order.SJTel))
{ {
await _addressRep.InsertAsync(new ExpressDeliveryAddress() _addressRep.Insert(new ExpressDeliveryAddress()
{ {
Address = order.SJAddress, Address = order.SJAddress,
City = order.SJCity, City = order.SJCity,
@ -427,9 +427,9 @@ namespace Myshipping.Application
Type = 1 Type = 1
}); });
} }
if (!await _addressRep.IsExistsAsync(a => a.People == order.FJPeople && a.Tel == order.FJTel)) if (!_addressRep.IsExists(a => a.People == order.FJPeople && a.Tel == order.FJTel))
{ {
await _addressRep.InsertAsync(new ExpressDeliveryAddress() _addressRep.Insert(new ExpressDeliveryAddress()
{ {
Address = order.FJAddress, Address = order.FJAddress,
City = order.FJCity, City = order.FJCity,

@ -58,21 +58,26 @@ namespace Myshipping.Core.MQ
ConnectionFactory factory = new ConnectionFactory(); ConnectionFactory factory = new ConnectionFactory();
var repoSysCfg = _serviceScope.ServiceProvider.GetService<SqlSugarRepository<SysConfig>>(); var repoSysCfg = _serviceScope.ServiceProvider.GetService<SqlSugarRepository<SysConfig>>();
var mqUrl = repoSysCfg.FirstOrDefault(x => x.Code == "CompanyUserChangeMqUrl").Value; var mqUrl = repoSysCfg.FirstOrDefault(x => x.Code == "CompanyUserChangeMqUrl")?.Value;
_logger.LogInformation($"准备连接公司用户同步消息队列:{mqUrl}"); if (string.IsNullOrEmpty(mqUrl))
factory.Uri = new Uri(mqUrl); {
mqConn = factory.CreateConnection("客户订舱平台客户端"); _logger.LogError($"接收公司、员工变动消息推送所需MQUrl未配置");
}
model = mqConn.CreateModel(); else
model.ExchangeDeclare(ExchangeName, ExchangeType.Fanout); {
model.QueueDeclare(QueueName, false, false, true, null); _logger.LogInformation($"准备连接公司用户同步消息队列:{mqUrl}");
model.QueueBind(QueueName, ExchangeName, "", null); factory.Uri = new Uri(mqUrl);
mqConn = factory.CreateConnection("客户订舱平台客户端");
var consumer = new EventingBasicConsumer(model);
consumer.Received += Consumer_Received; model = mqConn.CreateModel();
model.BasicConsume(QueueName, true, consumer); model.ExchangeDeclare(ExchangeName, ExchangeType.Fanout);
model.QueueDeclare(QueueName, false, false, true, null);
model.QueueBind(QueueName, ExchangeName, "", null);
var consumer = new EventingBasicConsumer(model);
consumer.Received += Consumer_Received;
model.BasicConsume(QueueName, true, consumer);
}
}); });
} }

@ -202,6 +202,13 @@ public static class JsonUtil
return "提单号存在中文字符或特殊字符"; return "提单号存在中文字符或特殊字符";
} }
} }
if (propName.ToUpper() == "TMBLNO" && !string.IsNullOrEmpty(sourceVal.ToString()))
{
if (!Regex.IsMatch(sourceVal.ToString(), @"^[a-zA-Z0-9]+$"))
{
return "真提单号存在中文字符或特殊字符";
}
}
if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "HBLNO") if (Regex.IsMatch(sourceVal.ToString(), @"[\u4e00-\u9fa5]") && propName.ToUpper() == "HBLNO")
{ {

Loading…
Cancel
Save