修改舱位管理

增加日志提取解析
usertest
jianghaiqing 4 months ago
parent 00642f7f7e
commit 4168188693

@ -1062,4 +1062,55 @@ public static class MultiLanguageConst
[Description("MSK API SPOT 检索海运船期详情失败,原因:{0}")] [Description("MSK API SPOT 检索海运船期详情失败,原因:{0}")]
public const string SpaceBookingAPISpotSearchShipResultError2 = "SpaceBK_API_Spot_SearchShip_Exception"; public const string SpaceBookingAPISpotSearchShipResultError2 = "SpaceBK_API_Spot_SearchShip_Exception";
#endregion #endregion
#region 舱位管理
/// <summary>
/// 订舱提单号已存在
/// </summary>
[Description("订舱提单号已存在")]
public const string BookingSlotSlotBookingNoExists = "BookingSlot_SlotBookingNo_Exists";
/// <summary>
/// 保存失败原因更新关联订舱时未查询到订舱关联表Id{item.Id}
/// </summary>
[Description("保存失败原因更新关联订舱时未查询到订舱关联表Id{0}")]
public const string BookingSlotSaveFailAllocRecordNull = "BookingSlot_SaveFail_AllocRecord_Null";
/// <summary>
/// 业务主键为空,请选中需要标记的业务信息
/// </summary>
[Description("业务主键为空,请选中需要标记的业务信息")]
public const string BookingSlotLabelBusiNoNull = "BookingSlotLabel_BusiNo_Null";
/// <summary>
/// 设定标签失败,原因:{0}
/// </summary>
[Description("设定标签失败,原因:{0}")]
public const string BookingSlotSetLabelError = "BookingSlotLabel_SetLabel_Error";
/// <summary>
/// 自动生成舱位标签失败,原因:{0}
/// </summary>
[Description("自动生成舱位标签失败,原因:{0}")]
public const string BookingSlotAutoSetLabelError = "BookingSlotLabel_AutoSetLabel_Error";
/// <summary>
/// 未查询到此舱位信息,已删除或不存在
/// </summary>
[Description("未查询到此舱位信息,已删除或不存在")]
public const string BookingSlotBaseInfoNull = "BookingSlot_BaseInfo_Null";
/// <summary>
/// 查询日志异常,原因:{0}
/// </summary>
[Description("查询日志异常,原因:{0}")]
public const string BookingSlotAuditLogError = "BookingSlot_AuditLog_Error";
/// <summary>
/// 解析日志异常,原因:{0}
/// </summary>
[Description("解析日志异常,原因:{0}")]
public const string BookingSlotAuditLogDeserializeError = "BookingSlot_AuditLogDeserialize_Error";
#endregion
} }

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
/// 舱位标签
/// </summary>
public class BookingLabelBaseDto
{
public long? Id { get; set; }
/// <summary>
/// 标签名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 标签使用范围 1-舱位
/// </summary>
public int Scope { get; set; }
/// <summary>
/// 颜色
/// </summary>
public string Color { get; set; }
/// <summary>
/// 正则匹配
/// </summary>
public string RegexPatternTxt { get; set; }
}
/// <summary>
/// 标签绑定Dto类
/// </summary>
public class BindLabelDto
{
/// <summary>
/// 标签主键列表
/// </summary>
public long[] LabelIdArray { get; set; }
/// <summary>
/// 业务主键列表
/// </summary>
public long[] BusinessIdArray { get; set; }
}
/// <summary>
///
/// </summary>
public class BookingLabelPageListInput : PageInputBase
{
/// <summary>
/// 标签名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 标签使用范围 1-舱位
/// </summary>
public int? Scope { get; set; }
}
}

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
///
/// </summary>
public class BookingLabelRegexDto
{
/// <summary>
/// 字段名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 操作类型
/// </summary>
public string oper { get; set; }
/// <summary>
/// 值
/// </summary>
public string val { get; set; }
/// <summary>
/// 是主要条件,必需满足
/// </summary>
public bool master { get; set; }
}
public enum LabelRegexOperEnum
{
equal,
like,
startwith,
notexists,
notequal,
notstartwith
}
}

