jianghaiqing 6 months ago
commit 9343de544f

@ -20,247 +20,259 @@ namespace Myshipping.Application
/// 舱位主键 /// 舱位主键
/// </summary> /// </summary>
[SugarColumn(ColumnName = "BOOKING_SLOT_ID")] [SugarColumn(ColumnName = "BOOKING_SLOT_ID")]
public long BOOKING_SLOT_ID{ get; set; } public long BOOKING_SLOT_ID { get; set; }
/// <summary> /// <summary>
/// 订舱主键,关联订舱主表ID /// 订舱主键,关联订舱主表ID
/// </summary> /// </summary>
[SugarColumn(ColumnName = "BOOKING_ID")] [SugarColumn(ColumnName = "BOOKING_ID")]
public long BOOKING_ID{ get; set; } public long BOOKING_ID { get; set; }
/// <summary> /// <summary>
/// 舱位提单号 /// 舱位提单号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "SLOT_BOOKING_NO")] [SugarColumn(ColumnName = "SLOT_BOOKING_NO")]
public string SLOT_BOOKING_NO{ get; set; } public string SLOT_BOOKING_NO { get; set; }
/// <summary> /// <summary>
/// 分配提单号 /// 分配提单号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "ALLO_BILL_NO")] [SugarColumn(ColumnName = "ALLO_BILL_NO")]
public string ALLO_BILL_NO{ get; set; } public string ALLO_BILL_NO { get; set; }
/// <summary> /// <summary>
/// 最终提单号,分票后船公司重新分配提单号 /// 最终提单号,分票后船公司重新分配提单号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "FINAL_BILL_NO")] [SugarColumn(ColumnName = "FINAL_BILL_NO")]
public string FINAL_BILL_NO{ get; set; } public string FINAL_BILL_NO { 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>
/// 订舱抬头 /// 订舱抬头
/// </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 = "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 = "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>
/// 收货地代码 /// 收货地代码
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PLACERECEIPTID")] [SugarColumn(ColumnName = "PLACERECEIPTID")]
public string PLACERECEIPTID{ get; set; } public string PLACERECEIPTID { get; set; }
/// <summary> /// <summary>
/// 收货地 /// 收货地
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PLACERECEIPT")] [SugarColumn(ColumnName = "PLACERECEIPT")]
public string PLACERECEIPT{ get; set; } public string PLACERECEIPT { get; set; }
/// <summary> /// <summary>
/// 交货地代码 /// 交货地代码
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERYID")] [SugarColumn(ColumnName = "PLACEDELIVERYID")]
public string PLACEDELIVERYID{ get; set; } public string PLACEDELIVERYID { get; set; }
/// <summary> /// <summary>
/// 交货地 /// 交货地
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PLACEDELIVERY")] [SugarColumn(ColumnName = "PLACEDELIVERY")]
public string PLACEDELIVERY{ get; set; } public string PLACEDELIVERY { get; set; }
/// <summary> /// <summary>
/// 装货港代码 /// 装货港代码
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PORTLOADID")] [SugarColumn(ColumnName = "PORTLOADID")]
public string PORTLOADID{ get; set; } public string PORTLOADID { get; set; }
/// <summary> /// <summary>
/// 装货港 /// 装货港
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PORTLOAD")] [SugarColumn(ColumnName = "PORTLOAD")]
public string PORTLOAD{ get; set; } public string PORTLOAD { get; set; }
/// <summary> /// <summary>
/// 卸货港代码 /// 卸货港代码
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PORTDISCHARGEID")] [SugarColumn(ColumnName = "PORTDISCHARGEID")]
public string PORTDISCHARGEID{ get; set; } public string PORTDISCHARGEID { get; set; }
/// <summary> /// <summary>
/// 卸货港 /// 卸货港
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PORTDISCHARGE")] [SugarColumn(ColumnName = "PORTDISCHARGE")]
public string PORTDISCHARGE{ get; set; } public string PORTDISCHARGE { get; set; }
/// <summary> /// <summary>
/// 中转港1 /// 中转港1
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TRANSFER_PORT_1")] [SugarColumn(ColumnName = "TRANSFER_PORT_1")]
public string TRANSFER_PORT_1{ get; set; } public string TRANSFER_PORT_1 { get; set; }
/// <summary> /// <summary>
/// 中转港2 /// 中转港2
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TRANSFER_PORT_2")] [SugarColumn(ColumnName = "TRANSFER_PORT_2")]
public string TRANSFER_PORT_2{ get; set; } public string TRANSFER_PORT_2 { 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 = "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>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转 /// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CARRIAGE_TYPE")] [SugarColumn(ColumnName = "CARRIAGE_TYPE")]
public string CARRIAGE_TYPE{ get; set; } public string CARRIAGE_TYPE { get; set; }
/// <summary> /// <summary>
/// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")] [SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")]
public string CARRIAGE_TYPE_NAME{ get; set; } public string CARRIAGE_TYPE_NAME { 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>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单; /// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// </summary> /// </summary>
[SugarColumn(ColumnName = "ISSUETYPE")] [SugarColumn(ColumnName = "ISSUETYPE")]
public string ISSUETYPE{ get; set; } public string ISSUETYPE { 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 = "WEEK_AT")] [SugarColumn(ColumnName = "WEEK_AT")]
public string WEEK_AT{ get; set; } public string WEEK_AT { get; set; }
/// <summary> /// <summary>
/// 箱使天数 /// 箱使天数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "DETENSION_FREE_DAYS")] [SugarColumn(ColumnName = "DETENSION_FREE_DAYS")]
public int DETENSION_FREE_DAYS{ get; set; } public int DETENSION_FREE_DAYS { get; set; }
/// <summary> /// <summary>
/// 样单截止日期 /// 样单截止日期
/// </summary> /// </summary>
[SugarColumn(ColumnName = "SI_CUT_DATE")] [SugarColumn(ColumnName = "SI_CUT_DATE")]
public DateTime? SI_CUT_DATE{ get; set; } public DateTime? SI_CUT_DATE { get; set; }
/// <summary> /// <summary>
/// 截港时间 /// 截港时间
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CY_CUT_DATE")] [SugarColumn(ColumnName = "CY_CUT_DATE")]
public DateTime? CY_CUT_DATE{ get; set; } public DateTime? CY_CUT_DATE { get; set; }
/// <summary> /// <summary>
/// VGM截止日期 /// VGM截止日期
/// </summary> /// </summary>
[SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")] [SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")]
public DateTime? VGM_SUBMISSION_CUT_DATE{ get; set; } public DateTime? VGM_SUBMISSION_CUT_DATE { get; set; }
/// <summary> /// <summary>
/// MDGF提交截止时间 /// MDGF提交截止时间
/// </summary> /// </summary>
[SugarColumn(ColumnName = "MDGF_CUT_DATE")] [SugarColumn(ColumnName = "MDGF_CUT_DATE")]
public DateTime? MDGF_CUT_DATE{ get; set; } public DateTime? MDGF_CUT_DATE { get; set; }
/// <summary> /// <summary>
/// 舱单截止时间 /// 舱单截止时间
/// </summary> /// </summary>
[SugarColumn(ColumnName = "MANIFEST_CUT_DATE")] [SugarColumn(ColumnName = "MANIFEST_CUT_DATE")]
public DateTime? MANIFEST_CUT_DATE{ get; set; } public DateTime? MANIFEST_CUT_DATE { get; set; }
/// <summary> /// <summary>
/// 租户名称 /// 租户名称
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TenantName")] [SugarColumn(ColumnName = "TenantName")]
public string TenantName{ get; set; } public string TenantName { get; set; }
/// <summary>
/// 客户ID
/// </summary>
public long? CUSTOMERID { get; set; }
/// <summary> /// <summary>
/// 客户名称 /// 客户名称
/// </summary> /// </summary>
public string CUSTOMERNAME { get; set; } public string CUSTOMERNAME { get; set; }
/// <summary>
/// 客服ID
/// </summary>
public string CUSTSERVICEID { get; set; }
/// <summary> /// <summary>
/// 客服名称 /// 客服名称
/// </summary> /// </summary>
public string CUSTSERVICE { get; set; } public string CUSTSERVICE { get; set; }
/// <summary>
/// 销售ID
/// </summary>
public string SALEID { get; set; }
/// <summary> /// <summary>
/// 销售名称 /// 销售名称
/// </summary> /// </summary>

