BC任务生成订单及订舱功能调整

usertest
zhangxiaofeng 4 months ago
parent 14c8b73585
commit 5fd6bcf430

@ -10,6 +10,16 @@
/// </summary>
public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo);
/// <summary>
/// 任务主表主键
/// </summary>
public const string TaskBaseId = "TaskBaseId";
/// <summary>
/// 任务BC子表主键
/// </summary>
public const string TaskBCId = "TaskBCId";
/// <summary>
/// 租户Id
/// </summary>

@ -28,7 +28,7 @@ namespace DS.WMS.Core.Op.Entity
/// <summary>
/// 箱型代码
/// </summary>
[SugarColumn(ColumnDescription = "箱型代码", IsNullable = true, Length = 4)]
[SugarColumn(ColumnDescription = "箱型代码", IsNullable = true, Length = 5)]
public string CtnCode { get; set; }
/// <summary>

@ -52,6 +52,7 @@ using DS.Module.Core.Data;
using DS.WMS.Core.TaskPlat.Dtos;
using NPOI.XSSF.UserModel;
using AngleSharp.Dom;
using DS.WMS.Core.TaskPlat.Entity;
namespace DS.WMS.Core.Op.Method
{
@ -819,15 +820,18 @@ namespace DS.WMS.Core.Op.Method
/// </summary>
public async Task<DataResult<BookingSlotBase?>> ApiReceiveTask(TaskFlowDataContext dataContext)
{
//var a = user.UserId;
//var b = user.UserName;
//var c = user.TenantId;
var messageInfo = dataContext.Get<TaskManageOrderMessageInfo>(TaskFlowDataNameConst.TaskManageOrderMessageInfo);
if (messageInfo == null)
{
throw new ArgumentNullException($"缺少参数:{TaskFlowDataNameConst.TaskManageOrderMessageInfo}");
}
var taskBcId = dataContext.Get<long?>(TaskFlowDataNameConst.TaskBCId);
if (taskBcId == null)
{
Logger.Log(NLog.LogLevel.Info, $"执行ApiReceiveTask时未获取到{TaskFlowDataNameConst.TaskBCId}");
}
DynameFileInfo bcFileInfo = null;
DynameFileInfo bcNoticeFileInfo = null;
@ -932,6 +936,20 @@ namespace DS.WMS.Core.Op.Method
var rlt = await InnerApiReceive(slotModel, bcFileInfo, bcNoticeFileInfo);
// 回写舱位主键到BC任务
if (rlt.Succeeded && rlt.Data != null && taskBcId != null)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var taskBcInfo = await tenantDb.Queryable<TaskBCInfo>().Where(x => x.Id == taskBcId).FirstAsync();
if (taskBcInfo != null && taskBcInfo.BOOKING_SLOT_ID == null)
{
taskBcInfo.BOOKING_SLOT_ID = rlt.Data.Id;
await tenantDb.Updateable<TaskBCInfo>(taskBcInfo).UpdateColumns(x => new
{
x.BOOKING_SLOT_ID
}).ExecuteCommandAsync();
}
}
return rlt;
}
#endregion
@ -1468,7 +1486,7 @@ namespace DS.WMS.Core.Op.Method
/// <param name="fileTypeName">附件类型名称</param>
/// <param name="moudle">附件模块代码</param>
/// <returns></returns>
private async Task<DataResult<string>> SaveEDIFile(long boookId, string FilePath, string fileName, long tenantId,int fileSize,
private async Task<DataResult<string>> SaveEDIFile(long boookId, string FilePath, string fileName, long tenantId, int fileSize,
string fileTypeCode = "bc", string fileTypeName = "Booking Confirmation", string moudle = "BookingSlot")
{
/*
@ -2414,6 +2432,10 @@ namespace DS.WMS.Core.Op.Method
Logger.Log(NLog.LogLevel.Info, "根据舱位生成订舱开始调用Save保存订舱");
var bkRlt = await _seaExportService.EditSeaExport(bkModel);
if (bkRlt.Data == null)
{
throw new Exception("根据舱位生成订舱后订舱主键为空messsage:" + bkRlt.Message);
}
Logger.Log(NLog.LogLevel.Info, $"根据舱位生成订舱调用Save保存订舱完成id:{bkRlt.Data}");
@ -3596,7 +3618,7 @@ namespace DS.WMS.Core.Op.Method
Logger.Log(NLog.LogLevel.Info, $"批次={batchNo} 开始查询台账");
//序列化查询条件
@ -4163,7 +4185,7 @@ namespace DS.WMS.Core.Op.Method
orderInfo = orderRlt.Data;
}
if(orderInfo == null)
if (orderInfo == null)
{
//海运出口详情获取失败,已作废或数据不存在
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.SeaExportInfoNotExists)));

@ -950,6 +950,20 @@ namespace DS.WMS.Core.TaskPlat.Method
}
var result = await bookingSlotService.Value.InnerApiReceive(slotModel, dynameFile, dynameNoticeFile);
if (result.Succeeded && result.Data != null)
{
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
var taskBcInfo = await tenantDb.Queryable<TaskBCInfo>().Where(x => x.Id == taskBCInfo.Id).FirstAsync();
if (taskBcInfo != null && taskBcInfo.BOOKING_SLOT_ID == null)
{
taskBcInfo.BOOKING_SLOT_ID = result.Data.Id;
await tenantDb.Updateable<TaskBCInfo>(taskBcInfo).UpdateColumns(x => new
{
x.BOOKING_SLOT_ID
}).ExecuteCommandAsync();
}
}
return result.Data;
}
catch (Exception ex)

@ -5,6 +5,7 @@ using DS.Module.Core.Helpers;
using DS.Module.DjyServiceStatus;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface;
@ -20,12 +21,17 @@ namespace DS.WMS.Core.TaskPlat.Method
{
public class TaskManageService : TaskManageBaseService<TaskManageService>, ITaskManageService
{
private readonly ICodeCtnService codeCtnService;
public TaskManageService(IUser user,
ILogger<TaskManageService> logger,
ISaasDbService saasDbService,
IServiceProvider serviceProvider,
IWebHostEnvironment environment) : base(user, logger, saasDbService, serviceProvider, environment)
{ }
IWebHostEnvironment environment,
ICodeCtnService codeCtnService) : base(user, logger, saasDbService, serviceProvider, environment)
{
this.codeCtnService = codeCtnService;
}
#region 对工作流提供的接口
/// <summary>
@ -736,12 +742,21 @@ namespace DS.WMS.Core.TaskPlat.Method
await tenantDb.Insertable(bcInfo).ExecuteCommandAsync();
//异步写入集装箱
var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List<Code.Dtos.CodeCtnRes>();
var ctnList = info.Main.BCInfo.CtnList.Select(ctn =>
{
var bcCtnInfo = ctn.Adapt<TaskBCCTNInfo>();
bcCtnInfo.Id = SnowFlakeSingle.Instance.NextId();
bcCtnInfo.P_ID = bcInfo.Id;
if (string.IsNullOrEmpty(bcCtnInfo.CTNCODE))
{
var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) && a.CtnName.Equals(bcCtnInfo.CTNALL, StringComparison.OrdinalIgnoreCase));
bcCtnInfo.CTNCODE = ctnCode != null ? ctnCode.EdiCode : "(箱型未收录)";
}
bcInfo.CreateBy = taskInfo.CreateBy;
bcInfo.CreateTime = taskInfo.CreateTime;
return bcCtnInfo;
@ -762,6 +777,7 @@ namespace DS.WMS.Core.TaskPlat.Method
// 执行自动化操作
TaskFlowDataContext dataContext = new(
(TaskFlowDataNameConst.TaskManageOrderMessageInfo, info),
(TaskFlowDataNameConst.TaskBCId, bcInfo.Id),
(TaskFlowDataNameConst.BCFile, file),
(TaskFlowDataNameConst.AmendmentFile, modifyFile)
);

@ -31,6 +31,19 @@
}
]
},
"DjyService": {
"IP": "118.190.144.189",
"Port": "5001",
"AccessKey": "8f96908b74d944e0b1dedfb2714a941f",
"AccessSecret": "a5689efa45367b591668b0b3031d9b68e9f3bb04dc6cee26e556cc272de78841e01f78f6f35a313b",
"SaveServiceProjectUrl": "/EmbedProjectGoodsStatus/SaveServiceProject",
"CancelServiceProjectUrl": "/EmbedProjectGoodsStatus/CancelServiceProject",
"GetServiceProjectListUrl": "/EmbedProjectGoodsStatus/GetServiceProjectList",
"GetServiceStatusListUrl": "/EmbedProjectGoodsStatus/GetServiceStatusList",
"SaveServiceStatusUrl": "/EmbedProjectGoodsStatus/SaveServiceStatus",
"CancelServiceStatusUrl": "/EmbedProjectGoodsStatus/CancelServiceStatus",
"GetEnableProjectDictTreeList": "/EmbedProjectGoodsStatus/GetEnableProjectDictTreeList"
},
"SwaggerDoc": {
"ContactName": "WmsTaskAPI",
"ContactEmail": "Wms API.Core@xxx.com",

Loading…
Cancel
Save