zhangxiaofeng 10 months ago
commit 5738f9a239

@ -95,5 +95,15 @@ namespace Myshipping.Application
/// 备注
/// </summary>
public string REMARK { get; set; }
/// <summary>
/// 批量换船备注
/// </summary>
public string BATCH_TRANSFER { get; set; }
/// <summary>
/// 分组KEY
/// </summary>
public int GROUP_INDX { get; set; }
}
}

@ -145,6 +145,16 @@ namespace Myshipping.Application
///
/// </summary>
public Nullable<DateTime> CLPNCLCutDate { get; set; }
/// <summary>
/// 批量换船备注
/// </summary>
public string BatchTransfer { get; set; }
/// <summary>
/// 分组KEY(有可能出现多个FROM多个TO的情况)
/// </summary>
public int GroupIndx { get; set; }
}

@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class TaskRollingNominationShowDto
{
/// <summary>
/// 计划类型Rolling-预甩货 Transfer-中转预甩)
/// </summary>
public string PlanType { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string BatchNo { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public string CarrierId { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 最后确认期限日期
/// </summary>
public Nullable<DateTime> ConfirmDeadLine { get; set; }
/// <summary>
/// 含有二甩声明备注
/// </summary>
public string RollingTouchDoubleRollRemark { get; set; }
/// <summary>
/// 生成时间
/// </summary>
public Nullable<DateTime> CreateTime { get; set; }
/// <summary>
/// 预甩计划详情列表
/// </summary>
public List<string> RollingPlanList { get; set; }
/// <summary>
/// 原船记录
/// </summary>
public TaskRollingNominationShipDto From { get; set; }
/// <summary>
/// 换船记录
/// </summary>
public TaskRollingNominationShipDto To { get; set; }
/// <summary>
/// 单票汇总列表
/// </summary>
public List<TaskRollingNominationShipPreBillShowDto> PreBillList { get; set; }
/// <summary>
/// Load列表
/// </summary>
public List<TaskRollingNominationShipDetailShowDto> LoadDetailList { get; set; }
}
/// <summary>
/// 单票详情
/// </summary>
public class TaskRollingNominationShipPreBillShowDto
{
/// <summary>
/// 批次ID
/// </summary>
public string BatchId { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
public string Bookedby { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
public string ContractualName { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string Shipment { get; set; }
/// <summary>
///
/// </summary>
public string PlaceOfReceipt { get; set; }
/// <summary>
///
/// </summary>
public string LoadPortName { get; set; }
/// <summary>
///
/// </summary>
public string DischargePortName { get; set; }
/// <summary>
///
/// </summary>
public string PlaceOfDelivery { get; set; }
/// <summary>
/// 委托客户ID
/// </summary>
public Nullable<long> CustomerId { get; set; }
/// <summary>
/// 委托单位名称
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 箱型箱量统计
/// </summary>
public string CtnStat { get; set; }
/// <summary>
/// 是否用户人工确认 true-人工确认(用户在访问链接上做了反馈) false-不是人工确认
/// </summary>
public bool IsUserManual { get; set; } = false;
/// <summary>
/// 是否已通知用户 true-已通知 false-未通知
/// </summary>
public bool IsSend { get; set; } = false;
/// <summary>
/// 最后确认期限日期
/// </summary>
public Nullable<DateTime> ConfirmDeadLine { get; set; }
/// <summary>
/// 用户选择意见
/// </summary>
public string UserOpinion { get; set; }
/// <summary>
/// 用户意见内容
/// </summary>
public string UserOpinionTxt { get; set; }
/// <summary>
/// 用户确认时间
/// </summary>
public Nullable<DateTime> ConfirmDate { get; set; }
/// <summary>
/// 生成链接时间
/// </summary>
public Nullable<DateTime> CreateShareLinkDate { get; set; }
/// <summary>
/// 生成链接访问KEY
/// </summary>
public string ShareLinkKey { get; set; }
/// <summary>
/// 分组名
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 订舱主键
/// </summary>
public Nullable<long> BookingId { get; set; }
}
/// <summary>
/// 可load明细列表
/// </summary>
public class TaskRollingNominationShipDetailShowDto
{
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
public string Bookedby { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>
public string ContractualName { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string Shipment { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string EquipmentNumber { get; set; }
/// <summary>
/// 箱型尺寸
/// </summary>
public string EquSize { get; set; }
/// <summary>
/// 集装箱类型
/// </summary>
public string ContainerType { get; set; }
/// <summary>
/// 集装箱高度
/// </summary>
public string ContainerHeight { get; set; }
/// <summary>
///
/// </summary>
public Nullable<decimal> FFE { get; set; }
/// <summary>
///
/// </summary>
public Nullable<decimal> Weight { get; set; }
/// <summary>
///
/// </summary>
public string PlaceOfReceipt { get; set; }
/// <summary>
///
/// </summary>
public string LoadPortName { get; set; }
/// <summary>
///
/// </summary>
public string DischargePortName { get; set; }
/// <summary>
///
/// </summary>
public string PlaceOfDelivery { get; set; }
/// <summary>
///
/// </summary>
public string BBYMAIL { get; set; }
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
/// <summary>
/// 箱型名称
/// </summary>
public string CtnAll { get; set; }
/// <summary>
/// 箱量
/// </summary>
public int CtnNum { get; set; }
}
}

@ -879,7 +879,9 @@ namespace Myshipping.Application
.Map(dest => dest.CY_CUTOFF_TIME, src => src.CYCutoffTime)
.Map(dest => dest.VOUCHER_CUT_DATE, src => src.VoucherCutDate)
.Map(dest => dest.VGM_CUTOFF_TIME, src => src.VGMCutoffTime)
.Map(dest => dest.CLOSING_DATE, src => src.CLPNCLCutDate);
.Map(dest => dest.CLOSING_DATE, src => src.CLPNCLCutDate)
.Map(dest => dest.BATCH_TRANSFER, src => src.BatchTransfer)
.Map(dest => dest.GROUP_INDX, src => src.GroupIndx);
config.ForType<TaskRollingNominationShipDetailDto, TaskRollingNominationDetailInfo>()
.Map(dest => dest.NOM_STATUS_NOTE, src => src.Status)
@ -898,6 +900,44 @@ namespace Myshipping.Application
.Map(dest => dest.PLACEOF_DELIVERY, src => src.PlaceOfDelivery)
.Map(dest => dest.BBYMAIL, src => src.BBYMAIL);
config.ForType<TaskRollingNominationShipInfo, TaskRollingNominationShipDto>()
.Map(dest => dest.ShipType, src => src.SHIP_TYPE)
.Map(dest => dest.ShipString, src => src.SHIP_STRING)
.Map(dest => dest.VslCode, src => src.VSL_CODE)
.Map(dest => dest.Vessel, src => src.VESSEL)
.Map(dest => dest.VoyNo, src => src.VOYNO)
.Map(dest => dest.Port, src => src.PORT)
.Map(dest => dest.Terminal, src => src.TERMINAL)
.Map(dest => dest.ETD, src => src.ETD)
.Map(dest => dest.SICutDate, src => src.SI_CUT_DATE)
.Map(dest => dest.CYCutoffTime, src => src.CY_CUTOFF_TIME)
.Map(dest => dest.VoucherCutDate, src => src.VOUCHER_CUT_DATE)
.Map(dest => dest.VGMCutoffTime, src => src.VGM_CUTOFF_TIME)
.Map(dest => dest.CLPNCLCutDate, src => src.CLOSING_DATE)
.Map(dest => dest.BatchTransfer, src => src.BATCH_TRANSFER)
.Map(dest => dest.GroupIndx, src => src.GROUP_INDX);
config.ForType<TaskRollingNominationDetailInfo, TaskRollingNominationShipDetailShowDto>()
.Map(dest => dest.Status, src => src.NOM_STATUS_NOTE)
.Map(dest => dest.Bookedby, src => src.BOOKED_BY)
.Map(dest => dest.ContractualName, src => src.CONTRACTUAL_NAME)
.Map(dest => dest.Shipment, src => src.SHIPMENT)
.Map(dest => dest.EquipmentNumber, src => src.EQUIPMENT_NUMBER)
.Map(dest => dest.EquSize, src => src.EQU_SIZE)
.Map(dest => dest.ContainerType, src => src.CONTAINER_TYPE)
.Map(dest => dest.ContainerHeight, src => src.CONTAINER_HEIGHT)
.Map(dest => dest.FFE, src => src.FEE)
.Map(dest => dest.Weight, src => src.WEIGHT)
.Map(dest => dest.PlaceOfReceipt, src => src.PLACEOF_RECEIPT)
.Map(dest => dest.LoadPortName, src => src.LOADPORT_NAME)
.Map(dest => dest.DischargePortName, src => src.DISCHARGEPORT_NAME)
.Map(dest => dest.PlaceOfDelivery, src => src.PLACEOF_DELIVERY)
.Map(dest => dest.BBYMAIL, src => src.BBYMAIL)
.Map(dest => dest.CtnCode, src => src.CTNCODE)
.Map(dest => dest.CtnAll, src => src.CTNALL)
.Map(dest => dest.CtnNum, src => src.CTNNUM);
}
}

@ -16,14 +16,14 @@ namespace Myshipping.Application
/// </summary>
/// <param name="pkId">预甩主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetInfo(string pkId);
Task<TaskRollingNominationShowDto> GetInfo(string pkId);
/// <summary>
/// 通过任务主键获取预甩详情
/// </summary>
/// <param name="taskPkId">预甩任务主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetInfoByTaskId(string taskPkId);
Task<TaskRollingNominationShowDto> GetInfoByTaskId(string taskPkId);
/// <summary>
/// 生成预甩货客户访问链接

@ -1,7 +1,15 @@
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common;
using NPOI.XWPF.UserModel;
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
@ -19,29 +27,221 @@ namespace Myshipping.Application
private readonly ISysCacheService _cache;
private readonly ILogger<TaskManageRollingNominationService> _logger;
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
private readonly SqlSugarRepository<TaskRollingNominationInfo> _taskRollingNominationInfoRepository;
private readonly SqlSugarRepository<TaskRollingNominationShipInfo> _taskRollingNominationShipInfoRepository;
private readonly SqlSugarRepository<TaskRollingNominationDetailInfo> _taskRollingNominationDetailInfoRepository;
private readonly SqlSugarRepository<TaskRollingNominationDispatchInfo> _taskRollingNominationDispatchInfoRepository;
private readonly SqlSugarRepository<TaskShareLinkInfo> _taskShareLinkInfoRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
public TaskManageRollingNominationService(SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
SqlSugarRepository<TaskRollingNominationInfo> taskRollingNominationInfoRepository,
SqlSugarRepository<TaskRollingNominationDetailInfo> taskRollingNominationDetailInfoRepository,
SqlSugarRepository<TaskRollingNominationDispatchInfo> taskRollingNominationDispatchInfoRepository,
SqlSugarRepository<TaskRollingNominationShipInfo> taskRollingNominationShipInfoRepository,
SqlSugarRepository<TaskShareLinkInfo> taskShareLinkInfoRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingCtnRepository)
{
_taskBaseRepository = taskBaseRepository;
_taskRollingNominationInfoRepository = taskRollingNominationInfoRepository;
_taskRollingNominationDetailInfoRepository = taskRollingNominationDetailInfoRepository;
_taskRollingNominationDispatchInfoRepository = taskRollingNominationDispatchInfoRepository;
_taskRollingNominationShipInfoRepository = taskRollingNominationShipInfoRepository;
_taskShareLinkInfoRepository = taskShareLinkInfoRepository;
_bookingOrderRepository = bookingOrderRepository;
_bookingCtnRepository = bookingCtnRepository;
}
#region 获取预甩详情
/// <summary>
/// 获取预甩详情
/// </summary>
/// <param name="pkId">预甩主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetInfo(string pkId)
[HttpGet("/TaskManageRollingNomination/GetInfo")]
public async Task<TaskRollingNominationShowDto> GetInfo(string pkId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
TaskRollingNominationShowDto model = null;
return result;
try
{
var rollModel = _taskRollingNominationInfoRepository.AsQueryable()
.First(a => a.PK_ID == pkId && !a.IsDeleted);
if (rollModel == null)
throw Oops.Oh($"预甩货主键{pkId}无法获取业务信息");
model = await InnerGetInfo(rollModel);
}
catch (Exception ex)
{
_logger.LogError($"获取预甩详情异常,原因:{ex.Message}");
throw ex;
}
return model;
}
#endregion
#region 通过任务主键获取预甩详情
/// <summary>
/// 通过任务主键获取预甩详情
/// </summary>
/// <param name="taskPkId">预甩任务主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetInfoByTaskId(string taskPkId)
[HttpGet("/TaskManageRollingNomination/GetInfoByTaskId")]
public async Task<TaskRollingNominationShowDto> GetInfoByTaskId(string taskPkId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
TaskRollingNominationShowDto model = null;
return result;
try
{
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId && !a.IsDeleted);
if (taskBase == null)
throw Oops.Oh($"预甩货任务主键{taskPkId}无法获取任务信息");
var rollModel = _taskRollingNominationInfoRepository.AsQueryable()
.First(a => a.TASK_ID == taskBase.PK_ID && !a.IsDeleted);
if (rollModel == null)
throw Oops.Oh($"预甩货任务主键{taskBase.PK_ID}无法获取业务信息");
model = await InnerGetInfo(rollModel);
}
catch(Exception ex)
{
_logger.LogError($"获取预甩详情异常,原因:{ex.Message}");
throw ex;
}
return model;
}
#endregion
#region 获取预甩详情
/// <summary>
/// 获取预甩详情
/// </summary>
/// <param name="rollModel">预甩货详情实体类</param>
/// <returns>返回详情</returns>
private async Task<TaskRollingNominationShowDto> InnerGetInfo(TaskRollingNominationInfo rollModel)
{
TaskRollingNominationShowDto model = null;
try
{
List<string> rollingPlanList = new List<string>();
if (!string.IsNullOrWhiteSpace(rollModel.PLAN_TXT))
{
rollingPlanList = rollModel.PLAN_TXT.Split("\\n").ToList();
}
model = new TaskRollingNominationShowDto
{
PlanType = rollModel.PLAN_TYPE,
CarrierId = rollModel.CARRIERID,
Carrier = rollModel.CARRIER,
ConfirmDeadLine = rollModel.CONFIRM_DEAD_LINE,
CreateTime = rollModel.READ_CREATE_TIME,
RollingTouchDoubleRollRemark = rollModel.ROLL_DOUBLE_REMARK,
LoadDetailList = new List<TaskRollingNominationShipDetailShowDto>(),
RollingPlanList = rollingPlanList,
PreBillList = new List<TaskRollingNominationShipPreBillShowDto>()
};
var shipList = _taskRollingNominationShipInfoRepository.AsQueryable()
.Where(a => a.NOM_ID == rollModel.PK_ID && a.GROUP_INDX == 1 && !a.IsDeleted).ToList();
var fromEntity = shipList.FirstOrDefault(a =>
a.SHIP_TYPE.Equals("From", StringComparison.OrdinalIgnoreCase));
if (fromEntity != null)
model.From = fromEntity.Adapt<TaskRollingNominationShipDto>();
var toEntity = shipList.FirstOrDefault(a =>
a.SHIP_TYPE.Equals("To", StringComparison.OrdinalIgnoreCase));
if (toEntity != null)
model.To = toEntity.Adapt<TaskRollingNominationShipDto>();
var withDispatchList = _taskRollingNominationDetailInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<TaskRollingNominationDispatchInfo>((detail, dispatch) => detail.PK_ID == dispatch.DETAIL_ID)
.Where((detail, dispatch) => detail.NOM_ID == rollModel.PK_ID && detail.IsDeleted == false
&& (string.IsNullOrWhiteSpace(dispatch.PK_ID) || (!string.IsNullOrWhiteSpace(dispatch.PK_ID) && dispatch.IsDeleted == false)))
.Select((detail, dispatch) => new { Detail = detail, Dispatch = dispatch }).ToList();
model.PreBillList = withDispatchList.Where(a=>
a.Dispatch != null || (a.Dispatch == null && !a.Detail.NOM_STATUS_NOTE.Equals("Load",StringComparison.OrdinalIgnoreCase)))
.GroupBy(a => a.Detail.CUSTOMERID)
.SelectMany((a,idx) => {
var cArg = a.ToList();
return a.GroupBy(b=> b.Detail.SHIPMENT).Select(
b => {
var preBillArg = b.ToList();
var preBillDetail = preBillArg.FirstOrDefault().Detail;
var preBillDispatch = preBillArg.FirstOrDefault().Dispatch;
string ctnStat = string.Join(",", preBillArg.GroupBy(x => x.Detail.CTNALL)
.Select(x =>
$"{x.Key}*{x.Sum(t => t.Detail.CTNNUM)}").ToArray());
TaskRollingNominationShipPreBillShowDto preBillInfo = new TaskRollingNominationShipPreBillShowDto
{
Bookedby = preBillDetail.BOOKED_BY,
ConfirmDate = preBillDispatch?.CONFIRM_DATE,
ConfirmDeadLine = preBillDispatch?.CONFIRM_DEAD_LINE,
CtnStat = ctnStat,
CustomerId = preBillDetail.CUSTOMERID,
CustomerName = preBillDetail.CUSTOMERNAME,
ContractualName = preBillDetail.CONTRACTUAL_NAME,
CreateShareLinkDate = preBillDispatch?.CREATE_SHARE_LINK_DATE,
DischargePortName = preBillDetail.DISCHARGEPORT_NAME,
IsSend = preBillDispatch != null ? preBillDispatch.IS_SEND : false,
IsUserManual = preBillDispatch != null ? preBillDispatch.IS_USER_MANUAL : false,
LoadPortName = preBillDetail.LOADPORT_NAME,
PlaceOfDelivery = preBillDetail.PLACEOF_DELIVERY,
PlaceOfReceipt = preBillDetail.PLACEOF_RECEIPT,
Shipment = preBillDetail.SHIPMENT,
Status = preBillDispatch?.STATUS,
ShareLinkKey = preBillDispatch?.SHARE_LINK_KEY,
UserOpinion = preBillDispatch?.USER_OPINION,
UserOpinionTxt = preBillDispatch?.USER_OPINION_TXT,
BatchId = preBillDispatch?.BATCH_ID,
BookingId = preBillDetail.BOOKING_ID,
GroupName = $"CUST_{idx + 1}",
};
return preBillInfo;
}).ToList();
}).ToList();
if(withDispatchList.Any(a=>a.Dispatch == null
&& a.Detail.NOM_STATUS_NOTE.Equals("Load", StringComparison.OrdinalIgnoreCase)))
{
model.LoadDetailList = withDispatchList.Where(a => a.Dispatch == null
&& a.Detail.NOM_STATUS_NOTE.Equals("Load", StringComparison.OrdinalIgnoreCase))
.Select(a => a.Detail.Adapt<TaskRollingNominationShipDetailShowDto>()).ToList();
}
}
catch (Exception ex)
{
_logger.LogError($"获取预甩详情异常,原因:{ex.Message}");
throw ex;
}
return model;
}
#endregion
/// <summary>
/// 生成预甩货客户访问链接

Loading…
Cancel
Save