@ -12,7 +12,7 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary> /// <summary>
/// 日志 /// 日志
/// </summary> /// </summary>
public List<BookingLogDto> LogList { get; set; } public List<DS.WMS.Core.Sys.Dtos.AuditLogBookingDto> LogList { get; set; }
} }
public class BookingSlotBaseSaveInput : BookingSlotBaseDto public class BookingSlotBaseSaveInput : BookingSlotBaseDto
@ -38,37 +38,37 @@ namespace DS.WMS.Core.Op.Dtos
/// 舱位提单号 /// 舱位提单号
/// </summary> /// </summary>
[Description("舱位提单号")] [Description("舱位提单号")]
public string SLOT_BOOKING_NO { get; set; } public string SlotBookingNo { get; set; }
/// <summary> /// <summary>
/// 订舱编号 /// 订舱编号
/// </summary> /// </summary>
[Description("订舱编号")] [Description("订舱编号")]
public string SLOT_NO { get; set; } public string SlotNo { get; set; }
/// <summary> /// <summary>
/// 合约号 /// 合约号
/// </summary> /// </summary>
[Description("合约号")] [Description("合约号")]
public string CONTRACT_NO { get; set; } public string ContractNo { get; set; }
/// <summary> /// <summary>
/// 订舱抬头 /// 订舱抬头
/// </summary> /// </summary>
[Description("订舱抬头")] [Description("订舱抬头")]
public string BOOKING_PARTY { get; set; } public string BookingParty { get; set; }
/// <summary> /// <summary>
/// 船名 /// 船名
/// </summary> /// </summary>
[Description("船名")] [Description("船名")]
public string VESSEL { get; set; } public string Vessel { get; set; }
/// <summary> /// <summary>
/// 航次号 /// 航次号
/// </summary> /// </summary>
[Description("航次号")] [Description("航次号")]
public string VOYNO { get; set; } public string Voyno { get; set; }
/// <summary> /// <summary>
/// 预计开船日期 /// 预计开船日期
@ -86,204 +86,210 @@ namespace DS.WMS.Core.Op.Dtos
/// 收货地代码 /// 收货地代码
/// </summary> /// </summary>
[Description("收货地代码")] [Description("收货地代码")]
public string PLACERECEIPTID { get; set; } public string PlaceReceiptId { get; set; }
/// <summary> /// <summary>
/// 收货地 /// 收货地
/// </summary> /// </summary>
[Description("收货地")] [Description("收货地")]
public string PLACERECEIPT { get; set; } public string PlaceReceipt { get; set; }
/// <summary> /// <summary>
/// 交货地代码 /// 交货地代码
/// </summary> /// </summary>
[Description("交货地代码")] [Description("交货地代码")]
public string PLACEDELIVERYID { get; set; } public string PlaceDeliveryId { get; set; }
/// <summary> /// <summary>
/// 交货地 /// 交货地
/// </summary> /// </summary>
[Description("交货地")] [Description("交货地")]
public string PLACEDELIVERY { get; set; } public string PlaceDelivery { get; set; }
/// <summary> /// <summary>
/// 装货港代码 /// 装货港代码
/// </summary> /// </summary>
[Description("装货港代码")] [Description("装货港代码")]
public string PORTLOADID { get; set; } public string PortLoadId { get; set; }
/// <summary> /// <summary>
/// 装货港 /// 装货港
/// </summary> /// </summary>
[Description("装货港")] [Description("装货港")]
public string PORTLOAD { get; set; } public string PortLoad { get; set; }
/// <summary> /// <summary>
/// 卸货港代码 /// 卸货港代码
/// </summary> /// </summary>
[Description("卸货港代码")] [Description("卸货港代码")]
public string PORTDISCHARGEID { get; set; } public string PortDischargeId { get; set; }
/// <summary> /// <summary>
/// 卸货港 /// 卸货港
/// </summary> /// </summary>
[Description("卸货港")] [Description("卸货港")]
public string PORTDISCHARGE { get; set; } public string PortDischarge { get; set; }
/// <summary> /// <summary>
/// 卸货港国家代码 /// 卸货港国家代码
/// </summary> /// </summary>
[Description("卸货港国家代码")] [Description("卸货港国家代码")]
public string PORTDISCHARGE_COUNTRY_CODE { get; set; } public string PortDischargeCountryCode { get; set; }
/// <summary> /// <summary>
/// 卸货港国家名称 /// 卸货港国家名称
/// </summary> /// </summary>
[Description("卸货港国家名称")] [Description("卸货港国家名称")]
public string PORTDISCHARGE_COUNTRY { get; set; } public string PortDischargeCountry { get; set; }
/// <summary> /// <summary>
/// 中转港1 /// 中转港1
/// </summary> /// </summary>
[Description("中转港1")] [Description("中转港1")]
public string TRANSFER_PORT_1 { get; set; } public string TransferPort1 { get; set; }
/// <summary> /// <summary>
/// 中转港2 /// 中转港2
/// </summary> /// </summary>
[Description("中转港2")] [Description("中转港2")]
public string TRANSFER_PORT_2 { get; set; } public string TransferPort2 { get; set; }
/// <summary> /// <summary>
/// 船公司代号 /// 船公司ID
/// </summary> /// </summary>
[Description("船公司代号")] [Description("船公司ID")]
public string CARRIERID { get; set; } public Nullable<long> CarrierId { get; set; }
/// <summary>
/// 船公司代码
/// </summary>
[Description("船公司代码")]
public string CarrierCode { get; set; }
/// <summary> /// <summary>
/// 船公司 /// 船公司
/// </summary> /// </summary>
[Description("船公司")] [Description("船公司")]
public string CARRIER { get; set; } public string Carrier { get; set; }
/// <summary> /// <summary>
/// 航线代码(船公司) /// 航线代码(船公司)
/// </summary> /// </summary>
[Description("航线代码(船公司)")] [Description("航线代码(船公司)")]
public string LANECODE { get; set; } public string LaneCode { get; set; }
/// <summary> /// <summary>
/// 航线名称(船公司) /// 航线名称(船公司)
/// </summary> /// </summary>
[Description("航线名称(船公司)")] [Description("航线名称(船公司)")]
public string LANENAME { get; set; } public string LaneName { get; set; }
/// <summary> /// <summary>
/// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转 /// 承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转
/// </summary> /// </summary>
[Description("承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转")] [Description("承运方式 DIRECT_SHIP-直达TRANSFER_SHIP-中转")]
public string CARRIAGE_TYPE { get; set; } public string CarriageType { get; set; }
/// <summary> /// <summary>
/// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
[Description("承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")] [Description("承运方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string CARRIAGE_TYPE_NAME { get; set; } public string CarriageTypeName { get; set; }
/// <summary> /// <summary>
/// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
[Description("订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")] [Description("订舱方式 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string BOOKING_SLOT_TYPE { get; set; } public string BookingSlotType { get; set; }
/// <summary> /// <summary>
/// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱 /// 订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱
/// </summary> /// </summary>
[Description("订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")] [Description("订舱方式名称 CONTRACT_ORDER-合约订舱SPOT_ORDER-SPOT订舱")]
public string BOOKING_SLOT_TYPE_NAME { get; set; } public string BookingSlotTypeName { get; set; }
/// <summary> /// <summary>
/// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单; /// 签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;
/// </summary> /// </summary>
[Description("签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;")] [Description("签单方式 ORIGINAL-正本TELEX-电放SEAWAY BILL-海运单;")]
public string ISSUETYPE { get; set; } public string IssueType { get; set; }
/// <summary> /// <summary>
/// 箱型箱量 /// 箱型箱量
/// </summary> /// </summary>
[Description("箱型箱量")] [Description("箱型箱量")]
public string CTN_STAT { get; set; } public string CtnStat { get; set; }
/// <summary> /// <summary>
/// 所在周数 /// 所在周数
/// </summary> /// </summary>
[Description("所在周数")] [Description("所在周数")]
public int? WEEK_AT { get; set; } public int? WeekAt { get; set; }
/// <summary> /// <summary>
/// 箱使天数 /// 箱使天数
/// </summary> /// </summary>
[Description("箱使天数")] [Description("箱使天数")]
public int? DETENSION_FREE_DAYS { get; set; } public int? DetensionFreeDays { get; set; }
/// <summary> /// <summary>
/// 样单截止日期 /// 样单截止日期
/// </summary> /// </summary>
[Description("样单截止日期")] [Description("样单截止日期")]
public DateTime? SI_CUT_DATE { get; set; } public DateTime? SICutDate { get; set; }
/// <summary> /// <summary>
/// 截港时间 /// 截港时间
/// </summary> /// </summary>
[Description("截港时间")] [Description("截港时间")]
public DateTime? CY_CUT_DATE { get; set; } public DateTime? CYCutDate { get; set; }
/// <summary> /// <summary>
/// VGM截止日期 /// VGM截止日期
/// </summary> /// </summary>
[Description("VGM截止日期")] [Description("VGM截止日期")]
public DateTime? VGM_SUBMISSION_CUT_DATE { get; set; } public DateTime? VGMSubmissionCutDate { get; set; }
/// <summary> /// <summary>
/// MDGF提交截止时间 /// MDGF提交截止时间
/// </summary> /// </summary>
[Description("MDGF提交截止时间")] [Description("MDGF提交截止时间")]
public DateTime? MDGF_CUT_DATE { get; set; } public DateTime? MDGFCutDate { get; set; }
/// <summary> /// <summary>
/// 舱单截止时间 /// 舱单截止时间
/// </summary> /// </summary>
[Description("舱单截止时间")] [Description("舱单截止时间")]
public DateTime? MANIFEST_CUT_DATE { get; set; } public DateTime? ManifestCutDate { get; set; }
/// <summary> /// <summary>
/// 是否Cancellation /// 是否Cancellation
/// </summary> /// </summary>
[Description("是否Cancellation")] [Description("是否Cancellation")]
public bool IS_CANCELLATION { get; set; } public bool IsCancellation { get; set; }
/// <summary> /// <summary>
/// Cancellation时间 /// Cancellation时间
/// </summary> /// </summary>
[Description("Cancellation时间")] [Description("Cancellation时间")]
public DateTime? CANCELLATION_DATE { get; set; } public DateTime? CancellationDate { get; set; }
/// <summary> /// <summary>
/// 客户样单截止日期 /// 客户样单截止日期
/// </summary> /// </summary>
[Description("客户样单截止日期")] [Description("客户样单截止日期")]
public Nullable<DateTime> CUSTOM_SI_CUT_DATE { get; set; } public Nullable<DateTime> CustomSICutDate { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
[Description("备注")] [Description("备注")]
public string REMARK { get; set; } public string Remark { get; set; }
/// <summary> /// <summary>
/// 计费日期 /// 计费日期
/// </summary> /// </summary>
[Description("计费日期")] [Description("计费日期")]
public DateTime? PRICE_CALCULATION_DATE { get; set; } public DateTime? PriceCalculationDate { get; set; }
/// <summary> /// <summary>
/// 舱位关联的订舱信息 /// 舱位关联的订舱信息
@ -294,19 +300,19 @@ namespace DS.WMS.Core.Op.Dtos
/// 拆票或合票标记 1-拆票 2-合票 /// 拆票或合票标记 1-拆票 2-合票
/// </summary> /// </summary>
[Description("拆票或合票标记")] [Description("拆票或合票标记")]
public Nullable<int> SPLIT_OR_MERGE_FLAG { get; set; } public Nullable<int> SplitOrMergeFlag { get; set; }
/// <summary> /// <summary>
/// 舱保类型 FULL-全舱保PART-部分舱保 /// 舱保类型 FULL-全舱保PART-部分舱保
/// </summary> /// </summary>
[Description("舱保类型")] [Description("舱保类型")]
public string LOAD_GUARANTEE_FLAG { get; set; } public string LoadGuaranteeFlag { get; set; }
// <summary> // <summary>
/// 舱保类型名称 FULL-全舱保PART-部分舱保 /// 舱保类型名称 FULL-全舱保PART-部分舱保
/// </summary> /// </summary>
[Description("舱保类型名称")] [Description("舱保类型名称")]
public string LOAD_GUARANTEE_FLAG_NAME { get; set; } public string LoadGuaranteeFlagName { get; set; }
} }
/// <summary> /// <summary>
@ -404,92 +410,101 @@ namespace DS.WMS.Core.Op.Dtos
/// 关联关系主键 /// 关联关系主键
/// </summary> /// </summary>
public long Id { get; set; } public long Id { get; set; }
/// <summary> /// <summary>
/// 订舱主键 /// 订舱主键
/// </summary> /// </summary>
public long BOOKING_ID { get; set; } public long BookingId { get; set; }
/// <summary> /// <summary>
/// 舱位主键 /// 舱位主键
/// </summary> /// </summary>
public long BOOKING_SLOT_ID { get; set; } public long BookingSlotId { get; set; }
/// <summary> /// <summary>
/// 客户ID /// 客户ID
/// </summary> /// </summary>
public long? CUSTOMERID { get; set; } public Nullable<long> CustomerId { get; set; }
/// <summary> /// <summary>
/// 客户名称 /// 客户名称
/// </summary> /// </summary>
public string CUSTOMERNAME { get; set; } public string CustomerName { get; set; }
/// <summary> /// <summary>
/// 客服ID /// 客服ID
/// </summary> /// </summary>
public string CUSTSERVICEID { get; set; } public string CustServiceId { get; set; }
/// <summary> /// <summary>
/// 客服名称 /// 客服名称
/// </summary> /// </summary>
public string CUSTSERVICE { get; set; } public string CustService { get; set; }
/// <summary> /// <summary>
/// 销售ID /// 销售ID
/// </summary> /// </summary>
public string SALEID { get; set; } public string SaleId { get; set; }
/// <summary> /// <summary>
/// 销售名称 /// 销售名称
/// </summary> /// </summary>
public string SALE { get; set; } public string Sale { get; set; }
/// <summary> /// <summary>
/// 操作id /// 操作id
/// </summary> /// </summary>
public string OPID { get; set; } public string OpId { get; set; }
/// <summary> /// <summary>
/// 操作 /// 操作
/// </summary> /// </summary>
public string OP { get; set; } public string Op { get; set; }
/// <summary> /// <summary>
/// 单证id /// 单证id
/// </summary> /// </summary>
public string DOCID { get; set; } public string DocId { get; set; }
/// <summary> /// <summary>
/// 单证 /// 单证
/// </summary> /// </summary>
public string DOC { get; set; } public string Doc { get; set; }
/// <summary> /// <summary>
/// 商务id /// 商务id
/// </summary> /// </summary>
public string BUSINESSID { get; set; } public string BusinessId { get; set; }
/// <summary> /// <summary>
/// 商务 /// 商务
/// </summary> /// </summary>
public string BUSINESS { get; set; } public string Business { get; set; }
/// <summary> /// <summary>
/// 销售日期 /// 销售日期
/// </summary> /// </summary>
public DateTime? SALE_TIME { get; set; } public Nullable<DateTime> SaleTime { get; set; }
/// <summary> /// <summary>
/// 发货人 /// 发货人
/// </summary> /// </summary>
public string SHIPPER { get; set; } public string Shipper { get; set; }
/// <summary> /// <summary>
/// 品名 /// 品名
/// </summary> /// </summary>
public string GOODSNAME { get; set; } public string GoodsName { get; set; }
/// <summary> /// <summary>
/// 卖价 /// 卖价
/// </summary> /// </summary>
public decimal? SELLING_PRICE { get; set; } public Nullable<decimal> SellingPrice { get; set; }
/// <summary> /// <summary>
/// 修改标记,前端提供给后端判断是否更新 /// 修改标记,前端提供给后端判断是否更新
/// </summary> /// </summary>
public bool UpdateFlag { get; set; } public bool UpdateFlag { get; set; }
public long? CreatedUserId { get; set; } /// <summary>
///
/// </summary>
public Nullable<long> CreatedUserId { get; set; }
} }
} }

