jianghaiqing 11 months ago
commit 54f9c8f33b

@ -19,5 +19,9 @@ namespace Myshipping.Application.Entity
/// 业务id
/// </summary>
public long? BookingId { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; } = "Order";
}
}

@ -2,10 +2,11 @@ using System;
using System.Collections.Generic;
using SqlSugar;
using Myshipping.Core.Entity;
using System.ComponentModel;
/*
* @author : whm
* @date : 2024-1-2
* @date : 2024-1-11
* @desc :
*/
namespace Myshipping.Application
@ -20,271 +21,323 @@ namespace Myshipping.Application
/// 舱位提单号
/// </summary>
[SugarColumn(ColumnName = "SLOT_BOOKING_NO")]
[Description("舱位提单号")]
public string SLOT_BOOKING_NO{ get; set; }
/// <summary>
/// 合约号
/// </summary>
[SugarColumn(ColumnName = "CONTRACT_NO")]
[Description("合约号")]
public string CONTRACT_NO{ get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
[SugarColumn(ColumnName = "BOOKING_PARTY")]
[Description("订舱抬头")]
public string BOOKING_PARTY{ get; set; }
/// <summary>
/// 船名
/// </summary>
[SugarColumn(ColumnName = "VESSEL")]
[Description("船名")]
public string VESSEL{ get; set; }
/// <summary>
/// 航次号
/// </summary>
[SugarColumn(ColumnName = "VOYNO")]
[Description("航次号")]
public string VOYNO{ get; set; }
/// <summary>
/// 预计开船日期
/// </summary>
[SugarColumn(ColumnName = "ETD")]
[Description("预计开船日期")]
public DateTime? ETD{ get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
[SugarColumn(ColumnName = "ETA")]
[Description("预计到港日期")]
public DateTime? ETA{ get; set; }
/// <summary>
/// 收货地代码
/// </summary>
[SugarColumn(ColumnName = "PLACERECEIPTID")]
[Description("收货地代码")]
public string PLACERECEIPTID{ get; set; }
/// <summary>
/// 收货地
/// </summary>
[SugarColumn(ColumnName = "PLACERECEIPT")]
[Description("收货地")]
public string PLACERECEIPT{ get; set; }
/// <summary>
/// 交货地代码
/// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERYID")]
[Description("交货地代码")]
public string PLACEDELIVERYID{ get; set; }
/// <summary>
/// 交货地
/// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERY")]
[Description("交货地")]
public string PLACEDELIVERY{ get; set; }
/// <summary>
/// 装货港代码
/// </summary>
[SugarColumn(ColumnName = "PORTLOADID")]
public string PORTLOADID { get; set; }
[Description("装货港代码")]
public string PORTLOADID{ get; set; }
/// <summary>
/// 装货港
/// </summary>
[SugarColumn(ColumnName = "PORTLOAD")]
public string PORTLOAD { get; set; }
[Description("装货港")]
public string PORTLOAD{ get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
[SugarColumn(ColumnName = "PORTDISCHARGEID")]
public string PORTDISCHARGEID { get; set; }
[Description("卸货港代码")]
public string PORTDISCHARGEID{ get; set; }
/// <summary>
/// 卸货港
/// </summary>
[SugarColumn(ColumnName = "PORTDISCHARGE")]
public string PORTDISCHARGE { get; set; }
[Description("卸货港")]
public string PORTDISCHARGE{ get; set; }
/// <summary>
/// 中转港1
/// </summary>
[SugarColumn(ColumnName = "TRANSFER_PORT_1")]
[Description("中转港1")]
public string TRANSFER_PORT_1{ get; set; }
/// <summary>
/// 中转港2
/// </summary>
[SugarColumn(ColumnName = "TRANSFER_PORT_2")]
[Description("中转港2")]
public string TRANSFER_PORT_2{ get; set; }
/// <summary>
/// 船公司代号
/// </summary>
[SugarColumn(ColumnName = "CARRIERID")]
[Description("船公司代号")]
public string CARRIERID{ get; set; }
/// <summary>
/// 船公司
/// </summary>
[SugarColumn(ColumnName = "CARRIER")]
[Description("船公司")]
public string CARRIER{ get; set; }
/// <summary>
/// 航线代码(船公司)
/// </summary>
[SugarColumn(ColumnName = "LANECODE")]
[Description("航线代码(船公司)")]
public string LANECODE{ get; set; }
/// <summary>
/// 航线名称(船公司)
/// </summary>
[SugarColumn(ColumnName = "LANENAME")]
[Description("航线名称(船公司)")]
public string LANENAME{ get; set; }
/// <summary>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
[SugarColumn(ColumnName = "CARRIAGE_TYPE")]
[Description("承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转")]
public string CARRIAGE_TYPE{ get; set; }
/// <summary>
/// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")]
[Description("承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string CARRIAGE_TYPE_NAME{ get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")]
[Description("订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string BOOKING_SLOT_TYPE{ get; set; }
/// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")]
[Description("订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string BOOKING_SLOT_TYPE_NAME{ get; set; }
/// <summary>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// </summary>
[SugarColumn(ColumnName = "ISSUETYPE")]
[Description("签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;")]
public string ISSUETYPE{ get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
[SugarColumn(ColumnName = "CTN_STAT")]
[Description("箱型箱量")]
public string CTN_STAT{ get; set; }
/// <summary>
/// 所在周数
/// </summary>
[SugarColumn(ColumnName = "WEEK_AT")]
[Description("所在周数")]
public string WEEK_AT{ get; set; }
/// <summary>
/// 箱使天数
/// </summary>
[SugarColumn(ColumnName = "DETENSION_FREE_DAYS")]
[Description("箱使天数")]
public int DETENSION_FREE_DAYS{ get; set; }
/// <summary>
/// 样单截止日期
/// </summary>
[SugarColumn(ColumnName = "SI_CUT_DATE")]
[Description("样单截止日期")]
public DateTime? SI_CUT_DATE{ get; set; }
/// <summary>
///
/// 截港时间
/// </summary>
[SugarColumn(ColumnName = "CY_CUT_DATE")]
[Description("截港时间")]
public DateTime? CY_CUT_DATE{ get; set; }
/// <summary>
/// VGM截止日期
/// </summary>
[SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")]
[Description("VGM截止日期")]
public DateTime? VGM_SUBMISSION_CUT_DATE{ get; set; }
/// <summary>
///
/// MDGF提交截止时间
/// </summary>
[SugarColumn(ColumnName = "MDGF_CUT_DATE")]
[Description("MDGF提交截止时间")]
public DateTime? MDGF_CUT_DATE{ get; set; }
/// <summary>
/// 舱单截止时间
/// </summary>
[SugarColumn(ColumnName = "MANIFEST_CUT_DATE")]
[Description("舱单截止时间")]
public DateTime? MANIFEST_CUT_DATE{ get; set; }
/// <summary>
/// 多状态标记,按预设的状态标记顺序二进制转数值,查询时用与或查询
/// </summary>
[SugarColumn(ColumnName = "MORE_FLAG_STATUS")]
[Description("多状态标记,按预设的状态标记顺序二进制转数值,查询时用与或查询")]
public int MORE_FLAG_STATUS{ get; set; }
/// <summary>
/// VGM回执
/// </summary>
[SugarColumn(ColumnName = "VGM_RLT_STAT")]
[Description("VGM回执")]
public string VGM_RLT_STAT{ get; set; }
/// <summary>
///
/// SI回执
/// </summary>
[SugarColumn(ColumnName = "SI_RLT_STAT")]
[Description("SI回执")]
public string SI_RLT_STAT{ get; set; }
/// <summary>
/// 提箱回执
/// </summary>
[SugarColumn(ColumnName = "TAKE_CTN_RLT_STAT")]
[Description("提箱回执")]
public string TAKE_CTN_RLT_STAT{ get; set; }
/// <summary>
/// 还箱回执
/// </summary>
[SugarColumn(ColumnName = "RETURN_CTN_RLT_STAT")]
[Description("还箱回执")]
public string RETURN_CTN_RLT_STAT{ get; set; }
/// <summary>
/// 预甩回执
/// </summary>
[SugarColumn(ColumnName = "NOMINATION_RLT_STAT")]
[Description("预甩回执")]
public string NOMINATION_RLT_STAT{ get; set; }
/// <summary>
/// 舱位变更回执
/// </summary>
[SugarColumn(ColumnName = "AMENDMENT_RLT_STAT")]
[Description("舱位变更回执")]
public string AMENDMENT_RLT_STAT{ get; set; }
/// <summary>
/// 舱位取消回执
/// </summary>
[SugarColumn(ColumnName = "CANCELLATION_RLT_STAT")]
[Description("舱位取消回执")]
public string CANCELLATION_RLT_STAT{ get; set; }
/// <summary>
/// 目的港卸船未提货回执
/// </summary>
[SugarColumn(ColumnName = "DISCHARGE_FULL_RLT_STAT")]
[Description("目的港卸船未提货回执")]
public string DISCHARGE_FULL_RLT_STAT{ get; set; }
/// <summary>
///
/// 目的港提箱未还空箱回执
/// </summary>
[SugarColumn(ColumnName = "GATE_OUTFULL_RLT_STAT")]
[Description("目的港提箱未还空箱回执")]
public string GATE_OUTFULL_RLT_STAT{ get; set; }
/// <summary>
/// 租户名称
/// </summary>
[SugarColumn(ColumnName = "TenantName")]
[Description("租户名称")]
public string TenantName{ get; set; }
/// <summary>
/// 舱位来源 EMAIL-邮件导入 MANUAL-手工
/// </summary>
[SugarColumn(ColumnName = "SLOT_SOURCE")]
[Description("舱位来源 EMAIL-邮件导入 MANUAL-手工")]
public string SLOT_SOURCE{ get; set; }
}
}

@ -29,6 +29,8 @@ using Furion.EventBus;
using Myshipping.Application.Event;
using Microsoft.AspNetCore.Authorization;
using Furion.DatabaseAccessor;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
using Myshipping.Application.Service.BookingOrder.Dto;
namespace Myshipping.Application
@ -42,6 +44,10 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingSlotBase> _repBase;
private readonly SqlSugarRepository<BookingSlotCtn> _repCtn;
private readonly SqlSugarRepository<BookingSlotStock> _repStock;
private readonly SqlSugarRepository<BookingLog> _repBookingLog;
private readonly SqlSugarRepository<BookingLogDetail> _repBookingLogDetail;
private readonly ILogger<BookingSlotService> _logger;
private readonly ISysCacheService _cache;
@ -50,6 +56,8 @@ namespace Myshipping.Application
public BookingSlotService(SqlSugarRepository<BookingSlotBase> repBase,
SqlSugarRepository<BookingSlotCtn> repCtn,
SqlSugarRepository<BookingSlotStock> repStock,
SqlSugarRepository<BookingLog> repBookingLog,
SqlSugarRepository<BookingLogDetail> repBookingLogDetail,
ILogger<BookingSlotService> logger,
ISysCacheService cache,
IEventPublisher publisher)
@ -57,6 +65,10 @@ namespace Myshipping.Application
_repBase = repBase;
_repCtn = repCtn;
_repStock = repStock;
_repBookingLog = repBookingLog;
_repBookingLogDetail = repBookingLogDetail;
_logger = logger;
_cache = cache;
@ -102,7 +114,7 @@ namespace Myshipping.Application
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingSlot/save")]
public async Task<BookingSlotBaseSaveDto> Save(BookingSlotBaseSaveDto input)
public async Task<BookingSlotBaseSaveOutput> Save(BookingSlotBaseSaveInput input)
{
BookingSlotBase model = null;
if (input.Id > 0) //修改
@ -114,6 +126,7 @@ namespace Myshipping.Application
}
model = _repBase.FirstOrDefault(x => x.Id == input.Id);
var oldObj = model.Adapt<BookingSlotBaseSaveInput>();
input.Adapt(model);
@ -126,6 +139,8 @@ namespace Myshipping.Application
newCtn.SLOT_ID = model.Id;
await _repCtn.InsertAsync(newCtn);
}
await InsLog("Update", model.Id, typeof(BookingSlotBaseSaveInput), oldObj, input, "CtnList");
}
else
{
@ -143,6 +158,8 @@ namespace Myshipping.Application
newCtn.SLOT_ID = model.Id;
await _repCtn.InsertAsync(newCtn);
}
await InsLog("Add", model.Id, "新增舱位");
}
//更新库存
@ -178,6 +195,8 @@ namespace Myshipping.Application
}
await _repCtn.UpdateAsync(ctns);
await InsLog("Del", entity.Id, "取消舱位");
//更新库存
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
{
@ -195,13 +214,30 @@ namespace Myshipping.Application
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("/BookingSlot/detail")]
public async Task<BookingSlotBaseSaveDto> Detail(long id)
public async Task<BookingSlotBaseSaveOutput> Detail(long id)
{
var slotBase = await _repBase.FirstOrDefaultAsync(u => u.Id == id);
var ctns = await _repCtn.Where(x => x.SLOT_ID == id).ToListAsync();
var rtn = slotBase.Adapt<BookingSlotBaseSaveDto>();
var rtn = slotBase.Adapt<BookingSlotBaseSaveOutput>();
rtn.CtnList = ctns.Adapt<List<BookingSlotCtnSaveInput>>();
List<BookingLogDto> list = new List<BookingLogDto>();
var main = await _repBookingLog.AsQueryable().Where(u => u.BookingId == slotBase.Id).ToListAsync();
var mailidlist = main.Select(x => x.Id).ToList();
list = main.Adapt<List<BookingLogDto>>();
if (list != null)
{
var bookinglogdetail = await _repBookingLogDetail.AsQueryable().Where(x => mailidlist.Contains(x.PId)).ToListAsync();
foreach (var item in list)
{
var details = bookinglogdetail.Where(x => x.PId == item.Id).ToList();
item.details = details;
}
}
rtn.LogList = list;
return rtn;
}
@ -234,6 +270,8 @@ namespace Myshipping.Application
newCtn.SLOT_ID = model.Id;
await _repCtn.InsertAsync(newCtn);
}
await InsLog("Add", model.Id, "新增舱位");
}
else if (dto.OpType == "update")
{
@ -243,6 +281,7 @@ namespace Myshipping.Application
throw Oops.Bah($"未找到订舱编号为 {dto.DataObj.SLOT_BOOKING_NO} 的数据");
}
var oldObj = model.Adapt<BookingSlotBaseApiSaveDto>();
dto.DataObj.Adapt(model);
await _repBase.UpdateAsync(model);
@ -253,6 +292,8 @@ namespace Myshipping.Application
newCtn.SLOT_ID = model.Id;
await _repCtn.InsertAsync(newCtn);
}
await InsLog("Update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, "CtnList");
}
else if (dto.OpType == "del")
{
@ -271,6 +312,8 @@ namespace Myshipping.Application
ctn.IsDeleted = true;
await _repCtn.UpdateAsync(ctn);
}
await InsLog("Del", model.Id, "取消舱位");
}
//更新库存
@ -290,6 +333,118 @@ namespace Myshipping.Application
}
#endregion
/// <summary>
/// 插入日志(仅显示一条文本信息)
/// </summary>
/// <param name="type"></param>
/// <param name="slotId"></param>
/// <param name="status"></param>
/// <returns></returns>
[NonAction]
private async Task InsLog(string type, long slotId, string status)
{
var bid = await _repBookingLog.InsertReturnSnowflakeIdAsync(new BookingLog
{
Type = type,
BookingId = slotId,
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
CreatedTime = DateTime.Now,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name,
Module = "Slot"
});
if (!string.IsNullOrEmpty(status))
{
await _repBookingLogDetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
{
PId = bid,
Field = "",
OldValue = "",
NewValue = status,
});
}
}
/// <summary>
/// 插入日志(比对修改内容)
/// </summary>
/// <param name="type"></param>
/// <param name="id"></param>
/// <param name="objType"></param>
/// <param name="objOld"></param>
/// <param name="objNew"></param>
/// <param name="excepProp"></param>
/// <returns></returns>
[NonAction]
private async Task InsLog(string type, long id, Type objType, object objOld, object objNew, params string[] excepProp)
{
var bid = await _repBookingLog.InsertReturnSnowflakeIdAsync(new BookingLog
{
Type = type,
BookingId = id,
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
CreatedTime = DateTime.Now,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name,
Module = "Slot"
});
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(objType))
{
if (excepProp.Contains(descriptor.Name))
{
continue;
}
var compResult = false;
var oldValue = descriptor.GetValue(objOld);
var newValue = descriptor.GetValue(objNew);
if (oldValue != null && newValue != null)
{
if (descriptor.PropertyType == typeof(string))
{
compResult = oldValue.ToString() == newValue.ToString();
}
else if (descriptor.PropertyType == typeof(DateTime) || descriptor.PropertyType == typeof(DateTime?))
{
compResult = Convert.ToDateTime(oldValue) == Convert.ToDateTime(newValue);
}
else if (descriptor.PropertyType == typeof(decimal) || descriptor.PropertyType == typeof(float) || descriptor.PropertyType == typeof(double)
|| descriptor.PropertyType == typeof(decimal?) || descriptor.PropertyType == typeof(float?) || descriptor.PropertyType == typeof(double?))
{
compResult = Convert.ToDecimal(oldValue) == Convert.ToDecimal(newValue);
}
else if (descriptor.PropertyType == typeof(int) || descriptor.PropertyType == typeof(long)
|| descriptor.PropertyType == typeof(int?) || descriptor.PropertyType == typeof(long?))
{
compResult = Convert.ToInt64(oldValue) == Convert.ToInt64(newValue);
}
}
else
{
compResult = oldValue == newValue;
}
if (!compResult)
{
var fieldName = descriptor.Name;
if (!string.IsNullOrWhiteSpace(descriptor.Description))
{
fieldName = descriptor.Description;
}
await _repBookingLogDetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
{
PId = bid,
Field = fieldName,
OldValue = $"{oldValue}",
NewValue = $"{newValue}",
});
}
}
}
#endregion
#region 库存
@ -327,6 +482,96 @@ namespace Myshipping.Application
//更新库存
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", input));
}
/// <summary>
/// 查询可用的舱位及箱子
/// </summary>
[HttpGet("/BookingSlot/getAvailableSlots")]
public async Task<List<BookingSlotAvailableDto>> GetAvailableSlots([FromQuery] BookingSlotBaseDto input)
{
string[] ctnCodeList = null;
if (!string.IsNullOrEmpty(input.CTN_STAT))
{
ctnCodeList = input.CTN_STAT.Split(',');
}
// 1. 【舱位基础表】与【箱子表】做关联并根据【舱位主键】、【箱型】做分组统计出【总的箱量】作为queryable1
var queryable1 = _repBase.Context.Queryable<BookingSlotBase, BookingSlotCtn>((bas, ctn) => bas.Id == ctn.SLOT_ID)
.WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), bas => bas.PORTLOAD.Contains(input.PORTLOAD))
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), bas => bas.PORTLOAD.Contains(input.PORTLOAD))
.WhereIF(!string.IsNullOrEmpty(input.VESSEL), bas => bas.VESSEL.Contains(input.VESSEL))
.WhereIF(!string.IsNullOrEmpty(input.VOYNO), bas => bas.VOYNO.Contains(input.VOYNO))
.WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), bas => bas.CARRIAGE_TYPE == input.CARRIAGE_TYPE)
.WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), bas => bas.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE)
.WhereIF(ctnCodeList != null, (bas, ctn) => ctnCodeList.Contains(ctn.CTNCODE))
.GroupBy((bas, ctn) => new
{
bas.Id,
ctn.CTNCODE
})
.Select((bas, ctn) => new
{
id = bas.Id,
ctnCode = ctn.CTNCODE,
numAll = SqlFunc.AggregateSum(ctn.CTNNUM)
})
.MergeTable();
// 2. 【已引入舱位表】与【已使用的箱子表】做关联并根据【舱位主键】、【箱型】做分组统计出【已使用的箱量】作为queryable2
var queryable2 = _repBase.Context.Queryable<BookingSlotAllocation, BookingSlotAllocationCtn>((alc, ctn) => alc.Id == ctn.SLOT_ALLOC_ID)
.GroupBy((alc, ctn) => new
{
alc.BOOKING_SLOT_ID,
ctn.CTNCODE
})
.Select((alc, ctn) => new
{
id = alc.BOOKING_SLOT_ID,
ctnCode = ctn.CTNCODE,
numUse = SqlFunc.AggregateSum(ctn.CTNNUM)
})
.MergeTable();
// 3. 将queryable1 左连接 queryable2使用【总的箱量】减去【已使用的箱量】得到【剩余的箱量】添加【剩余的箱量】> 0 的条件作为queryable3
var queryable3 = queryable1.LeftJoin(queryable2, (q1, q2) => q1.id == q2.id && q1.ctnCode == q2.ctnCode)
.Select((q1, q2) => new
{
q1.id,
q1.ctnCode,
numResidue = SqlFunc.IsNull(q1.numAll - q2.numUse, q1.numAll)
})
.MergeTable()
.Where(r => r.numResidue > 0);
// 4. 执行ToList(),得到可用的【舱位主键】、【箱型】、【箱量】列表
var canUselist = await queryable3.ToListAsync();
// 查询舱位列表
var baseIdList = canUselist.Select(c => c.id);
List<BookingSlotBase> baseList = await _repBase.AsQueryable()
.Where(u => baseIdList.Contains(u.Id))
.ToListAsync();
List<Core.Entity.CodeCtn> ctnCodeCache = await _cache.GetAllCodeCtn();
// 构建结果
List<BookingSlotAvailableDto> result = baseList.Adapt<List<BookingSlotAvailableDto>>();
foreach (var item in result)
{
var ctnList = canUselist.Where(c => c.id == item.Id).ToList();
if (ctnList?.Any() == true)
{
item.CtnList = ctnList.Select(c => new BookingSlotCtnDto()
{
CTNCODE = c.ctnCode,
CTNNUM = c.numResidue,
CTNALL = ctnCodeCache.FirstOrDefault(e => e.Code == c.ctnCode)?.Name ?? throw new Exception($"舱位信息中存在未收录的箱型:{c.ctnCode},需要在箱型字典中补充"),
}).ToList();
}
}
return result;
}
#endregion
}
}

