修改任务台账

master
jianghaiqing 8 months ago
parent 3bc4a78757
commit 73514485e9

@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.ConfigOption;
using Myshipping.Application.Entity;
using Myshipping.Application.Event;
using Myshipping.Application.Service.BookingOrder.Dto;
@ -19,6 +20,7 @@ using Myshipping.Application.Service.BookingSlot.Dto;
using Myshipping.Core;
using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common;
using NPOI.XWPF.UserModel;
using Org.BouncyCastle.Asn1.Tsp;
using SqlSugar;
using System;
@ -52,6 +54,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingSlotAllocationCtn> _repAllocationCtn;
private readonly SqlSugarRepository<BookingFile> _bookingFileRepository;
private readonly SqlSugarRepository<BookingSlotCompare> _bookingSlotCompareRepository;
private readonly SqlSugarRepository<BookingOrderContact> _bookingOrderContactRepository;
private readonly SqlSugarRepository<BookingLog> _repBookingLog;
private readonly SqlSugarRepository<BookingLogDetail> _repBookingLogDetail;
@ -61,6 +64,9 @@ namespace Myshipping.Application
private readonly ISysCacheService _cache;
private readonly IEventPublisher _publisher;
private readonly IBookingOrderService _bookingOrderService;
private readonly IDjyCustomerService _djyCustomerService;
private readonly IBookingValueAddedService _bookingValueAddedService;
const string CONST_BC_FILE_CODE = "bc";
const string CONST_BC_FILE_NAME = "Booking Confirmation";
@ -83,10 +89,14 @@ namespace Myshipping.Application
ILogger<BookingSlotService> logger,
ISysCacheService cache,
IEventPublisher publisher,
IDjyCustomerService djyCustomerService,
SqlSugarRepository<BookingSlotAllocation> repAllocation,
SqlSugarRepository<BookingSlotAllocationCtn> repAllocationCtn,
SqlSugarRepository<BookingFile> bookingFileRepository,
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository)
SqlSugarRepository<BookingSlotCompare> bookingSlotCompareRepository,
SqlSugarRepository<BookingOrderContact> bookingOrderContactRepository,
IBookingOrderService bookingOrderService,
IBookingValueAddedService bookingValueAddedService)
{
_repBase = repBase;
_repCtn = repCtn;
@ -95,7 +105,7 @@ namespace Myshipping.Application
_repBookingLogDetail = repBookingLogDetail;
_repAllocation = repAllocation;
_repAllocationCtn = repAllocationCtn;
_djyCustomerService = djyCustomerService;
_logger = logger;
_cache = cache;
@ -104,6 +114,9 @@ namespace Myshipping.Application
_bookingfile = bookingfile;
_bookingFileRepository = bookingFileRepository;
_bookingSlotCompareRepository = bookingSlotCompareRepository;
_bookingOrderService = bookingOrderService;
_bookingOrderContactRepository = bookingOrderContactRepository;
_bookingValueAddedService = bookingValueAddedService;
}
#region 舱位
@ -1148,8 +1161,275 @@ namespace Myshipping.Application
return result;
}
#endregion
#region 生成订舱订单
/// <summary>
/// 生成订舱订单
/// </summary>
/// <param name="model">生成订舱订单请求</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CreateBookingOrder(BookingGenerateDto model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
if (!model.SlotId.HasValue || model.SlotId.Value < 1)
throw Oops.Oh($"舱位ID不能为空");
var slotInfo = await _repBase.AsQueryable()
.FirstAsync(a => a.Id == model.SlotId.Value);
if (slotInfo == null)
throw Oops.Oh($"舱位信息不存在或已作废");
// 判断是否已存在引用关系
if (_repAllocation.IsExists(a => a.BOOKING_SLOT_ID == slotInfo.Id
&& a.BOOKING_ID > 0 && a.IsDeleted == false))
{
throw Oops.Oh($"舱位已有对应的订舱订单,不能重复执行");
}
var ctnList = _repCtn.AsQueryable().Where(a => a.SLOT_ID == slotInfo.Id && a.IsDeleted == false)
.ToList();
var fileList = await _bookingfile.AsQueryable().Filter(null, true)
.Where(u => u.BookingId == slotInfo.Id && u.Moudle == "BookingSlot").ToListAsync();
var bookingOrderId = await GenerateBookingOrder(slotInfo, ctnList, fileList, model);
result.succ = true;
result.msg = "成功";
return result;
}
#endregion
#region 生成订舱
/// <summary>
/// 生成订舱
/// </summary>
/// <param name="bookingSlotBase">舱位详情</param>
/// <param name="bookingSlotCtnList">舱位集装箱列表</param>
/// <param name="bookingSlotFileList">舱位附件列表</param>
/// <param name="generateModel">订舱请求详情</param>
/// <returns>返回订舱ID</returns>
private async Task<long> GenerateBookingOrder(BookingSlotBase bookingSlotBase, List<BookingSlotCtn> bookingSlotCtnList,
List<BookingFile> bookingSlotFileList,
BookingGenerateDto generateModel)
{
long id = 0;
try
{
/*
1
2
3
*/
var carrierInfo = _cache.GetAllCodeCarrier().GetAwaiter().GetResult()
.Where(t => t.Code.Equals(bookingSlotBase.CARRIERID, StringComparison.OrdinalIgnoreCase)
|| t.EnName.Equals(bookingSlotBase.CARRIERID, StringComparison.OrdinalIgnoreCase)
|| t.CnName.Equals(bookingSlotBase.CARRIERID, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
SaveBookingOrderInput bkModel = new SaveBookingOrderInput
{
CUSTOMERID = generateModel.CustomerId,
CUSTOMERNAME = generateModel.CustomerName,
CARRIERID = carrierInfo.Code?.Trim(),
CARRIER = carrierInfo.CnName?.Trim(),
MBLNO = bookingSlotBase.SLOT_BOOKING_NO.Trim(),
CONTRACTNO = !string.IsNullOrWhiteSpace(bookingSlotBase.CONTRACT_NO) ? bookingSlotBase.CONTRACT_NO : "",
VESSEL = bookingSlotBase.VESSEL.ToUpper().Trim(),
VOYNO = bookingSlotBase.VOYNO.ToUpper().Trim(),
VOYNOINNER = bookingSlotBase.VOYNO.ToUpper().Trim(),
ETD = bookingSlotBase.ETD,
ETA = bookingSlotBase.ETA,
SALEID = generateModel.SaleId.ToString(),
SALE = generateModel.SaleName,
OPID = generateModel.OpId.ToString(),
OP = generateModel.OpName,
DOCID = generateModel.DocId.ToString(),
DOC = generateModel.DocName,
ROUTEID = generateModel.RouteID.ToString(),
ROUTE = generateModel.Route,
CZRemark = generateModel.CZRemark,
ShenQingXiangShi = generateModel.ShenQingXiangShi,
LineManageID = generateModel.LineManageID.ToString(),
LineName = generateModel.LineManage,
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
ctnInputs = new List<BookingCtnDto>()
};
var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList();
if (bookingSlotCtnList.Count > 0)
{
bookingSlotCtnList.ForEach(t =>
{
var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.Name) &&
a.Name.Equals(t.CTNALL, StringComparison.OrdinalIgnoreCase));
BookingCtnDto ctn = new BookingCtnDto
{
CTNCODE = ctnCode?.Code,
CTNALL = t.CTNALL,
CTNNUM = t.CTNNUM
};
bkModel.ctnInputs.Add(ctn);
});
}
var bkRlt = await _bookingOrderService.Save(bkModel);
id = bkRlt.Id;
string batchNo = IDGen.NextID().ToString();
if (id > 0)
{
//这里如果指定了委托单位的邮件联系人,则推送订舱联系人
if (generateModel.CustomerContactList != null && generateModel.CustomerContactList.Count > 0)
{
var bookingContactList = _bookingOrderContactRepository.AsQueryable()
.Where(a => a.BookingId == id && !a.IsDeleted).ToList();
var djyCustomerInfo = _djyCustomerService.Detail(new GetDjyCustomerInput { Id = generateModel.CustomerId.Value })
.GetAwaiter().GetResult();
generateModel.CustomerContactList.ForEach(contact =>
{
DjyCustomerContactOutput djyCustomerContactMan = null;
if (djyCustomerInfo.Contacts != null && djyCustomerInfo.Contacts.Count > 0)
{
djyCustomerContactMan = djyCustomerInfo.Contacts.FirstOrDefault(a =>
a.Id == contact.CustomerContactId);
}
if (djyCustomerContactMan != null)
{
var bookingContact = bookingContactList
.FirstOrDefault(x => x.Email.Equals(djyCustomerContactMan.Email, StringComparison.OrdinalIgnoreCase));
if (bookingContact == null)
{
bookingContact = new BookingOrderContact
{
Name = djyCustomerContactMan.Name,
BookingId = id,
Email = djyCustomerContactMan.Email,
Remark = djyCustomerContactMan.Remark,
CreatedTime = DateTime.Now,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name
};
_bookingOrderContactRepository.Insert(bookingContact);
}
else
{
bookingContact.Name = djyCustomerContactMan.Name;
bookingContact.Email = djyCustomerContactMan.Email;
bookingContact.Remark = djyCustomerContactMan.Remark;
bookingContact.UpdatedTime = DateTime.Now;
bookingContact.UpdatedUserId = UserManager.UserId;
bookingContact.UpdatedUserName = UserManager.Name;
_bookingOrderContactRepository.AsUpdateable(bookingContact).UpdateColumns(it => new
{
it.Name,
it.Email,
it.Remark,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommand();
}
}
});
}
if (generateModel.ProjectList != null && generateModel.ProjectList.Count > 0)
{
ModifyServiceProjectDto projectDto = new ModifyServiceProjectDto
{
BookingId = id,
ProjectCodes = generateModel.ProjectList.Distinct().ToArray(),
};
//写入服务项目
var prjRlt = await _bookingValueAddedService.SaveServiceProject(projectDto);
_logger.LogInformation($"推送订舱的服务项目完成 id={id} rlt={JSON.Serialize(prjRlt)}");
}
var opt = App.GetOptions<BookingAttachOptions>();
var dirAbs = opt.basePath;
if (string.IsNullOrEmpty(dirAbs))
{
dirAbs = App.WebHostEnvironment.WebRootPath;
}
if (bookingSlotFileList.Any(a => a.TypeCode.Equals("bc", StringComparison.OrdinalIgnoreCase)))
{
var file = bookingSlotFileList.OrderByDescending(a => a.CreatedTime)
.FirstOrDefault(a => a.TypeCode.Equals("bc", StringComparison.OrdinalIgnoreCase));
var fileFullPath = Path.Combine(dirAbs, file.FilePath);
if (File.Exists(fileFullPath))
{
//如果确认文件读取成功
var bookFilePath = FileAttachHelper.MoveFile(id.ToString(), fileFullPath, batchNo
, false, null, true).GetAwaiter().GetResult();
//将格式单附件写入订舱的附件
SaveEDIFile(id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, file.TenantId.Value,
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME).GetAwaiter();
}
}
if (bookingSlotFileList.Any(a => a.TypeCode.Equals("bc_notice", StringComparison.OrdinalIgnoreCase)))
{
var file = bookingSlotFileList.OrderByDescending(a => a.CreatedTime)
.FirstOrDefault(a => a.TypeCode.Equals("bc_notice", StringComparison.OrdinalIgnoreCase));
var fileFullPath = Path.Combine(dirAbs, file.FilePath);
if (File.Exists(fileFullPath))
{
//如果确认文件读取成功
var bookFilePath = FileAttachHelper.MoveFile(id.ToString(), fileFullPath, batchNo
, false, "bcnoticefile", true).GetAwaiter().GetResult();
//将格式单附件写入订舱的附件
SaveEDIFile(id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, file.TenantId.Value,
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME).GetAwaiter();
}
}
}
_logger.LogInformation($"MBLNO:{bookingSlotBase.SLOT_BOOKING_NO} 生成订舱订单成功 id={id}");
}
catch (Exception ex)
{
_logger.LogError($"MBLNO:{bookingSlotBase.SLOT_BOOKING_NO} 生成订舱订单异常,原因:{ex.Message}");
}
return id;
}
#endregion
}
public class DynameFileInfo
{
/// <summary>

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class BookingGenerateDto
{
/// <summary>
/// 舱位ID
/// </summary>
public Nullable<long> SlotId { get; set; }
/// <summary>
/// 委托客户ID
/// </summary>
public Nullable<long> CustomerId { get; set; }
/// <summary>
/// 委托客户名称
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 销售ID
/// </summary>
public Nullable<long> SaleId { get; set; }
/// <summary>
/// 销售名称
/// </summary>
public string SaleName { get; set; }
/// <summary>
/// 操作ID
/// </summary>
public Nullable<long> OpId { get; set; }
/// <summary>
/// 操作名称
/// </summary>
public string OpName { get; set; }
/// <summary>
/// 单证ID
/// </summary>
public Nullable<long> DocId { get; set; }
/// <summary>
/// 单证名称
/// </summary>
public string DocName { get; set; }
/// <summary>
/// 航线操作ID
/// </summary>
public Nullable<long> RouteID { get; set; }
/// <summary>
/// 航线操作
/// </summary>
public string Route { get; set; }
/// <summary>
/// 航线管理
/// </summary>
public string LineManage { get; set; }
/// <summary>
/// 航线管理ID
/// </summary>
public Nullable<long> LineManageID { get; set; }
/// <summary>
/// 操作备注
/// </summary>
public string CZRemark { get; set; }
/// <summary>
/// 申请箱使
/// </summary>
public string ShenQingXiangShi { get; set; }
/// <summary>
/// 服务项目列表传serviceProjectCode
/// </summary>
public List<string> ProjectList { get; set; }
/// <summary>
/// 联系人列表
/// </summary>
public List<CustomerContact> CustomerContactList { get; set; }
/// <summary>
/// 是否直接发送邮件给订舱联系人
/// </summary>
public bool IsDirectSend { get; set; } = false;
}
}

@ -89,5 +89,12 @@ namespace Myshipping.Application
/// <param name="file">导入舱位文件</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> ImportSlotFromFile(IFormFile file);
/// <summary>
/// 生成订舱订单
/// </summary>
/// <param name="model">生成订舱订单请求</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CreateBookingOrder(BookingGenerateDto model);
}
}