@ -1,12 +1,60 @@
using System; using DS.Module.Core.Data;
using SqlSugar;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Entity.BookingSlot namespace DS.WMS.Core.Op.Entity
{ {
internal class BookingSlotCompare /// <summary>
/// 舱位变更比对记录表
/// </summary>
[SqlSugar.SugarTable("op_sea_booking_slot_compare", "舱位变更比对记录表")]
public class BookingSlotCompare : BaseModelV2<long>
{ {
/// <summary>
/// 舱位主键
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "舱位主键", IsNullable = false)]
public long SlotId { get; set; }
/// <summary>
/// 打印时间
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "打印时间", IsNullable = true)]
public Nullable<DateTime> PrintDate { get; set; }
/// <summary>
/// 比对类型 BC_MODIFY-BC变更比对
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "比对类型 BC_MODIFY-BC变更比对", IsNullable = true)]
public string CompareType { get; set; }
/// <summary>
/// 比对结果JSON
/// </summary>
[SqlSugar.SugarColumn(ColumnDataType = "text", ColumnDescription = "比对结果JSON", IsNullable = true)]
public string CompareRlt { get; set; }
/// <summary>
/// 比对差异项数
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "比对差异项数", IsNullable = true)]
public Nullable<int> CompareDiffNum { get; set; }
/// <summary>
/// 比对批次号
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "比对批次号", IsNullable = true)]
public string CompareBatchNo { get; set; }
/// <summary>
/// 任务BC主键
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "任务BC主键", IsNullable = true)]
public string BCTaskId { get; set; }
} }
} }

