wet 1 year ago
commit 25c635e640

@ -26,6 +26,16 @@ namespace Myshipping.Application
/// docx
/// </summary>
[Description("docx")]
DOCX = 3
DOCX = 3,
/// <summary>
/// xls
/// </summary>
[Description("xls")]
XLS = 4,
/// <summary>
/// doc
/// </summary>
[Description("doc")]
DOC = 5
}
}

@ -251,6 +251,14 @@ namespace Myshipping.Application
{
fileType = ".docx";
}
else if (printFileType == PrintFileTypeEnum.XLS)
{
fileType = ".xls";
}
else if (printFileType == PrintFileTypeEnum.DOC)
{
fileType = ".doc";
}
string curFileName = fileNameNoSuffix;

@ -2177,7 +2177,7 @@ namespace Myshipping.Application
private async Task SyncVesselExcepAtOp(List<DjyVesselExceptDto> dto)
{
var tenantId = UserManager.TENANT_ID;
SpareTime.DoOnce(1000, (tmr, l) =>
SpareTime.DoOnce(60000, (tmr, l) =>
{
try
{
@ -2228,7 +2228,7 @@ namespace Myshipping.Application
{
var content = string.Join("\r\n", dic[k]);
_logger.LogInformation($"准备发送船期通知给 {k},内容:\r\n{content}");
//DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { k }, null);
DingTalkGroupHelper.SendDingTalkGroupMessage("hechuanVesselAtOpNotify", "船期提醒", content, false, new string[] { k }, null);
}
});
}
@ -2239,7 +2239,7 @@ namespace Myshipping.Application
{
var content = string.Join("\r\n", item.Value);
_logger.LogInformation($"准备发送船期通知给 {item.Key},内容:\r\n{content}");
//DingTalkGroupHelper.SendDingTalkGroupMessage("", "船期提醒", content, false, new string[] { item.Key }, null);
DingTalkGroupHelper.SendDingTalkGroupMessage("hechuanVesselAtOpNotify", "船期提醒", content, false, new string[] { item.Key }, null);
}
}
}

