|
|
@ -3,6 +3,7 @@ using DS.Module.Core.Condition;
|
|
|
|
using DS.Module.Core.Constants;
|
|
|
|
using DS.Module.Core.Constants;
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
using DS.Module.Core.Enums;
|
|
|
|
using DS.Module.Core.Enums;
|
|
|
|
|
|
|
|
using DS.Module.Core.Enums.TaskPlat;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.Module.Core.Helpers;
|
|
|
|
using DS.Module.Core.Helpers;
|
|
|
|
using DS.Module.DjyServiceStatus;
|
|
|
|
using DS.Module.DjyServiceStatus;
|
|
|
@ -62,7 +63,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code"
|
|
|
|
static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code"
|
|
|
|
|
|
|
|
|
|
|
|
public TaskManageService(IUser user,
|
|
|
|
public TaskManageService(IUser user,
|
|
|
|
ILogger<TaskManageService> logger,
|
|
|
|
//ILogger<TaskManageService> logger,
|
|
|
|
ISaasDbService saasDbService,
|
|
|
|
ISaasDbService saasDbService,
|
|
|
|
IServiceProvider serviceProvider,
|
|
|
|
IServiceProvider serviceProvider,
|
|
|
|
IWebHostEnvironment environment,
|
|
|
|
IWebHostEnvironment environment,
|
|
|
@ -71,7 +72,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
IMappingPortService mappingPortService,
|
|
|
|
IMappingPortService mappingPortService,
|
|
|
|
IMappingCarrierService mappingCarrierService,
|
|
|
|
IMappingCarrierService mappingCarrierService,
|
|
|
|
ICodeCarrierService codeCarrierService,
|
|
|
|
ICodeCarrierService codeCarrierService,
|
|
|
|
ICommonService commonService) : base(user, logger, saasDbService, serviceProvider, environment)
|
|
|
|
ICommonService commonService) : base(user, saasDbService, serviceProvider, environment)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.codeCtnService = codeCtnService;
|
|
|
|
this.codeCtnService = codeCtnService;
|
|
|
|
this.codePortService = codePortService;
|
|
|
|
this.codePortService = codePortService;
|
|
|
@ -97,7 +98,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos,
|
|
|
|
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos,
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.LogInformation("接收到任务个人状态修改报文 bsno={bsno} 状态设置={status} 人员列表={userList} childBsno={childBsno} childTaskBaseTypeEnum={childTaskBaseTypeEnum}", bsno, taskStatusEnum.ToString(), JsonConvert.SerializeObject(userInfos), childBsno, childTaskBaseTypeEnum);
|
|
|
|
logger.LogInformation($"{nameof(SetTaskStatusWithBsno)} bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};taskStatusEnum={taskStatusEnum};statusTime={statusTime};userInfos={(userInfos == null ? "" : string.Join(',', userInfos ?? []))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
|
|
|
|
|
|
|
|
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
@ -177,6 +178,8 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
public async Task<DataResult> SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, bool isCheckAllChildTaskComplete, string? taskDesc = null, List<long>? userIdList = null,
|
|
|
|
public async Task<DataResult> SetTaskStatusWithBsno(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, bool isCheckAllChildTaskComplete, string? taskDesc = null, List<long>? userIdList = null,
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.LogInformation($"SetTaskStatusWithBsno bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};taskStatusEnum={taskStatusEnum};statusTime={statusTime};isCheckAllChildTaskComplete={isCheckAllChildTaskComplete};taskDesc={taskDesc};userIdList={(userIdList == null ? "" : string.Join(',', userIdList))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
|
|
|
|
|
|
|
|
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
var taskTypeStr = taskBaseTypeEnum.ToString();
|
|
|
|
var taskTypeStr = taskBaseTypeEnum.ToString();
|
|
|
@ -281,6 +284,8 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
public async Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos, SqlSugarScopeProvider? tenantDb = null,
|
|
|
|
public async Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos, SqlSugarScopeProvider? tenantDb = null,
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.LogInformation($"TransferTask bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};userInfos={(userInfos == null ? "" : string.Join(',', userInfos))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
|
|
|
|
|
|
|
|
|
|
|
|
tenantDb ??= saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
tenantDb ??= saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
logger.LogInformation("接收到任务转交报文 bsno={bsno} taskBaseTypeEnum={taskBaseTypeEnum} 转交人员列表={userinfo} childBsno={childBsno} childTaskBaseTypeEnum={childTaskBaseTypeEnum}",
|
|
|
|
logger.LogInformation("接收到任务转交报文 bsno={bsno} taskBaseTypeEnum={taskBaseTypeEnum} 转交人员列表={userinfo} childBsno={childBsno} childTaskBaseTypeEnum={childTaskBaseTypeEnum}",
|
|
|
@ -394,6 +399,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null,
|
|
|
|
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null,
|
|
|
|
params Expression<Func<TaskBaseInfo, bool>>[] columns)
|
|
|
|
params Expression<Func<TaskBaseInfo, bool>>[] columns)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.LogInformation($"SetTaskBaseInfoPropertyWithBsno bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum};");
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -463,10 +469,10 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
public async Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null)
|
|
|
|
public async Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string batchNo = Guid.NewGuid().ToString();
|
|
|
|
string batchNo = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
logger.LogInformation($"{nameof(InitTaskJob)} bsno={info?.Head.BSNO}; ChildBSNO={info?.Head?.ChildBSNO};info={JsonConvert.SerializeObject(info)}");
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//Monitor.Enter(ImportLockObj);
|
|
|
|
//Monitor.Enter(ImportLockObj);
|
|
|
|
logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, JsonConvert.SerializeObject(info));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (info.Head.IsChild && info.Head.ChildBSNO == 0)
|
|
|
|
if (info.Head.IsChild && info.Head.ChildBSNO == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -3858,6 +3864,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
|
|
result.bno = model.TASK_NO;
|
|
|
|
result.bno = model.TASK_NO;
|
|
|
|
|
|
|
|
logger.LogInformation($"InnerManualTask batchNo={batchNo};model.OUT_BS_NO={model.OUT_BS_NO};model.Id={model.Id};taskOperTypeEnum={taskOperTypeEnum};");
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -4164,6 +4171,9 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var taskIdList = taskList.Select(x => x.Id).ToList();
|
|
|
|
var taskIdList = taskList.Select(x => x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.LogInformation($"PullTask taskIdList={string.Join(",", taskIdList)}");
|
|
|
|
|
|
|
|
|
|
|
|
var taskTypeList = taskList.Where(x => x.TASK_SOURCE == TaskSourceEnum.WORK_FLOW.ToString() && x.OUT_BS_NO != null).Select(x => x.TASK_TYPE).Distinct().ToList();
|
|
|
|
var taskTypeList = taskList.Where(x => x.TASK_SOURCE == TaskSourceEnum.WORK_FLOW.ToString() && x.OUT_BS_NO != null).Select(x => x.TASK_TYPE).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var taskCompleteStatusCodeList = taskTypeList.Count > 0 ? await tenantDb.Queryable<TaskFlowModule>()
|
|
|
|
var taskCompleteStatusCodeList = taskTypeList.Count > 0 ? await tenantDb.Queryable<TaskFlowModule>()
|
|
|
@ -4231,6 +4241,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await tenantDb.AsTenant().RollbackTranAsync();
|
|
|
|
await tenantDb.AsTenant().RollbackTranAsync();
|
|
|
|
|
|
|
|
logger.LogError($"PullTask Exception 原因:{ex.Message}");
|
|
|
|
return DataResult.Failed("任务领取失败,原因:" + ex.Message);
|
|
|
|
return DataResult.Failed("任务领取失败,原因:" + ex.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4239,9 +4250,8 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 测试用
|
|
|
|
/// 测试用
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public async Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType)
|
|
|
|
public async Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType, string? content = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4409,10 +4419,100 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
var temp2 = tenantDb.Ado.SqlQuery<dynamic>("select * from task_flow_module where id in(@id)", p);
|
|
|
|
var temp2 = tenantDb.Ado.SqlQuery<dynamic>("select * from task_flow_module where id in(@id)", p);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//await serviceProvider.GetRequiredService<taskmana>
|
|
|
|
|
|
|
|
var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType);
|
|
|
|
|
|
|
|
await SetTaskBaseInfoPropertyWithBsno(taskId, taskTypeEnum, null, null, x => x.TASK_DESP == content);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("测试成功");
|
|
|
|
return DataResult.Successed("测试成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 任务台配置维护相关
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取任务是否生成配置列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public async Task<DataResult<List<CreateTaskConfigDto>>> GetCreateTaskConfigList()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var type = typeof(TaskBaseTypeEnum);
|
|
|
|
|
|
|
|
List<TaskBaseTypeEnum> allServiceItemTask = Enum.GetValues(type)
|
|
|
|
|
|
|
|
.Cast<TaskBaseTypeEnum>()
|
|
|
|
|
|
|
|
.Where(x => Convert.ToInt32(x) >= 300 && Convert.ToInt32(x) < 400)
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
var noCreateTaskType = await GetNotCreateTaskTypeList(tenantDb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = allServiceItemTask.Select(x => new CreateTaskConfigDto()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TaskTypeCode = x.ToString(),
|
|
|
|
|
|
|
|
TaskTypeName = x.EnumDescription(),
|
|
|
|
|
|
|
|
IsCreate = !noCreateTaskType.Contains(x)
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
return DataResult<List<CreateTaskConfigDto>>.Success(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 保存任务是否生成的配置
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="taskTypeCode">任务类型编码</param>
|
|
|
|
|
|
|
|
/// <param name="isCreate">是否生成任务</param>
|
|
|
|
|
|
|
|
public async Task<DataResult> SaveCreateTaskConfig(string taskTypeCode, bool isCreate)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Enum.TryParse(typeof(TaskBaseTypeEnum), taskTypeCode, out _))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(MultiLanguageConst.TaskTypeError);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var configTypeStr = TaskConfigTypeCodeEnum.NotCreateTask.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var notCreateTaskConfigList = await tenantDb.Queryable<TaskFlowTypeConfig>()
|
|
|
|
|
|
|
|
.Where(x => x.ConfigTypeCode == configTypeStr && x.TaskType == taskTypeCode)
|
|
|
|
|
|
|
|
//.Select(x => x.Id)
|
|
|
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await tenantDb.Ado.BeginTranAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (notCreateTaskConfigList.Count > 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var ids = notCreateTaskConfigList.Select(x => x.Id);
|
|
|
|
|
|
|
|
await tenantDb.Deleteable<TaskFlowTypeConfig>().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (notCreateTaskConfigList.Count > 1 || notCreateTaskConfigList.Count == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var model = new TaskFlowTypeConfig()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ConfigTypeCode = configTypeStr,
|
|
|
|
|
|
|
|
ConfigTypeName = TaskConfigTypeCodeEnum.NotCreateTask.EnumDescription(),
|
|
|
|
|
|
|
|
ConfigValue = isCreate ? "0" : "1",
|
|
|
|
|
|
|
|
TaskType = taskTypeCode
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
await tenantDb.Insertable(model).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var updateModel = notCreateTaskConfigList.First();
|
|
|
|
|
|
|
|
updateModel.ConfigValue = isCreate ? "0" : "1";
|
|
|
|
|
|
|
|
await tenantDb.Updateable(updateModel).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await tenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await tenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|