jianghaiqing 9 months ago
commit 9316b71be2

@ -20,109 +20,120 @@ namespace Myshipping.Application
/// 船名 /// 船名
/// </summary> /// </summary>
[SugarColumn(ColumnName = "VESSEL")] [SugarColumn(ColumnName = "VESSEL")]
public string VESSEL{ get; set; } public string VESSEL { get; set; }
/// <summary> /// <summary>
/// 航次号 /// 航次号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "VOYNO")] [SugarColumn(ColumnName = "VOYNO")]
public string VOYNO{ get; set; } public string VOYNO { get; set; }
/// <summary> /// <summary>
/// 合约号 /// 合约号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CONTRACT_NO")] [SugarColumn(ColumnName = "CONTRACT_NO")]
public string CONTRACT_NO{ get; set; } public string CONTRACT_NO { get; set; }
/// <summary> /// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")] [SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")]
public string BOOKING_SLOT_TYPE{ get; set; } public string BOOKING_SLOT_TYPE { get; set; }
/// <summary> /// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")] [SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")]
public string BOOKING_SLOT_TYPE_NAME{ get; set; } public string BOOKING_SLOT_TYPE_NAME { get; set; }
/// <summary> /// <summary>
/// 订舱抬头 /// 订舱抬头
/// </summary> /// </summary>
[SugarColumn(ColumnName = "BOOKING_PARTY")] [SugarColumn(ColumnName = "BOOKING_PARTY")]
public string BOOKING_PARTY{ get; set; } public string BOOKING_PARTY { get; set; }
/// <summary> /// <summary>
/// 船公司代号 /// 船公司代号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CARRIERID")] [SugarColumn(ColumnName = "CARRIERID")]
public string CARRIERID{ get; set; } public string CARRIERID { get; set; }
/// <summary> /// <summary>
/// 船公司 /// 船公司
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CARRIER")] [SugarColumn(ColumnName = "CARRIER")]
public string CARRIER{ get; set; } public string CARRIER { get; set; }
/// <summary> /// <summary>
/// 预计开船日期 /// 预计开船日期
/// </summary> /// </summary>
[SugarColumn(ColumnName = "ETD")] [SugarColumn(ColumnName = "ETD")]
public DateTime? ETD{ get; set; } public DateTime? ETD { get; set; }
/// <summary> /// <summary>
/// 预计到港日期 /// 预计到港日期
/// </summary> /// </summary>
[SugarColumn(ColumnName = "ETA")] [SugarColumn(ColumnName = "ETA")]
public DateTime? ETA{ get; set; } public DateTime? ETA { get; set; }
/// <summary>
/// 收货地
/// </summary>
[SugarColumn(ColumnName = "PLACERECEIPT")]
public string PLACERECEIPT { get; set; }
/// <summary>
/// 交货地
/// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERY")]
public string PLACEDELIVERY { get; set; }
/// <summary> /// <summary>
/// 航线代码(船公司) /// 航线代码(船公司)
/// </summary> /// </summary>
[SugarColumn(ColumnName = "LANECODE")] [SugarColumn(ColumnName = "LANECODE")]
public string LANECODE{ get; set; } public string LANECODE { get; set; }
/// <summary> /// <summary>
/// 航线名称(船公司) /// 航线名称(船公司)
/// </summary> /// </summary>
[SugarColumn(ColumnName = "LANENAME")] [SugarColumn(ColumnName = "LANENAME")]
public string LANENAME{ get; set; } public string LANENAME { get; set; }
/// <summary> /// <summary>
/// 所在周数 /// 所在周数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "WEEK_AT")] [SugarColumn(ColumnName = "WEEK_AT")]
public string WEEK_AT{ get; set; } public string WEEK_AT { get; set; }
/// <summary> /// <summary>
/// 箱型箱量 /// 箱型箱量
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CTN_STAT")] [SugarColumn(ColumnName = "CTN_STAT")]
public string CTN_STAT{ get; set; } public string CTN_STAT { get; set; }
/// <summary> /// <summary>
/// 使用箱型箱量 /// 使用箱型箱量
/// </summary> /// </summary>
[SugarColumn(ColumnName = "USE_CTN_STAT")] [SugarColumn(ColumnName = "USE_CTN_STAT")]
public string USE_CTN_STAT{ get; set; } public string USE_CTN_STAT { get; set; }
/// <summary> /// <summary>
/// 剩余箱型箱量 /// 剩余箱型箱量
/// </summary> /// </summary>
[SugarColumn(ColumnName = "REMAIN_CTN_STAT")] [SugarColumn(ColumnName = "REMAIN_CTN_STAT")]
public string REMAIN_CTN_STAT{ get; set; } public string REMAIN_CTN_STAT { get; set; }
/// <summary> /// <summary>
/// 总舱位数 /// 总舱位数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TOTAL_ORDERS")] [SugarColumn(ColumnName = "TOTAL_ORDERS")]
public int TOTAL_ORDERS{ get; set; } public int TOTAL_ORDERS { get; set; }
/// <summary> /// <summary>
/// 使用舱位数 /// 使用舱位数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "USE_NUM")] [SugarColumn(ColumnName = "USE_NUM")]
public int USE_NUM{ get; set; } public int USE_NUM { get; set; }
/// <summary> /// <summary>
/// 取消舱位数 /// 取消舱位数
@ -134,25 +145,25 @@ namespace Myshipping.Application
/// 总箱数 /// 总箱数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TOTAL_CTNS")] [SugarColumn(ColumnName = "TOTAL_CTNS")]
public int TOTAL_CTNS{ get; set; } public int TOTAL_CTNS { get; set; }
/// <summary> /// <summary>
/// 使用箱数 /// 使用箱数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "USE_CTNS_NUM")] [SugarColumn(ColumnName = "USE_CTNS_NUM")]
public int USE_CTNS_NUM{ get; set; } public int USE_CTNS_NUM { get; set; }
/// <summary> /// <summary>
/// 剩余箱数 /// 剩余箱数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "REMAIN_CTNS_NUM")] [SugarColumn(ColumnName = "REMAIN_CTNS_NUM")]
public int REMAIN_CTNS_NUM{ get; set; } public int REMAIN_CTNS_NUM { get; set; }
/// <summary> /// <summary>
/// 租户名称 /// 租户名称
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TenantName")] [SugarColumn(ColumnName = "TenantName")]
public string TenantName{ get; set; } public string TenantName { get; set; }
} }
} }