@ -371,7 +371,7 @@ namespace Myshipping.Application
/// </summary> /// </summary>
[SugarColumn(ColumnName = "CUSTOM_SI_CUT_DATE")] [SugarColumn(ColumnName = "CUSTOM_SI_CUT_DATE")]
[Description("客户样单截止日期")] [Description("客户样单截止日期")]
public Nullable<DateTime> CUSTOM_SI_CUT_DATE { get; set; } public DateTime? CUSTOM_SI_CUT_DATE { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注

@ -6,7 +6,6 @@ using Furion.EventBus;
using Furion.Extensions; using Furion.Extensions;
using Furion.FriendlyException; using Furion.FriendlyException;
using Furion.JsonSerialization; using Furion.JsonSerialization;
using Furion.RemoteRequest.Extensions;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -20,15 +19,10 @@ using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Application.Service.BookingSlot.Dto; using Myshipping.Application.Service.BookingSlot.Dto;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common;
using NPOI.XWPF.UserModel;
using Org.BouncyCastle.Asn1.Tsp;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
@ -36,9 +30,7 @@ using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using Yitter.IdGenerator; using Yitter.IdGenerator;
using static Aliyun.OSS.Model.CreateSelectObjectMetaInputFormatModel;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -56,7 +48,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingFile> _bookingFileRepository; private readonly SqlSugarRepository<BookingFile> _bookingFileRepository;
private readonly SqlSugarRepository<BookingSlotCompare> _bookingSlotCompareRepository; private readonly SqlSugarRepository<BookingSlotCompare> _bookingSlotCompareRepository;
private readonly SqlSugarRepository<BookingOrderContact> _bookingOrderContactRepository; private readonly SqlSugarRepository<BookingOrderContact> _bookingOrderContactRepository;
private readonly SqlSugarRepository<BookingOrder> _repBookingOrder;
private readonly SqlSugarRepository<BookingLog> _repBookingLog; private readonly SqlSugarRepository<BookingLog> _repBookingLog;
private readonly SqlSugarRepository<BookingLogDetail> _repBookingLogDetail; private readonly SqlSugarRepository<BookingLogDetail> _repBookingLogDetail;
private readonly SqlSugarRepository<BookingFile> _bookingfile; private readonly SqlSugarRepository<BookingFile> _bookingfile;
@ -97,7 +89,8 @@ namespace Myshipping.Application
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository, SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository,
SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository, SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository,
INamedServiceProvider<IBookingOrderService> namedBookingOrderServiceProvider, INamedServiceProvider<IBookingOrderService> namedBookingOrderServiceProvider,
IBookingValueAddedService bookingValueAddedService) IBookingValueAddedService bookingValueAddedService,
SqlSugarRepository<BookingOrder> repBookingOrder)
{ {
_repBase = repBase; _repBase = repBase;
_repCtn = repCtn; _repCtn = repCtn;
@ -118,6 +111,7 @@ namespace Myshipping.Application
_namedBookingOrderServiceProvider = namedBookingOrderServiceProvider; _namedBookingOrderServiceProvider = namedBookingOrderServiceProvider;
_bookingOrderContactRepository = bookingOrderContactRepository; _bookingOrderContactRepository = bookingOrderContactRepository;
_bookingValueAddedService = bookingValueAddedService; _bookingValueAddedService = bookingValueAddedService;
_repBookingOrder = repBookingOrder;
} }
#region 舱位 #region 舱位
@ -156,7 +150,6 @@ namespace Myshipping.Application
{ {
isNeedUpdateOldStock = true; isNeedUpdateOldStock = true;
} }
await _repBase.UpdateAsync(model); await _repBase.UpdateAsync(model);
if (isNeedUpdateOldStock) if (isNeedUpdateOldStock)
@ -175,14 +168,106 @@ namespace Myshipping.Application
})); }));
} }
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id); await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
foreach (var ctn in input.CtnList) if (input.CtnList != null)
{ {
var newCtn = ctn.Adapt<BookingSlotCtn>(); foreach (var ctn in input.CtnList)
newCtn.SLOT_ID = model.Id; {
await _repCtn.InsertAsync(newCtn); var newCtn = ctn.Adapt<BookingSlotCtn>();
newCtn.SLOT_ID = model.Id;
await _repCtn.InsertAsync(newCtn);
}
} }
await InsLog("Update", model.Id, typeof(BookingSlotBaseSaveInput), oldObj, input, "CtnList");
#region 关联订舱信息修改
if (input.BookingSlotSaleInfoList != null)
{
var bookingOrderService = App.GetService<IBookingOrderService>();
foreach (var item in input.BookingSlotSaleInfoList)
{
if (!item.UpdateFlag)
{
continue;
}
var allocation = await _repAllocation.FirstOrDefaultAsync(x => x.Id == item.Id);
if (allocation == null)
{
throw Oops.Oh($"保存失败原因更新关联订舱时未查询到订舱关联表Id{item.Id}");
}
// 更新关联表
item.Adapt(allocation);
_repAllocation.CurrentBeginTran();
try
{
await _repAllocation.AsUpdateable(allocation).UpdateColumns(x => new
{
x.CUSTOMERID,
x.CUSTOMERNAME,
x.CUSTSERVICE,
x.CUSTSERVICEID,
x.SALE,
x.SALEID,
x.SHIPPER,
x.SALE_TIME,
x.GOODSNAME,
x.SELLING_PRICE,
x.UpdatedUserId,
x.UpdatedUserName,
x.UpdatedTime,
}).ExecuteCommandAsync();
// 更新订舱表
var bookingOrder = await _repBookingOrder.FirstOrDefaultAsync(x => x.Id == allocation.BOOKING_ID);
var oldBookingOrder = bookingOrder.Adapt<BookingOrder>();
if (bookingOrder != null)
{
bookingOrder.CUSTOMERID = allocation.CUSTOMERID;
bookingOrder.CUSTOMERNAME = allocation.CUSTOMERNAME;
bookingOrder.CUSTSERVICE = allocation.CUSTSERVICE;
bookingOrder.CUSTSERVICEID = allocation.CUSTSERVICEID;
bookingOrder.SALE = allocation.SALE;
bookingOrder.SALEID = allocation.SALEID;
await _repBookingOrder.AsUpdateable(bookingOrder).UpdateColumns(x => new
{
x.CUSTOMERID,
x.CUSTOMERNAME,
x.CUSTSERVICE,
x.CUSTSERVICEID,
x.SALE,
x.SALEID,
x.UpdatedUserId,
x.UpdatedUserName,
x.UpdatedTime,
}).ExecuteCommandAsync();
//Parallel.For(0, 1, (n) =>
//{
bookingOrderService.SaveLog(bookingOrder, oldBookingOrder, "舱位关联更新");
// 推送东胜
bookingOrderService.SendBookingOrder(new long[] { allocation.BOOKING_ID });
//});
}
_repAllocation.CurrentCommitTran();
}
catch (Exception)
{
_repAllocation.CurrentRollbackTran();
throw;
}
}
}
#endregion
//Parallel.For(0, 1, (n) =>
//{
InsLog("Update", model.Id, typeof(BookingSlotBaseSaveInput), oldObj, input,
nameof(BookingSlotBaseApiSaveDto.CtnList),
nameof(BookingSlotBaseApiSaveDto.BookingSlotSaleInfoList));
//});
} }
else else
{ {
@ -220,6 +305,135 @@ namespace Myshipping.Application
return await Detail(model.Id); return await Detail(model.Id);
} }
/// <summary>
/// 直接在台账页数据列表上进行保存
/// </summary>
/// <returns></returns>
[HttpPost("/BookingSlot/SaveDataInList")]
public async Task<BookingSlotBaseSaveOutput> SaveDataInList(BookingSlotBaseSaveDataInListInputDto input)
{
long slotBaseId = 0;
if (input.SlotBase != null)
{
slotBaseId = input.SlotBase.GetLongValue("Id");
if (slotBaseId == 0)
{
throw Oops.Bah("修改舱位信息需要提供参数Id");
}
var model = await _repBase.FirstOrDefaultAsync(x => x.Id == slotBaseId);
if (model == null)
{
throw Oops.Bah("未查询到舱位信息,请刷新页面");
}
var type = typeof(BookingSlotBase);
var properties = type.GetProperties();
List<string> updateColumns = new(input.SlotBase.Count + 3)
{
"UpdatedTime","UpdatedUserId","UpdatedUserName"
};
foreach (var item in input.SlotBase)
{
if (item.Key == "Id")
{
continue;
}
updateColumns.Add(item.Key);
var property = properties.FirstOrDefault(x => x.Name.Equals(item.Key, StringComparison.OrdinalIgnoreCase))
?? throw Oops.Bah($"参数有误,该属性不存在:{item.Key}");
if (property.PropertyType == typeof(string) || property.PropertyType == typeof(string))
{
property.SetValue(model, input.SlotBase.GetStringValue(item.Key));
}
else if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?))
{
property.SetValue(model, input.SlotBase.GetIntValue(item.Key));
}
else if (property.PropertyType == typeof(long) || property.PropertyType == typeof(long?))
{
property.SetValue(model, input.SlotBase.GetLongValue(item.Key));
}
else if (property.PropertyType == typeof(DateTime) || property.PropertyType == typeof(DateTime?))
{
property.SetValue(model, input.SlotBase.GetDateTimeValue(item.Key));
}
else if (property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?))
{
property.SetValue(model, input.SlotBase.GetBooleanValue(item.Key));
}
else if (property.PropertyType == typeof(decimal) || property.PropertyType == typeof(decimal?))
{
property.SetValue(model, input.SlotBase.GetDecimalValue(item.Key));
}
else
{
throw new Exception($"需要维护此类型:{property.PropertyType},请联系管理员");
}
}
await _repBase.AsUpdateable(model).UpdateColumns(updateColumns.ToArray()).ExecuteCommandAsync();
}
if (input.SlotSaleInfo != null)
{
var allocationId = input.SlotSaleInfo.GetLongValue("Id");
if (allocationId == 0)
{
throw Oops.Bah("修改订舱信息需要提供参数Id");
}
var model = await _repAllocation.FirstOrDefaultAsync(x => x.Id == allocationId);
if (model == null)
{
throw Oops.Bah("未查询到关联的订舱信息,请刷新页面");
}
slotBaseId = model.BOOKING_SLOT_ID;
var update1 = _repAllocation.Context.Updateable<BookingSlotAllocation>();
var update2 = _repBookingOrder.Context.Updateable<BookingOrder>();
foreach (var item in input.SlotSaleInfo)
{
if (item.Key == "Id")
{
continue;
}
if (item.Key.Equals("CUSTOMERNAME", StringComparison.OrdinalIgnoreCase))
{
var value = input.SlotSaleInfo.GetStringValue(item.Key);
update1.SetColumns(x => x.CUSTOMERNAME == value);
update2.SetColumns(x => x.CUSTOMERNAME == value);
}
else if (item.Key.Equals("CUSTOMERID", StringComparison.OrdinalIgnoreCase))
{
var value = input.SlotSaleInfo.GetLongValue(item.Key);
update1.SetColumns(x => x.CUSTOMERID == value);
update2.SetColumns(x => x.CUSTOMERID == value);
}
else
{
throw Oops.Bah($"需要维护此字段:{item.Key},请联系管理员");
}
}
try
{
_repAllocation.CurrentBeginTran();
await update1.Where(x => x.Id == model.Id).ExecuteCommandAsync();
await update2.Where(x => x.Id == model.BOOKING_ID).ExecuteCommandAsync();
_repAllocation.CurrentCommitTran();
var bookingOrderService = App.GetService<IBookingOrderService>();
await bookingOrderService.SendBookingOrder(new long[] { model.BOOKING_ID });
}
catch (Exception)
{
_repAllocation.CurrentRollbackTran();
throw;
}
}
return await Detail(slotBaseId);
}
/// <summary> /// <summary>
/// 获取订舱舱位 /// 获取订舱舱位
/// </summary> /// </summary>
@ -250,6 +464,28 @@ namespace Myshipping.Application
rtn.LogList = list; rtn.LogList = list;
// 赋值关联的订舱列表
// 查询舱位绑定的销售信息,赋值到舱位对象中
List<BookingSlotSaleInfoDto> saleInfoList = await _repAllocation.AsQueryable()
.Where(x => x.BOOKING_SLOT_ID == id)
.Select(x => new BookingSlotSaleInfoDto
{
Id = x.Id,
BOOKING_ID = x.BOOKING_ID,
BOOKING_SLOT_ID = x.BOOKING_SLOT_ID,
CUSTOMERID = x.CUSTOMERID,
CUSTOMERNAME = x.CUSTOMERNAME,
CUSTSERVICEID = x.CUSTSERVICEID,
CUSTSERVICE = x.CUSTSERVICE,
SALEID = x.SALEID,
SALE = x.SALE,
SALE_TIME = x.SALE_TIME,
SHIPPER = x.SHIPPER,
GOODSNAME = x.GOODSNAME,
SELLING_PRICE = x.SELLING_PRICE
}).ToListAsync();
rtn.BookingSlotSaleInfoList = saleInfoList;
return rtn; return rtn;
} }
@ -554,7 +790,7 @@ namespace Myshipping.Application
await _repCtn.InsertAsync(newCtn); await _repCtn.InsertAsync(newCtn);
} }
await InsLog("Update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, "CtnList"); await InsLog("Update", model.Id, typeof(BookingSlotBaseApiSaveDto), oldObj, dto.DataObj, nameof(BookingSlotBaseApiSaveDto.CtnList), nameof(BookingSlotBaseApiSaveDto.BookingSlotSaleInfoList));
string batchNo = IDGen.NextID().ToString(); string batchNo = IDGen.NextID().ToString();
@ -732,7 +968,7 @@ namespace Myshipping.Application
CreatedUserName = UserManager.Name, CreatedUserName = UserManager.Name,
Module = "Slot" Module = "Slot"
}); });
List<BookingLogDetail> waitInsertLogList = new();
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(objType)) foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(objType))
{ {
if (excepProp.Contains(descriptor.Name)) if (excepProp.Contains(descriptor.Name))
@ -740,52 +976,29 @@ namespace Myshipping.Application
continue; continue;
} }
var compResult = false; var oldValue = descriptor.GetValue(objOld)?.ToString();
var oldValue = descriptor.GetValue(objOld); var newValue = descriptor.GetValue(objNew)?.ToString();
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) if (oldValue != newValue)
{ {
var fieldName = descriptor.Name; var fieldName = descriptor.Name;
if (!string.IsNullOrWhiteSpace(descriptor.Description)) if (!string.IsNullOrWhiteSpace(descriptor.Description))
{ {
fieldName = descriptor.Description; fieldName = descriptor.Description;
} }
waitInsertLogList.Add(new BookingLogDetail
await _repBookingLogDetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
{ {
PId = bid, PId = bid,
Field = fieldName, Field = fieldName,
OldValue = $"{oldValue}", OldValue = oldValue switch { "True" => "是", "False" => "否", _ => oldValue },
NewValue = $"{newValue}", NewValue = newValue switch { "True" => "是", "False" => "否", _ => newValue },
}); });
} }
} }
if (waitInsertLogList.Any())
{
await _repBookingLogDetail.InsertAsync(waitInsertLogList);
}
} }
#endregion #endregion
@ -1134,23 +1347,31 @@ namespace Myshipping.Application
{ {
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))
.WhereIF(input.STATUS == 1, u => !u.IS_CANCELLATION)
.WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION)
.WhereIF(!string.IsNullOrEmpty(input.VESSEL), u => u.VESSEL.Contains(input.VESSEL)) .WhereIF(!string.IsNullOrEmpty(input.VESSEL), u => u.VESSEL.Contains(input.VESSEL))
.WhereIF(!string.IsNullOrEmpty(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO)) .WhereIF(!string.IsNullOrEmpty(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
.WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTLOAD.Contains(input.PORTLOAD)) .WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
.WhereIF(!string.IsNullOrEmpty(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER))
.WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
.WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), u => u.CARRIAGE_TYPE == input.CARRIAGE_TYPE)
.WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE)
.WhereIF(!string.IsNullOrEmpty(input.CTN_STAT), u => u.CTN_STAT.Contains(input.CTN_STAT))
.WhereIF(!string.IsNullOrEmpty(input.VGM_RLT_STAT), u => u.VGM_RLT_STAT == input.VGM_RLT_STAT)
.WhereIF(!string.IsNullOrEmpty(input.SI_RLT_STAT), u => u.SI_RLT_STAT == input.SI_RLT_STAT)
.WhereIF(input.ETD_START.HasValue, u => u.ETD >= input.ETD_START.Value) .WhereIF(input.ETD_START.HasValue, u => u.ETD >= input.ETD_START.Value)
.WhereIF(input.ETD_END.HasValue, u => u.ETD < input.ETD_END.Value.AddDays(1)) .WhereIF(input.ETD_END.HasValue, u => u.ETD < input.ETD_END.Value.AddDays(1))
.WhereIF(input.ETA_START.HasValue, u => u.ETA >= input.ETA_START.Value) .WhereIF(input.ETA_START.HasValue, u => u.ETA >= input.ETA_START.Value)
.WhereIF(input.ETA_END.HasValue, u => u.ETA < input.ETA_END.Value.AddDays(1)) .WhereIF(input.ETA_END.HasValue, u => u.ETA < input.ETA_END.Value.AddDays(1))
.WhereIF(input.STATUS == 1, u => !u.IS_CANCELLATION) .WhereIF(!string.IsNullOrEmpty(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
.WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION) .WhereIF(!string.IsNullOrEmpty(input.UpdatedUserName), u => u.UpdatedUserName.Contains(input.UpdatedUserName))
.WhereIF(!string.IsNullOrEmpty(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER))
.WhereIF(!string.IsNullOrEmpty(input.CONTRACT_NO), u => u.CONTRACT_NO.Contains(input.CONTRACT_NO))
.WhereIF(!string.IsNullOrEmpty(input.SI_RLT_STAT), u => u.SI_RLT_STAT == input.SI_RLT_STAT)
.WhereIF(!string.IsNullOrEmpty(input.VGM_RLT_STAT), u => u.VGM_RLT_STAT == input.VGM_RLT_STAT)
.WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), u => u.CARRIAGE_TYPE == input.CARRIAGE_TYPE)
.WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE)
.WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
.WhereIF(!string.IsNullOrEmpty(input.CTN_STAT), u => u.CTN_STAT.Contains(input.CTN_STAT))
.WhereIF(!string.IsNullOrEmpty(input.WEEK_AT), u => u.WEEK_AT.Contains(input.WEEK_AT))
.OrderByDescending(u => u.CreatedTime)
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>(); var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>();
@ -1163,9 +1384,14 @@ namespace Myshipping.Application
.Where(x => slotIds.Contains(x.BOOKING_SLOT_ID)) .Where(x => slotIds.Contains(x.BOOKING_SLOT_ID))
.Select(x => new BookingSlotSaleInfoDto .Select(x => new BookingSlotSaleInfoDto
{ {
Id = x.Id,
BOOKING_ID = x.BOOKING_ID,
BOOKING_SLOT_ID = x.BOOKING_SLOT_ID, BOOKING_SLOT_ID = x.BOOKING_SLOT_ID,
CUSTOMERID = x.CUSTOMERID,
CUSTOMERNAME = x.CUSTOMERNAME, CUSTOMERNAME = x.CUSTOMERNAME,
CUSTSERVICEID = x.CUSTSERVICEID,
CUSTSERVICE = x.CUSTSERVICE, CUSTSERVICE = x.CUSTSERVICE,
SALEID = x.SALEID,
SALE = x.SALE, SALE = x.SALE,
SALE_TIME = x.SALE_TIME, SALE_TIME = x.SALE_TIME,
SHIPPER = x.SHIPPER, SHIPPER = x.SHIPPER,

@ -1,5 +1,6 @@
using Myshipping.Application.Service.BookingOrder.Dto; using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core; using Myshipping.Core;
using Newtonsoft.Json.Linq;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -105,6 +106,24 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// 舱位状态 0-全部 1-未取消 2:已取消 /// 舱位状态 0-全部 1-未取消 2:已取消
/// </summary> /// </summary>
public int STATUS { get; set; } public int STATUS { get; set; }
/// <summary>
/// 创建者名称
/// </summary>
public string CreatedUserName { get; set; }
/// <summary>
/// 修改者名称
/// </summary>
public string UpdatedUserName { get; set; }
/// <summary>
/// 合约号
/// </summary>
public string CONTRACT_NO { get; set; }
/// <summary>
/// 周数
/// </summary>
public string WEEK_AT { get; set; }
} }
/// <summary> /// <summary>
@ -356,6 +375,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
[Description("计费日期")] [Description("计费日期")]
public DateTime? PRICE_CALCULATION_DATE { get; set; } public DateTime? PRICE_CALCULATION_DATE { get; set; }
/// <summary>
/// 舱位关联的订舱信息
/// </summary>
public List<BookingSlotSaleInfoDto> BookingSlotSaleInfoList { get; set; }
} }
/// <summary> /// <summary>
@ -375,6 +399,22 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
public List<BookingSlotCtnSaveInput> CtnList { get; set; } public List<BookingSlotCtnSaveInput> CtnList { get; set; }
} }
/// <summary>
/// 舱位台账列表保存输入
/// </summary>
public class BookingSlotBaseSaveDataInListInputDto
{
/// <summary>
/// 舱位信息
/// </summary>
public JObject SlotBase { get; set; }
/// <summary>
/// 关联订单的销售信息
/// </summary>
public JObject SlotSaleInfo { get; set; }
}
/// <summary> /// <summary>
/// 保存舱位输出 /// 保存舱位输出
/// </summary> /// </summary>
@ -470,10 +510,6 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
public string UpdatedUserName { get; set; } public string UpdatedUserName { get; set; }
/// <summary>
/// 舱位关联的订舱信息
/// </summary>
public List<BookingSlotSaleInfoDto> BookingSlotSaleInfoList { get; set; }
} }
/// <summary> /// <summary>
@ -529,21 +565,38 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// </summary> /// </summary>
public class BookingSlotSaleInfoDto public class BookingSlotSaleInfoDto
{ {
/// <summary>
/// 关联关系主键
/// </summary>
public long Id { get; set; }
/// <summary>
/// 订舱主键
/// </summary>
public long BOOKING_ID { get; set; }
/// <summary> /// <summary>
/// 舱位主键 /// 舱位主键
/// </summary> /// </summary>
public long BOOKING_SLOT_ID { get; set; } public long BOOKING_SLOT_ID { get; set; }
/// <summary>
/// 客户ID
/// </summary>
public long? CUSTOMERID { get; set; }
/// <summary> /// <summary>
/// 客户名称 /// 客户名称
/// </summary> /// </summary>
public string CUSTOMERNAME { get; set; } public string CUSTOMERNAME { get; set; }
/// <summary>
/// 客服ID
/// </summary>
public string CUSTSERVICEID { get; set; }
/// <summary> /// <summary>
/// 客服名称 /// 客服名称
/// </summary> /// </summary>
public string CUSTSERVICE { get; set; } public string CUSTSERVICE { get; set; }
/// <summary>
/// 销售ID
/// </summary>
public string SALEID { get; set; }
/// <summary> /// <summary>
/// 销售名称 /// 销售名称
/// </summary> /// </summary>
@ -568,5 +621,9 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// 卖价 /// 卖价
/// </summary> /// </summary>
public decimal? SELLING_PRICE { get; set; } public decimal? SELLING_PRICE { get; set; }
/// <summary>
/// 修改标记,前端提供给后端判断是否更新
/// </summary>
public bool UpdateFlag { get; set; }
} }
} }

Loading…
Cancel
Save