@ -0,0 +1,249 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// BC展示信息
/// </summary>
public class TaskBCShowBaseDto
{
/// <summary>
/// 主键
/// </summary>
public string PKId { get; set; }
/// <summary>
/// 任务主键
/// </summary>
public string TaskId { get; set; }
/// <summary>
/// 订舱单位
/// </summary>
public string BookingParty { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string Shipper { get; set; }
/// <summary>
/// 收货人
/// </summary>
public string Consignee { get; set; }
/// <summary>
/// 通知人
/// </summary>
public string NotifyParty { get; set; }
/// <summary>
/// BC更新次数
/// </summary>
public Nullable<int> BCModifyTimes { get; set; }
/// <summary>
/// BC更新时间
/// </summary>
public Nullable<DateTime> BCModifyDate { get; set; }
/// <summary>
/// 主单号
/// </summary>
public string MBLNo { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VoyNo { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PlaceReceipt { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string Portload { get; set; }
/// <summary>
/// 截关时间
/// </summary>
public Nullable<DateTime> ClosingDate { get; set; }
/// <summary>
/// 截VGM时间
/// </summary>
public Nullable<DateTime> VGMCutoffTime { get; set; }
/// <summary>
/// ETA(预计到港时间)
/// </summary>
public Nullable<DateTime> ETA { get; set; }
/// <summary>
/// ETD(预计离港时间)
/// </summary>
public Nullable<DateTime> ETD { get; set; }
/// <summary>
/// 目的港ETA
/// </summary>
public Nullable<DateTime> PODETA { get; set; }
/// <summary>
/// 截单时间
/// </summary>
public Nullable<DateTime> CutSingleTime { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PortDischarge { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PlaceDelivery { get; set; }
/// <summary>
/// 装运方式
/// </summary>
public string ShippingMethod { get; set; }
/// <summary>
/// 运输条款
/// </summary>
public string Service { get; set; }
/// <summary>
/// 港前运输形态
/// </summary>
public string PreTransMode { get; set; }
/// <summary>
/// 品名
/// </summary>
public string Description { get; set; }
/// <summary>
/// 签单地点
/// </summary>
public string IssuePlace { get; set; }
/// <summary>
/// 集港码头
/// </summary>
public string CollectionTerminal { get; set; }
/// <summary>
/// 约号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 预付地点
/// </summary>
public string PrepardAT { get; set; }
/// <summary>
/// 船代
/// </summary>
public string ShipAgent { get; set; }
/// <summary>
/// 场站
/// </summary>
public string Yard { get; set; }
/// <summary>
/// 场站联系人
/// </summary>
public string YardContactUserName { get; set; }
/// <summary>
/// 场站联系电话
/// </summary>
public string YardContactTel { get; set; }
/// <summary>
/// 一代客服姓名
/// </summary>
public string FstCustomerSerUserName { get; set; }
/// <summary>
/// 一代客服电话
/// </summary>
public string FstCustomerSerUserTel { get; set; }
/// <summary>
/// 一代客服邮箱
/// </summary>
public string FstCustomerSerUserEmail { get; set; }
/// <summary>
/// 备注1
/// </summary>
public string Remark1 { get; set; }
/// <summary>
/// 截港时间
/// </summary>
public Nullable<DateTime> CYCutoffTime { get; set; }
/// <summary>
/// 状态 TEMP-暂存 SUCC-已对应 ERROR-异常
/// </summary>
public string Status { get; set; }
/// <summary>
/// 文件MD5
/// </summary>
public string FileMD5 { get; set; }
/// <summary>
/// 最后对应时间,最后关联到订舱日期
/// </summary>
public Nullable<DateTime> LastToBookingDate { get; set; }
/// <summary>
/// 来源邮箱
/// </summary>
public string FromEmail { get; set; }
/// <summary>
/// 接收邮箱
/// </summary>
public string RecvEmail { get; set; }
/// <summary>
/// 订舱ID对应成功后订舱ID写入
/// </summary>
public Nullable<long> BookingOrderId { get; set; }
/// <summary>
/// 集装箱列表
/// </summary>
public List<TaskBCCTNInfoDto> CtnList { get; set; }
/// <summary>
/// 任务附件
/// </summary>
public List<TaskFileDto> FileList { get; set; }
}
}

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 任务附件
/// </summary>
public class TaskFileDto
{
/// <summary>
/// 文件路径
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// 文件类型
/// </summary>
public string FileType { get; set; }
/// <summary>
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 附件类型代码 BC-Booking Confirmation
/// </summary>
public string FileCategory { get; set; }
/// <summary>
/// 附件类型名称 BC-Booking Confirmation
/// </summary>
public string FileCategoryName { get; set; }
}
}

@ -661,6 +661,131 @@ namespace Myshipping.Application
.Map(dest => dest.FromEmail, src => src.FROM_EMAIL)
.Map(dest => dest.RecvEmail, src => src.RECV_EMAIL)
.Map(dest => dest.BookingOrderId, src => src.BOOKING_ORDER_ID);
config.ForType<TaskBCInfo, TaskBCShowBaseDto>()
.Map(dest => dest.PKId, src => src.PK_ID)
.Map(dest => dest.TaskId, src => src.TASK_ID)
.Map(dest => dest.BookingParty, src => src.BOOKING_PARTY)
.Map(dest => dest.Shipper, src => src.SHIPPER)
.Map(dest => dest.Consignee, src => src.CONSIGNEE)
.Map(dest => dest.NotifyParty, src => src.NOTIFYPARTY)
.Map(dest => dest.BCModifyTimes, src => src.BC_MODIFY_TIMES)
.Map(dest => dest.BCModifyDate, src => src.BC_MODIFY_DATE)
.Map(dest => dest.MBLNo, src => src.MBL_NO)
.Map(dest => dest.TaskId, src => src.TASK_ID)
.Map(dest => dest.Vessel, src => src.VESSEL)
.Map(dest => dest.VoyNo, src => src.VOYNO)
.Map(dest => dest.Carrier, src => src.CARRIER)
.Map(dest => dest.PlaceReceipt, src => src.PLACERECEIPT)
.Map(dest => dest.Portload, src => src.PORTLOAD)
.Map(dest => dest.ClosingDate, src => src.CLOSING_DATE)
.Map(dest => dest.VGMCutoffTime, src => src.VGM_CUTOFF_TIME)
.Map(dest => dest.ETA, src => src.ETA)
.Map(dest => dest.ETD, src => src.ETD)
.Map(dest => dest.PODETA, src => src.POD_ETA)
.Map(dest => dest.CutSingleTime, src => src.CUT_SINGLE_TIME)
.Map(dest => dest.PortDischarge, src => src.PORTDISCHARGE)
.Map(dest => dest.PlaceDelivery, src => src.PLACEDELIVERY)
.Map(dest => dest.ShippingMethod, src => src.SHIPPING_METHOD)
.Map(dest => dest.Service, src => src.SERVICE)
.Map(dest => dest.PreTransMode, src => src.PRETRANS_MODE)
.Map(dest => dest.Description, src => src.DESCRIPTION)
.Map(dest => dest.IssuePlace, src => src.ISSUEPLACE)
.Map(dest => dest.CollectionTerminal, src => src.COLLECTION_TERMINAL)
.Map(dest => dest.ContractNo, src => src.CONTRACTNO)
.Map(dest => dest.PrepardAT, src => src.PREPARDAT)
.Map(dest => dest.ShipAgent, src => src.SHIP_AGENT)
.Map(dest => dest.Yard, src => src.YARD)
.Map(dest => dest.YardContactUserName, src => src.YARD_CONTACT_USR)
.Map(dest => dest.YardContactTel, src => src.YARD_CONTACT_TEL)
.Map(dest => dest.FstCustomerSerUserName, src => src.FST_CUSTOMER_SER_USRNAME)
.Map(dest => dest.FstCustomerSerUserTel, src => src.FST_CUSTOMER_SER_TEL)
.Map(dest => dest.FstCustomerSerUserEmail, src => src.FST_CUSTOMER_SER_EMAIL)
.Map(dest => dest.Remark1, src => src.REMARK1)
.Map(dest => dest.CYCutoffTime, src => src.CY_CUTOFF_TIME)
.Map(dest => dest.Status, src => src.STATUS)
.Map(dest => dest.FileMD5, src => src.FILE_MD5)
.Map(dest => dest.LastToBookingDate, src => src.LAST_TOBOOKING_DATE)
.Map(dest => dest.FromEmail, src => src.FROM_EMAIL)
.Map(dest => dest.RecvEmail, src => src.RECV_EMAIL)
.Map(dest => dest.BookingOrderId, src => src.BOOKING_ORDER_ID);
config.ForType<TaskManageOrderBCInfo, TaskBCInfo>()
.Map(dest => dest.BOOKING_PARTY, src => src.BookingParty)
.Map(dest => dest.SHIPPER, src => src.Shipper)
.Map(dest => dest.CONSIGNEE, src => src.Consignee)
.Map(dest => dest.NOTIFYPARTY, src => src.NotifyParty)
.Map(dest => dest.BC_MODIFY_TIMES, src => src.BCModifyTimes)
.Map(dest => dest.BC_MODIFY_DATE, src => src.BCModifyDate)
.Map(dest => dest.MBL_NO, src => src.MBLNo)
.Map(dest => dest.VESSEL, src => src.Vessel)
.Map(dest => dest.VOYNO, src => src.VoyNo)
.Map(dest => dest.CARRIER, src => src.Carrier)
.Map(dest => dest.PLACERECEIPT, src => src.PlaceReceipt)
.Map(dest => dest.PORTLOAD, src => src.Portload)
.Map(dest => dest.CLOSING_DATE, src => src.ClosingDate)
.Map(dest => dest.VGM_CUTOFF_TIME, src => src.VGMCutoffTime)
.Map(dest => dest.ETA, src => src.ETA)
.Map(dest => dest.ETD, src => src.ETD)
.Map(dest => dest.POD_ETA, src => src.PODETA)
.Map(dest => dest.CUT_SINGLE_TIME, src => src.CutSingleTime)
.Map(dest => dest.PORTDISCHARGE, src => src.PortDischarge)
.Map(dest => dest.PLACEDELIVERY, src => src.PlaceDelivery)
.Map(dest => dest.SHIPPING_METHOD, src => src.ShippingMethod)
.Map(dest => dest.SERVICE, src => src.Service)
.Map(dest => dest.PRETRANS_MODE, src => src.PreTransMode)
.Map(dest => dest.DESCRIPTION, src => src.Description)
.Map(dest => dest.ISSUEPLACE, src => src.IssuePlace)
.Map(dest => dest.COLLECTION_TERMINAL, src => src.CollectionTerminal)
.Map(dest => dest.CONTRACTNO, src => src.ContractNo)
.Map(dest => dest.PREPARDAT, src => src.PrepardAT)
.Map(dest => dest.SHIP_AGENT, src => src.ShipAgent)
.Map(dest => dest.YARD, src => src.Yard)
.Map(dest => dest.YARD_CONTACT_USR, src => src.YardContactUserName)
.Map(dest => dest.YARD_CONTACT_TEL, src => src.YardContactTel)
.Map(dest => dest.FST_CUSTOMER_SER_USRNAME, src => src.FstCustomerSerUserName)
.Map(dest => dest.FST_CUSTOMER_SER_TEL, src => src.FstCustomerSerUserTel)
.Map(dest => dest.FST_CUSTOMER_SER_EMAIL, src => src.FstCustomerSerUserEmail)
.Map(dest => dest.REMARK1, src => src.Remark1)
.Map(dest => dest.CY_CUTOFF_TIME, src => src.CYCutoffTime)
.Map(dest => dest.FROM_EMAIL, src => src.FromEmail)
.Map(dest => dest.RECV_EMAIL, src => src.RecvEmail);
config.ForType<TaskBCCTNInfo, TaskBCCTNInfoDto>()
.Map(dest => dest.CtnCode, src => src.CTNCODE)
.Map(dest => dest.CtnALL, src => src.CTNALL)
.Map(dest => dest.CTNNUM, src => src.CTNNUM)
.Map(dest => dest.PKGS, src => src.PKGS)
.Map(dest => dest.CBM, src => src.CBM)
.Map(dest => dest.KGS, src => src.KGS)
.Map(dest => dest.TareWeight, src => src.TAREWEIGHT)
.Map(dest => dest.IODGT, src => src.IODGT)
.Map(dest => dest.SpecialLoadingRequire, src => src.SPECIAL_LOADING_REQUIRE)
.Map(dest => dest.TakeCTNYard, src => src.TAKE_CTN_YARD)
.Map(dest => dest.TakeCTNTime, src => src.TAKE_CTN_TIME)
.Map(dest => dest.ReturnCTNYard, src => src.RETURN_CTN_YARD);
config.ForType<TaskManageOrderBCCTNInfo, TaskBCCTNInfo>()
.Map(dest => dest.CTNCODE, src => src.CtnCode)
.Map(dest => dest.CTNALL, src => src.CtnALL)
.Map(dest => dest.CTNNUM, src => src.CTNNUM)
.Map(dest => dest.PKGS, src => src.PKGS)
.Map(dest => dest.CBM, src => src.CBM)
.Map(dest => dest.KGS, src => src.KGS)
.Map(dest => dest.TAREWEIGHT, src => src.TareWeight)
.Map(dest => dest.IODGT, src => src.IODGT)
.Map(dest => dest.SPECIAL_LOADING_REQUIRE, src => src.SpecialLoadingRequire)
.Map(dest => dest.TAKE_CTN_YARD, src => src.TakeCTNYard)
.Map(dest => dest.TAKE_CTN_TIME, src => src.TakeCTNTime)
.Map(dest => dest.RETURN_CTN_YARD, src => src.ReturnCTNYard);
config.ForType<TaskFileInfo, TaskFileDto>()
.Map(dest => dest.FilePath, src => src.FILE_PATH)
.Map(dest => dest.FileType, src => src.FILE_TYPE)
.Map(dest => dest.FileName, src => src.FILE_NAME)
.Map(dest => dest.FileCategory, src => src.FILE_CATEGORY)
.Map(dest => dest.FileCategoryName, src => src.FILE_CATEGORY_NAME);
}
}

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// BC集装箱详情
/// </summary>
public class TaskManageOrderBCCTNInfo
{
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string CtnALL { get; set; }
/// <summary>
/// 箱量
/// </summary>
public Nullable<int> CTNNUM { get; set; }
/// <summary>
/// 件数
/// </summary>
public Nullable<int> PKGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public Nullable<decimal> CBM { get; set; }
/// <summary>
/// 毛重
/// </summary>
public Nullable<decimal> KGS { get; set; }
/// <summary>
/// 皮重
/// </summary>
public Nullable<decimal> TareWeight { get; set; }
/// <summary>
/// 危品票标示
/// </summary>
public string IODGT { get; set; }
/// <summary>
/// 特殊装载需求
/// </summary>
public string SpecialLoadingRequire { get; set; }
/// <summary>
/// 提箱场站
/// </summary>
public string TakeCTNYard { get; set; }
/// <summary>
/// 提箱时间
/// </summary>
public Nullable<DateTime> TakeCTNTime { get; set; }
/// <summary>
/// 还箱场站
/// </summary>
public string ReturnCTNYard { get; set; }
}
}

@ -221,5 +221,9 @@ namespace Myshipping.Application
/// </summary>
public string RecvEmail { get; set; }
/// <summary>
/// 集装箱列表
/// </summary>
public List<TaskManageOrderBCCTNInfo> CtnList { get; set; }
}
}

