From 3e8b428057bd47c900ba9cb5ec2a7212be3b30be Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Fri, 26 Jul 2024 14:27:36 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Constants/MultiLanguageConst.cs | 6 +
.../Dtos/BC/BookingOrSlotGenerateDto.cs | 148 +++++++
.../TaskPlat/Dtos/BC/BookingOrderBCQuery.cs | 59 +++
.../TaskPlat/Dtos/BC/BookingOrderBCTaskDto.cs | 21 +
.../TaskPlat/Dtos/BC/TaskBCShowBaseDto.cs | 398 ++++++++++++++++++
.../TaskPlat/Dtos/TaskBCCTNInfoDto.cs | 78 ++++
.../DS.WMS.Core/TaskPlat/Dtos/TaskFileDto.cs | 31 ++
.../Interface/ITaskManageBCService.cs | 16 +
.../TaskPlat/Interface/ITaskManageService.cs | 7 +
.../TaskPlat/Method/TaskManageBCService.cs | 137 ++++++
.../TaskPlat/Method/TaskManageService.cs | 69 +++
.../Controllers/TaskManageBCController.cs | 30 ++
.../Controllers/TaskManageController.cs | 45 +-
13 files changed, 1035 insertions(+), 10 deletions(-)
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrSlotGenerateDto.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCQuery.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCTaskDto.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/TaskBCShowBaseDto.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBCCTNInfoDto.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskFileDto.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
create mode 100644 ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs
diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
index 94e28c03..2ee5b088 100644
--- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
+++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
@@ -1425,6 +1425,12 @@ public static class MultiLanguageConst
#region 任务台相关
[Description("当前状态是{0}不能执行完成")]
public const string TaskCannotCompleteWhenStatusMismatch = "TaskCannotCompleteWhenStatusMismatch";
+
+ [Description("未能获取到指定任务基础数据")]
+ public const string TaskBaseEmpty = "TaskBaseEmpty";
+
+ [Description("未能获取到相应BC业务数据")]
+ public const string TaskBCInfoEmpty = "TaskBCInfoEmpty";
#endregion
#region 邮件解析配置
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrSlotGenerateDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrSlotGenerateDto.cs
new file mode 100644
index 00000000..277d7bd2
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrSlotGenerateDto.cs
@@ -0,0 +1,148 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ ///
+ /// 生成订舱或者舱位请求
+ ///
+ public class BookingOrSlotGenerateDto
+ {
+ ///
+ /// BC任务主键
+ ///
+ public long BCTaskId { get; set; }
+
+ ///
+ /// BC主键
+ ///
+ public long BCPkId { get; set; }
+
+ ///
+ /// 生成方式(GEN_BOOKING_SLOT-生成舱位和订舱;GEN_BOOKING-只生成订舱;GEN_SLOT-只生成舱位;GEN_EXIST_BOOKING-匹配指定的订舱;UPD_BOOKING-更新订舱)
+ ///
+ public string GenerateMethod { get; set; }
+
+ ///
+ /// 舱位ID
+ ///
+ public Nullable SlotId { get; set; }
+
+ ///
+ /// 委托客户ID
+ ///
+ public Nullable CustomerId { get; set; }
+
+ ///
+ /// 委托客户名称
+ ///
+ public string CustomerName { get; set; }
+
+ ///
+ /// 销售ID
+ ///
+ public Nullable SaleId { get; set; }
+
+ ///
+ /// 销售名称
+ ///
+ public string SaleName { get; set; }
+
+ ///
+ /// 操作ID
+ ///
+ public Nullable OpId { get; set; }
+
+ ///
+ /// 操作名称
+ ///
+ public string OpName { get; set; }
+
+ ///
+ /// 单证ID
+ ///
+ public Nullable DocId { get; set; }
+
+ ///
+ /// 单证名称
+ ///
+ public string DocName { get; set; }
+
+ ///
+ /// 航线操作ID
+ ///
+ public Nullable RouteID { get; set; }
+
+ ///
+ /// 航线操作
+ ///
+ public string Route { get; set; }
+
+ ///
+ /// 航线管理
+ ///
+ public string LineManage { get; set; }
+
+ ///
+ /// 航线管理ID
+ ///
+ public Nullable LineManageID { get; set; }
+
+ ///
+ /// 操作备注
+ ///
+ public string CZRemark { get; set; }
+
+ ///
+ /// 申请箱使
+ ///
+ public string ShenQingXiangShi { get; set; }
+
+ ///
+ /// 服务项目列表(传serviceProjectCode)
+ ///
+ public List ProjectList { get; set; }
+
+ ///
+ /// 联系人列表
+ ///
+ public List CustomerContactList { get; set; }
+
+ ///
+ /// 是否直接发送邮件给订舱联系人
+ ///
+ public bool IsDirectSend { get; set; } = false;
+
+ ///
+ /// 是否默认使用用户个人邮箱发送 false-使用公共邮箱 true-使用个人邮箱
+ ///
+ public bool usePersonalEmailSend { get; set; } = false;
+
+ ///
+ /// 客服ID
+ ///
+ public Nullable CustServiceId { get; set; }
+
+ ///
+ /// 客服名称
+ ///
+ public string CustServiceName { get; set; }
+ }
+
+ public class CustomerContact
+ {
+ ///
+ /// 委托单位联系人ID
+ ///
+ public long CustomerContactId { get; set; }
+
+ ///
+ /// 委托单位联系人名称
+ ///
+ public string CustomerContactName { get; set; }
+ }
+
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCQuery.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCQuery.cs
new file mode 100644
index 00000000..2e1728c5
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCQuery.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ ///
+ /// 批量BC引入订舱检索
+ ///
+ public class BookingOrderBCQuery
+ {
+ ///
+ /// 开船开始日期
+ ///
+ public Nullable beginETD { get; set; }
+
+ ///
+ /// 开船结束日期
+ ///
+ public Nullable endETD { get; set; }
+
+ ///
+ /// 创建开始日期
+ ///
+ public Nullable beginCreated { get; set; }
+
+ ///
+ /// 创建结束日期
+ ///
+ public Nullable endCreated { get; set; }
+
+ ///
+ /// 主提单号
+ ///
+ public string mblNo { get; set; }
+
+ ///
+ /// 订舱编号
+ ///
+ public string custNo { get; set; }
+
+ ///
+ /// 船名
+ ///
+ public string vessel { get; set; }
+
+ ///
+ /// 航次号
+ ///
+ public string voyno { get; set; }
+
+ ///
+ /// 最大返回行数(默认100)
+ ///
+ public int topNum { get; set; } = 100;
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCTaskDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCTaskDto.cs
new file mode 100644
index 00000000..2816f67e
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/BookingOrderBCTaskDto.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ public class BookingOrderBCTaskDto
+ {
+ ///
+ /// 序号
+ ///
+ public int Indx { get; set; }
+
+ ///
+ /// 对应BC序号
+ ///
+ public int BCIndx { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/TaskBCShowBaseDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/TaskBCShowBaseDto.cs
new file mode 100644
index 00000000..e810cb7b
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/BC/TaskBCShowBaseDto.cs
@@ -0,0 +1,398 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ ///
+ /// BC展示信息
+ ///
+ public class TaskBCShowBaseDto
+ {
+ ///
+ /// 主键
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 任务主键
+ ///
+ public long TaskId { get; set; }
+
+ ///
+ /// 业务类型 BookingConfirmation(订舱);BookingAmendment(订舱变更);BookingCancellation(订舱取消)
+ ///
+ public string BusiType { get; set; }
+
+ ///
+ /// 订舱单位
+ ///
+ public string BookingParty { get; set; }
+
+ ///
+ /// 发货人
+ ///
+ public string Shipper { get; set; }
+
+ ///
+ /// 收货人
+ ///
+ public string Consignee { get; set; }
+
+ ///
+ /// 通知人
+ ///
+ public string NotifyParty { get; set; }
+
+ ///
+ /// BC更新次数
+ ///
+ public Nullable BCModifyTimes { get; set; }
+
+ ///
+ /// BC更新时间
+ ///
+ public Nullable BCModifyDate { get; set; }
+
+ ///
+ /// 主单号
+ ///
+ public string MBLNo { get; set; }
+
+ ///
+ /// 船名
+ ///
+ public string Vessel { get; set; }
+
+ ///
+ /// 航次
+ ///
+ public string VoyNo { get; set; }
+
+ ///
+ /// 船公司
+ ///
+ public string Carrier { get; set; }
+
+ ///
+ /// 收货地
+ ///
+ public string PlaceReceipt { get; set; }
+
+ ///
+ /// 装货港
+ ///
+ public string Portload { get; set; }
+
+ ///
+ /// 截关时间
+ ///
+ public Nullable ClosingDate { get; set; }
+
+ ///
+ /// 截VGM时间
+ ///
+ public Nullable VGMCutoffTime { get; set; }
+
+ ///
+ /// ETA(预计到港时间)
+ ///
+ public Nullable ETA { get; set; }
+
+ ///
+ /// ETD(预计离港时间)
+ ///
+ public Nullable ETD { get; set; }
+
+ ///
+ /// 目的港ETA
+ ///
+ public Nullable PODETA { get; set; }
+
+ ///
+ /// 截单时间
+ ///
+ public Nullable CutSingleTime { get; set; }
+
+ ///
+ /// 卸货港
+ ///
+ public string PortDischarge { get; set; }
+
+ ///
+ /// 交货地
+ ///
+ public string PlaceDelivery { get; set; }
+
+ ///
+ /// 装运方式
+ ///
+ public string ShippingMethod { get; set; }
+
+ ///
+ /// 运输条款
+ ///
+ public string Service { get; set; }
+
+ ///
+ /// 港前运输形态
+ ///
+ public string PreTransMode { get; set; }
+
+ ///
+ /// 品名
+ ///
+ public string Description { get; set; }
+
+ ///
+ /// 签单地点
+ ///
+ public string IssuePlace { get; set; }
+
+ ///
+ /// 集港码头
+ ///
+ public string CollectionTerminal { get; set; }
+
+ ///
+ /// 约号
+ ///
+ public string ContractNo { get; set; }
+
+ ///
+ /// 预付地点
+ ///
+ public string PrepardAT { get; set; }
+
+ ///
+ /// 船代
+ ///
+ public string ShipAgent { get; set; }
+
+ ///
+ /// 场站
+ ///
+ public string Yard { get; set; }
+
+ ///
+ /// 场站联系人
+ ///
+ public string YardContactUserName { get; set; }
+
+ ///
+ /// 场站联系电话
+ ///
+ public string YardContactTel { get; set; }
+
+ ///
+ /// 一代客服姓名
+ ///
+ public string FstCustomerSerUserName { get; set; }
+
+ ///
+ /// 一代客服电话
+ ///
+ public string FstCustomerSerUserTel { get; set; }
+
+ ///
+ /// 一代客服邮箱
+ ///
+ public string FstCustomerSerUserEmail { get; set; }
+
+ ///
+ /// 备注1
+ ///
+ public string Remark1 { get; set; }
+
+ ///
+ /// 截港时间
+ ///
+ public Nullable CYCutoffTime { get; set; }
+
+ ///
+ /// 状态 TEMP-暂存 SUCC-已对应 ERROR-异常
+ ///
+ public string Status { get; set; }
+
+ ///
+ /// 文件MD5
+ ///
+ public string FileMD5 { get; set; }
+
+ ///
+ /// 最后对应时间,最后关联到订舱日期
+ ///
+ public Nullable LastToBookingDate { get; set; }
+
+ ///
+ /// 来源邮箱
+ ///
+ public string FromEmail { get; set; }
+
+ ///
+ /// 接收邮箱
+ ///
+ public string RecvEmail { get; set; }
+
+ ///
+ /// 订舱ID,对应成功后,订舱ID写入
+ ///
+ public Nullable BookingOrderId { get; set; }
+
+ ///
+ /// 集装箱列表
+ ///
+ public List CtnList { get; set; }
+
+ ///
+ /// 任务附件
+ ///
+ public List FileList { get; set; }
+
+ ///
+ /// 舱位主键
+ ///
+ public Nullable BookingSlotId { get; set; }
+
+ ///
+ /// 船公司代号
+ ///
+ public string CarrierId { get; set; }
+
+ ///
+ /// 航线代码(船公司)
+ ///
+ public string LaneCode { get; set; }
+
+ ///
+ /// 航线名称(船公司)
+ ///
+ public string LaneName { get; set; }
+
+ ///
+ /// 承运方式 DIRECT_SHIP-直达;TRANSFER_SHIP-中转
+ ///
+ public string CarriageType { get; set; }
+
+ ///
+ /// 承运方式名称 DIRECT_SHIP-直达;TRANSFER_SHIP-中转
+ ///
+ public string CarriageTypeName { get; set; }
+
+ ///
+ /// 订舱方式 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱
+ ///
+ public string BookingSlotType { get; set; }
+
+ ///
+ /// 订舱方式名称 CONTRACT_ORDER-合约订舱;SPOT_ORDER-SPOT订舱
+ ///
+ public string BookingSlotTypeName { get; set; }
+
+ ///
+ /// 箱型箱量
+ ///
+ public string CtnStat { get; set; }
+
+ ///
+ /// 所在周数
+ ///
+ public string WeekAt { get; set; }
+
+ ///
+ /// 箱使天数
+ ///
+ public int DetensionFreeDays { get; set; }
+
+ ///
+ /// 样单截止日期
+ ///
+ public Nullable SICutDate { get; set; }
+
+ ///
+ /// VGM截止日期
+ ///
+ public Nullable VGMSubmissionCutDate { get; set; }
+
+ ///
+ /// 舱单截止时间
+ ///
+ public Nullable ManifestCutDate { get; set; }
+
+ ///
+ /// MDGF提交截止时间
+ ///
+ public Nullable MDGFCutDate { get; set; }
+
+ ///
+ /// 中转港1
+ ///
+ public string TransferPort1 { get; set; }
+
+ ///
+ /// 中转港2
+ ///
+ public string TransferPort2 { get; set; }
+
+
+ ///
+ /// 二程船名
+ ///
+ public string SecondVessel { get; set; }
+
+ ///
+ /// 二程航次
+ ///
+ public string SecondVoyno { get; set; }
+
+ ///
+ /// 二程ETD
+ ///
+ public Nullable SecondETD { get; set; }
+
+ ///
+ /// 二程ETA
+ ///
+ public Nullable SecondETA { get; set; }
+
+ ///
+ /// 订舱确认时间
+ ///
+ public Nullable BookingConfirmDate { get; set; }
+
+ ///
+ /// 关键信息列表
+ ///
+ public List Keywords { get; set; }
+
+ ///
+ /// 任务状态
+ ///
+ public string taskStatus { get; set; }
+
+ ///
+ /// 批次号
+ ///
+ public string BatchNo { get; set; }
+ }
+
+ public class TaskBCShowBaseKeywordDto
+ {
+ ///
+ /// 关键名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 关键背景色
+ ///
+ public string Background { get; set; }
+
+ ///
+ /// 图标KEY
+ ///
+ public string Icon { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBCCTNInfoDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBCCTNInfoDto.cs
new file mode 100644
index 00000000..48a93dc9
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskBCCTNInfoDto.cs
@@ -0,0 +1,78 @@
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ ///
+ /// 任务BC集装箱
+ ///
+ public class TaskBCCTNInfoDto
+ {
+ ///
+ /// 惟一主键
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 父主键
+ ///
+ public long P_ID { get; set; }
+
+ ///
+ /// 箱型代码
+ ///
+ public string CtnCode { get; set; }
+
+ ///
+ /// 箱型
+ ///
+ public string CtnALL { get; set; }
+
+ ///
+ /// 箱量
+ ///
+ public Nullable CTNNUM { get; set; }
+
+ ///
+ /// 件数
+ ///
+ public Nullable PKGS { get; set; }
+
+ ///
+ /// 尺码
+ ///
+ public Nullable CBM { get; set; }
+
+ ///
+ /// 毛重
+ ///
+ public Nullable KGS { get; set; }
+
+ ///
+ /// 皮重
+ ///
+ public Nullable TareWeight { get; set; }
+
+ ///
+ /// 危品票标示
+ ///
+ public string IODGT { get; set; }
+
+ ///
+ /// 特殊装载需求
+ ///
+ public string SpecialLoadingRequire { get; set; }
+
+ ///
+ /// 提箱场站
+ ///
+ public string TakeCTNYard { get; set; }
+
+ ///
+ /// 提箱时间
+ ///
+ public Nullable TakeCTNTime { get; set; }
+
+ ///
+ /// 还箱场站
+ ///
+ public string ReturnCTNYard { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskFileDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskFileDto.cs
new file mode 100644
index 00000000..a61beabd
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskFileDto.cs
@@ -0,0 +1,31 @@
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ ///
+ /// 任务附件
+ ///
+ public class TaskFileDto
+ {
+ ///
+ /// 文件路径
+ ///
+ public string FilePath { get; set; }
+ ///
+ /// 文件类型
+ ///
+ public string FileType { get; set; }
+ ///
+ /// 文件名
+ ///
+ public string FileName { get; set; }
+
+ ///
+ /// 附件类型代码 BC-Booking Confirmation
+ ///
+ public string FileCategory { get; set; }
+
+ ///
+ /// 附件类型名称 BC-Booking Confirmation
+ ///
+ public string FileCategoryName { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs
new file mode 100644
index 00000000..bb734aa0
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs
@@ -0,0 +1,16 @@
+using DS.Module.Core;
+using DS.Module.DjyServiceStatus;
+using DS.WMS.Core.TaskPlat.Dtos;
+using Microsoft.AspNetCore.Http;
+
+namespace DS.WMS.Core.TaskPlat.Interface
+{
+ public interface ITaskManageBCService
+ {
+ ///
+ /// 通过任务主键获取BC详情
+ ///
+ /// BC任务主键
+ Task> GetInfoByTaskId(long taskId);
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
index b59b102b..576ea79a 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
@@ -14,6 +14,13 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// 返回结果
Task> CancelTask(long[] ids);
+ ///
+ /// 完成任务(可批量)
+ ///
+ /// 任务主键数组
+ /// 返回结果
+ Task> CompleteTask(long[] ids);
+
///
/// 获取登陆人相关的任务统计信息
///
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
new file mode 100644
index 00000000..78fefe82
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
@@ -0,0 +1,137 @@
+using DS.Module.Core;
+using DS.Module.Core.Data;
+using DS.Module.Core.Helpers;
+using DS.Module.SqlSugar;
+using DS.Module.UserModule;
+using DS.WMS.Core.TaskPlat.Dtos;
+using DS.WMS.Core.TaskPlat.Entity;
+using DS.WMS.Core.TaskPlat.Interface;
+using Mapster;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using SqlSugar;
+using System.Runtime.InteropServices;
+using DS.Module.Core.Extensions;
+using DS.Module.DjyServiceStatus;
+using LanguageExt.Common;
+
+namespace DS.WMS.Core.TaskPlat.Method
+{
+ ///
+ /// 任务台-BC子任务
+ ///
+ public class TaskManageBCService : ITaskManageBCService
+ {
+ private readonly ILogger _logger;
+ private readonly IUser user;
+ private readonly ISaasDbService saasDbService;
+ private readonly IServiceProvider serviceProvider;
+ private readonly IWebHostEnvironment environment;
+
+ public TaskManageBCService(ILogger logger,
+ ISaasDbService saasDbService,
+ IServiceProvider serviceProvider,
+ IUser user,
+ IWebHostEnvironment environment)
+ {
+ _logger = logger;
+ this.saasDbService = saasDbService;
+ this.serviceProvider = serviceProvider;
+ this.user = user;
+ this.environment = environment;
+ }
+
+ ///
+ /// 通过任务主键获取BC详情
+ ///
+ /// BC任务主键
+ public async Task> GetInfoByTaskId(long taskId)
+ {
+ TaskManageOrderResultDto result = new TaskManageOrderResultDto();
+ try
+ {
+ var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
+
+ var taskBase = await tenantDb.Queryable().FirstAsync(a => a.Id == taskId);
+
+ if (taskBase == null)
+ throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.TaskBaseEmpty)));
+
+ var bcOrder = await tenantDb.Queryable().FirstAsync(a => a.TASK_ID == taskId);
+
+ if (bcOrder == null)
+ throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.TaskBCInfoEmpty)));
+
+ var bcCtnList = await tenantDb.Queryable().ToListAsync(a => a.P_ID == bcOrder.Id);
+
+ TaskBCShowBaseDto model = bcOrder.Adapt();
+
+ if (bcCtnList.Count > 0)
+ model.CtnList = bcCtnList.Adapt>();
+
+ var fileList = await tenantDb.Queryable ().Where(a => a.TASK_PKID == bcOrder.TASK_ID).ToListAsync();
+
+ if (fileList.Count > 0)
+ model.FileList = fileList.Adapt>();
+
+ model.taskStatus = taskBase.STATUS;
+
+ //生成关键信息
+ #region 生成关键信息
+ model.Keywords = new List();
+
+ if (bcOrder.CARRIAGE_TYPE == "DIRECT_SHIP")
+ {
+ model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"承运方式:{bcOrder.CARRIAGE_TYPE_NAME}", Background = "#FFFF80", Icon = "icon-yunshu1" });
+ }
+ else if (bcOrder.CARRIAGE_TYPE == "TRANSFER_SHIP")
+ {
+ model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"承运方式:{bcOrder.CARRIAGE_TYPE_NAME}", Background = "#CAF982", Icon = "icon-shuaxin" });
+ }
+
+ if (bcOrder.BOOKING_SLOT_TYPE == "CONTRACT_ORDER")
+ {
+ model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"订舱方式:{bcOrder.BOOKING_SLOT_TYPE_NAME}", Background = "#81D3F8", Icon = "icon-touzijilu" });
+ }
+ else if (bcOrder.BOOKING_SLOT_TYPE == "SPOT_ORDER")
+ {
+ model.Keywords.Add(new TaskBCShowBaseKeywordDto() { Name = $"订舱方式:{bcOrder.BOOKING_SLOT_TYPE_NAME}", Background = "#FACD91", Icon = "icon-beizhu1" });
+ }
+ #endregion
+
+ result.succ = true;
+ result.ext = model;
+
+ //如果当前BC有对应记录,则读取订舱详情
+ //0726:经确认页面上没有用到订舱详情,所以暂时不返回
+ //if (bcOrder.BOOKING_ORDER_ID.HasValue)
+ //{
+ // var bkOrder = await _bookingOrderRepository.AsQueryable().
+ // FirstAsync(a => a.Id == bcOrder.BOOKING_ORDER_ID.Value);
+
+ // if (bkOrder != null)
+ // {
+ // var showBKOrder = bkOrder.Adapt();
+
+ // var ctnList = await _bookingCtnRepository.AsQueryable().
+ // Where(a => a.BILLID == bkOrder.Id).ToListAsync();
+
+ // if (ctnList.Count > 0)
+ // showBKOrder.ctnInputs = ctnList.Adapt>();
+
+ // result.ext2 = showBKOrder;
+ // }
+ //}
+ }
+ catch (Exception ex)
+ {
+ result.succ = false;
+ result.msg = $"获取BC详情异常,原因:{ex.Message}";
+ }
+
+ return DataResult.Success(result);
+ }
+ }
+}
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 203086f3..cda4895c 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -1657,6 +1657,75 @@ namespace DS.WMS.Core.TaskPlat.Method
return result;
}
+
+ ///
+ /// 完成任务(可批量)
+ ///
+ /// 任务主键数组
+ /// 返回结果
+ public async Task> CompleteTask(long[] ids)
+ {
+ TaskManageOrderResultDto result = new TaskManageOrderResultDto();
+
+ var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
+ var userId = long.Parse(user.UserId);
+ string batchNo = Guid.NewGuid().ToString();
+
+ var taskList = await tenantDb.Queryable()
+ .Where(x => ids.Contains(x.Id)).ToListAsync();
+
+
+ List taskRunList = new List();
+ _logger.LogInformation("批次={no} ids={ids} 完成任务开始", batchNo, string.Join(",", ids));
+
+ var noList = ids.Select((a, idx) => new { no = idx + 1, id = a }).ToList();
+
+ foreach (var bk in taskList)
+ {
+ var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
+ taskRunList.Add(await InnerManualTask(batchNo, bk, TaskOperTypeEnum.COMPLETE_TASK, sortNo));
+ }
+
+ result.succ = true;
+ result.msg = "执行成功";
+
+ var downResultList = taskRunList.Select(x => x).ToList();
+
+ if (downResultList.Any(x => !x.succ))
+ {
+ result.succ = false;
+ result.msg = "执行失败";
+ }
+ else
+ {
+ result.succ = true;
+ result.msg = downResultList.FirstOrDefault().msg;
+ }
+
+ result.ext = downResultList;
+
+ var succ = downResultList.Count(x => x.succ);
+ var fail = downResultList.Count(x => !x.succ);
+
+ if (succ > 0)
+ {
+ result.batchTotal = succ.ToString();
+ }
+ else
+ {
+ result.batchTotal = "- ";
+ }
+
+ if (fail > 0)
+ {
+ result.batchTotal += "/" + fail.ToString();
+ }
+ else
+ {
+ result.batchTotal += " -";
+ }
+ return DataResult.Success(result);
+ }
#endregion
}
}
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs
new file mode 100644
index 00000000..267a3b28
--- /dev/null
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageBCController.cs
@@ -0,0 +1,30 @@
+using DS.Module.Core;
+using DS.Module.DjyServiceStatus;
+using DS.WMS.Core.TaskPlat.Interface;
+using DS.WMS.Core.TaskPlat.Method;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DS.WMS.TaskApi.Controllers
+{
+ ///
+ /// 任务台-BC子任务相关接口
+ ///
+ public class TaskManageBCController : ApiController
+ {
+ private readonly ITaskManageBCService _taskManageBCService;
+ public TaskManageBCController(ITaskManageBCService taskManageBCService)
+ {
+ _taskManageBCService = taskManageBCService;
+ }
+ ///
+ /// 通过任务主键获取BC详情
+ ///
+ /// BC任务主键
+ [HttpPost("GetInfoByTaskId")]
+ public async Task> GetInfoByTaskId(long taskId)
+ {
+ var result = await _taskManageBCService.GetInfoByTaskId(taskId);
+ return result;
+ }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
index 27d473a2..178cdbe8 100644
--- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
@@ -90,6 +90,18 @@ public class TaskManageController : ApiController
return result;
}
+ ///
+ /// 完成任务(可批量)
+ ///
+ /// 任务主键数组
+ /// 返回结果
+ [HttpPost("CompleteTask")]
+ public async Task> CompleteTask([FromBody] long[] Ids)
+ {
+ var result = await taskManageService.CompleteTask(Ids);
+ return result;
+ }
+
///
/// 取消任务(可批量)
///
@@ -108,20 +120,33 @@ public class TaskManageController : ApiController
[HttpPost("GetTaskPlatEnumDict")]
public DataResult