From 633b14289cbd8116632984545423609bf2f7fcd8 Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Wed, 24 Jul 2024 17:57:45 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8E=A5=E6=94=B6=E3=80=81?=
=?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=B0=83=E6=95=B4=E4=B8=BA=E5=A4=9A=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DS.WMS.Core/TaskPlat/Dtos/RecvUserInfo.cs | 18 +++++++
.../Dtos/TaskManageOrderMessageMainInfo.cs | 13 +++--
.../TaskPlat/Entity/TaskBaseAllocation.cs | 37 +++++++++++++
.../TaskPlat/Method/TaskManageService.cs | 52 ++++++++++++++-----
4 files changed, 102 insertions(+), 18 deletions(-)
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/RecvUserInfo.cs
create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/RecvUserInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/RecvUserInfo.cs
new file mode 100644
index 00000000..1ca03597
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/RecvUserInfo.cs
@@ -0,0 +1,18 @@
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ ///
+ /// 任务接收人信息
+ ///
+ public class RecvUserInfo
+ {
+ ///
+ /// 接收人信息主键
+ ///
+ public long RecvUserId { get; set; }
+
+ ///
+ /// 接收人信息姓名
+ ///
+ public string RecvUserName { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs
index 03b3cd32..7b6889c0 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs
@@ -56,25 +56,30 @@ namespace DS.WMS.Core.TaskPlat.Dtos
public int IsException { get; set; } = 0;
///
- /// 任务对应操作人ID
+ /// 任务对应操作人ID(任务制单人)
///
public string TaskUserId { get; set; }
///
- /// 任务对应操作人名称
+ /// 任务对应操作人名称(任务制单人)
///
public string TaskUserName { get; set; }
///
- /// 任务对应接收操作人ID
+ /// 任务对应接收操作人ID(任务接收人)
///
public string RecvUserId { get; set; }
///
- /// 任务对应接收操作人名称
+ /// 任务对应接收操作人名称(任务接收人)
///
public string RecvUserName { get; set; }
+ ///
+ /// 任务接收人列表
+ ///
+ public List RecvUserInfoList { get; set; }
+
///
/// 任务对应接收操作人ID(大简云账户体系)
///
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs
new file mode 100644
index 00000000..3235be40
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs
@@ -0,0 +1,37 @@
+using DS.Module.Core.Data;
+using SqlSugar;
+
+namespace DS.WMS.Core.TaskPlat.Entity
+{
+ ///
+ /// 任务归属关系表
+ ///
+ [SugarTable("task_base_allocation", "任务归属关系表")]
+ public class TaskBaseAllocation : BaseModelV2
+ {
+ ///
+ /// 任务主键
+ ///
+ [SugarColumn(ColumnDescription = "任务主键", IsNullable = false)]
+ public long TaskId { get; set; }
+
+ ///
+ /// 所属人员主键
+ ///
+ [SugarColumn(ColumnDescription = "所属人员主键", IsNullable = false)]
+ public long UserId { get; set; }
+
+ ///
+ /// 所属人员姓名
+ ///
+ [SugarColumn(ColumnDescription = "所属人员姓名", IsNullable = false, Length = 255)]
+ public string UserName { get; set; }
+
+ ///
+ /// 所属机构主键
+ ///
+ [SugarColumn(ColumnDescription = "所属机构主键", IsNullable = true)]
+ public long? OrgId { get; set; }
+ }
+
+}
\ No newline at end of file
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 8c47d9d0..a4c6bac1 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -64,13 +64,17 @@ namespace DS.WMS.Core.TaskPlat.Method
_logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString());
taskInfo.STATUS = taskStatusEnum.ToString();
+ taskInfo.RealUserId = long.Parse(user.UserId);
+ taskInfo.RealUserName = user.UserName;
await tenantDb.Updateable(taskInfo).UpdateColumns(x => new
{
x.UpdateBy,
x.UpdateTime,
x.UpdateUserName,
- x.STATUS
+ x.STATUS,
+ x.RealUserId,
+ x.RealUserName
}).ExecuteCommandAsync();
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
@@ -156,37 +160,57 @@ namespace DS.WMS.Core.TaskPlat.Method
BATCH_STATIC = info.Main.BatchStatic,
DJYUserId = info.Head.DJYUserId,
OUT_BS_NO = info.Head.BSNO,
+ CreateTime = DateTime.Now,
};
- long taskReqUserId = 0;
+ // 人员字段说明:
+ // TaskBaseInfo.CreateBy 创建人:谁创建的,只有一个人(可能是某个租户的管理员,因为任务可以由外部(邮件)创建,无法为每个人创建接口授权信息)
+ // TaskBaseInfo.TASK_REQ_USERID 制单人:只有一个人,使用任务创建报文中传入的TaskUserId
+ // TaskBaseAllocation.UserId 任务关系:任务属于谁,谁能够查看并处理,可能是多个人(可能是多个人一起处理);取值优先级:TaskBaseInfo.TASK_REQ_USERID>关联订单>TaskBaseInfo.CreateBy
+ // TaskBaseInfo.RealUserId 实际操作人:谁实际处理的,只有一个人
+
+ // 创建人
+ taskInfo.CreateBy = long.Parse(user.UserId);
+ taskInfo.CreateUserName = user.UserName;
+
+ // 制单人
+ long taskReqUserId = 0;
if (!string.IsNullOrWhiteSpace(info.Main.TaskUserId))
{
if (long.TryParse(info.Main.TaskUserId, out taskReqUserId))
{
taskInfo.TASK_REQ_USERID = taskReqUserId;
+ taskInfo.TASK_REQ_USERNAME = info.Main.TaskUserName;
}
}
- // 忽略
- taskInfo.CreateBy = long.Parse(user.UserId);
- taskInfo.CreateTime = DateTime.Now;
-
- //taskInfo.CreatedUserId = userTendInfo.userId;
- //taskInfo.CreatedUserName = userTendInfo.userName;
- //taskInfo.TenantId = userTendInfo.tendId;
- //taskInfo.TenantName = userTendInfo.tenantName;
+ _logger.LogInformation("批次={no} 获取登录人详情 recvUserId={recvUserId} UserId={UserId}", batchNo,
+ info.Main.RecvUserId,
+ user.UserId);
- if (info.Main.TaskType == TaskBaseTypeEnum.TRUCK_DISPATCH || info.Main.TaskType == TaskBaseTypeEnum.CAUTION_NOTICE)
+ // 任务所属人员列表
+ // 如果明确指出接收人(接收人列表),则将任务作为个人任务
+ if (info.Main.RecvUserInfoList?.Count > 0)
{
+ _logger.LogInformation("批次={no} 接收人列表 recvUserList={recvUserList} ", batchNo,
+ JsonConvert.SerializeObject(info.Main.RecvUserInfoList));
+
taskInfo.IS_PUBLIC = 0;
+ var allocationList = info.Main.RecvUserInfoList.Select(x => new TaskBaseAllocation
+ {
+ TaskId = taskInfo.Id,
+ UserId = x.RecvUserId,
+ UserName = x.RecvUserName
+ }).ToList();
+ await tenantDb.Insertable(allocationList).ExecuteCommandAsync();
+
}
+ // 否则判断任务关联订单,如果能关联到,则判断任务设置的角色;如果有设置,则将任务挂载到订单的指定角色上;如果没关联到或者没有设置,则作为公共任务
else
{
taskInfo.IS_PUBLIC = 1;
+ //
}
- _logger.LogInformation("批次={no} 获取登录人详情 userid={userid} UserId={UserId}", batchNo,
- info.Main.RecvUserId,
- user.UserId);
if (info.Main != null && info.Main.TruckInfo != null && info.Main.TruckInfo.NeedArriveTime.HasValue)
{