From 485c57f5f2103dc18b83d1f4d617b67f5635b625 Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Wed, 15 May 2024 15:08:51 +0800
Subject: [PATCH] =?UTF-8?q?=E8=88=B1=E4=BD=8D=E7=AE=A1=E7=90=86=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BookingSlot/BookingSlotAllocation.cs | 168 +++++----
.../Entity/BookingSlot/BookingSlotBase.cs | 2 +-
.../Service/BookingSlot/BookingSlotService.cs | 348 +++++++++++++++---
.../BookingSlot/Dto/BookingSlotBaseDto.cs | 71 +++-
4 files changed, 442 insertions(+), 147 deletions(-)
diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs
index 833b8445..39d9dbeb 100644
--- a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs
+++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs
@@ -20,247 +20,259 @@ namespace Myshipping.Application
/// 舱位主键
///
[SugarColumn(ColumnName = "BOOKING_SLOT_ID")]
- public long BOOKING_SLOT_ID{ get; set; }
-
+ public long BOOKING_SLOT_ID { get; set; }
+
///
/// 订舱主键,关联订舱主表ID
///
[SugarColumn(ColumnName = "BOOKING_ID")]
- public long BOOKING_ID{ get; set; }
-
+ public long BOOKING_ID { get; set; }
+
///
/// 舱位提单号
///
[SugarColumn(ColumnName = "SLOT_BOOKING_NO")]
- public string SLOT_BOOKING_NO{ get; set; }
-
+ public string SLOT_BOOKING_NO { get; set; }
+
///
/// 分配提单号
///
[SugarColumn(ColumnName = "ALLO_BILL_NO")]
- public string ALLO_BILL_NO{ get; set; }
-
+ public string ALLO_BILL_NO { get; set; }
+
///
/// 最终提单号,分票后船公司重新分配提单号
///
[SugarColumn(ColumnName = "FINAL_BILL_NO")]
- public string FINAL_BILL_NO{ get; set; }
-
+ public string FINAL_BILL_NO { get; set; }
+
///
/// 合约号
///
[SugarColumn(ColumnName = "CONTRACT_NO")]
- public string CONTRACT_NO{ get; set; }
-
+ public string CONTRACT_NO { get; set; }
+
///
/// 订舱抬头
///
[SugarColumn(ColumnName = "BOOKING_PARTY")]
- public string BOOKING_PARTY{ get; set; }
-
+ public string BOOKING_PARTY { get; set; }
+
///
/// 船名
///
[SugarColumn(ColumnName = "VESSEL")]
- public string VESSEL{ get; set; }
-
+ public string VESSEL { get; set; }
+
///
/// 航次号
///
[SugarColumn(ColumnName = "VOYNO")]
- public string VOYNO{ get; set; }
-
+ public string VOYNO { get; set; }
+
///
/// 预计开船日期
///
[SugarColumn(ColumnName = "ETD")]
- public DateTime? ETD{ get; set; }
-
+ public DateTime? ETD { get; set; }
+
///
/// 预计到港日期
///
[SugarColumn(ColumnName = "ETA")]
- public DateTime? ETA{ get; set; }
-
+ public DateTime? ETA { get; set; }
+
///
/// 收货地代码
///
[SugarColumn(ColumnName = "PLACERECEIPTID")]
- public string PLACERECEIPTID{ get; set; }
-
+ public string PLACERECEIPTID { get; set; }
+
///
/// 收货地
///
[SugarColumn(ColumnName = "PLACERECEIPT")]
- public string PLACERECEIPT{ get; set; }
-
+ public string PLACERECEIPT { get; set; }
+
///
/// 交货地代码
///
[SugarColumn(ColumnName = "PLACEDELIVERYID")]
- public string PLACEDELIVERYID{ get; set; }
-
+ public string PLACEDELIVERYID { get; set; }
+
///
/// 交货地
///
[SugarColumn(ColumnName = "PLACEDELIVERY")]
- public string PLACEDELIVERY{ get; set; }
-
+ public string PLACEDELIVERY { get; set; }
+
///
/// 装货港代码
///
[SugarColumn(ColumnName = "PORTLOADID")]
- public string PORTLOADID{ get; set; }
-
+ public string PORTLOADID { get; set; }
+
///
/// 装货港
///
[SugarColumn(ColumnName = "PORTLOAD")]
- public string PORTLOAD{ get; set; }
-
+ public string PORTLOAD { get; set; }
+
///
/// 卸货港代码
///
[SugarColumn(ColumnName = "PORTDISCHARGEID")]
- public string PORTDISCHARGEID{ get; set; }
-
+ public string PORTDISCHARGEID { get; set; }
+
///
/// 卸货港
///
[SugarColumn(ColumnName = "PORTDISCHARGE")]
- public string PORTDISCHARGE{ get; set; }
-
+ public string PORTDISCHARGE { get; set; }
+
///
/// 中转港1
///
[SugarColumn(ColumnName = "TRANSFER_PORT_1")]
- public string TRANSFER_PORT_1{ get; set; }
-
+ public string TRANSFER_PORT_1 { get; set; }
+
///
/// 中转港2
///
[SugarColumn(ColumnName = "TRANSFER_PORT_2")]
- public string TRANSFER_PORT_2{ get; set; }
-
+ public string TRANSFER_PORT_2 { get; set; }
+
///
/// 船公司代号
///
[SugarColumn(ColumnName = "CARRIERID")]
- public string CARRIERID{ get; set; }
-
+ public string CARRIERID { get; set; }
+
///
/// 船公司
///
[SugarColumn(ColumnName = "CARRIER")]
- public string CARRIER{ get; set; }
-
+ public string CARRIER { get; set; }
+
///
/// 航线代码(船公司)
///
[SugarColumn(ColumnName = "LANECODE")]
- public string LANECODE{ get; set; }
-
+ public string LANECODE { get; set; }
+
///
/// 航线名称(船公司)
///
[SugarColumn(ColumnName = "LANENAME")]
- public string LANENAME{ get; set; }
-
+ public string LANENAME { get; set; }
+
///
/// 承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转
///
[SugarColumn(ColumnName = "CARRIAGE_TYPE")]
- public string CARRIAGE_TYPE{ get; set; }
-
+ public string CARRIAGE_TYPE { get; set; }
+
///
/// 承运方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱
///
[SugarColumn(ColumnName = "CARRIAGE_TYPE_NAME")]
- public string CARRIAGE_TYPE_NAME{ get; set; }
-
+ public string CARRIAGE_TYPE_NAME { get; set; }
+
///
/// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱
///
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE")]
- public string BOOKING_SLOT_TYPE{ get; set; }
-
+ public string BOOKING_SLOT_TYPE { get; set; }
+
///
/// 订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱
///
[SugarColumn(ColumnName = "BOOKING_SLOT_TYPE_NAME")]
- public string BOOKING_SLOT_TYPE_NAME{ get; set; }
-
+ public string BOOKING_SLOT_TYPE_NAME { get; set; }
+
///
/// 签单方式 ORIGINAL-正本;TELEX-电放;SEAWAY BILL-海运单;
///
[SugarColumn(ColumnName = "ISSUETYPE")]
- public string ISSUETYPE{ get; set; }
-
+ public string ISSUETYPE { get; set; }
+
///
/// 箱型箱量
///
[SugarColumn(ColumnName = "CTN_STAT")]
- public string CTN_STAT{ get; set; }
-
+ public string CTN_STAT { get; set; }
+
///
/// 所在周数
///
[SugarColumn(ColumnName = "WEEK_AT")]
- public string WEEK_AT{ get; set; }
-
+ public string WEEK_AT { get; set; }
+
///
/// 箱使天数
///
[SugarColumn(ColumnName = "DETENSION_FREE_DAYS")]
- public int DETENSION_FREE_DAYS{ get; set; }
-
+ public int DETENSION_FREE_DAYS { get; set; }
+
///
/// 样单截止日期
///
[SugarColumn(ColumnName = "SI_CUT_DATE")]
- public DateTime? SI_CUT_DATE{ get; set; }
-
+ public DateTime? SI_CUT_DATE { get; set; }
+
///
/// 截港时间
///
[SugarColumn(ColumnName = "CY_CUT_DATE")]
- public DateTime? CY_CUT_DATE{ get; set; }
-
+ public DateTime? CY_CUT_DATE { get; set; }
+
///
/// VGM截止日期
///
[SugarColumn(ColumnName = "VGM_SUBMISSION_CUT_DATE")]
- public DateTime? VGM_SUBMISSION_CUT_DATE{ get; set; }
-
+ public DateTime? VGM_SUBMISSION_CUT_DATE { get; set; }
+
///
/// MDGF提交截止时间
///
[SugarColumn(ColumnName = "MDGF_CUT_DATE")]
- public DateTime? MDGF_CUT_DATE{ get; set; }
-
+ public DateTime? MDGF_CUT_DATE { get; set; }
+
///
/// 舱单截止时间
///
[SugarColumn(ColumnName = "MANIFEST_CUT_DATE")]
- public DateTime? MANIFEST_CUT_DATE{ get; set; }
-
-
+ public DateTime? MANIFEST_CUT_DATE { get; set; }
+
+
///
/// 租户名称
///
[SugarColumn(ColumnName = "TenantName")]
- public string TenantName{ get; set; }
+ public string TenantName { get; set; }
+ ///
+ /// 客户ID
+ ///
+ public long? CUSTOMERID { get; set; }
///
/// 客户名称
///
public string CUSTOMERNAME { get; set; }
+ ///
+ /// 客服ID
+ ///
+ public string CUSTSERVICEID { get; set; }
///
/// 客服名称
///
public string CUSTSERVICE { get; set; }
+ ///
+ /// 销售ID
+ ///
+ public string SALEID { get; set; }
///
/// 销售名称
///
diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs
index 9e43cd75..656ab9ff 100644
--- a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs
+++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs
@@ -371,7 +371,7 @@ namespace Myshipping.Application
///
[SugarColumn(ColumnName = "CUSTOM_SI_CUT_DATE")]
[Description("客户样单截止日期")]
- public Nullable CUSTOM_SI_CUT_DATE { get; set; }
+ public DateTime? CUSTOM_SI_CUT_DATE { get; set; }
///
/// 备注
diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs
index a4d3c22a..34f2e770 100644
--- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs
+++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs
@@ -6,7 +6,6 @@ using Furion.EventBus;
using Furion.Extensions;
using Furion.FriendlyException;
using Furion.JsonSerialization;
-using Furion.RemoteRequest.Extensions;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@@ -20,15 +19,10 @@ using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Application.Service.BookingSlot.Dto;
using Myshipping.Core;
using Myshipping.Core.Service;
-using MySqlX.XDevAPI.Common;
-using NPOI.XWPF.UserModel;
-using Org.BouncyCastle.Asn1.Tsp;
using SqlSugar;
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
using System.ComponentModel;
-using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net.Http;
@@ -36,9 +30,7 @@ using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using System.Web;
using Yitter.IdGenerator;
-using static Aliyun.OSS.Model.CreateSelectObjectMetaInputFormatModel;
namespace Myshipping.Application
{
@@ -56,7 +48,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository _bookingFileRepository;
private readonly SqlSugarRepository _bookingSlotCompareRepository;
private readonly SqlSugarRepository _bookingOrderContactRepository;
-
+ private readonly SqlSugarRepository _repBookingOrder;
private readonly SqlSugarRepository _repBookingLog;
private readonly SqlSugarRepository _repBookingLogDetail;
private readonly SqlSugarRepository _bookingfile;
@@ -97,7 +89,8 @@ namespace Myshipping.Application
SqlSugarRepository bookingSlotCompareRepository,
SqlSugarRepository bookingOrderContactRepository,
INamedServiceProvider namedBookingOrderServiceProvider,
- IBookingValueAddedService bookingValueAddedService)
+ IBookingValueAddedService bookingValueAddedService,
+ SqlSugarRepository repBookingOrder)
{
_repBase = repBase;
_repCtn = repCtn;
@@ -118,6 +111,7 @@ namespace Myshipping.Application
_namedBookingOrderServiceProvider = namedBookingOrderServiceProvider;
_bookingOrderContactRepository = bookingOrderContactRepository;
_bookingValueAddedService = bookingValueAddedService;
+ _repBookingOrder = repBookingOrder;
}
#region 舱位
@@ -156,7 +150,6 @@ namespace Myshipping.Application
{
isNeedUpdateOldStock = true;
}
-
await _repBase.UpdateAsync(model);
if (isNeedUpdateOldStock)
@@ -175,14 +168,106 @@ namespace Myshipping.Application
}));
}
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
- foreach (var ctn in input.CtnList)
+ if (input.CtnList != null)
{
- var newCtn = ctn.Adapt();
- newCtn.SLOT_ID = model.Id;
- await _repCtn.InsertAsync(newCtn);
+ foreach (var ctn in input.CtnList)
+ {
+ var newCtn = ctn.Adapt();
+ 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();
+ 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();
+ 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
{
@@ -220,6 +305,135 @@ namespace Myshipping.Application
return await Detail(model.Id);
}
+
+ ///
+ /// 直接在台账页数据列表上进行保存
+ ///
+ ///
+ [HttpPost("/BookingSlot/SaveDataInList")]
+ public async Task 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 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();
+ var update2 = _repBookingOrder.Context.Updateable();
+ 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();
+ await bookingOrderService.SendBookingOrder(new long[] { model.BOOKING_ID });
+ }
+ catch (Exception)
+ {
+ _repAllocation.CurrentRollbackTran();
+ throw;
+ }
+ }
+
+ return await Detail(slotBaseId);
+ }
///
/// 获取订舱舱位
///
@@ -250,6 +464,28 @@ namespace Myshipping.Application
rtn.LogList = list;
+ // 赋值关联的订舱列表
+ // 查询舱位绑定的销售信息,赋值到舱位对象中
+ List 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;
}
@@ -554,7 +790,7 @@ namespace Myshipping.Application
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();
@@ -732,7 +968,7 @@ namespace Myshipping.Application
CreatedUserName = UserManager.Name,
Module = "Slot"
});
-
+ List waitInsertLogList = new();
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(objType))
{
if (excepProp.Contains(descriptor.Name))
@@ -740,52 +976,29 @@ namespace Myshipping.Application
continue;
}
- var compResult = false;
- var oldValue = descriptor.GetValue(objOld);
- 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;
- }
+ var oldValue = descriptor.GetValue(objOld)?.ToString();
+ var newValue = descriptor.GetValue(objNew)?.ToString();
- if (!compResult)
+ if (oldValue != newValue)
{
var fieldName = descriptor.Name;
if (!string.IsNullOrWhiteSpace(descriptor.Description))
{
fieldName = descriptor.Description;
}
-
- await _repBookingLogDetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
+ waitInsertLogList.Add(new BookingLogDetail
{
PId = bid,
Field = fieldName,
- OldValue = $"{oldValue}",
- NewValue = $"{newValue}",
+ OldValue = oldValue switch { "True" => "是", "False" => "否", _ => oldValue },
+ NewValue = newValue switch { "True" => "是", "False" => "否", _ => newValue },
});
}
}
+ if (waitInsertLogList.Any())
+ {
+ await _repBookingLogDetail.InsertAsync(waitInsertLogList);
+ }
}
#endregion
@@ -1134,23 +1347,31 @@ namespace Myshipping.Application
{
var entities = await _repBase.AsQueryable()
.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.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
.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.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(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
+
.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.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.STATUS == 1, u => !u.IS_CANCELLATION)
- .WhereIF(input.STATUS == 2, u => u.IS_CANCELLATION)
+ .WhereIF(!string.IsNullOrEmpty(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
+ .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);
var result = entities.Adapt>();
@@ -1163,9 +1384,14 @@ namespace Myshipping.Application
.Where(x => slotIds.Contains(x.BOOKING_SLOT_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,
diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs
index c7b727ca..e5422ec4 100644
--- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs
+++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs
@@ -1,5 +1,6 @@
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
+using Newtonsoft.Json.Linq;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -105,6 +106,24 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// 舱位状态 0-全部 1-未取消 2:已取消
///
public int STATUS { get; set; }
+ ///
+ /// 创建者名称
+ ///
+ public string CreatedUserName { get; set; }
+ ///
+ /// 修改者名称
+ ///
+ public string UpdatedUserName { get; set; }
+
+ ///
+ /// 合约号
+ ///
+ public string CONTRACT_NO { get; set; }
+
+ ///
+ /// 周数
+ ///
+ public string WEEK_AT { get; set; }
}
///
@@ -356,6 +375,11 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
///
[Description("计费日期")]
public DateTime? PRICE_CALCULATION_DATE { get; set; }
+
+ ///
+ /// 舱位关联的订舱信息
+ ///
+ public List BookingSlotSaleInfoList { get; set; }
}
///
@@ -375,6 +399,22 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
public List CtnList { get; set; }
}
+ ///
+ /// 舱位台账列表保存输入
+ ///
+ public class BookingSlotBaseSaveDataInListInputDto
+ {
+ ///
+ /// 舱位信息
+ ///
+ public JObject SlotBase { get; set; }
+
+ ///
+ /// 关联订单的销售信息
+ ///
+ public JObject SlotSaleInfo { get; set; }
+ }
+
///
/// 保存舱位输出
///
@@ -470,10 +510,6 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
///
public string UpdatedUserName { get; set; }
- ///
- /// 舱位关联的订舱信息
- ///
- public List BookingSlotSaleInfoList { get; set; }
}
///
@@ -529,21 +565,38 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
///
public class BookingSlotSaleInfoDto
{
+ ///
+ /// 关联关系主键
+ ///
+ public long Id { get; set; }
+ ///
+ /// 订舱主键
+ ///
+ public long BOOKING_ID { get; set; }
///
/// 舱位主键
///
public long BOOKING_SLOT_ID { get; set; }
-
+ ///
+ /// 客户ID
+ ///
+ public long? CUSTOMERID { get; set; }
///
/// 客户名称
///
public string CUSTOMERNAME { get; set; }
-
+ ///
+ /// 客服ID
+ ///
+ public string CUSTSERVICEID { get; set; }
///
/// 客服名称
///
public string CUSTSERVICE { get; set; }
-
+ ///
+ /// 销售ID
+ ///
+ public string SALEID { get; set; }
///
/// 销售名称
///
@@ -568,5 +621,9 @@ namespace Myshipping.Application.Service.BookingSlot.Dto
/// 卖价
///
public decimal? SELLING_PRICE { get; set; }
+ ///
+ /// 修改标记,前端提供给后端判断是否更新
+ ///
+ public bool UpdateFlag { get; set; }
}
}