jianghaiqing 9 months ago
commit 9316b71be2

@ -20,109 +20,120 @@ namespace Myshipping.Application
/// 船名
/// </summary>
[SugarColumn(ColumnName = "VESSEL")]
public string VESSEL{ get; set; }
public string VESSEL { get; set; }
/// <summary>
/// 航次号
/// </summary>
[SugarColumn(ColumnName = "VOYNO")]
public string VOYNO{ get; set; }
public string VOYNO { get; set; }
/// <summary>
/// 合约号
/// </summary>
[SugarColumn(ColumnName = "CONTRACT_NO")]
public string CONTRACT_NO{ get; set; }
public string CONTRACT_NO { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")]
public string BOOKING_SLOT_TYPE{ get; set; }
public string BOOKING_SLOT_TYPE { get; set; }
/// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")]
public string BOOKING_SLOT_TYPE_NAME{ get; set; }
public string BOOKING_SLOT_TYPE_NAME { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
[SugarColumn(ColumnName = "BOOKING_PARTY")]
public string BOOKING_PARTY{ get; set; }
public string BOOKING_PARTY { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
[SugarColumn(ColumnName = "CARRIERID")]
public string CARRIERID{ get; set; }
public string CARRIERID { get; set; }
/// <summary>
/// 船公司
/// </summary>
[SugarColumn(ColumnName = "CARRIER")]
public string CARRIER{ get; set; }
public string CARRIER { get; set; }
/// <summary>
/// 预计开船日期
/// </summary>
[SugarColumn(ColumnName = "ETD")]
public DateTime? ETD{ get; set; }
public DateTime? ETD { get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
[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>
[SugarColumn(ColumnName = "LANECODE")]
public string LANECODE{ get; set; }
public string LANECODE { get; set; }
/// <summary>
/// 航线名称(船公司)
/// </summary>
[SugarColumn(ColumnName = "LANENAME")]
public string LANENAME{ get; set; }
public string LANENAME { get; set; }
/// <summary>
/// 所在周数
/// </summary>
[SugarColumn(ColumnName = "WEEK_AT")]
public string WEEK_AT{ get; set; }
public string WEEK_AT { get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
[SugarColumn(ColumnName = "CTN_STAT")]
public string CTN_STAT{ get; set; }
public string CTN_STAT { get; set; }
/// <summary>
/// 使用箱型箱量
/// </summary>
[SugarColumn(ColumnName = "USE_CTN_STAT")]
public string USE_CTN_STAT{ get; set; }
public string USE_CTN_STAT { get; set; }
/// <summary>
/// 剩余箱型箱量
/// </summary>
[SugarColumn(ColumnName = "REMAIN_CTN_STAT")]
public string REMAIN_CTN_STAT{ get; set; }
public string REMAIN_CTN_STAT { get; set; }
/// <summary>
/// 总舱位数
/// </summary>
[SugarColumn(ColumnName = "TOTAL_ORDERS")]
public int TOTAL_ORDERS{ get; set; }
public int TOTAL_ORDERS { get; set; }
/// <summary>
/// 使用舱位数
/// </summary>
[SugarColumn(ColumnName = "USE_NUM")]
public int USE_NUM{ get; set; }
public int USE_NUM { get; set; }
/// <summary>
/// 取消舱位数
@ -134,25 +145,25 @@ namespace Myshipping.Application
/// 总箱数
/// </summary>
[SugarColumn(ColumnName = "TOTAL_CTNS")]
public int TOTAL_CTNS{ get; set; }
public int TOTAL_CTNS { get; set; }
/// <summary>
/// 使用箱数
/// </summary>
[SugarColumn(ColumnName = "USE_CTNS_NUM")]
public int USE_CTNS_NUM{ get; set; }
public int USE_CTNS_NUM { get; set; }
/// <summary>
/// 剩余箱数
/// </summary>
[SugarColumn(ColumnName = "REMAIN_CTNS_NUM")]
public int REMAIN_CTNS_NUM{ get; set; }
public int REMAIN_CTNS_NUM { get; set; }
/// <summary>
/// 租户名称
/// </summary>
[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.CONTRACT_NO == paraObj.CONTRACT_NO
&& 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)
.ToListAsync();
if (!baseList.Any())
@ -73,7 +75,9 @@ namespace Myshipping.Application.Event
&& x.VOYNO == paraObj.VOYNO
&& x.CONTRACT_NO == paraObj.CONTRACT_NO
&& 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)
{
stockObj = new BookingSlotStock();
@ -104,18 +108,38 @@ namespace Myshipping.Application.Event
// 总箱数
stockObj.TOTAL_CTNS = ctnAllList.Sum(x => x.CTNNUM);
// 订舱引用表主键与订舱主表主键
var lstAllocKeyList = await _repAlloc.AsQueryable()
.Filter(null, true)
.Where(x => !x.IsDeleted && lstBaseId.Contains(x.BOOKING_SLOT_ID))
.Select(x => new { x.Id, x.BOOKING_SLOT_ID })
.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)
.Where(x => !x.IsDeleted && lstAllocIdList.Contains(x.SLOT_ALLOC_ID))
.GroupBy(x => x.CTNALL)
@ -124,33 +148,35 @@ namespace Myshipping.Application.Event
x.CTNALL,
CTNNUM = SqlFunc.AggregateSum(x.CTNNUM)
}).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);
foreach (var item in ctnAllList)
{
var useItem = userCtnList.FirstOrDefault(x => x.CTNALL == item.CTNALL);
if (useItem == null)
{
remainCtnList.Add(item.CTNALL, item.CTNNUM);
}
else
// 剩余的箱型箱量
Dictionary<string, int> remainCtnList = new(ctnAllList.Count);
foreach (var item in ctnAllList)
{
int remainCtnNum = item.CTNNUM - useItem.CTNNUM;
if (remainCtnNum > 0)
var useItem = userCtnList.FirstOrDefault(x => x.CTNALL == item.CTNALL);
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);
}
@ -186,5 +212,14 @@ namespace Myshipping.Application.Event
/// 船公司代号
/// </summary>
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<BookingExtendState> _repextendstate;
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
private readonly IDjyUserConfigService _djyUserConfigService;
@ -161,7 +161,7 @@ namespace Myshipping.Application
const string CONST_ONE_SOFILE_CATE_CODE = "one_so_file_template";
const string PRINT_DATASOURCE_KEY = "booking_order";
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep,
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
@ -11437,7 +11437,9 @@ namespace Myshipping.Application
CARRIERID = item.CARRIERID,
CONTRACT_NO = item.CONTRACT_NO,
VESSEL = item.VESSEL,
VOYNO = item.VOYNO
VOYNO = item.VOYNO,
PLACERECEIPT = item.PLACERECEIPT,
PLACEDELIVERY = item.PLACEDELIVERY
}));
}
}
@ -11888,7 +11890,7 @@ namespace Myshipping.Application
#endregion
}
}

@ -169,7 +169,9 @@ namespace Myshipping.Application
CARRIERID = model.CARRIERID,
CONTRACT_NO = model.CONTRACT_NO,
VESSEL = model.VESSEL,
VOYNO = model.VOYNO
VOYNO = model.VOYNO,
PLACERECEIPT = model.PLACERECEIPT,
PLACEDELIVERY = model.PLACEDELIVERY
}));
return await Detail(model.Id);
@ -491,7 +493,9 @@ namespace Myshipping.Application
CARRIERID = model.CARRIERID,
CONTRACT_NO = model.CONTRACT_NO,
VESSEL = model.VESSEL,
VOYNO = model.VOYNO
VOYNO = model.VOYNO,
PLACERECEIPT = model.PLACERECEIPT,
PLACEDELIVERY = model.PLACEDELIVERY
}));
}
else
@ -873,7 +877,9 @@ namespace Myshipping.Application
CARRIERID = latestSlot.CARRIERID,
CONTRACT_NO = latestSlot.CONTRACT_NO,
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>
public int REMAIN_CTNS_NUM { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PLACEDELIVERY { get; set; }
}

Loading…
Cancel
Save