@ -79,6 +79,31 @@ namespace Myshipping.Application
/// </summary>
public string RecvUserName { get; set; }
/// <summary>
/// 任务对应接收操作人ID(大简云账户体系)
/// </summary>
public string DJYRecvUserId { get; set; }
/// <summary>
/// 任务对应接收操作人名称(大简云账户体系)
/// </summary>
public string DJYRecvUserName { get; set; }
/// <summary>
/// 任务对应接收操作人邮箱(大简云账户体系)
/// </summary>
public string DJYRecvUserEmail { get; set; }
/// <summary>
/// 任务对应部门代码(大简云账户体系)
/// </summary>
public string DJYTaskOrgCode { get; set; }
/// <summary>
/// 任务对应部门名称(大简云账户体系)
/// </summary>
public string DJYTaskOrgName { get; set; }
/// <summary>
/// 任务对应部门代码
/// </summary>
@ -163,5 +188,10 @@ namespace Myshipping.Application
/// 派车信息
/// </summary>
public TaskManageOrderTruckInfo TruckInfo { get; set; }
/// <summary>
/// BC信息
/// </summary>
public TaskManageOrderBCInfo BCInfo { get; set; }
}
}

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// BC任务
/// </summary>
public interface ITaskManageBCService
{
/// <summary>
/// 获取BC详情
/// </summary>
/// <param name="pkId">BC主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetInfo(string pkId);
/// <summary>
/// 通过任务主键获取BC详情
/// </summary>
/// <param name="taskPkId">BC任务主键</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetInfoByTaskId(string taskPkId);
}
}

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Myshipping.Core;
using NPOI.POIFS.Crypt.Dsig;
@ -269,6 +270,14 @@ namespace Myshipping.Application
/// <returns>返回结果</returns>
Task<List<LaraPaperRegistPostDto>> CalcLaraPageNumbers(CalcLaraPageNumbersDto model);
/// <summary>
/// 创建BC任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="jsonData">BC任务详情JSON</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, string jsonData);
/// <summary>
/// 获取任务列表
/// </summary>

