修改BC任务

optimize
jianghaiqing 1 year ago
parent e0985ba5db
commit 914a22a584

@ -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;

@ -0,0 +1,244 @@
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; }
}
}

@ -661,6 +661,76 @@ 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<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);
}
}

@ -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,123 @@
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 = "TaskManageBCService", 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;
public TaskManageBCService(SqlSugarRepository<TaskBCInfo> taskBCInfoRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
SqlSugarRepository<TaskBCCTNInfo> taskBCCTNInfoRepository)
{
_taskBaseRepository = taskBaseRepository;
_taskBCInfoRepository = taskBCInfoRepository;
_taskBCCTNInfoRepository = taskBCCTNInfoRepository;
}
#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>>();
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>>();
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