@ -294,5 +294,14 @@ namespace Myshipping.Application
/// <param name="jsonData">BC任务详情JSON</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CreateDRAFTTaskJob(IFormFile file, IFormFile modifyFile, string jsonData);
/// <summary>
/// 创建截单回执任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="modifyFile">截单回执变更内容后文件</param>
/// <param name="jsonData">截单回执任务详情JSON</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CreateSISubmittedTaskJob(IFormFile file, IFormFile modifyFile, string jsonData);
}
}

@ -841,118 +841,212 @@ namespace Myshipping.Application
else if (model.GenerateMethod == "GEN_BOOKING")
{
#region 推送订舱
//推送订舱
var bookingOrderId = GenerateBookingOrder(bcOrder, bcCtnList, fileList, model).GetAwaiter().GetResult();
long bookingId = 0;
long bookingSlotId = 0;
if (bookingOrderId > 0)
if (bcOrder.BOOKING_ORDER_ID.HasValue && bcOrder.BOOKING_ORDER_ID.Value > 0)
{
if (model.IsDirectSend)
{
//异步推送邮件
await GenerateSendEmail(bcOrder);
}
//bookingSlotId = bcOrder.BOOKING_SLOT_ID.Value;
throw Oops.Oh($"生成订舱订单失败,订舱订单已存在");
}
if (!bcOrder.BOOKING_SLOT_ID.HasValue || bcOrder.BOOKING_SLOT_ID.Value < 1)
{
//bookingSlotId = bcOrder.BOOKING_SLOT_ID.Value;
throw Oops.Oh($"生成订舱订单失败,舱位未生成不能直接生成订舱订单");
}
bookingSlotId = bcOrder.BOOKING_SLOT_ID.Value;
//推送订舱订单
var bookingOrderId = await GenerateBookingOrder(bcOrder, bcCtnList, fileList, model);
List<BookingSlotBaseWithCtnDto> slots = new List<BookingSlotBaseWithCtnDto>();
//检索舱位信息
var slotInfo = _bookingSlotService.Detail(bookingSlotId).GetAwaiter().GetResult();
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcTaskInfo.PK_ID);
BookingSlotBaseWithCtnDto baseInfo = slotInfo.Adapt<BookingSlotBaseWithCtnDto>();
baseInfo.Id = bookingSlotId;
baseInfo.CtnList = slotInfo.CtnList.Adapt<List<BookingSlotCtnDto>>();
if (bcEntity != null)
slots.Add(baseInfo);
//对应订舱和舱位关系
var allocRlt = await _bookingSlotService.ImportSlots(slots, bookingOrderId, false);
_logger.LogInformation($"生成订舱和舱位关系完成allocRlt={JSON.Serialize(allocRlt)} taskid={bcOrder.TASK_ID}");
if (!allocRlt.isSuccess)
{
throw Oops.Oh($"生成订舱和舱位关系失败");
}
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcOrder.PK_ID);
if (bcEntity == null)
{
throw Oops.Oh($"未获取有效任务BC失败更新失败");
}
bcEntity.BOOKING_ORDER_ID = bookingOrderId;
bcEntity.BOOKING_SLOT_ID = bookingSlotId;
bcEntity.UpdatedTime = DateTime.Now;
bcEntity.UpdatedUserId = UserManager.UserId;
bcEntity.UpdatedUserName = UserManager.Name;
//更新任务BC
await _taskBCInfoRepository.AsUpdateable(bcEntity).UpdateColumns(it => new
{
it.BOOKING_ORDER_ID,
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
var taskEntity = _taskBaseRepository.AsQueryable().First(u => u.PK_ID == bcEntity.TASK_ID);
if (taskEntity == null)
{
throw Oops.Oh($"未获取有效任务记录,更新失败");
}
#region 更新任务
//如果是公共任务,需要变成个人任务 RealUserId = 当前操作人
if (taskEntity.IS_PUBLIC == 1)
{
taskEntity.IS_PUBLIC = 0;
taskEntity.RealUserId = UserManager.UserId;
taskEntity.RealUserName = UserManager.Name;
taskEntity.UpdatedTime = DateTime.Now;
taskEntity.UpdatedUserId = UserManager.UserId;
taskEntity.UpdatedUserName = UserManager.Name;
await _taskBaseRepository.AsUpdateable(taskEntity).UpdateColumns(it => new
{
if (bookingOrderId > 0)
bcEntity.BOOKING_ORDER_ID = bookingOrderId;
it.IS_PUBLIC,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName,
it.RealUserId,
it.RealUserName
bcEntity.UpdatedTime = DateTime.Now;
bcEntity.UpdatedUserId = UserManager.UserId;
bcEntity.UpdatedUserName = UserManager.Name;
}).ExecuteCommandAsync();
}
else
{
taskEntity.UpdatedTime = DateTime.Now;
taskEntity.UpdatedUserId = UserManager.UserId;
taskEntity.UpdatedUserName = UserManager.Name;
_taskBCInfoRepository.AsUpdateable(bcEntity).UpdateColumns(it => new
{
it.BOOKING_ORDER_ID,
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
await _taskBaseRepository.AsUpdateable(taskEntity).UpdateColumns(it => new
{
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommand();
}).ExecuteCommandAsync();
}
#endregion
var currBCOrder = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcEntity.PK_ID);
var taskEntity = _taskBaseRepository.AsQueryable().First(u => u.PK_ID == bcEntity.TASK_ID);
if (currBCOrder != null && model.IsDirectSend)
{
//异步推送邮件
var mailRlt = await GenerateSendEmail(currBCOrder);
if (taskEntity != null && taskEntity.IS_PUBLIC == 1)
{
taskEntity.IS_PUBLIC = 0;
taskEntity.RealUserId = UserManager.UserId;
taskEntity.RealUserName = UserManager.Name;
taskEntity.UpdatedTime = DateTime.Now;
taskEntity.UpdatedUserId = UserManager.UserId;
taskEntity.UpdatedUserName = UserManager.Name;
_taskBaseRepository.AsUpdateable(taskEntity).UpdateColumns(it => new
{
it.IS_PUBLIC,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName,
it.RealUserId,
it.RealUserName
}).ExecuteCommand();
}
if (!mailRlt.succ)
{
throw Oops.Oh($"邮件推送失败,原因:{mailRlt.msg},可以任务编辑页面重新发送邮件");
}
}
#endregion
}
else if (model.GenerateMethod == "GEN_SLOT")
{
#region 推送舱位
//推送舱位
var bookingSlotId = GenerateBookingSlot(bcOrder, bcCtnList, fileList).GetAwaiter().GetResult();
long bookingSlotId = 0;
if (bookingSlotId > 0)
if (bcOrder.BOOKING_SLOT_ID.HasValue && bcOrder.BOOKING_SLOT_ID.Value > 0)
{
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcTaskInfo.PK_ID);
//bookingSlotId = bcOrder.BOOKING_SLOT_ID.Value;
throw Oops.Oh($"生成舱位失败,舱位已存在");
}
if (bcEntity != null)
{
if (bookingSlotId > 0)
bcEntity.BOOKING_SLOT_ID = bookingSlotId;
//触发生成舱位
bookingSlotId = await GenerateBookingSlot(bcOrder, bcCtnList, fileList);
bcEntity.UpdatedTime = DateTime.Now;
bcEntity.UpdatedUserId = UserManager.UserId;
bcEntity.UpdatedUserName = UserManager.Name;
_logger.LogInformation($"生成舱位完成bookingSlotId={bookingSlotId} taskid={bcOrder.TASK_ID}");
_taskBCInfoRepository.AsUpdateable(bcEntity).UpdateColumns(it => new
{
it.BOOKING_ORDER_ID,
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
if (bookingSlotId < 1)
throw Oops.Oh($"生成舱位失败");
}).ExecuteCommand();
var bcEntity = _taskBCInfoRepository.AsQueryable().First(a => a.PK_ID == bcOrder.PK_ID);
if (bcEntity == null)
{
throw Oops.Oh($"未获取有效任务BC失败更新失败");
}
var taskEntity = _taskBaseRepository.AsQueryable().First(u => u.PK_ID == bcEntity.TASK_ID);
bcEntity.BOOKING_SLOT_ID = bookingSlotId;
bcEntity.UpdatedTime = DateTime.Now;
bcEntity.UpdatedUserId = UserManager.UserId;
bcEntity.UpdatedUserName = UserManager.Name;
if (taskEntity != null && taskEntity.IS_PUBLIC == 1)
{
taskEntity.IS_PUBLIC = 0;
taskEntity.RealUserId = UserManager.UserId;
taskEntity.RealUserName = UserManager.Name;
taskEntity.UpdatedTime = DateTime.Now;
taskEntity.UpdatedUserId = UserManager.UserId;
taskEntity.UpdatedUserName = UserManager.Name;
_taskBaseRepository.AsUpdateable(taskEntity).UpdateColumns(it => new
{
it.IS_PUBLIC,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName,
it.RealUserId,
it.RealUserName
}).ExecuteCommand();
}
}
//更新任务BC
await _taskBCInfoRepository.AsUpdateable(bcEntity).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
var taskEntity = _taskBaseRepository.AsQueryable().First(u => u.PK_ID == bcEntity.TASK_ID);
if (taskEntity == null)
{
throw Oops.Oh($"未获取有效任务记录,更新失败");
}
#region 更新任务
//如果是公共任务,需要变成个人任务 RealUserId = 当前操作人
if (taskEntity.IS_PUBLIC == 1)
{
taskEntity.IS_PUBLIC = 0;
taskEntity.RealUserId = UserManager.UserId;
taskEntity.RealUserName = UserManager.Name;
taskEntity.UpdatedTime = DateTime.Now;
taskEntity.UpdatedUserId = UserManager.UserId;
taskEntity.UpdatedUserName = UserManager.Name;
await _taskBaseRepository.AsUpdateable(taskEntity).UpdateColumns(it => new
{
it.IS_PUBLIC,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName,
it.RealUserId,
it.RealUserName
}).ExecuteCommandAsync();
}
else
{
taskEntity.UpdatedTime = DateTime.Now;
taskEntity.UpdatedUserId = UserManager.UserId;
taskEntity.UpdatedUserName = UserManager.Name;
await _taskBaseRepository.AsUpdateable(taskEntity).UpdateColumns(it => new
{
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
}
#endregion
}

@ -5685,8 +5685,8 @@ namespace Myshipping.Application
/// 创建DRAFT任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="modifyFile">BC变更内容后文件</param>
/// <param name="jsonData">BC任务详情JSON</param>
/// <param name="modifyFile">DRAFT变更内容后文件</param>
/// <param name="jsonData">DRAFT任务详情JSON</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskManage/CreateDRAFTTaskJob"), ApiUser(ApiCode = "BCTaskManage")]
public async Task<TaskManageOrderResultDto> CreateDRAFTTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData)
@ -5717,6 +5717,43 @@ namespace Myshipping.Application
}
#endregion
#region 创建截单回执任务
/// <summary>
/// 创建截单回执任务
/// </summary>
/// <param name="file">文件</param>
/// <param name="modifyFile">截单回执变更内容后文件</param>
/// <param name="jsonData">截单回执任务详情JSON</param>
/// <returns>返回回执</returns>
[AllowAnonymous, HttpPost("/TaskManage/CreateSISubmittedTaskJob"), ApiUser(ApiCode = "BCTaskManage")]
public async Task<TaskManageOrderResultDto> CreateSISubmittedTaskJob(IFormFile file, IFormFile modifyFile, [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, modifyFile);
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"请求任务异常,{ex.Message}";
}
return result;
}
#endregion
#region 获取文件类型
/// <summary>
/// 获取文件类型

Loading…
Cancel
Save