@ -0,0 +1,136 @@
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// BC任务
/// </summary>
[ApiDescriptionSettings("Application", Name = "TaskManageBC", Order = 10)]
public class TaskManageBCService: ITaskManageBCService, IDynamicApiController
{
private readonly ISysCacheService _cache;
private readonly ILogger<TaskManageBCService> _logger;
private readonly SqlSugarRepository<TaskBCInfo> _taskBCInfoRepository;
private readonly SqlSugarRepository<TaskBCCTNInfo> _taskBCCTNInfoRepository;
private readonly SqlSugarRepository<TaskBaseInfo> _taskBaseRepository;
private readonly SqlSugarRepository<TaskFileInfo> _taskFileRepository;
public TaskManageBCService(SqlSugarRepository<TaskBCInfo> taskBCInfoRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
SqlSugarRepository<TaskBCCTNInfo> taskBCCTNInfoRepository,
SqlSugarRepository<TaskFileInfo> taskFileRepository)
{
_taskBaseRepository = taskBaseRepository;
_taskBCInfoRepository = taskBCInfoRepository;
_taskBCCTNInfoRepository = taskBCCTNInfoRepository;
_taskFileRepository = taskFileRepository;
}
#region 获取BC详情
/// <summary>
/// 获取BC详情
/// </summary>
/// <param name="pkId">BC主键</param>
/// <returns>返回回执</returns>
[HttpGet("/TaskManageBC/GetInfo")]
public async Task<TaskManageOrderResultDto> GetInfo(string pkId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == pkId);
if (bcOrder == null)
throw Oops.Oh($"BC主键{pkId}无法获取业务信息");
var BCCtnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == pkId).ToList();
TaskBCShowBaseDto model = bcOrder.Adapt<TaskBCShowBaseDto>();
if (BCCtnList.Count > 0)
model.CtnList = BCCtnList.Adapt<List<TaskBCCTNInfoDto>>();
var fileList = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == bcOrder.TASK_ID).ToList();
if (fileList.Count > 0)
model.FileList = fileList.Adapt<List<TaskFileDto>>();
result.succ = true;
result.ext = model;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取派车详情异常,原因:{ex.Message}";
}
return result;
}
#endregion
#region 通过任务主键获取BC详情
/// <summary>
/// 通过任务主键获取BC详情
/// </summary>
/// <param name="taskPkId">BC任务主键</param>
/// <returns>返回回执</returns>
[HttpGet("/TaskManageBC/GetInfoByTaskId")]
public async Task<TaskManageOrderResultDto> GetInfoByTaskId(string taskPkId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId);
if (taskBase == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息");
var bcOrder = _taskBCInfoRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID);
if (bcOrder == null)
throw Oops.Oh($"任务主键{taskPkId}无法获取BC业务信息");
var bcCtnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == bcOrder.PK_ID).ToList();
TaskBCShowBaseDto model = bcOrder.Adapt<TaskBCShowBaseDto>();
if (bcCtnList.Count > 0)
model.CtnList = bcCtnList.Adapt<List<TaskBCCTNInfoDto>>();
var fileList = _taskFileRepository.AsQueryable().Where(a => a.TASK_PKID == bcOrder.TASK_ID).ToList();
if (fileList.Count > 0)
model.FileList = fileList.Adapt<List<TaskFileDto>>();
result.succ = true;
result.ext = model;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取派车详情异常,原因:{ex.Message}";
}
return result;
}
#endregion
}
}