@ -0,0 +1,45 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Dtos;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Interface
{
/// <summary>
///
/// </summary>
public interface IBookingLabelService
{
/// <summary>
/// 获取全部或指定范围类型的标签列表
/// </summary>
/// <param name="scope">标签使用范围 空-全部 1-舱位管理台账</param>
/// <returns>返回列表</returns>
Task<DataResult<List<BookingLabelBaseDto>>> List(int? scope);
/// <summary>
/// 设定标签
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回回执</returns>
Task<DataResult<string>> SetLabel(BindLabelDto input);
/// <summary>
/// 保存标签
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回标签主键</returns>
Task<DataResult<long>> Save(BookingLabelBaseDto input);
/// <summary>
/// 删除标签信息
/// </summary>
/// <param name="ids">标签主键组</param>
/// <returns></returns>
Task<DataResult<string>> Delete(long[] ids);
}
}

@ -74,11 +74,11 @@ namespace DS.WMS.Core.Op.Interface
Task RefreshStock(BookingSlotStockUpdateModel input); Task RefreshStock(BookingSlotStockUpdateModel input);
/// <summary> /// <summary>
/// /// 保存舱位
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input">舱位详情</param>
/// <returns></returns> /// <returns>返回输出</returns>
Task<BookingSlotBaseSaveOutput> Save(BookingSlotBaseSaveInput input); Task<DataResult<BookingSlotBaseSaveOutput>> Save(BookingSlotBaseSaveInput input);
/// <summary> /// <summary>
/// 获取附件 /// 获取附件

@ -0,0 +1,217 @@
using Amazon.Runtime.Internal.Util;
using DS.Module.Core;
using DS.Module.Core.Log;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using DS.WMS.Core.Op.Interface;
using SqlSugar.IOC;
using System.Text.Json.Nodes;
using NLog;
using DS.Module.RedisModule;
using MySqlConnector.Logging;
using Newtonsoft.Json;
namespace DS.WMS.Core.Op.Method
{
public class BookingLabelService : IBookingLabelService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
private readonly ISeaExportService _seaExportService;
private readonly IRedisService _redisService;
const string CACHE_KEY_BOOKING_LABEL = "BookingLabelList";
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
public BookingLabelService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
_seaExportService = _serviceProvider.GetRequiredService<ISeaExportService>();
_redisService = _serviceProvider.GetRequiredService<IRedisService>();
}
#region 设定标签
/// <summary>
/// 设定标签
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回回执</returns>
public async Task<DataResult<string>> SetLabel(BindLabelDto input)
{
if (input.BusinessIdArray?.Any() != true)
{
//业务主键为空,请选中需要标记的业务信息
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotLabelBusiNoNull)));
}
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
try
{
var recordList = tenantDb.Queryable<BookingLabelAllocation>()
.Where(x => input.BusinessIdArray.Contains(x.BusinessId));
recordList.ForEach(async p =>
{
await tenantDb.Deleteable<BookingLabelAllocation>().ExecuteCommandAsync();
});
if (input.LabelIdArray != null && input.LabelIdArray.Length > 0)
{
List<BookingLabelAllocation> list = new();
foreach (var item in input.LabelIdArray)
{
foreach (var businessId in input.BusinessIdArray)
{
list.Add(new BookingLabelAllocation
{
LabelId = item,
BusinessId = businessId,
//TenantId = UserManager.TENANT_ID
});
}
}
await tenantDb.Insertable<BookingLabelAllocation>(list).ExecuteCommandAsync();
}
}
catch (Exception e)
{
Logger.Log(NLog.LogLevel.Error, $"设定标签失败,原因:{e.Message}");
DataResult<string>.Failed(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSetLabelError)), e.Message));
}
return DataResult<string>.Success(string.Empty);
}
#endregion
#region 获取全部或指定范围类型的标签列表
/// <summary>
/// 获取全部或指定范围类型的标签列表
/// </summary>
/// <param name="scope">标签使用范围 空-全部 1-舱位管理台账</param>
/// <returns>返回列表</returns>
public async Task<DataResult<List<BookingLabelBaseDto>>> List(int? scope)
{
List<BookingLabelBaseDto> cacheList = _redisService.GetEntity<List<BookingLabelBaseDto>>($"{CACHE_KEY_BOOKING_LABEL}:{user.TenantId}");
if (cacheList?.Any() != true)
{
cacheList = await Cache();
}
var result = scope == null
? cacheList
: cacheList.Where(x => x.Scope == scope).ToList();
return DataResult<List<BookingLabelBaseDto>>.Success(result);
}
#endregion
///// <summary>
///// 分页获取全部或指定范围类型的标签列表
///// </summary>
//public async Task<SqlSugarPagedList<BookingLabelBaseDto>> PageList(BookingLabelPageListInput input)
//{
// var list = await _rep.AsQueryable()
// .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name))
// .WhereIF(input.Scope != null, x => x.Scope == input.Scope)
// .ToPagedListAsync(input.PageNo, input.PageSize);
// var result = list.Adapt<SqlSugarPagedList<BookingLabelBaseDto>>();
// return result;
//}
#region 保存标签
/// <summary>
/// 保存标签
/// </summary>
/// <param name="input">请求参数</param>
/// <returns>返回标签主键</returns>
public async Task<DataResult<long>> Save(BookingLabelBaseDto input)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var model = input.Adapt<BookingLabel>();
if (input.Id is null or 0)
{
await tenantDb.Insertable<BookingLabel>(model).ExecuteReturnEntityAsync();
await Cache();
return DataResult<long>.Success(model.Id);
}
else
{
var oldModel = await tenantDb.Queryable<BookingLabel>().FirstAsync(x => x.Id == input.Id);
if (oldModel != null)
{
input.Adapt(oldModel);
await tenantDb.Updateable<BookingLabel>(oldModel).ExecuteCommandAsync();
await Cache();
}
return DataResult<long>.Success(input.Id.Value);
}
}
#endregion
/// <summary>
/// 删除标签信息
/// </summary>
/// <param name="ids">标签主键组</param>
/// <returns></returns>
public async Task<DataResult<string>> Delete([FromBody] long[] ids)
{
if (ids != null && ids.Length > 0)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var recordList = tenantDb.Queryable<BookingLabel>()
.Where(x => ids.Contains(x.Id));
recordList.ForEach(async p =>
{
await tenantDb.Deleteable<BookingLabel>().ExecuteCommandAsync();
});
await Cache();
return DataResult<string>.Success(string.Empty);
}
return DataResult<string>.Failed(string.Empty);
}
/// <summary>
/// 缓存数据
/// </summary>
/// <returns>返回标签列表</returns>
private async Task<List<BookingLabelBaseDto>> Cache()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<BookingLabel>().ToListAsync();
var cacheList = list.Adapt<List<BookingLabelBaseDto>>();
_redisService.SetValue($"{CACHE_KEY_BOOKING_LABEL}:{user.TenantId}", JsonConvert.SerializeObject(list), 72 * 3600);
return cacheList;
}
}
}