@ -1,7 +1,9 @@
using Myshipping.Core;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
@ -108,160 +110,214 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// <summary>
/// 舱位提单号
/// </summary>
[Description("舱位提单号")]
public string SLOT_BOOKING_NO { get; set; }
/// <summary>
/// 船名
/// </summary>
public string VESSEL { get; set; }
/// <summary>
/// 航次号
/// </summary>
public string VOYNO { get; set; }
/// <summary>
/// 合约号
/// </summary>
[Description("合约号")]
public string CONTRACT_NO { get; set; }
/// <summary>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
public string CARRIAGE_TYPE { get; set; }
/// <summary>
/// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// 订舱抬头
/// </summary>
public string CARRIAGE_TYPE_NAME { get; set; }
[Description("订舱抬头")]
public string BOOKING_PARTY { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// 船名
/// </summary>
public string BOOKING_SLOT_TYPE { get; set; }
[Description("船名")]
public string VESSEL { get; set; }
/// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// 航次号
/// </summary>
public string BOOKING_SLOT_TYPE_NAME { get; set; }
[Description("航次号")]
public string VOYNO { get; set; }
/// <summary>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// 预计开船日期
/// </summary>
public string ISSUETYPE { get; set; }
[Description("预计开船日期")]
public DateTime? ETD { get; set; }
/// <summary>
/// 订舱抬头
/// 预计到港日期
/// </summary>
public string BOOKING_PARTY { get; set; }
[Description("预计到港日期")]
public DateTime? ETA { get; set; }
/// <summary>
/// 船公司代号
/// 收货地代码
/// </summary>
public string CARRIERID { get; set; }
[Description("收货地代码")]
public string PLACERECEIPTID { get; set; }
/// <summary>
/// 船公司
/// 收货地
/// </summary>
public string CARRIER { get; set; }
[Description("收货地")]
public string PLACERECEIPT { get; set; }
/// <summary>
/// 预计开船日期
/// 交货地代码
/// </summary>
public DateTime? ETD { get; set; }
[Description("交货地代码")]
public string PLACEDELIVERYID { get; set; }
/// <summary>
/// 预计到港日期
/// 交货地
/// </summary>
public DateTime? ETA { get; set; }
[Description("交货地")]
public string PLACEDELIVERY { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
[Description("装货港代码")]
public string PORTLOADID { get; set; }
/// <summary>
/// 装货港
/// </summary>
[Description("装货港")]
public string PORTLOAD { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
[Description("卸货港代码")]
public string PORTDISCHARGEID { get; set; }
/// <summary>
/// 卸货港
/// </summary>
[Description("卸货港")]
public string PORTDISCHARGE { get; set; }
/// <summary>
/// 中转港1
/// </summary>
[Description("中转港1")]
public string TRANSFER_PORT_1 { get; set; }
/// <summary>
/// 中转港2
/// </summary>
[Description("中转港2")]
public string TRANSFER_PORT_2 { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
[Description("船公司代号")]
public string CARRIERID { get; set; }
/// <summary>
/// 船公司
/// </summary>
[Description("船公司")]
public string CARRIER { get; set; }
/// <summary>
/// 航线代码(船公司)
/// </summary>
[Description("航线代码(船公司)")]
public string LANECODE { get; set; }
/// <summary>
/// 航线名称(船公司)
/// </summary>
[Description("航线名称(船公司)")]
public string LANENAME { get; set; }
/// <summary>
/// 所在周数
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
public string WEEK_AT { get; set; }
[Description("承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转")]
public string CARRIAGE_TYPE { get; set; }
/// <summary>
/// 箱使天数
/// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public int DETENSION_FREE_DAYS { get; set; }
[Description("承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string CARRIAGE_TYPE_NAME { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[Description("订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string BOOKING_SLOT_TYPE { get; set; }
/// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[Description("订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string BOOKING_SLOT_TYPE_NAME { get; set; }
/// <summary>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// </summary>
[Description("签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;")]
public string ISSUETYPE { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
[Description("箱型箱量")]
public string CTN_STAT { get; set; }
/// <summary>
/// 所在周数
/// </summary>
[Description("所在周数")]
public string WEEK_AT { get; set; }
/// <summary>
/// 箱使天数
/// </summary>
[Description("箱使天数")]
public int DETENSION_FREE_DAYS { get; set; }
/// <summary>
/// 样单截止日期
/// </summary>
[Description("样单截止日期")]
public DateTime? SI_CUT_DATE { get; set; }
/// <summary>
/// 截港截止日期
/// 截港时间
/// </summary>
[Description("截港时间")]
public DateTime? CY_CUT_DATE { get; set; }
/// <summary>
/// VGM截止日期
/// </summary>
[Description("VGM截止日期")]
public DateTime? VGM_SUBMISSION_CUT_DATE { get; set; }
/// <summary>
/// MDGF截止
/// MDGF提交截止时间
/// </summary>
[Description("MDGF提交截止时间")]
public DateTime? MDGF_CUT_DATE { get; set; }
/// <summary>
/// 舱单(入港)截止时间
/// 舱单截止时间
/// </summary>
[Description("舱单截止时间")]
public DateTime? MANIFEST_CUT_DATE { get; set; }
}
/// <summary>
/// 保存舱位dto
/// 保存舱位输入
/// </summary>
public class BookingSlotBaseSaveDto : BookingSlotBaseDto
public class BookingSlotBaseSaveInput : BookingSlotBaseDto
{
/// <summary>
/// Id
@ -275,6 +331,17 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
public List<BookingSlotCtnSaveInput> CtnList { get; set; }
}
/// <summary>
/// 保存舱位输出
/// </summary>
public class BookingSlotBaseSaveOutput : BookingSlotBaseSaveInput
{
/// <summary>
/// 日志
/// </summary>
public List<BookingLogDto> LogList { get; set; }
}
public class BookingSlotBaseListOutput : BookingSlotBaseDto
{
/// <summary>
@ -283,6 +350,61 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
public long Id { get; set; }
/// <summary>
/// VGM回执
/// </summary>
[Description("VGM回执")]
public string VGM_RLT_STAT { get; set; }
/// <summary>
/// SI回执
/// </summary>
[Description("SI回执")]
public string SI_RLT_STAT { get; set; }
/// <summary>
/// 提箱回执
/// </summary>
[Description("提箱回执")]
public string TAKE_CTN_RLT_STAT { get; set; }
/// <summary>
/// 还箱回执
/// </summary>
[Description("还箱回执")]
public string RETURN_CTN_RLT_STAT { get; set; }
/// <summary>
/// 预甩回执
/// </summary>
[Description("预甩回执")]
public string NOMINATION_RLT_STAT { get; set; }
/// <summary>
/// 舱位变更回执
/// </summary>
[Description("舱位变更回执")]
public string AMENDMENT_RLT_STAT { get; set; }
/// <summary>
/// 舱位取消回执
/// </summary>
[Description("舱位取消回执")]
public string CANCELLATION_RLT_STAT { get; set; }
/// <summary>
/// 目的港卸船未提货回执
/// </summary>
[Description("目的港卸船未提货回执")]
public string DISCHARGE_FULL_RLT_STAT { get; set; }
/// <summary>
/// 目的港提箱未还空箱回执
/// </summary>
[Description("目的港提箱未还空箱回执")]
public string GATE_OUTFULL_RLT_STAT { get; set; }
/// <summary>
/// 创建时间
/// </summary>
@ -331,4 +453,20 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary>
public BookingSlotBaseApiSaveDto DataObj { get; set; }
}
/// <summary>
/// 查询可用舱位信息Dto
/// </summary>
public class BookingSlotAvailableDto: BookingSlotBaseDto
{
/// <summary>
/// Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 舱位箱信息
/// </summary>
public List<BookingSlotCtnDto> CtnList { get; set; }
}
}

Loading…
Cancel
Save