@ -58,7 +58,9 @@ namespace Myshipping.Application.Event
&& x.VOYNO == paraObj.VOYNO && x.VOYNO == paraObj.VOYNO
&& x.CONTRACT_NO == paraObj.CONTRACT_NO && x.CONTRACT_NO == paraObj.CONTRACT_NO
&& x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE && x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE
&& x.CARRIERID == paraObj.CARRIERID) && x.CARRIERID == paraObj.CARRIERID
&& x.PLACEDELIVERY == paraObj.PLACEDELIVERY
&& x.PLACERECEIPT == paraObj.PLACERECEIPT)
.OrderByDescending(x => x.UpdatedTime) .OrderByDescending(x => x.UpdatedTime)
.ToListAsync(); .ToListAsync();
if (!baseList.Any()) if (!baseList.Any())
@ -73,7 +75,9 @@ namespace Myshipping.Application.Event
&& x.VOYNO == paraObj.VOYNO && x.VOYNO == paraObj.VOYNO
&& x.CONTRACT_NO == paraObj.CONTRACT_NO && x.CONTRACT_NO == paraObj.CONTRACT_NO
&& x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE && x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE
&& x.CARRIERID == paraObj.CARRIERID); && x.CARRIERID == paraObj.CARRIERID
&& x.PLACEDELIVERY == paraObj.PLACEDELIVERY
&& x.PLACERECEIPT == paraObj.PLACERECEIPT);
if (stockObj == null) if (stockObj == null)
{ {
stockObj = new BookingSlotStock(); stockObj = new BookingSlotStock();
@ -104,18 +108,38 @@ namespace Myshipping.Application.Event
// 总箱数 // 总箱数
stockObj.TOTAL_CTNS = ctnAllList.Sum(x => x.CTNNUM); stockObj.TOTAL_CTNS = ctnAllList.Sum(x => x.CTNNUM);
// 订舱引用表主键与订舱主表主键
var lstAllocKeyList = await _repAlloc.AsQueryable() var lstAllocKeyList = await _repAlloc.AsQueryable()
.Filter(null, true) .Filter(null, true)
.Where(x => !x.IsDeleted && lstBaseId.Contains(x.BOOKING_SLOT_ID)) .Where(x => !x.IsDeleted && lstBaseId.Contains(x.BOOKING_SLOT_ID))
.Select(x => new { x.Id, x.BOOKING_SLOT_ID }) .Select(x => new { x.Id, x.BOOKING_SLOT_ID })
.ToListAsync(); .ToListAsync();
// 已使用舱位数
stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count();
var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList(); // 如果舱位未被引用过,可以直接确定库存
if (!lstAllocKeyList.Any())
{
// 已使用舱位数
stockObj.USE_NUM = 0;
// 已使用的箱型箱量
stockObj.USE_CTN_STAT = "";
// 已使用的箱数
stockObj.USE_CTNS_NUM = 0;
// 剩余的箱型箱量
stockObj.REMAIN_CTN_STAT = stockObj.CTN_STAT;
// 剩余箱数
stockObj.REMAIN_CTNS_NUM = stockObj.TOTAL_CTNS;
}
else
{
// 已使用舱位数
stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count();
// 订舱引用表主键列表
var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList();
// 已使用的箱型箱量 // 已使用的箱型箱量
var userCtnList = await _repAllocCtn.AsQueryable() var userCtnList = await _repAllocCtn.AsQueryable()
.Filter(null, true) .Filter(null, true)
.Where(x => !x.IsDeleted && lstAllocIdList.Contains(x.SLOT_ALLOC_ID)) .Where(x => !x.IsDeleted && lstAllocIdList.Contains(x.SLOT_ALLOC_ID))
.GroupBy(x => x.CTNALL) .GroupBy(x => x.CTNALL)
@ -124,33 +148,35 @@ namespace Myshipping.Application.Event
x.CTNALL, x.CTNALL,
CTNNUM = SqlFunc.AggregateSum(x.CTNNUM) CTNNUM = SqlFunc.AggregateSum(x.CTNNUM)
}).ToListAsync(); }).ToListAsync();
stockObj.USE_CTN_STAT = string.Join(' ', userCtnList.Select(c => c.CTNALL + "*" + c.CTNNUM)); stockObj.USE_CTN_STAT = string.Join(' ', userCtnList.Select(c => c.CTNALL + "*" + c.CTNNUM));
// 已使用的箱数 // 已使用的箱数
stockObj.USE_CTNS_NUM = userCtnList.Sum(x => x.CTNNUM); stockObj.USE_CTNS_NUM = userCtnList.Sum(x => x.CTNNUM);
// 剩余的箱型箱量 // 剩余的箱型箱量
Dictionary<string, int> remainCtnList = new(ctnAllList.Count); Dictionary<string, int> remainCtnList = new(ctnAllList.Count);
foreach (var item in ctnAllList) foreach (var item in ctnAllList)
{
var useItem = userCtnList.FirstOrDefault(x => x.CTNALL == item.CTNALL);
if (useItem == null)
{
remainCtnList.Add(item.CTNALL, item.CTNNUM);
}
else
{ {
int remainCtnNum = item.CTNNUM - useItem.CTNNUM; var useItem = userCtnList.FirstOrDefault(x => x.CTNALL == item.CTNALL);
if (remainCtnNum > 0) if (useItem == null)
{ {
remainCtnList.Add(item.CTNALL, remainCtnNum); remainCtnList.Add(item.CTNALL, item.CTNNUM);
}
else
{
int remainCtnNum = item.CTNNUM - useItem.CTNNUM;
if (remainCtnNum > 0)
{
remainCtnList.Add(item.CTNALL, remainCtnNum);
}
} }
} }
stockObj.REMAIN_CTN_STAT = string.Join(' ', remainCtnList.Select(x => x.Key + "*" + x.Value));
// 剩余箱数
stockObj.REMAIN_CTNS_NUM = stockObj.TOTAL_CTNS - stockObj.USE_CTNS_NUM;
} }
stockObj.REMAIN_CTN_STAT = string.Join(' ', remainCtnList.Select(x => x.Key + "*" + x.Value));
// 剩余箱数
stockObj.REMAIN_CTNS_NUM = stockObj.TOTAL_CTNS - stockObj.USE_CTNS_NUM;
await _repStock.UpdateAsync(stockObj); await _repStock.UpdateAsync(stockObj);
} }
@ -186,5 +212,14 @@ namespace Myshipping.Application.Event
/// 船公司代号 /// 船公司代号
/// </summary> /// </summary>
public string CARRIERID { get; set; } public string CARRIERID { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PLACEDELIVERY { get; set; }
} }
} }

