From 5fd6bcf43017970d1b242bccfb9071d66c7b1ef3 Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Wed, 31 Jul 2024 21:37:23 +0800
Subject: [PATCH] =?UTF-8?q?BC=E4=BB=BB=E5=8A=A1=E7=94=9F=E6=88=90=E8=AE=A2?=
=?UTF-8?q?=E5=8D=95=E5=8F=8A=E8=AE=A2=E8=88=B1=E5=8A=9F=E8=83=BD=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Constants/TaskFlowDataNameConst.cs | 10 ++++++
ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs | 2 +-
.../Method/BookingSlot/BookingSlotService.cs | 34 +++++++++++++++----
.../TaskPlat/Method/TaskManageBCService.cs | 14 ++++++++
.../TaskPlat/Method/TaskManageService.cs | 20 +++++++++--
.../DS.WMS.TaskApi/appsettings.json | 13 +++++++
6 files changed, 84 insertions(+), 9 deletions(-)
diff --git a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs
index 3d692c6e..3854056c 100644
--- a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs
+++ b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs
@@ -10,6 +10,16 @@
///
public const string TaskManageOrderMessageInfo = nameof(TaskManageOrderMessageInfo);
+ ///
+ /// 任务主表主键
+ ///
+ public const string TaskBaseId = "TaskBaseId";
+
+ ///
+ /// 任务BC子表主键
+ ///
+ public const string TaskBCId = "TaskBCId";
+
///
/// 租户Id
///
diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs
index 15b4698d..5adfe465 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Entity/OpCtn.cs
@@ -28,7 +28,7 @@ namespace DS.WMS.Core.Op.Entity
///
/// 箱型代码
///
- [SugarColumn(ColumnDescription = "箱型代码", IsNullable = true, Length = 4)]
+ [SugarColumn(ColumnDescription = "箱型代码", IsNullable = true, Length = 5)]
public string CtnCode { get; set; }
///
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
index ba9ac82e..c1eb075b 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
@@ -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
///
public async Task> ApiReceiveTask(TaskFlowDataContext dataContext)
{
- //var a = user.UserId;
- //var b = user.UserName;
- //var c = user.TenantId;
var messageInfo = dataContext.Get(TaskFlowDataNameConst.TaskManageOrderMessageInfo);
if (messageInfo == null)
{
throw new ArgumentNullException($"缺少参数:{TaskFlowDataNameConst.TaskManageOrderMessageInfo}");
}
+ var taskBcId = dataContext.Get(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().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).UpdateColumns(x => new
+ {
+ x.BOOKING_SLOT_ID
+ }).ExecuteCommandAsync();
+ }
+ }
return rlt;
}
#endregion
@@ -1468,7 +1486,7 @@ namespace DS.WMS.Core.Op.Method
/// 附件类型名称
/// 附件模块代码
///
- private async Task> SaveEDIFile(long boookId, string FilePath, string fileName, long tenantId,int fileSize,
+ private async Task> 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)));
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
index e4c95f61..c09d0efd 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
@@ -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().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).UpdateColumns(x => new
+ {
+ x.BOOKING_SLOT_ID
+ }).ExecuteCommandAsync();
+ }
+ }
return result.Data;
}
catch (Exception ex)
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
index 97cfd29c..37b5c458 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -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, ITaskManageService
{
+
+ private readonly ICodeCtnService codeCtnService;
public TaskManageService(IUser user,
ILogger 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 对工作流提供的接口
///
@@ -736,12 +742,21 @@ namespace DS.WMS.Core.TaskPlat.Method
await tenantDb.Insertable(bcInfo).ExecuteCommandAsync();
//异步写入集装箱
+
+ var ctnCodeList = (await codeCtnService.GetAllList()).Data ?? new List();
var ctnList = info.Main.BCInfo.CtnList.Select(ctn =>
{
var bcCtnInfo = ctn.Adapt();
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)
);
diff --git a/ds-wms-service/DS.WMS.TaskApi/appsettings.json b/ds-wms-service/DS.WMS.TaskApi/appsettings.json
index a0603ed5..7f9bd9f5 100644
--- a/ds-wms-service/DS.WMS.TaskApi/appsettings.json
+++ b/ds-wms-service/DS.WMS.TaskApi/appsettings.json
@@ -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",