jianghaiqing 4 months ago
commit 0749628da2

@ -0,0 +1,18 @@
namespace DS.WMS.Core.TaskPlat.Dtos
{
/// <summary>
/// 任务接收人信息
/// </summary>
public class RecvUserInfo
{
/// <summary>
/// 接收人信息主键
/// </summary>
public long RecvUserId { get; set; }
/// <summary>
/// 接收人信息姓名
/// </summary>
public string RecvUserName { get; set; }
}
}

@ -56,25 +56,30 @@ namespace DS.WMS.Core.TaskPlat.Dtos
public int IsException { get; set; } = 0; public int IsException { get; set; } = 0;
/// <summary> /// <summary>
/// 任务对应操作人ID /// 任务对应操作人ID(任务制单人)
/// </summary> /// </summary>
public string TaskUserId { get; set; } public string TaskUserId { get; set; }
/// <summary> /// <summary>
/// 任务对应操作人名称 /// 任务对应操作人名称(任务制单人)
/// </summary> /// </summary>
public string TaskUserName { get; set; } public string TaskUserName { get; set; }
/// <summary> /// <summary>
/// 任务对应接收操作人ID /// 任务对应接收操作人ID(任务接收人)
/// </summary> /// </summary>
public string RecvUserId { get; set; } public string RecvUserId { get; set; }
/// <summary> /// <summary>
/// 任务对应接收操作人名称 /// 任务对应接收操作人名称(任务接收人)
/// </summary> /// </summary>
public string RecvUserName { get; set; } public string RecvUserName { get; set; }
/// <summary>
/// 任务接收人列表
/// </summary>
public List<RecvUserInfo> RecvUserInfoList { get; set; }
/// <summary> /// <summary>
/// 任务对应接收操作人ID(大简云账户体系) /// 任务对应接收操作人ID(大简云账户体系)
/// </summary> /// </summary>

@ -0,0 +1,37 @@
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.TaskPlat.Entity
{
/// <summary>
/// 任务归属关系表
///</summary>
[SugarTable("task_base_allocation", "任务归属关系表")]
public class TaskBaseAllocation : BaseModelV2<long>
{
/// <summary>
/// 任务主键
/// </summary>
[SugarColumn(ColumnDescription = "任务主键", IsNullable = false)]
public long TaskId { get; set; }
/// <summary>
/// 所属人员主键
/// </summary>
[SugarColumn(ColumnDescription = "所属人员主键", IsNullable = false)]
public long UserId { get; set; }
/// <summary>
/// 所属人员姓名
/// </summary>
[SugarColumn(ColumnDescription = "所属人员姓名", IsNullable = false, Length = 255)]
public string UserName { get; set; }
/// <summary>
/// 所属机构主键
/// </summary>
[SugarColumn(ColumnDescription = "所属机构主键", IsNullable = true)]
public long? OrgId { get; set; }
}
}

@ -64,13 +64,17 @@ namespace DS.WMS.Core.TaskPlat.Method
_logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString()); _logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString());
taskInfo.STATUS = taskStatusEnum.ToString(); taskInfo.STATUS = taskStatusEnum.ToString();
taskInfo.RealUserId = long.Parse(user.UserId);
taskInfo.RealUserName = user.UserName;
await tenantDb.Updateable(taskInfo).UpdateColumns(x => new await tenantDb.Updateable(taskInfo).UpdateColumns(x => new
{ {
x.UpdateBy, x.UpdateBy,
x.UpdateTime, x.UpdateTime,
x.UpdateUserName, x.UpdateUserName,
x.STATUS x.STATUS,
x.RealUserId,
x.RealUserName
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess))); return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
@ -156,37 +160,57 @@ namespace DS.WMS.Core.TaskPlat.Method
BATCH_STATIC = info.Main.BatchStatic, BATCH_STATIC = info.Main.BatchStatic,
DJYUserId = info.Head.DJYUserId, DJYUserId = info.Head.DJYUserId,
OUT_BS_NO = info.Head.BSNO, 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 (!string.IsNullOrWhiteSpace(info.Main.TaskUserId))
{ {
if (long.TryParse(info.Main.TaskUserId, out taskReqUserId)) if (long.TryParse(info.Main.TaskUserId, out taskReqUserId))
{ {
taskInfo.TASK_REQ_USERID = taskReqUserId; taskInfo.TASK_REQ_USERID = taskReqUserId;
taskInfo.TASK_REQ_USERNAME = info.Main.TaskUserName;
} }
} }
// 忽略 _logger.LogInformation("批次={no} 获取登录人详情 recvUserId={recvUserId} UserId={UserId}", batchNo,
taskInfo.CreateBy = long.Parse(user.UserId); info.Main.RecvUserId,
taskInfo.CreateTime = DateTime.Now; user.UserId);
//taskInfo.CreatedUserId = userTendInfo.userId;
//taskInfo.CreatedUserName = userTendInfo.userName;
//taskInfo.TenantId = userTendInfo.tendId;
//taskInfo.TenantName = userTendInfo.tenantName;
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; 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 else
{ {
taskInfo.IS_PUBLIC = 1; 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) if (info.Main != null && info.Main.TruckInfo != null && info.Main.TruckInfo.NeedArriveTime.HasValue)
{ {

Loading…
Cancel
Save