@ -2,6 +2,7 @@
using Furion.DependencyInjection;
using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
using Furion.Extensions;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Furion.Localization;
@ -9,6 +10,7 @@ using Furion.RemoteRequest;
using Furion.RemoteRequest.Extensions;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.CodeAnalysis.CSharp.Syntax;
@ -85,7 +87,8 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<TaskStoreMsgInfo> _taskStoreMsgInfoRepository;
private readonly SqlSugarRepository<TaskChangeShipHisInfo> _taskChangeShipHisInfoRepository;
private readonly SqlSugarRepository<TaskBCInfo> _taskBCInfoRepository;
private readonly SqlSugarRepository<TaskBCCTNInfo> _taskBCCTNInfoRepository;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingOrderContaRepository;
@ -139,6 +142,7 @@ namespace Myshipping.Application
SqlSugarRepository<TaskTruckInfo> taskTruckInfoRepository,
SqlSugarRepository<TaskTruckCtn> taskTruckCtnRepository,
SqlSugarRepository<TaskBCInfo> taskBCInfoRepository,
SqlSugarRepository<TaskBCCTNInfo> taskBCCTNInfoRepository,
INamedServiceProvider<IBookingOrderService> namedBookingOrderServiceProvider,
IDjyWebsiteAccountConfigService webAccountConfig,
ISysCacheService cache,
@ -169,6 +173,7 @@ namespace Myshipping.Application
_taskTruckInfoRepository = taskTruckInfoRepository;
_taskTruckCtnRepository = taskTruckCtnRepository;
_taskBCInfoRepository = taskBCInfoRepository;
_taskBCCTNInfoRepository = taskBCCTNInfoRepository;
_namedBookingOrderServiceProvider = namedBookingOrderServiceProvider;
@ -215,9 +220,10 @@ namespace Myshipping.Application
/// </summary>
/// <param name="info">任务详情</param>
/// <param name="batchNo">批次号</param>
/// <param name="file">文件</param>
/// <returns>返回回执</returns>
[SqlSugarUnitOfWork]
private async Task<TaskManageOrderResultDto> InitTaskJob(TaskManageOrderMessageInfo info,string batchNo)
private async Task<TaskManageOrderResultDto> InitTaskJob(TaskManageOrderMessageInfo info,string batchNo, IFormFile file = null)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
@ -238,7 +244,6 @@ namespace Myshipping.Application
throw Oops.Oh($"状态已存在,不能重复创建任务");
}
taskInfo = new TaskBaseInfo
{
@ -276,7 +281,23 @@ namespace Myshipping.Application
}
}
UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
UserTendDto userTendInfo = null;
//如果大简云用户ID不为空接收人为空时通过大简云用户ID关联订舱人ID
if (!string.IsNullOrWhiteSpace(info.Main.DJYRecvUserId) && string.IsNullOrWhiteSpace(info.Main.TaskUserId))
{
userTendInfo = GetUserTendInfoByDJYUserId(info.Main.DJYRecvUserId, info.Main.DJYRecvUserEmail);
if(userTendInfo != null)
{
taskInfo.IS_PUBLIC = 0;
}
}
else
{
userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
}
taskInfo.CreatedUserId = userTendInfo.userId;
taskInfo.CreatedUserName = userTendInfo.userName;
@ -303,6 +324,30 @@ namespace Myshipping.Application
//新增
_taskBaseInfoRepository.Insert(taskInfo);
if (file != null)
{
var bytes = file.ToByteArray();
var fileFullName = await FileAttachHelper.SaveFile(taskInfo.PK_ID, bytes, batchNo, file.FileName,
GetFileType(file.FileName), "bcfiles");
if (!string.IsNullOrWhiteSpace(fileFullName))
{
if (info.Main.FileList == null)
{
info.Main.FileList = new List<TaskManageOrderFileInfo>();
}
info.Main.FileList.Add(new TaskManageOrderFileInfo
{
PKId = IDGen.NextID().ToString(),
FileName = file.FileName,
FileType = Path.GetExtension(file.FileName).ToLower(),
FilePath = fileFullName
});
}
}
#region 附件
//附件
if (info.Main.FileList != null && info.Main.FileList.Count > 0)
@ -548,6 +593,46 @@ namespace Myshipping.Application
}
#endregion
#region BC 任务
if (info.Main.TaskType == TaskBaseTypeEnum.BC)
{
//异步写入
var bcInfo = info.Main.BCInfo.Adapt<TaskBCInfo>();
bcInfo.PK_ID = IDGen.NextID().ToString();
bcInfo.TASK_ID = taskInfo.PK_ID;
bcInfo.CreatedTime = taskInfo.CreatedTime;
bcInfo.UpdatedTime = taskInfo.CreatedTime;
bcInfo.CreatedUserId = taskInfo.CreatedUserId;
bcInfo.CreatedUserName = taskInfo.CreatedUserName;
bcInfo.TenantId = taskInfo.TenantId;
bcInfo.TenantName = taskInfo.TenantName;
await _taskBCInfoRepository.InsertAsync(bcInfo);
//异步写入集装箱
info.Main.BCInfo.CtnList.ForEach(async ctn =>
{
var bcCtnInfo = ctn.Adapt<TaskBCCTNInfo>();
bcCtnInfo.PK_ID = IDGen.NextID().ToString();
bcCtnInfo.P_ID = bcInfo.PK_ID;
bcInfo.CreatedTime = taskInfo.CreatedTime;
bcInfo.UpdatedTime = taskInfo.CreatedTime;
bcInfo.CreatedUserId = taskInfo.CreatedUserId;
bcInfo.CreatedUserName = taskInfo.CreatedUserName;
bcInfo.TenantId = taskInfo.TenantId;
bcInfo.TenantName = taskInfo.TenantName;
await _taskBCCTNInfoRepository.InsertAsync(bcCtnInfo);
});
}
#endregion
if (info.Main.SerialMsgInfo != null)
{
var storeInfo = new TaskStoreMsgInfo
@ -584,11 +669,12 @@ namespace Myshipping.Application
}
#endregion
#region 查询订舱表查询用户和租户信息
/// <summary>
/// 查询订舱表查询用户和租户信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
/// <param name="userId">用户ID</param>
/// <returns>返回用户和租户信息</returns>
private UserTendDto GetUserTendInfo(string userId)
{
UserTendDto userTendDto = null;
@ -612,6 +698,40 @@ namespace Myshipping.Application
return userTendDto;
}
#endregion
#region 查询订舱表查询用户和租户信息
/// <summary>
/// 查询订舱表查询用户和租户信息
/// </summary>
/// <param name="djyUserId">大简云用户ID</param>
/// <param name="djyUserEmail">大简云用户邮箱</param>
/// <returns>返回用户和租户信息</returns>
private UserTendDto GetUserTendInfoByDJYUserId(string djyUserId,string djyUserEmail)
{
UserTendDto userTendDto = null;
//这里因为接口是不做授权验证的所以这里直接写的动态sql提取了用户和租户信息
var userTendInfo = _sysUserRepository.EntityContext.Queryable<dynamic>("user").AS("sys_user")
.AddJoinInfo("sys_tenant", "ten", "user.TenantId=ten.Id")
.Where("user.DjyUserId=@id and user.Email like '%"+ djyUserEmail + "%'", new { id = djyUserId})
.Select("user.Id as UserId,user.Name as UserName,ten.Id as TendId,ten.Name as TendName").First();
if (userTendInfo == null || userTendInfo.TendId == null)
throw Oops.Oh("当前用户详情获取失败,请确认{0}赋值是否准确", nameof(TaskManageOrderMessageInfo.Main.TaskUserId));
userTendDto = new UserTendDto
{
userId = long.Parse(userTendInfo.UserId.ToString()),
userName = userTendInfo.UserName.ToString(),
tendId = long.Parse(userTendInfo.TendId.ToString()),
tenantName = userTendInfo.TendName.ToString()
};
return userTendDto;
}
#endregion
#region 获取查询参数
/// <summary>
@ -751,7 +871,7 @@ namespace Myshipping.Application
});
if (nextList.Count > 0)
resultInfo.LevelNext = nextList.OrderBy(t => t.SortNo).ToList();
resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
exceptList.GroupBy(t => new { t.Status, t.TaskType })
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
@ -806,7 +926,7 @@ namespace Myshipping.Application
});
if (nextList.Count > 0)
resultInfo.LevelNext = nextList.OrderBy(t => t.SortNo).ToList();
resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
personList.GroupBy(t => new { t.Status, t.TaskType })
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
@ -862,7 +982,7 @@ namespace Myshipping.Application
});
if (nextList.Count > 0)
resultInfo.LevelNext = nextList.OrderBy(t => t.SortNo).ToList();
resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
publicList.GroupBy(t => new { t.Status, t.TaskType })
.Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
@ -4806,6 +4926,75 @@ namespace Myshipping.Application
return result;
}
#region 创建BC任务
/// <summary>
/// 创建BC任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="jsonData">BC任务详情JSON</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskManage/CreateBCTaskJob")]
public async Task<TaskManageOrderResultDto> CreateBCTaskJob(IFormFile file, [FromForm] string jsonData)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, jsonData);
try
{
TaskManageOrderMessageInfo info = JSON.Deserialize<TaskManageOrderMessageInfo>(jsonData);
if(info == null)
throw Oops.Bah("jsonData请求内容错误无法反序列化报文");
result = await InitTaskJob(info, batchNo, file);
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"请求任务异常,{ex.Message}";
}
return result;
}
#endregion
#region 获取文件类型
/// <summary>
/// 获取文件类型
/// </summary>
/// <param name="fileName">文件完成路径</param>
/// <returns>返回文件类型枚举</returns>
private PrintFileTypeEnum GetFileType(string fileName)
{
PrintFileTypeEnum fileType = PrintFileTypeEnum.PDF;
switch (Path.GetExtension(fileName).ToLower())
{
case ".pdf":
fileType = PrintFileTypeEnum.PDF;
break;
case ".xlsx":
fileType = PrintFileTypeEnum.XLSX;
break;
case ".docx":
fileType = PrintFileTypeEnum.DOCX;
break;
case ".xls":
fileType = PrintFileTypeEnum.XLS;
break;
case ".doc":
fileType = PrintFileTypeEnum.DOC;
break;
}
return fileType;
}
#endregion
}
#region 样本业务提取帮助类

Loading…
Cancel
Save