diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ImportSlotsDto.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ImportSlotsDto.cs
index 10f8fa94..12799aa4 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ImportSlotsDto.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/ImportSlotsDto.cs
@@ -32,5 +32,15 @@ namespace DS.WMS.Core.Op.Dtos
///
public BookingGenerateDto generateModel { get; set; }
+
+ ///
+ /// 海运订舱详情
+ ///
+ public SeaExportRes orderInfo { get; set; }
+
+ ///
+ /// 是否订单引入
+ ///
+ public bool isOrderImport { get; set; }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs
index 57c68bdb..af6746f0 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs
@@ -1453,4 +1453,9 @@ public class SeaExportRes
/// 拆票或合票标志 1-拆票 2-合票
///
public int SplitOrMergeFlag { get; set; }
+
+ ///
+ /// 所属公司ID
+ ///
+ public long OrgId { get; set; }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
index 06dde2b6..dec9cf15 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
@@ -56,6 +56,7 @@ using DS.WMS.Core.TaskPlat.Entity;
using Microsoft.VisualBasic.FileIO;
using Microsoft.Extensions.Logging;
using AnyDiff.Extensions;
+using DS.WMS.Core.Sys.Entity;
namespace DS.WMS.Core.Op.Method
{
@@ -2672,6 +2673,40 @@ namespace DS.WMS.Core.Op.Method
var slotIdList = model.slots.Select(s => s.Id).ToList();
List latestSlotList = tenantDb.Queryable().Where(b => slotIdList.Contains(b.Id)).ToList();
+
+ //(订单引入现舱时)需要对订单数据进行比对(约号、启运港、目的港、船名航次和现舱的上述信息做比对,如果不一致终止并提示)
+ if (model.isOrderImport)
+ {
+ if (model.orderInfo == null)
+ {
+ return DataResult.FailedData("当前引入现舱时,无法获取订单信息");
+ }
+
+ //比约号
+ if (!string.IsNullOrWhiteSpace(model.orderInfo.ContractNo) && latestSlotList.Any(a => !string.IsNullOrWhiteSpace(a.ContractNo) && !a.ContractNo.Equals(model.orderInfo.ContractNo)))
+ {
+ return DataResult.FailedData($"引入校验失败,订单约号【{model.orderInfo.ContractNo}】 与舱位约号【{latestSlotList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.ContractNo)).ContractNo}】 不一致");
+ }
+
+ //船名航次
+ if (!string.IsNullOrWhiteSpace(model.orderInfo.Vessel) && !string.IsNullOrWhiteSpace(model.orderInfo.Voyno) && latestSlotList.Any(a => $"{a.Vessel?.Trim()}/{a.Voyno?.Trim()}".Equals($"{model.orderInfo.Vessel?.Trim()}/{model.orderInfo.Voyno?.Trim()}")))
+ {
+ return DataResult.FailedData($"引入校验失败,船名航次【{model.orderInfo.Vessel?.Trim()}/{model.orderInfo.Voyno?.Trim()}】 与舱位船名航次【{latestSlotList.FirstOrDefault().Vessel?.Trim()}/{latestSlotList.FirstOrDefault().Voyno?.Trim()}】 不一致");
+ }
+
+ //比对装货港
+ if (model.orderInfo.LoadPortId > 0 && latestSlotList.Any(a => a.PortLoadId.HasValue && a.PortLoadId.Value != model.orderInfo.LoadPortId))
+ {
+ return DataResult.FailedData($"引入校验失败,订单装货港【{model.orderInfo.LoadPort}】 与舱位装货港【{latestSlotList.FirstOrDefault(a=>a.PortLoadId.HasValue).PortLoad}】 不一致");
+ }
+
+ //比对卸货港
+ if (model.orderInfo.DischargePortId > 0 && latestSlotList.Any(a => a.PortDischargeId.HasValue && a.PortDischargeId.Value != model.orderInfo.DischargePortId))
+ {
+ return DataResult.FailedData($"引入校验失败,订单卸货港【{model.orderInfo.DischargePort}】 与舱位卸货港【{latestSlotList.FirstOrDefault(a => a.PortDischargeId.HasValue).PortDischarge}】 不一致");
+ }
+ }
+
foreach (var inSlotItem in model.slots)
{
var latestSlot = latestSlotList.First(b => b.Id == inSlotItem.Id);
@@ -2772,6 +2807,8 @@ namespace DS.WMS.Core.Op.Method
file.LinkId = model.bookingOrderId;
tenantDb.Insertable(file).ExecuteCommand();
}
+
+ //推送计算舱位库存
_bookingSlotStockService.BookingSlotStock(new BookingSlotStockUpdateModel
{
BookingSlotType = latestSlot.BookingSlotType,
@@ -4274,6 +4311,7 @@ namespace DS.WMS.Core.Op.Method
1、提取海运出口的订舱详情
2、触发舱位的关联订舱
*/
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.seaExportId == 0)
{
@@ -4314,13 +4352,97 @@ namespace DS.WMS.Core.Op.Method
generateDto.NewSubBlNo = orderInfo.HBLNO;
}
+ /*
+ 1、对用途进行匹配。
+ 2、需要对订单数据进行比对(约号、启运港、目的港、船名航次和现舱的上述信息做比对,如果不一致终止并提示)
+ 3、BC文件写入订单
+ 4、需要支持拆票
+ 5、订单引入舱位时,需要将订单的内容返写舱位(委托单位、客服、操作、单证、商务、销售、SHIPPER、品名、卖价、销售日期、是否拆合票)
+ */
+
+ var slotId = model.slots.FirstOrDefault().Id;
+
+ var useToList = tenantDb.Queryable().Where(a => a.SlotId == slotId).ToList();
+
+ if (useToList.Count > 0)
+ {
+ //ASSIGN_FORWARDER-指定货
+ if (useToList.Any(b => b.UseTo.Equals(BookingSlotUseToEnum.ASSIGN_FORWARDER.ToString(), StringComparison.OrdinalIgnoreCase)))
+ {
+ var currUseTo = useToList.FirstOrDefault(b => b.UseTo.Equals(BookingSlotUseToEnum.ASSIGN_FORWARDER.ToString(), StringComparison.OrdinalIgnoreCase));
+
+ if (orderInfo.AgentId.HasValue && !currUseTo.UseToVal.Equals(orderInfo.AgentId.Value.ToString()))
+ {
+ throw new Exception($"舱位用途验证失败,指定货【{currUseTo.UseToValShow}】与订单的国外代理【{orderInfo.Agent}】不一致");
+ }
+ }
+
+ //GUEST_ONLY-专属客户
+ if (useToList.Any(b => b.UseTo.Equals(BookingSlotUseToEnum.GUEST_ONLY.ToString(), StringComparison.OrdinalIgnoreCase)))
+ {
+ var currUseTo = useToList.FirstOrDefault(b => b.UseTo.Equals(BookingSlotUseToEnum.GUEST_ONLY.ToString(), StringComparison.OrdinalIgnoreCase));
+
+ if (orderInfo.CustomerId > 0 && !currUseTo.UseToVal.Equals(orderInfo.CustomerId.ToString()))
+ {
+ throw new Exception($"舱位用途验证失败,专属客户【{currUseTo.UseToValShow}】与订单的委托单位【{orderInfo.CustomerName}】不一致");
+ }
+ }
+
+ //SALEER_ONLY-专属销售
+ if (useToList.Any(b => b.UseTo.Equals(BookingSlotUseToEnum.SALEER_ONLY.ToString(), StringComparison.OrdinalIgnoreCase)))
+ {
+ var currUseTo = useToList.FirstOrDefault(b => b.UseTo.Equals(BookingSlotUseToEnum.SALEER_ONLY.ToString(), StringComparison.OrdinalIgnoreCase));
+
+ if (orderInfo.SaleId > 0 && !currUseTo.UseToVal.Equals(orderInfo.SaleId.ToString()))
+ {
+ throw new Exception($"舱位用途验证失败,专属销售【{currUseTo.UseToValShow}】与订单的揽货人【{orderInfo.Sale}】不一致");
+ }
+ }
+
+ //COMPANY_ONLY-专属公司
+ if (useToList.Any(b => b.UseTo.Equals(BookingSlotUseToEnum.COMPANY_ONLY.ToString(), StringComparison.OrdinalIgnoreCase)))
+ {
+ var currUseTo = useToList.FirstOrDefault(b => b.UseTo.Equals(BookingSlotUseToEnum.COMPANY_ONLY.ToString(), StringComparison.OrdinalIgnoreCase));
+
+ if (orderInfo.OrgId > 0 && !currUseTo.UseToVal.Equals(orderInfo.OrgId.ToString()))
+ {
+ long useToVal = long.Parse(currUseTo.UseToVal);
+ var origList = db.Queryable().Where(a => a.Status == StatusEnum.Enable && (orderInfo.OrgId == a.Id || useToVal == a.Id)).ToList();
+ throw new Exception($"舱位用途验证失败,专属公司【{origList.FirstOrDefault(a=>a.Id == useToVal)?.OrgName}】与订单的揽货人【{origList.FirstOrDefault(a=>a.Id == orderInfo.OrgId)?.OrgName}}】不一致");
+ }
+ }
+
+ //GOODS-品名大类
+ if (useToList.Any(b => b.UseTo.Equals(BookingSlotUseToEnum.GOODS.ToString(), StringComparison.OrdinalIgnoreCase)))
+ {
+ var currUseTo = useToList.FirstOrDefault(b => b.UseTo.Equals(BookingSlotUseToEnum.GOODS.ToString(), StringComparison.OrdinalIgnoreCase));
+
+ if (orderInfo.GoodsId > 0 && !currUseTo.UseToVal.Equals(orderInfo.GoodsId.ToString()))
+ {
+ throw new Exception($"舱位用途验证失败,品名大类【{currUseTo.UseToValShow}】与订单的品名【{orderInfo.GoodsName}】不一致");
+ }
+ }
+
+ //HSCODE-品名大类
+ if (useToList.Any(b => b.UseTo.Equals(BookingSlotUseToEnum.HSCODE.ToString(), StringComparison.OrdinalIgnoreCase)))
+ {
+ var currUseTo = useToList.FirstOrDefault(b => b.UseTo.Equals(BookingSlotUseToEnum.HSCODE.ToString(), StringComparison.OrdinalIgnoreCase));
+
+ if (!currUseTo.UseToVal.Equals(orderInfo.HSCode))
+ {
+ throw new Exception($"舱位用途验证失败,HSCODE【{currUseTo.UseToValShow}】与订单的HSCODE【{orderInfo.HSCode}】不一致");
+ }
+ }
+ }
+
return await ImportSlots(new ImportSlotsDto
{
slots = model.slots,
isCheck = false,
bookingOrderId = model.seaExportId,
- generateModel = generateDto
-
+ generateModel = generateDto,
+ orderInfo = orderInfo,
+ isOrderImport = true
});
}
#endregion