@ -140,7 +140,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingGoodsStatusSubscribe> _repBookingStatusSubscribe; private readonly SqlSugarRepository<BookingGoodsStatusSubscribe> _repBookingStatusSubscribe;
private readonly SqlSugarRepository<BookingExtendState> _repextendstate; private readonly SqlSugarRepository<BookingExtendState> _repextendstate;
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService; private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
private readonly IDjyUserConfigService _djyUserConfigService; private readonly IDjyUserConfigService _djyUserConfigService;
@ -161,7 +161,7 @@ namespace Myshipping.Application
const string CONST_ONE_SOFILE_CATE_CODE = "one_so_file_template"; const string CONST_ONE_SOFILE_CATE_CODE = "one_so_file_template";
const string PRINT_DATASOURCE_KEY = "booking_order"; const string PRINT_DATASOURCE_KEY = "booking_order";
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep, public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep,
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
@ -11437,7 +11437,9 @@ namespace Myshipping.Application
CARRIERID = item.CARRIERID, CARRIERID = item.CARRIERID,
CONTRACT_NO = item.CONTRACT_NO, CONTRACT_NO = item.CONTRACT_NO,
VESSEL = item.VESSEL, VESSEL = item.VESSEL,
VOYNO = item.VOYNO VOYNO = item.VOYNO,
PLACERECEIPT = item.PLACERECEIPT,
PLACEDELIVERY = item.PLACEDELIVERY
})); }));
} }
} }
@ -11888,7 +11890,7 @@ namespace Myshipping.Application
#endregion #endregion
} }
} }

