|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
using NPOI.POIFS.Storage;
|
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
|
using Furion.DistributedIDGenerator;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using Furion;
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
|
using HtmlAgilityPack;
|
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
|
using Myshipping.Application.Enum;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货物运输计划已变更
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings("Application", Name = "TaskTransPlanHasChange", Order = 10)]
|
|
|
|
|
public class TaskTransPlanHasChangeService : ITaskTransPlanHasChangeService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly ILogger<TaskCautionNoticeService> _logger;
|
|
|
|
|
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskTransPlanHasChangeInfo> _taskTransPlanHasChangeInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskTransPlanHasChangeDetailInfo> _taskTransPlanHasChangeDetailInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<DjyUserMailAccount> _djyUserMailAccount;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrderContact> _bookingOrderContactRepository;
|
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate;
|
|
|
|
|
private readonly SqlSugarRepository<TaskFileInfo> _taskFileRepository;
|
|
|
|
|
|
|
|
|
|
public TaskTransPlanHasChangeService(ISysCacheService cache, ILogger<TaskCautionNoticeService> logger,
|
|
|
|
|
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
|
|
|
|
|
SqlSugarRepository<TaskTransPlanHasChangeInfo> taskTransPlanHasChangeInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskTransPlanHasChangeDetailInfo> taskTransPlanHasChangeDetailInfoRepository,
|
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccount,
|
|
|
|
|
SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository,
|
|
|
|
|
SqlSugarRepository<SysUser> sysUserRepository,
|
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate,
|
|
|
|
|
SqlSugarRepository<TaskFileInfo> taskFileRepository,
|
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository)
|
|
|
|
|
{
|
|
|
|
|
_cache = cache;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
|
|
|
|
|
_taskBaseRepository = taskBaseRepository;
|
|
|
|
|
_taskTransPlanHasChangeInfoRepository = taskTransPlanHasChangeInfoRepository;
|
|
|
|
|
_taskTransPlanHasChangeDetailInfoRepository = taskTransPlanHasChangeDetailInfoRepository;
|
|
|
|
|
_djyUserMailAccount = djyUserMailAccount;
|
|
|
|
|
_bookingOrderRepository = bookingOrderRepository;
|
|
|
|
|
_bookingOrderContactRepository = bookingOrderContactRepository;
|
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
|
|
|
|
|
|
_repPrintTemplate = repPrintTemplate;
|
|
|
|
|
_taskFileRepository = taskFileRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取货物运输计划已变更详情
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取货物运输计划已变更详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPkId">货物运输计划已变更任务主键</param>
|
|
|
|
|
/// <returns>返回详情</returns>
|
|
|
|
|
[HttpGet("/TaskTransPlanHasChange/GetInfoByTaskId")]
|
|
|
|
|
public async Task<TaskTransPlanHasChangeShowDto> GetInfoByTaskId(string taskPkId)
|
|
|
|
|
{
|
|
|
|
|
TaskTransPlanHasChangeShowDto dto = new TaskTransPlanHasChangeShowDto();
|
|
|
|
|
|
|
|
|
|
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId);
|
|
|
|
|
|
|
|
|
|
if (taskBase == null)
|
|
|
|
|
throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息");
|
|
|
|
|
|
|
|
|
|
var entityInfo = _taskTransPlanHasChangeInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
|
|
|
|
|
|
|
|
|
|
if (entityInfo == null)
|
|
|
|
|
throw Oops.Oh($"货物运输计划已变更主键{taskPkId}无法获取业务信息");
|
|
|
|
|
|
|
|
|
|
var detailList = _taskTransPlanHasChangeDetailInfoRepository.AsQueryable()
|
|
|
|
|
.Where(a => a.P_ID == entityInfo.PK_ID).ToList();
|
|
|
|
|
|
|
|
|
|
if(detailList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var ctnList = detailList.Where(a => a.COLUMN_TYPE.Equals("CTN", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
dto.ContaNoList = ctnList.Select(a => a.CONTA_NO).ToList();
|
|
|
|
|
|
|
|
|
|
var fromList = detailList.Where(a => !string.IsNullOrWhiteSpace(a.PLAN_TYPE) && a.PLAN_TYPE.Equals("FROM", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
dto.From = new TaskTransportPlanHasChangeDetailShow
|
|
|
|
|
{
|
|
|
|
|
portList = new List<TaskTransPlanHasChangePortShow>(),
|
|
|
|
|
dateList = new List<TaskTransPlanHasChangeDateShow>(),
|
|
|
|
|
vesselList = new List<TaskTransPlanHasChangeVesselShow>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dto.From.portList = fromList.Where(a => !string.IsNullOrWhiteSpace(a.COLUMN_TYPE) && a.COLUMN_TYPE.Equals("PORT", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
return new TaskTransPlanHasChangePortShow
|
|
|
|
|
{
|
|
|
|
|
Indx = a.SORT_NO,
|
|
|
|
|
PortName = a.PORTLOAD,
|
|
|
|
|
//CountryCode = a.
|
|
|
|
|
};
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var toList = detailList.Where(a => !string.IsNullOrWhiteSpace(a.PLAN_TYPE) && a.PLAN_TYPE.Equals("TO", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 自动转发货物运输计划已变更
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动转发货物运输计划已变更
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">货物运输计划已变更任务主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> AutoTransferNotice(string taskPKId)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 检索对应的订舱订单
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索对应的订舱订单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">货物运输计划已变更任务主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> QueryVBookingOrder(string taskPKId)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 发送邮件通知给客户
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发送邮件通知给客户
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">货物运输计划已变更主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SendEmailToCustomer(string taskPKId)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|