optimize
hao 11 months ago
parent bd55f78c6a
commit 9d3c09b3f2

@ -0,0 +1,255 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Myshipping.Core.Entity;
/*
* @author : whm
* @date : 2024-1-5
* @desc :
*/
namespace Myshipping.Application
{
/// <summary>
/// 舱位分配表
/// </summary>
[SugarTable("booking_slot_allocation", TableDescription = "舱位分配表")]
public class BookingSlotAllocation : DBEntityTenant
{
/// <summary>
/// 舱位主键
/// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_ID")]
public long BOOKING_SLOT_ID{ get; set; }
/// <summary>
/// 订舱主键,关联订舱主表ID
/// </summary>
[SugarColumn(ColumnName = "BOOKING_ID")]
public long BOOKING_ID{ get; set; }
/// <summary>
/// 舱位提单号
/// </summary>
[SugarColumn(ColumnName = "SLOT_BOOKING_NO")]
public string SLOT_BOOKING_NO{ get; set; }
/// <summary>
/// 分配提单号
/// </summary>
[SugarColumn(ColumnName = "ALLO_BILL_NO")]
public string ALLO_BILL_NO{ get; set; }
/// <summary>
/// 最终提单号,分票后船公司重新分配提单号
/// </summary>
[SugarColumn(ColumnName = "FINAL_BILL_NO")]
public string FINAL_BILL_NO{ get; set; }
/// <summary>
/// 合约号
/// </summary>
[SugarColumn(ColumnName = "CONTRACT_NO")]
public string CONTRACT_NO{ get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
[SugarColumn(ColumnName = "BOOKING_PARTY")]
public string BOOKING_PARTY{ get; set; }
/// <summary>
/// 船名
/// </summary>
[SugarColumn(ColumnName = "VESSEL")]
public string VESSEL{ get; set; }
/// <summary>
/// 航次号
/// </summary>
[SugarColumn(ColumnName = "VOYNO")]
public string VOYNO{ get; set; }
/// <summary>
/// 预计开船日期
/// </summary>
[SugarColumn(ColumnName = "ETD")]
public DateTime ETD{ get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
[SugarColumn(ColumnName = "ETA")]
public DateTime ETA{ get; set; }
/// <summary>
/// 收货地代码
/// </summary>
[SugarColumn(ColumnName = "PLACERECEIPTID")]
public string PLACERECEIPTID{ get; set; }
/// <summary>
/// 收货地
/// </summary>
[SugarColumn(ColumnName = "PLACERECEIPT")]
public string PLACERECEIPT{ get; set; }
/// <summary>
/// 交货地代码
/// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERYID")]
public string PLACEDELIVERYID{ get; set; }
/// <summary>
/// 交货地
/// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERY")]
public string PLACEDELIVERY{ get; set; }
/// <summary>
/// 装货港代码
/// </summary>
[SugarColumn(ColumnName = "PORTLOADID")]
public string PORTLOADID{ get; set; }
/// <summary>
/// 装货港
/// </summary>
[SugarColumn(ColumnName = "PORTLOAD")]
public string PORTLOAD{ get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
[SugarColumn(ColumnName = "PORTDISCHARGEID")]
public string PORTDISCHARGEID{ get; set; }
/// <summary>
/// 卸货港
/// </summary>
[SugarColumn(ColumnName = "PORTDISCHARGE")]
public string PORTDISCHARGE{ get; set; }
/// <summary>
/// 中转港1
/// </summary>
[SugarColumn(ColumnName = "TRANSFER_PORT_1")]
public string TRANSFER_PORT_1{ get; set; }
/// <summary>
/// 中转港2
/// </summary>
[SugarColumn(ColumnName = "TRANSFER_PORT_2")]
public string TRANSFER_PORT_2{ get; set; }
/// <summary>
/// 船公司代号
/// </summary>
[SugarColumn(ColumnName = "CARRIERID")]
public string CARRIERID{ get; set; }
/// <summary>
/// 船公司
/// </summary>
[SugarColumn(ColumnName = "CARRIER")]
public string CARRIER{ get; set; }
/// <summary>
/// 航线代码(船公司)
/// </summary>
[SugarColumn(ColumnName = "LANECODE")]
public string LANECODE{ get; set; }
/// <summary>
/// 航线名称(船公司)
/// </summary>
[SugarColumn(ColumnName = "LANENAME")]
public string LANENAME{ get; set; }
/// <summary>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary>
[SugarColumn(ColumnName = "CARRIAGE_TYPE")]
public string CARRIAGE_TYPE{ get; set; }
/// <summary>
/// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")]
public string CARRIAGE_TYPE_NAME{ get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")]
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; }
/// <summary>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// </summary>
[SugarColumn(ColumnName = "ISSUETYPE")]
public string ISSUETYPE{ get; set; }
/// <summary>
/// 箱型箱量
/// </summary>
[SugarColumn(ColumnName = "CTN_STAT")]
public string CTN_STAT{ get; set; }
/// <summary>
/// 所在周数
/// </summary>
[SugarColumn(ColumnName = "WEEK_AT")]
public string WEEK_AT{ get; set; }
/// <summary>
/// 箱使天数
/// </summary>
[SugarColumn(ColumnName = "DETENSION_FREE_DAYS")]
public int DETENSION_FREE_DAYS{ get; set; }
/// <summary>
/// 样单截止日期
/// </summary>
[SugarColumn(ColumnName = "SI_CUT_DATE")]
public DateTime SI_CUT_DATE{ get; set; }
/// <summary>
/// 截港时间
/// </summary>
[SugarColumn(ColumnName = "CY_CUT_DATE")]
public DateTime CY_CUT_DATE{ get; set; }
/// <summary>
/// VGM截止日期
/// </summary>
[SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")]
public DateTime VGM_SUBMISSION_CUT_DATE{ get; set; }
/// <summary>
/// MDGF提交截止时间
/// </summary>
[SugarColumn(ColumnName = "MDGF_CUT_DATE")]
public DateTime MDGF_CUT_DATE{ get; set; }
/// <summary>
/// 舱单截止时间
/// </summary>
[SugarColumn(ColumnName = "MANIFEST_CUT_DATE")]
public DateTime MANIFEST_CUT_DATE{ get; set; }
/// <summary>
/// 租户名称
/// </summary>
[SugarColumn(ColumnName = "TenantName")]
public string TenantName{ get; set; }
}
}

@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Myshipping.Core.Entity;
/*
* @author : whm
* @date : 2024-1-5
* @desc :
*/
namespace Myshipping.Application
{
/// <summary>
/// 舱位分配集装箱表
/// </summary>
[SugarTable("booking_slot_allocation_ctn", TableDescription = "舱位分配集装箱表")]
public class BookingSlotAllocationCtn : DBEntityTenant
{
/// <summary>
/// 舱位分配主键
/// </summary>
[SugarColumn(ColumnName = "SLOT_ALLOC_ID")]
public long SLOT_ALLOC_ID{ get; set; }
/// <summary>
/// 箱型代码
/// </summary>
[SugarColumn(ColumnName = "CTNCODE")]
public string CTNCODE{ get; set; }
/// <summary>
/// 箱型名称
/// </summary>
[SugarColumn(ColumnName = "CTNALL")]
public string CTNALL{ get; set; }
/// <summary>
/// 箱量
/// </summary>
[SugarColumn(ColumnName = "CTNNUM")]
public int CTNNUM{ get; set; }
/// <summary>
/// 箱号
/// </summary>
[SugarColumn(ColumnName = "CNTRNO")]
public string CNTRNO{ get; set; }
/// <summary>
/// 箱封号
/// </summary>
[SugarColumn(ColumnName = "SEALNO")]
public string SEALNO{ get; set; }
/// <summary>
/// 件数
/// </summary>
[SugarColumn(ColumnName = "PKGS")]
public int PKGS{ get; set; }
/// <summary>
/// 包装
/// </summary>
[SugarColumn(ColumnName = "KINDPKGS")]
public string KINDPKGS{ get; set; }
/// <summary>
/// 毛重
/// </summary>
[SugarColumn(ColumnName = "KGS")]
public decimal KGS{ get; set; }
/// <summary>
/// 尺码
/// </summary>
[SugarColumn(ColumnName = "CBM")]
public decimal CBM{ get; set; }
/// <summary>
/// 皮重
/// </summary>
[SugarColumn(ColumnName = "TAREWEIGHT")]
public decimal TAREWEIGHT{ get; set; }
/// <summary>
/// 箱状态
/// </summary>
[SugarColumn(ColumnName = "CTNSTATUS")]
public string CTNSTATUS{ get; set; }
/// <summary>
/// 称重方式
/// </summary>
[SugarColumn(ColumnName = "WEIGHTYPE")]
public string WEIGHTYPE{ get; set; }
/// <summary>
/// 称重重量
/// </summary>
[SugarColumn(ColumnName = "WEIGHKGS")]
public decimal WEIGHKGS{ get; set; }
/// <summary>
/// 称重联系人
/// </summary>
[SugarColumn(ColumnName = "WEIGHATTN")]
public string WEIGHATTN{ get; set; }
}
}

@ -68,13 +68,13 @@ namespace Myshipping.Application
/// 预计开船日期 /// 预计开船日期
/// </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>
/// 航线代码(船公司) /// 航线代码(船公司)

@ -0,0 +1,126 @@
using Furion;
using Furion.EventBus;
using Furion.FriendlyException;
using Furion.RemoteRequest.Extensions;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Myshipping.Application.ConfigOption;
using Myshipping.Application.Entity;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
using Myshipping.Core.Entity;
using Myshipping.Core.Service;
using Newtonsoft.Json.Linq;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Event
{
/// <summary>
/// 运踪
/// </summary>
public class BookingSlotStockSubscriber : IEventSubscriber
{
private readonly SqlSugarRepository<BookingSlotBase> _repBase;
private readonly SqlSugarRepository<BookingSlotCtn> _repCtn;
private readonly SqlSugarRepository<BookingSlotStock> _repStock;
private readonly ILogger<BookingSlotStockSubscriber> _logger;
public BookingSlotStockSubscriber(SqlSugarRepository<BookingSlotBase> repBase,
SqlSugarRepository<BookingSlotCtn> repCtn,
SqlSugarRepository<BookingSlotStock> repStock,
ILogger<BookingSlotStockSubscriber> logger)
{
_repBase = repBase;
_repCtn = repCtn;
_repStock = repStock;
_logger = logger;
}
//更新库存
[EventSubscribe("BookingSlotStock:Update")]
public async Task BookingSlotStock(EventHandlerExecutingContext context)
{
_logger.LogInformation($"收到更新库存订阅请求:{context.Source.Payload}");
var paraObj = context.Source.Payload as BookingSlotStockUpdateModel;
var baseList = await _repBase.AsQueryable().Filter(null, true)
.Where(x => !x.IsDeleted
&& x.VESSEL == paraObj.VESSEL
&& x.VOYNO == paraObj.VOYNO
&& x.CONTRACT_NO == paraObj.CONTRACT_NO
&& x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE
&& x.CARRIERID == paraObj.CARRIERID)
.ToListAsync();
var stockObj = await _repStock.AsQueryable()
.Filter(null, true)
.FirstAsync(x => !x.IsDeleted
&& x.VESSEL == paraObj.VESSEL
&& x.VOYNO == paraObj.VOYNO
&& x.CONTRACT_NO == paraObj.CONTRACT_NO
&& x.BOOKING_SLOT_TYPE == paraObj.BOOKING_SLOT_TYPE
&& x.CARRIERID == paraObj.CARRIERID);
if (stockObj == null)
{
stockObj = new BookingSlotStock();
stockObj.VESSEL= baseList[0].VESSEL;
stockObj.VOYNO= baseList[0].VOYNO;
stockObj.CONTRACT_NO= baseList[0].CONTRACT_NO;
stockObj.BOOKING_SLOT_TYPE= baseList[0].BOOKING_SLOT_TYPE;
stockObj.BOOKING_SLOT_TYPE_NAME = baseList[0].BOOKING_SLOT_TYPE_NAME;
stockObj.BOOKING_PARTY = baseList[0].BOOKING_PARTY;
stockObj.CARRIERID = baseList[0].CARRIERID;
stockObj.CARRIER = baseList[0].CARRIER;
stockObj.ETD = baseList[0].ETD;
stockObj.ETA = baseList[0].ETA;
stockObj.LANECODE = baseList[0].LANECODE;
stockObj.LANENAME = baseList[0].LANENAME;
stockObj.WEEK_AT= baseList[0].WEEK_AT;
stockObj.TenantId = baseList[0].TenantId;
await _repStock.InsertAsync(stockObj);
}
stockObj.TOTAL_ORDERS = baseList.Count;
}
}
public class BookingSlotStockUpdateModel
{
/// <summary>
/// 船名
/// </summary>
public string VESSEL { get; set; }
/// <summary>
/// 航次号
/// </summary>
public string VOYNO { get; set; }
/// <summary>
/// 合约号
/// </summary>
public string CONTRACT_NO { get; set; }
/// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary>
public string BOOKING_SLOT_TYPE { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public string CARRIERID { get; set; }
}
}

@ -60,7 +60,7 @@ namespace Myshipping.Application
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("/BookingSlot/page")] [HttpGet("/BookingSlot/page")]
public async Task<dynamic> Page([FromQuery] BookingSlotBasePageInput input) public async Task<SqlSugarPagedList<BookingSlotBaseListOutput>> Page([FromQuery] BookingSlotBasePageInput input)
{ {
var entities = await _repBase.AsQueryable() var entities = await _repBase.AsQueryable()
.WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO)) .WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SLOT_BOOKING_NO.Contains(input.SLOT_BOOKING_NO))

@ -130,6 +130,17 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
public string CONTRACT_NO { get; set; } 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; }
/// <summary> /// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
@ -140,6 +151,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
public string BOOKING_SLOT_TYPE_NAME { get; set; } public string BOOKING_SLOT_TYPE_NAME { get; set; }
/// <summary>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// </summary>
public string ISSUETYPE { get; set; }
/// <summary> /// <summary>
/// 订舱抬头 /// 订舱抬头
/// </summary> /// </summary>
@ -211,6 +227,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
public string WEEK_AT { get; set; } public string WEEK_AT { get; set; }
/// <summary>
/// 箱使天数
/// </summary>
public int DETENSION_FREE_DAYS { get; set; }
/// <summary> /// <summary>
/// 箱型箱量 /// 箱型箱量
/// </summary> /// </summary>

Loading…
Cancel
Save