@ -0,0 +1,664 @@
using Amazon.Runtime.Internal.Util;
using DS.Module.Core;
using DS.Module.Core.Log;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using DS.WMS.Core.Op.Interface;
using SqlSugar.IOC;
using Newtonsoft.Json;
using NLog;
using DS.WMS.Core.Sys.Interface;
namespace DS.WMS.Core.Op.Method
{
public class BookingSlotService //: IBookingSlotService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
private readonly ISeaExportService _seaExportService;
private readonly IBookingLabelService _bookingLabelService;
private readonly ILogAuditService _logAuditService;
private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();
public BookingSlotService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
_seaExportService = _serviceProvider.GetRequiredService<ISeaExportService>();
_bookingLabelService = _serviceProvider.GetRequiredService<IBookingLabelService>();
_logAuditService = _serviceProvider.GetRequiredService<ILogAuditService>();
}
#region 保存舱位
/// <summary>
/// 保存舱位
/// </summary>
/// <param name="input">舱位详情</param>
/// <returns>返回输出</returns>
public async Task<DataResult<BookingSlotBaseSaveOutput>> Save(BookingSlotBaseSaveInput input)
{
BookingSlotBase model = null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (input.Id > 0) //修改
{
var c = tenantDb.Queryable<BookingSlotBase>().Where(x => x.SlotBookingNo == input.SlotBookingNo
&& input.Id != input.Id).Count();
if (c > 0)
{
//订舱提单号已存在
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSlotBookingNoExists)));
}
model = tenantDb.Queryable<BookingSlotBase>().First(x => x.Id == input.Id);
var oldObj = model.Adapt<BookingSlotBaseSaveInput>();
input.Adapt(model);
// 1.判断新的舱位信息的7个库存统计维度是否发生变化
// 2.如果有变化,则需要更新旧的库存信息
bool isNeedUpdateOldStock = false;
if (oldObj.Vessel != model.Vessel
|| oldObj.Voyno != model.Voyno
|| oldObj.BookingSlotType != model.BookingSlotType
|| oldObj.CarrierCode != model.CarrierCode
|| oldObj.PortLoadId != model.PortLoadId
|| oldObj.PortDischargeId != model.PortDischargeId)
{
isNeedUpdateOldStock = true;
}
await tenantDb.Updateable<BookingSlotBase>(model).ExecuteCommandAsync();
if (isNeedUpdateOldStock)
{
//更新库存
//await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
//{
// BOOKING_SLOT_TYPE = oldObj.BOOKING_SLOT_TYPE,
// CARRIERID = oldObj.CARRIERID,
// CONTRACT_NO = oldObj.CONTRACT_NO,
// VESSEL = oldObj.VESSEL,
// VOYNO = oldObj.VOYNO,
// PORTLOADID = oldObj.PORTLOADID,
// PORTDISCHARGEID = oldObj.PORTDISCHARGEID,
// TenantId = model.TenantId
//}));
}
var delCtnList = tenantDb.Queryable<BookingSlotCtn>().Where(x => x.SlotId == model.Id).ToList();
if(delCtnList.Count > 0)
await tenantDb.Deleteable<BookingSlotCtn>(delCtnList).ExecuteCommandAsync();
if (input.CtnList != null)
{
foreach (var ctn in input.CtnList)
{
var newCtn = ctn.Adapt<BookingSlotCtn>();
newCtn.SlotId = model.Id;
await tenantDb.Insertable<BookingSlotCtn>(newCtn).ExecuteCommandAsync();
}
}
#region 关联订舱信息修改
if (input.BookingSlotSaleInfoList != null)
{
foreach (var item in input.BookingSlotSaleInfoList)
{
if (!item.UpdateFlag)
{
continue;
}
var allocation = await tenantDb.Queryable<BookingSlotAllocation>().FirstAsync(x => x.Id == item.Id);
if (allocation == null)
{
//保存失败原因更新关联订舱时未查询到订舱关联表Id{item.Id}
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSaveFailAllocRecordNull)), item.Id));
}
// 更新关联表
item.Adapt(allocation);
await tenantDb.Ado.BeginTranAsync();
try
{
await tenantDb.Updateable<BookingSlotAllocation>(allocation).UpdateColumns(x => new
{
x.CustomerId,
x.CustomerName,
x.CustServiceId,
x.CustService,
x.Sale,
x.SaleId,
x.Op,
x.OpId,
x.Doc,
x.DocId,
x.BusinessId,
x.Business,
x.Shipper,
x.SaleTime,
x.GoodsName,
x.SellingPrice,
x.UpdateBy,
//x.UpdatedUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
// 更新订舱表
//var bookingOrder = await _repBookingOrder.FirstOrDefaultAsync(x => x.Id == allocation.BOOKING_ID);
var bookingOrder = _seaExportService.GetSeaExportInfo(allocation.BookingId.ToString()).Data;
/*
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;
bookingOrder.OP = allocation.OP;
bookingOrder.OPID = allocation.OPID;
bookingOrder.DOC = allocation.DOC;
bookingOrder.DOCID = allocation.DOCID;
bookingOrder.BUSINESS = allocation.BUSINESS;
bookingOrder.BUSINESSID = allocation.BUSINESSID;
await _repBookingOrder.AsUpdateable(bookingOrder).UpdateColumns(x => new
{
x.CUSTOMERID,
x.CUSTOMERNAME,
x.CUSTSERVICE,
x.CUSTSERVICEID,
x.SALE,
x.SALEID,
x.OP,
x.OPID,
x.DOC,
x.DOCID,
x.UpdatedUserId,
x.UpdatedUserName,
x.UpdatedTime,
}).ExecuteCommandAsync();
Parallel.For(0, 1, (n) =>
{
//bookingOrderService.SaveLog(bookingOrder, oldBookingOrder, "舱位关联更新");
// 推送东胜
//bookingOrderService.SendBookingOrder(new long[] { allocation.BOOKING_ID });
});
}
*/
await tenantDb.Ado.CommitTranAsync();
}
catch (Exception)
{
await tenantDb.Ado.RollbackTranAsync();
//await ex.LogAsync(Db);
//return DataResult.Failed(MultiLanguageConst.Operation_Failed);
//_repAllocation.CurrentRollbackTran();
throw;
}
}
}
#endregion
//Parallel.For(0, 1, (n) =>
//{
// _ = InsLog("Update", model.Id, typeof(BookingSlotBaseSaveInput), oldObj, input,
// nameof(BookingSlotBaseApiSaveDto.CtnList),
// nameof(BookingSlotBaseApiSaveDto.BookingSlotSaleInfoList));
//});
}
else
{
var c = tenantDb.Queryable<BookingSlotBase>().Where(x => x.SlotBookingNo == input.SlotBookingNo).Count();
if (c > 0)
{
//订舱提单号已存在
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSlotBookingNoExists)));
}
model = input.Adapt<BookingSlotBase>();
await tenantDb.Insertable<BookingSlotBase>(model).ExecuteReturnEntityAsync();
foreach (var ctn in input.CtnList)
{
var newCtn = ctn.Adapt<BookingSlotCtn>();
newCtn.SlotId = model.Id;
await tenantDb.Insertable<BookingSlotCtn>(newCtn).ExecuteCommandAsync();
}
//await InsLog("Add", model.Id, "新增舱位");
}
//更新库存
//await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
//{
// BOOKING_SLOT_TYPE = model.BOOKING_SLOT_TYPE,
// CARRIERID = model.CARRIERID,
// CONTRACT_NO = model.CONTRACT_NO,
// VESSEL = model.VESSEL,
// VOYNO = model.VOYNO,
// PORTLOADID = model.PORTLOADID,
// PORTDISCHARGEID = model.PORTDISCHARGEID,
// TenantId = model.TenantId
//}));
var inputDto = new BookingSlotBaseApiDto
{
DataObj = new BookingSlotBaseApiSaveDto
{
PortDischargeId = model.PortDischargeId,
PortDischarge = model.PortDischarge,
PortLoadId = model.PortLoadId,
PortLoad = model.PortLoad,
PlaceDelivery = model.PlaceDelivery,
PlaceDeliveryId = model.PlaceDeliveryId,
PlaceReceipt = model.PlaceReceipt,
PlaceReceiptId = model.PlaceReceiptId,
}
};
//这里自动匹配标签
await GenerateSlotLabel(inputDto, model.Id);
return await Detail(model.Id);
}
#endregion
#region 自动生成舱位标签
/// <summary>
/// 自动生成舱位标签
/// </summary>
/// <param name="dto">舱位详情</param>
/// <param name="id">舱位ID</param>
/// <returns></returns>
private async Task<DataResult<string>> GenerateSlotLabel(BookingSlotBaseApiDto dto, long id)
{
try
{
/*
1
2REGEX_PATTERN_TXT
3JSON
*/
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var labelList = _bookingLabelService.List(1).GetAwaiter().GetResult().Data;
List<BookingLabelBaseDto> ruleList = new List<BookingLabelBaseDto>();
if (labelList.Count > 0)
{
for (int i = 0; i < labelList.Count; i++)
{
if (!string.IsNullOrWhiteSpace(labelList[i].RegexPatternTxt))
{
try
{
var regList = JsonConvert.DeserializeObject<List<BookingLabelRegexDto>>(labelList[i].RegexPatternTxt);
if (regList != null && regList.Count > 0)
{
bool isSucc = true;
for (int j = 0; j < regList.Count; j++)
{
var operEnum = (LabelRegexOperEnum)System.Enum.Parse(typeof(LabelRegexOperEnum), regList[j].oper);
if (regList[j].name.Equals("PORTLOADID", StringComparison.OrdinalIgnoreCase))
{
isSucc = CheckLabel("PORTLOADID", dto.DataObj.PortLoadId, regList[j].val, regList[j].master, operEnum);
if (isSucc)
{
ruleList.Add(labelList[i]);
break;
}
else
{
if (regList[j].master)
break;
continue;
}
}
else if (regList[j].name.Equals("PLACERECEIPT", StringComparison.OrdinalIgnoreCase))
{
isSucc = CheckLabel("PLACERECEIPT", dto.DataObj.PlaceReceipt, regList[j].val, regList[j].master, operEnum);
if (isSucc)
{
ruleList.Add(labelList[i]);
break;
}
else
{
if (regList[j].master)
break;
continue;
}
}
else if (regList[j].name.Equals("PORTLOAD", StringComparison.OrdinalIgnoreCase))
{
isSucc = CheckLabel("PORTLOAD", dto.DataObj.PortLoad, regList[j].val, regList[j].master, operEnum);
if (isSucc)
{
ruleList.Add(labelList[i]);
break;
}
else
{
if (regList[j].master)
break;
continue;
}
}
else if (regList[j].name.Equals("PORTDISCHARGEID", StringComparison.OrdinalIgnoreCase))
{
isSucc = CheckLabel("PORTDISCHARGEID", dto.DataObj.PortDischargeId, regList[j].val, regList[j].master, operEnum);
if (isSucc)
{
ruleList.Add(labelList[i]);
break;
}
else
{
if (regList[j].master)
break;
continue;
}
}
else if (regList[j].name.Equals("PORTDISCHARGE", StringComparison.OrdinalIgnoreCase))
{
isSucc = CheckLabel("PORTDISCHARGE", dto.DataObj.PortDischarge, regList[j].val, regList[j].master, operEnum);
if (isSucc)
{
ruleList.Add(labelList[i]);
break;
}
else
{
if (regList[j].master)
break;
continue;
}
}
else if (regList[j].name.Equals("PLACEDELIVERY", StringComparison.OrdinalIgnoreCase))
{
isSucc = CheckLabel("PLACEDELIVERY", dto.DataObj.PlaceDelivery, regList[j].val, regList[j].master, operEnum);
if (isSucc)
{
ruleList.Add(labelList[i]);
break;
}
else
{
if (regList[j].master)
break;
continue;
}
}
}
if (isSucc)
{
Logger.Log(NLog.LogLevel.Info, $"标签对应到有效规则,{labelList[i].Name}");
}
}
}
catch (Exception innEx)
{
Logger.Log(NLog.LogLevel.Info, $"标签对应失败,{labelList[i].Name},原因:{innEx.Message}");
}
}
else
{
continue;
}
}
if (ruleList.Count > 0)
{
var bindModel = new BindLabelDto
{
BusinessIdArray = new[] { id },
LabelIdArray = ruleList.Select(a => a.Id.Value).ToArray()
};
Logger.Log(NLog.LogLevel.Info, $"标签绑定请求,{JsonConvert.SerializeObject(bindModel)}");
await _bookingLabelService.SetLabel(bindModel);
Logger.Log(NLog.LogLevel.Info, $"标签绑定请求完成");
}
}
}
catch (Exception e)
{
Logger.Log(NLog.LogLevel.Error, $"自动生成舱位标签失败,原因:{e.Message}");
return DataResult<string>.Failed(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotSlotBookingNoExists)),e.Message));
}
return DataResult<string>.Success(string.Empty);
}
#endregion
#region 判断标签识别
/// <summary>
/// 判断标签识别
/// </summary>
/// <param name="name">字段名称</param>
/// <param name="val">字段值</param>
/// <param name="checkVal">判断值</param>
/// <param name="isMaster">是否必校验</param>
/// <param name="operEnum">操作符枚举</param>
/// <returns>true-满足识别 false-不满足识别</returns>
private bool CheckLabel(string name, string val, string checkVal, bool isMaster, LabelRegexOperEnum operEnum)
{
if (operEnum == LabelRegexOperEnum.equal)
{
if (!string.IsNullOrWhiteSpace(val) && val.Equals(checkVal, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
else if (operEnum == LabelRegexOperEnum.startwith)
{
if (!string.IsNullOrWhiteSpace(val) && val.StartsWith(checkVal, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
else if (operEnum == LabelRegexOperEnum.like)
{
if (!string.IsNullOrWhiteSpace(val) && val.Contains(checkVal, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
else if (operEnum == LabelRegexOperEnum.notequal)
{
if (!string.IsNullOrWhiteSpace(val))
{
if (!val.Equals(checkVal, StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
if (isMaster)
return false;
}
}
}
else if (operEnum == LabelRegexOperEnum.notexists)
{
if (!string.IsNullOrWhiteSpace(val))
{
if (!val.Contains(checkVal, StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
if (isMaster)
return false;
}
}
}
else if (operEnum == LabelRegexOperEnum.notstartwith)
{
if (!string.IsNullOrWhiteSpace(val))
{
if (!val.StartsWith(checkVal, StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
if (isMaster)
return false;
}
}
}
return false;
}
#endregion
#region 获取舱位详情
/// <summary>
/// 获取舱位详情
/// </summary>
/// <param name="id">舱位主键</param>
/// <returns>返回舱位详情</returns>
public async Task<DataResult<BookingSlotBaseSaveOutput>> Detail(long id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var slotBase = await tenantDb.Queryable<BookingSlotBase>().FirstAsync(u => u.Id == id);
if (slotBase == null)
{
//未查询到此舱位信息,已删除或不存在
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotBaseInfoNull)));
}
var ctns = await tenantDb.Queryable<BookingSlotCtn>().Where(x => x.SlotId == id).ToListAsync();
var rtn = slotBase.Adapt<BookingSlotBaseSaveOutput>();
rtn.CtnList = ctns.Adapt<List<BookingSlotCtnSaveInput>>();
rtn.LogList = _logAuditService.GetAuditLogBookingList(slotBase.Id).GetAwaiter().GetResult()?.Data;
// 赋值关联的订舱列表
// 查询舱位绑定的销售信息,赋值到舱位对象中
List<BookingSlotSaleInfoDto> saleInfoList = await tenantDb.Queryable<BookingSlotAllocation>()
.Where(x => x.BookingSlotId == id)
.Select(x => new BookingSlotSaleInfoDto
{
Id = x.Id,
BookingId = x.BookingId,
BookingSlotId = x.BookingSlotId,
CustomerId = x.CustomerId,
CustomerName = x.CustomerName,
CustServiceId = x.CustServiceId,
CustService = x.CustService,
SaleId = x.SaleId,
Sale = x.Sale,
OpId = x.OpId,
Op = x.Op,
DocId = x.DocId,
Doc = x.Doc,
BusinessId = x.BusinessId,
Business = x.Business,
SaleTime = x.SaleTime,
Shipper = x.Shipper,
GoodsName = x.GoodsName,
SellingPrice = x.SellingPrice,
CreatedUserId = x.CreateBy
}).ToListAsync();
/*
if (saleInfoList.Any())
{
// 判断是否启用了委托单位查看控制权限
var tenantParamList = await _cache.GetAllTenantParam();
var isEnableCustomerAuthority = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID
&& x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode == "YES";
List<long> userList = null;
List<string> userListStr = null;
if (isEnableCustomerAuthority)
{
userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer);
if (userList != null && userList.Count > 0)
{
userListStr = userList.Select(x => x.ToString()).ToList();
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
foreach (BookingSlotSaleInfoDto saleInfoItem in saleInfoList)
{
if (!userList.Contains(saleInfoItem.CreatedUserId ?? 0)
&& !userListStr.Contains(saleInfoItem.OPID)
&& !userListStr.Contains(saleInfoItem.DOCID)
&& !userListStr.Contains(saleInfoItem.SALEID)
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
{
saleInfoItem.CUSTOMERID = 0;
saleInfoItem.CUSTOMERNAME = "--";
saleInfoItem.OPID = "";
saleInfoItem.OP = "--";
saleInfoItem.DOCID = "";
saleInfoItem.DOC = "--";
saleInfoItem.SALEID = "";
saleInfoItem.SALE = "--";
saleInfoItem.SHIPPER = "--";
saleInfoItem.GOODSNAME = "--";
saleInfoItem.CUSTSERVICEID = "";
saleInfoItem.CUSTSERVICE = "--";
}
}
}
}
}
*/
rtn.BookingSlotSaleInfoList = saleInfoList;
return DataResult<BookingSlotBaseSaveOutput>.Success(rtn);
}
#endregion
}
}

@ -4,19 +4,25 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos namespace DS.WMS.Core.Sys.Dtos
{ {
public class BookingLogDto /// <summary>
/// 订舱类日志(包含舱位日志)
/// </summary>
public class AuditLogBookingDto
{ {
public long Id { get; set; } public long Id { get; set; }
/// <summary> /// <summary>
/// 操作类型(新增,编辑) /// 操作类型(新增,编辑)
/// </summary> /// </summary>
public string Type { get; set; } public string Type { get; set; }
/// <summary> /// <summary>
/// 租户Id /// 租户Id
/// </summary> /// </summary>
public long TenantId { get; set; } public long TenantId { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
@ -42,9 +48,28 @@ namespace DS.WMS.Core.Op.Dtos
public string FromFunc { get; set; } public string FromFunc { get; set; }
/// <summary> /// <summary>
/// /// 明细
/// </summary> /// </summary>
//public List<BookingLogDetail> details { get; set; } public List<AuditLogBookingDetailDto> details { get; set; }
} }
/// <summary>
///
/// </summary>
public class AuditLogBookingDetailDto
{
/// <summary>
/// 字段
/// </summary>
public string Field { get; set; }
/// <summary>
/// 原值
/// </summary>
public string OldValue { get; set; }
/// <summary>
/// 新值
/// </summary>
public string NewValue { get; set; }
}
} }

@ -20,4 +20,11 @@ public interface ILogAuditService
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
DataResult<AuditLogRes> GetAuditLogInfo(string id); DataResult<AuditLogRes> GetAuditLogInfo(string id);
//// <summary>
/// 获取订舱类操作日志列表
/// </summary>
/// <param name="id">业务ID</param>
/// <returns>返回操作日志列表</returns>
Task<DataResult<List<AuditLogBookingDto>>> GetAuditLogBookingList(long id);
} }

@ -6,8 +6,10 @@ using DS.Module.UserModule;
using DS.WMS.Core.Sys.Dtos; using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Interface;
using Google.Cloud.Storage.V1;
using Mapster; using Mapster;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar; using SqlSugar;
namespace DS.WMS.Core.Sys.Method; namespace DS.WMS.Core.Sys.Method;
@ -48,4 +50,108 @@ public class LogAuditService : ILogAuditService
.First(); .First();
return DataResult<AuditLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess); return DataResult<AuditLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
} }
#region 获取订舱类操作日志列表
/// <summary>
/// 获取订舱类操作日志列表
/// </summary>
/// <param name="id">业务ID</param>
/// <returns>返回操作日志列表</returns>
public async Task<DataResult<List<AuditLogBookingDto>>> GetAuditLogBookingList(long id)
{
List<AuditLogBookingDto> list = new List<AuditLogBookingDto>();
try
{
var logList = await saasService.GetLogDb().Queryable<SysLogAudit>().Filter(null, true)
.Where(a => a.Id == id).ToListAsync();
if (logList.Count > 0)
{
list = logList.Select(a =>
{
var model = new AuditLogBookingDto
{
Type = a.OperateType,
BookingId = a.KeyId,
CreatedTime = a.CreateTime,
CreatedUserId = a.CreateBy,
FromFunc = "",
Id = a.Id,
TenantId = a.TenantId,
details = new List<AuditLogBookingDetailDto>()
};
DiffLogTableInfo oldObj = null;
DiffLogTableInfo newObj = null;
try
{
oldObj = JsonConvert.DeserializeObject<DiffLogTableInfo>(a.OldValue);
}
catch (Exception e1)
{
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotAuditLogDeserializeError)), e1.Message));
}
try
{
newObj = JsonConvert.DeserializeObject<DiffLogTableInfo>(a.NewValue);
}
catch (Exception e2)
{
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotAuditLogDeserializeError)), e2.Message));
}
if (oldObj != null && newObj != null)
{
model.details = oldObj.Columns.Join(newObj.Columns, l => l.ColumnName, r => r.ColumnName, (l, r) =>
{
string left = l.Value != null ? l.Value.ToString() : "";
string right = r.Value != null ? r.Value.ToString() : "";
if (!left.Equals(right))
{
return new
{
IsDiff = true,
Obj = new AuditLogBookingDetailDto
{
Field = !string.IsNullOrWhiteSpace(l.ColumnDescription) ? l.ColumnDescription : l.ColumnName,
OldValue = left,
NewValue = right,
}
};
}
else
{
return new
{
IsDiff = false,
Obj = new AuditLogBookingDetailDto
{
Field = !string.IsNullOrWhiteSpace(l.ColumnDescription) ? l.ColumnDescription : l.ColumnName,
OldValue = left,
NewValue = right,
}
};
}
}).Where(a => a.IsDiff).Select(a => a.Obj).ToList();
}
return model;
}).OrderByDescending(a => a.CreatedTime).ToList();
return DataResult<List<AuditLogBookingDto>>.Success(list);
}
}
catch (Exception e)
{
//查询日志异常
return DataResult<List<AuditLogBookingDto>>.FailedData(list, string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotAuditLogError)),e.Message));
}
return DataResult<List<AuditLogBookingDto>>.FailedData(list);
}
#endregion
} }

@ -6,6 +6,7 @@ using DS.WMS.Core.Check.Entity;
using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Entity.BookingSlot;
using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Entity;
using Mapster; using Mapster;
using Masuit.Tools.Strings; using Masuit.Tools.Strings;
@ -181,7 +182,17 @@ public class SaasTest
tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrder)); tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrder));
tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrderCtn)); tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrderCtn));
tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrderShipSchedule)); tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrderShipSchedule));
tenantDb.CodeFirst.InitTables(typeof(CodeThirdParty)); tenantDb.CodeFirst.InitTables(typeof(BookingSlotBase));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotCtn));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotStock));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotAllocation));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotAllocationCtn));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotDemand));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotDemandCtn));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotCompare));
//tenantDb.CodeFirst.InitTables(typeof(CodeThirdParty));
//tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail)); //tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail));
//db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn)); //db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn));
Assert.True(true); Assert.True(true);

Loading…
Cancel
Save