@ -169,7 +169,9 @@ namespace Myshipping.Application
CARRIERID = model.CARRIERID, CARRIERID = model.CARRIERID,
CONTRACT_NO = model.CONTRACT_NO, CONTRACT_NO = model.CONTRACT_NO,
VESSEL = model.VESSEL, VESSEL = model.VESSEL,
VOYNO = model.VOYNO VOYNO = model.VOYNO,
PLACERECEIPT = model.PLACERECEIPT,
PLACEDELIVERY = model.PLACEDELIVERY
})); }));
return await Detail(model.Id); return await Detail(model.Id);
@ -491,7 +493,9 @@ namespace Myshipping.Application
CARRIERID = model.CARRIERID, CARRIERID = model.CARRIERID,
CONTRACT_NO = model.CONTRACT_NO, CONTRACT_NO = model.CONTRACT_NO,
VESSEL = model.VESSEL, VESSEL = model.VESSEL,
VOYNO = model.VOYNO VOYNO = model.VOYNO,
PLACERECEIPT = model.PLACERECEIPT,
PLACEDELIVERY = model.PLACEDELIVERY
})); }));
} }
else else
@ -873,7 +877,9 @@ namespace Myshipping.Application
CARRIERID = latestSlot.CARRIERID, CARRIERID = latestSlot.CARRIERID,
CONTRACT_NO = latestSlot.CONTRACT_NO, CONTRACT_NO = latestSlot.CONTRACT_NO,
VESSEL = latestSlot.VESSEL, VESSEL = latestSlot.VESSEL,
VOYNO = latestSlot.VOYNO VOYNO = latestSlot.VOYNO,
PLACERECEIPT = latestSlot.PLACERECEIPT,
PLACEDELIVERY = latestSlot.PLACEDELIVERY
})); }));
} }
} }

@ -165,6 +165,17 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// 剩余箱数 /// 剩余箱数
/// </summary> /// </summary>
public int REMAIN_CTNS_NUM { get; set; } public int REMAIN_CTNS_NUM { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PLACEDELIVERY { get; set; }
} }

Loading…
Cancel
Save