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,14 +108,34 @@ 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();
// 如果舱位未被引用过,可以直接确定库存
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(); stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count();
// 订舱引用表主键列表
var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList(); var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList();
// 已使用的箱型箱量 // 已使用的箱型箱量
@ -151,6 +175,8 @@ namespace Myshipping.Application.Event
// 剩余箱数 // 剩余箱数
stockObj.REMAIN_CTNS_NUM = stockObj.TOTAL_CTNS - stockObj.USE_CTNS_NUM; 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; }
} }
} }

@ -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
})); }));
} }
} }

@ -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