任务台权限、BC生成订舱

usertest
zhangxiaofeng 4 months ago
parent 343bf7ca21
commit 3033b9d5ed

@ -18,7 +18,7 @@ namespace DS.WMS.Core.Op.Entity
/// <summary>
/// 船名
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "舱位主键", Length = 10, IsNullable = true)]
[SqlSugar.SugarColumn(ColumnDescription = "船名", Length = 30, IsNullable = true)]
public string Vessel { get; set; }
/// <summary>

@ -1160,8 +1160,8 @@ namespace DS.WMS.Core.Op.Method
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, file.FileName, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME).GetAwaiter();
await SaveEDIFile(id, fileFullPath, file.FileName, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME);
}
}
@ -1178,8 +1178,8 @@ namespace DS.WMS.Core.Op.Method
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, modifyFile.FileName, long.Parse(user.TenantId),
CONST_BC_NOTICE_FILE_CODE, CONST_BC_NOTICE_FILE_NAME).GetAwaiter();
await SaveEDIFile(id, fileFullPath, modifyFile.FileName, long.Parse(user.TenantId),
CONST_BC_NOTICE_FILE_CODE, CONST_BC_NOTICE_FILE_NAME);
}
}
@ -1330,8 +1330,8 @@ namespace DS.WMS.Core.Op.Method
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, file.FileName, long.Parse(user.TenantId),
CONST_BC_MODIFY_FILE_CODE, CONST_BC_MODIFY_FILE_NAME).GetAwaiter();
await SaveEDIFile(id, fileFullPath, file.FileName, long.Parse(user.TenantId),
CONST_BC_MODIFY_FILE_CODE, CONST_BC_MODIFY_FILE_NAME);
}
}
@ -1348,8 +1348,8 @@ namespace DS.WMS.Core.Op.Method
if (!string.IsNullOrWhiteSpace(fileFullPath))
{
//将格式单附件写入订舱的附件
SaveEDIFile(id, fileFullPath, modifyFile.FileName, long.Parse(user.TenantId),
CONST_BC_MODIFY_NOTICE_FILE_CODE, CONST_BC_MODIFY_NOTICE_FILE_NAME).GetAwaiter();
await SaveEDIFile(id, fileFullPath, modifyFile.FileName, long.Parse(user.TenantId),
CONST_BC_MODIFY_NOTICE_FILE_CODE, CONST_BC_MODIFY_NOTICE_FILE_NAME);
}
}
@ -2246,21 +2246,30 @@ namespace DS.WMS.Core.Op.Method
else
{
bkModel.AccountDate = DateTime.Now.ToString("yyyy-MM");
}
if (generateModel.CtnList == null)
{
bkModel.SplitOrMergeFlag = 0;
}
else
{
// 判断是否为拆票的舱位如果为拆票提单号需要加上ABCD...
var selectNum = generateModel.CtnList.Sum(x => x.CtnNum);
Logger.Log(NLog.LogLevel.Info, "根据舱位生成订舱selectNum:{selectNum}", selectNum);
var allNum = await tenantDb.Queryable<BookingSlotCtn>().Where(x => x.SlotId == generateModel.SlotId).SumAsync(x => x.CtnNum);
// 判断是否为拆票的舱位如果为拆票提单号需要加上ABCD...
var selectNum = generateModel.CtnList.Sum(x => x.CtnNum);
Logger.Log(NLog.LogLevel.Info, "根据舱位生成订舱selectNum:{selectNum}", selectNum);
Logger.Log(NLog.LogLevel.Info, "根据舱位生成订舱allNum:{allNum}", allNum);
//bkModel.IsSplit = selectNum != allNum;
bkModel.SplitOrMergeFlag = selectNum != allNum ? 1 : 0;
var allNum = await tenantDb.Queryable<BookingSlotCtn>().Where(x => x.SlotId == generateModel.SlotId).SumAsync(x => x.CtnNum);
if (!string.IsNullOrWhiteSpace(masterBookingSlotNo))
bkModel.SplitOrMergeFlag = 2;
}
}
Logger.Log(NLog.LogLevel.Info, "根据舱位生成订舱allNum:{allNum}", allNum);
//bkModel.IsSplit = selectNum != allNum;
bkModel.SplitOrMergeFlag = selectNum != allNum ? 1 : 0;
if (!string.IsNullOrWhiteSpace(masterBookingSlotNo))
bkModel.SplitOrMergeFlag = 2;
//拆票逻辑
if (bkModel.SplitOrMergeFlag == 1)
@ -2529,8 +2538,8 @@ namespace DS.WMS.Core.Op.Method
, false, null, true).GetAwaiter().GetResult().Data;
//将格式单附件写入订舱的附件
SaveEDIFile(id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME).GetAwaiter();
await SaveEDIFile(id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME);
}
}
@ -2548,8 +2557,8 @@ namespace DS.WMS.Core.Op.Method
, false, "bcnoticefile", true).GetAwaiter().GetResult().Data;
//将格式单附件写入订舱的附件
SaveEDIFile(id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME).GetAwaiter();
await SaveEDIFile(id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name, long.Parse(user.TenantId),
CONST_BC_FILE_CODE, CONST_BC_FILE_NAME);
}
}
}

@ -0,0 +1,16 @@
namespace DS.WMS.Core.TaskPlat.Dtos
{
public class TaskAllocationSaveDto
{
/// <summary>
/// 分配对象编码 Operator=操作 VouchingClerk=单证 Sale=销售 Custom=报关员 FinancialStaff=财务 CustomerService=客服 Driver=司机 Dispatcher=派车调度人员
/// </summary>
public string AllocationTargetCode { get; set; }
/// <summary>
/// 任务类型编码列表
/// </summary>
public List<string> TaskTypeCodeList { get; set; }
}
}

@ -6,8 +6,8 @@ namespace DS.WMS.Core.TaskPlat.Entity
/// <summary>
/// 任务分配设置表
///</summary>
[SugarTable("task_allot_set", "任务分配设置表")]
public class TaskAllotSet : BaseModelV2<long>
[SugarTable("task_allocation_set", "任务分配设置表")]
public class TaskAllocationtSet : BaseModelV2<long>
{
/// <summary>
/// 任务类型
@ -19,48 +19,48 @@ namespace DS.WMS.Core.TaskPlat.Entity
/// 是否分配至操作
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至操作", IsNullable = false)]
public bool AllotOperator { get; set; }
public bool IsAllotOperator { get; set; }
/// <summary>
/// 是否分配至单证
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至单证", IsNullable = false)]
public bool AllotVouchingClerk { get; set; }
public bool IsAllotVouchingClerk { get; set; }
/// <summary>
/// 是否分配至销售
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至销售", IsNullable = false)]
public bool AllotSale { get; set; }
public bool IsAllotSale { get; set; }
/// <summary>
/// 是否分配至报关员
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至报关员", IsNullable = false)]
public bool AllotCustom { get; set; }
public bool IsAllotCustom { get; set; }
/// <summary>
/// 是否分配至财务
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至财务", IsNullable = false)]
public bool AllotFinancialStaff { get; set; }
public bool IsAllotFinancialStaff { get; set; }
/// <summary>
/// 是否分配至客服
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至客服", IsNullable = false)]
public bool AllotCustomerService { get; set; }
public bool IsAllotCustomerService { get; set; }
/// <summary>
/// 是否分配至司机
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至司机", IsNullable = false)]
public bool AllotDriver { get; set; }
public bool IsAllotDriver { get; set; }
/// <summary>
/// 是否分配至派车调度人员
/// </summary>
[SugarColumn(ColumnDescription = "是否分配至派车调度人员", IsNullable = false)]
public bool AllotDispatcher { get; set; }
public bool IsAllotDispatcher { get; set; }
}
}

@ -27,6 +27,25 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "所属人员姓名", IsNullable = false, Length = 255)]
public string UserName { get; set; }
/// <summary>
/// 状态 Create-待处理Retransmit-已转发Complete-已完成Cancel-已取消Pending-已挂起
/// </summary>
[SugarColumn(ColumnDescription = "状态 Create-待处理Retransmit-已转发Complete-已完成Cancel-已取消Pending-已挂起", IsNullable = false, Length = 20, DefaultValue = "")]
public string Status { get; set; } = "";
/// <summary>
/// 状态名称
/// </summary>
[SugarColumn(ColumnDescription = "状态名称", IsNullable = true, Length = 50)]
public string? StatusName { get; set; }
/// <summary>
/// 状态发生时间
/// </summary>
[SugarColumn(ColumnDescription = "状态发生时间", IsNullable = true)]
public DateTime? StatusTime { get; set; }
/// <summary>
/// 所属机构主键
/// </summary>

@ -0,0 +1,11 @@
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 ITaskAllocation
{
}
}

@ -42,6 +42,15 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <returns>返回回执</returns>
Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null);
/// <summary>
/// 工作流设置任务在个人下的状态
/// </summary>
/// <param name="bsno">业务主键</param>
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="taskStatusEnum">业务状态</param>
/// <param name="statusTime">状态发生时间</param>
/// <param name="userInfos">要设置任务状态的人员列表</param>
Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos);
/// <summary>
/// 工作流设置任务状态
/// </summary>
@ -50,7 +59,6 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <param name="taskStatusEnum">业务状态</param>
/// <param name="statusTime">状态发生时间</param>
Task<DataResult> SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime);
/// <summary>
/// 工作流任务转交
/// </summary>

@ -0,0 +1,31 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.Module.DjyServiceStatus;
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;
namespace DS.WMS.Core.TaskPlat.Method
{
public class TaskAllocationService : ITaskAllocation
{
public TaskAllocationService(IUser user,
ILogger<TaskAllocationService> logger,
ISaasDbService saasDbService,
IServiceProvider serviceProvider,
IWebHostEnvironment environment)
{ }
}
}

@ -28,14 +28,17 @@ namespace DS.WMS.Core.TaskPlat.Method
/// </summary>
public class TaskManageBCService : TaskManageBaseService<TaskManageBCService>, ITaskManageBCService
{
// 实例化时构建
private readonly IConfigService configService;
private readonly IClientInfoService clientInfoService;
private readonly IMappingCarrierService mappingCarrierService;
private readonly IBookingSlotService bookingSlotService;
private readonly IOpFileService opFileService;
private ISeaExportService seaExportService;
private IDjyServiceStatusService djyServiceStatusService;
// 按需构建
private Lazy<IBookingSlotService> bookingSlotService;
private Lazy<ISeaExportService> seaExportService;
private Lazy<IDjyServiceStatusService> djyServiceStatusService;
public TaskManageBCService(IUser user,
ILogger<TaskManageBCService> logger,
ISaasDbService saasDbService,
@ -51,6 +54,10 @@ namespace DS.WMS.Core.TaskPlat.Method
this.clientInfoService = clientInfoService;
this.mappingCarrierService = mappingCarrierService;
this.opFileService = opFileService;
bookingSlotService = new Lazy<IBookingSlotService>(serviceProvider.GetRequiredService<IBookingSlotService>);
seaExportService = new Lazy<ISeaExportService>(serviceProvider.GetRequiredService<ISeaExportService>);
djyServiceStatusService = new Lazy<IDjyServiceStatusService>(serviceProvider.GetRequiredService<IDjyServiceStatusService>);
}
/// <summary>
@ -140,8 +147,13 @@ namespace DS.WMS.Core.TaskPlat.Method
var slotFileList = opFileService.GetOpFileList(bookingSlot.Id.ToString()).Data;
//if (bookingSlotService == null)
//{
// bookingSlotService = serviceProvider.GetRequiredService<IBookingSlotService>();
//}
//推送订舱订单
var bookingOrderId = await bookingSlotService.GenerateBookingOrder(bookingSlot, slotFileList, model, null);
var bookingOrderId = await bookingSlotService.Value.GenerateBookingOrder(bookingSlot, slotFileList, model, null);
logger.LogInformation($"生成订舱订单完成bookingOrderId={bookingOrderId} taskid={bcOrder.TASK_ID}");
@ -152,7 +164,7 @@ namespace DS.WMS.Core.TaskPlat.Method
//检索舱位信息
var slotInfo = (await bookingSlotService.Detail(bookingSlot.Id)).Data;
var slotInfo = (await bookingSlotService.Value.Detail(bookingSlot.Id)).Data;
BookingSlotBaseWithCtnDto baseInfo = slotInfo.Adapt<BookingSlotBaseWithCtnDto>();
baseInfo.Id = bookingSlot.Id;
baseInfo.CtnList = slotInfo.CtnList.Adapt<List<BookingSlotCtnDto>>();
@ -165,7 +177,7 @@ namespace DS.WMS.Core.TaskPlat.Method
slots = slots,
isCheck = false
};
var allocRlt = await bookingSlotService.ImportSlots(importSlotsDto);
var allocRlt = await bookingSlotService.Value.ImportSlots(importSlotsDto);
logger.LogInformation($"生成订舱和舱位关系完成allocRlt={JsonConvert.SerializeObject(allocRlt)} taskid={bcOrder.TASK_ID}");
@ -188,7 +200,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bcEntity.UpdateUserName = user.UserName;
//更新任务BC
await tenantDb.Updateable<TaskBCInfo>().UpdateColumns(it => new
await tenantDb.Updateable<TaskBCInfo>(bcEntity).UpdateColumns(it => new
{
it.BOOKING_ORDER_ID,
it.BOOKING_SLOT_ID,
@ -295,10 +307,18 @@ namespace DS.WMS.Core.TaskPlat.Method
ValidateContact(model);
BookingSlotBase? bookingSlot = await tenantDb.Queryable<BookingSlotBase>().Where(x => x.Id == bookingSlotId).FirstAsync();
if (bookingSlot == null)
{
throw new Exception($"生成订舱订单失败,舱位未生成不能直接生成订舱订单");
}
var slotFileList = opFileService.GetOpFileList(bookingSlotId.ToString()).Data;
//推送订舱订单
var bookingOrderId = await bookingSlotService.GenerateBookingOrder(bookingSlot, slotFileList, model, null);
//if (bookingSlotService == null)
//{
// bookingSlotService = serviceProvider.GetRequiredService<IBookingSlotService>();
//}
var bookingOrderId = await bookingSlotService.Value.GenerateBookingOrder(bookingSlot, slotFileList, model, null);
logger.LogInformation($"生成订舱订单完成bookingOrderId={bookingOrderId} taskid={bcOrder.TASK_ID}");
@ -309,7 +329,7 @@ namespace DS.WMS.Core.TaskPlat.Method
//检索舱位信息
var slotInfo = (await bookingSlotService.Detail(bookingSlot.Id)).Data;
var slotInfo = (await bookingSlotService.Value.Detail(bookingSlot.Id)).Data;
BookingSlotBaseWithCtnDto baseInfo = slotInfo.Adapt<BookingSlotBaseWithCtnDto>();
baseInfo.Id = bookingSlot.Id;
baseInfo.CtnList = slotInfo.CtnList.Adapt<List<BookingSlotCtnDto>>();
@ -322,7 +342,7 @@ namespace DS.WMS.Core.TaskPlat.Method
slots = slots,
isCheck = false
};
var allocRlt = await bookingSlotService.ImportSlots(importSlotsDto);
var allocRlt = await bookingSlotService.Value.ImportSlots(importSlotsDto);
logger.LogInformation($"生成订舱和舱位关系完成allocRlt={JsonConvert.SerializeObject(allocRlt)} taskid={bcOrder.TASK_ID}");
@ -345,7 +365,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bcEntity.UpdateUserName = user.UserName;
//更新任务BC
await tenantDb.Updateable<TaskBCInfo>().UpdateColumns(it => new
await tenantDb.Updateable<TaskBCInfo>(bcEntity).UpdateColumns(it => new
{
it.BOOKING_ORDER_ID,
it.BOOKING_SLOT_ID,
@ -462,7 +482,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bcEntity.UpdateUserName = user.UserName;
//更新任务BC
await tenantDb.Updateable<TaskBCInfo>().UpdateColumns(it => new
await tenantDb.Updateable<TaskBCInfo>(bcEntity).UpdateColumns(it => new
{
it.BOOKING_SLOT_ID,
it.UpdateTime,
@ -620,6 +640,10 @@ namespace DS.WMS.Core.TaskPlat.Method
#endregion
}
result.succ = true;
result.msg = "成功";
return DataResult<TaskManageOrderResultDto>.Success(result);
}
catch (Exception ex)
@ -661,11 +685,11 @@ namespace DS.WMS.Core.TaskPlat.Method
model.CustomerContactList.ForEach(contact =>
{
var djyCustomerContactMan = djyCustomerInfo.ClientContactList
.FirstOrDefault(a => a.Id == contact.CustomerContactId);
.FirstOrDefault(a => a.Id == contact.Id);
if (djyCustomerContactMan == null)
{
logger.LogInformation($"委托单位{model.CustomerName} 联系人 {contact.Name}获取失败,联系人不存在或已作废 SlotId={model.SlotId.Value}");
logger.LogInformation($"委托单位{model.CustomerName} 联系人 {contact.Name}获取失败,联系人不存在或已作废 SlotId={model.SlotId}");
//委托单位 {0} 联系人 {1} 获取失败,联系人不存在或已作废
throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotCreateCustomerContractDeletedOrNoExists)), model.CustomerName, contact.Name));
@ -913,7 +937,7 @@ namespace DS.WMS.Core.TaskPlat.Method
};
}
var result = await bookingSlotService.InnerApiReceive(slotModel, dynameFile, dynameNoticeFile);
var result = await bookingSlotService.Value.InnerApiReceive(slotModel, dynameFile, dynameNoticeFile);
return result.Data;
}
catch (Exception ex)
@ -1025,9 +1049,7 @@ namespace DS.WMS.Core.TaskPlat.Method
});
}
seaExportService = serviceProvider.GetRequiredService<ISeaExportService>();
var bkRlt = await seaExportService.EditSeaExport(bkModel);
var bkRlt = await seaExportService.Value.EditSeaExport(bkModel);
id = long.Parse(bkRlt.Data.ToString());
@ -1114,10 +1136,8 @@ namespace DS.WMS.Core.TaskPlat.Method
if (generateModel.ProjectList != null && generateModel.ProjectList.Count > 0)
{
djyServiceStatusService = serviceProvider.GetRequiredService<IDjyServiceStatusService>();
//写入服务项目
var prjRlt = djyServiceStatusService.SaveServiceProject(new EmbedServiceProjectDto
var prjRlt = djyServiceStatusService.Value.SaveServiceProject(new EmbedServiceProjectDto
{
BusinessId = id.ToString(),
ProjectCodes = generateModel.ProjectList.Distinct().ToArray(),

@ -28,6 +28,51 @@ namespace DS.WMS.Core.TaskPlat.Method
{ }
#region 对工作流提供的接口
/// <summary>
/// 工作流设置任务在个人下的状态
/// </summary>
/// <param name="bsno">业务主键</param>
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="taskStatusEnum">业务状态</param>
/// <param name="statusTime">状态发生时间</param>
/// <param name="userInfos">要设置任务状态的人员列表</param>
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> userInfos)
{
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
TaskBaseInfo taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
.OrderByDescending(a => a.CreateTime)
.FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_TYPE == taskBaseTypeEnum.ToString());
if (taskInfo == null)
{
logger.LogInformation($"根据bsno:【{bsno}】,TaskBaseTypeEnum【{taskBaseTypeEnum}】未查询到任务");
return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData)));
}
logger.LogInformation("接收到任务个人状态修改报文 任务主键={id} 状态设置={status} 人员列表={userList}", taskInfo.Id, taskStatusEnum.ToString(), JsonConvert.SerializeObject(userInfos));
var taskBaseAllocationList = await tenantDb.Queryable<TaskBaseAllocation>().Where(x => x.TaskId == taskInfo.Id).ToListAsync();
taskBaseAllocationList.ForEach(x =>
{
x.Status = taskStatusEnum.ToString();
x.StatusName = taskStatusEnum.EnumDescription();
x.StatusTime = statusTime;
});
await tenantDb.Updateable(taskBaseAllocationList).UpdateColumns(x => new
{
x.UpdateBy,
x.UpdateTime,
x.UpdateUserName,
x.Status,
x.StatusName,
x.StatusTime
}).ExecuteCommandAsync();
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
}
/// <summary>
/// 设置任务状态
/// </summary>
@ -51,6 +96,7 @@ namespace DS.WMS.Core.TaskPlat.Method
logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString());
taskInfo.STATUS = taskStatusEnum.ToString();
taskInfo.STATUS_NAME = taskStatusEnum.EnumDescription();
taskInfo.RealUserId = long.Parse(user.UserId);
taskInfo.RealUserName = user.UserName;
@ -60,10 +106,32 @@ namespace DS.WMS.Core.TaskPlat.Method
x.UpdateTime,
x.UpdateUserName,
x.STATUS,
x.STATUS_NAME,
x.RealUserId,
x.RealUserName
}).ExecuteCommandAsync();
var taskBaseAllocationList = await tenantDb.Queryable<TaskBaseAllocation>().Where(x => x.TaskId == taskInfo.Id).ToListAsync();
if (taskBaseAllocationList.Count != 0)
{
taskBaseAllocationList.ForEach(x =>
{
x.Status = taskStatusEnum.ToString();
x.StatusName = taskStatusEnum.EnumDescription();
x.StatusTime = statusTime;
});
await tenantDb.Updateable(taskBaseAllocationList).UpdateColumns(x => new
{
x.UpdateBy,
x.UpdateTime,
x.UpdateUserName,
x.Status,
x.StatusName,
x.StatusTime
}).ExecuteCommandAsync();
}
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
}
@ -713,6 +781,11 @@ namespace DS.WMS.Core.TaskPlat.Method
{
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
if (querySearch.OtherQueryCondition == null)
{
throw new ArgumentNullException(nameof(querySearch.OtherQueryCondition));
}
//序列化查询条件
List<IConditionalModel>? whereList = null;
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
@ -757,10 +830,11 @@ namespace DS.WMS.Core.TaskPlat.Method
{
case TaskBaseTypeEnum.BC:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID);
var queryable = tenantDb.Queryable<TaskBaseInfo>()
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -848,7 +922,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskSiSubmitted>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -894,7 +968,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.IS_UPDATE_BOOKING,
bc.UPDATE_BOOKING_DATE
})
.ToQueryPageAsync(querySearch.PageCondition);
.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.INVOICE_BILL_MAIL:
@ -902,7 +976,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskPerBillBase>((t, a, bc) => t.Id == bc.TASK_PKID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -918,7 +992,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.DONGSH_RESULT_TIME,
bc.DONGSH_RECV_REASON
})
.ToQueryPageAsync(querySearch.PageCondition);
.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.TRUCK_DISPATCH:
@ -926,7 +1000,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskTruck>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -991,7 +1065,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskCutDateChangeInfo>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1002,7 +1076,7 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.VOYNO,
bc.NOTICE_DATE
})
.ToQueryPageAsync(querySearch.PageCondition);
.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.ROLLING_NOMINATION:
@ -1011,7 +1085,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskRollingNomination>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1037,7 +1111,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskDraftInfo>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1060,7 +1134,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskPodDischargeGateoutFull>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1079,7 +1153,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskCautionNotice>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1110,7 +1184,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskRouteChangeAdvisory>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
{
@ -1141,7 +1215,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId);
SetCondition(queryable, whereList, taskType, taskStatLevel, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition!.Status, userId);
result = await queryable.Select<dynamic>(t => t).ToQueryPageAsync(querySearch.PageCondition);
@ -1650,32 +1724,40 @@ namespace DS.WMS.Core.TaskPlat.Method
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
private void SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum taskStatLevel,
long userId)
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum taskStatLevel,
string status,
long userId)
{
queryable.Where(whereList)
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.IS_EXCEPT == 0)
.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 && t.IS_EXCEPT == 0 && a.UserId == userId);
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
&& t.IS_EXCEPT == 0
&& (t.CreateBy == userId || (a.UserId == userId && (t.STATUS == status || a.Status == status))));
//.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
}
/// <summary>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
private void SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum taskStatLevel,
long userId)
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum taskStatLevel,
string status,
long userId)
{
queryable.Where(whereList)
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.IS_EXCEPT == 0)
.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 && t.IS_EXCEPT == 0 && a.UserId == userId);
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
&& t.IS_EXCEPT == 0
&& (t.CreateBy == userId || (a.UserId == userId && (t.STATUS == status || a.Status == status))));
//.WhereIF(taskStatLevel == TaskStatLevelEnum.EXCPTION, (t, a) => t.IS_EXCEPT == 1)
}
}
}

@ -0,0 +1,46 @@
using DS.Module.Core;
using DS.Module.Core.Attributes;
using DS.Module.DjyServiceStatus;
using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace DS.WMS.TaskApi.Controllers;
/// <summary>
/// 任务分配相关接口
/// </summary>
public class TaskAllocationController : ApiController
{
private readonly ITaskManageService taskManageService;
public TaskAllocationController(ITaskManageService taskManageService)
{
this.taskManageService = taskManageService;
}
/// <summary>
/// 获取未设置分配的任务类型列表
/// </summary>
[HttpGet("GetUnSetTaskTypeList")]
public async Task<DataResult> GetUnSetTaskTypeList([FromQuery] long[] taskIds, [FromBody] List<RecvUserInfo> userInfo)
{
//await taskManageService.SetTaskOwner(taskIds, userInfo);
//return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.OperationSuccess));
return default;
}
/// <summary>
/// 任务分配设置保存
/// </summary>
[HttpPost("Save")]
public async Task<DataResult> Save()
{
//await taskManageService.SetTaskOwner(taskIds, userInfo);
//return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.OperationSuccess));
return default;
}
}

@ -56,6 +56,16 @@ public class TaskManageController : ApiController
}
/// <summary>
/// (测试)工作流设置任务在个人下的状态
/// </summary>
[HttpPost("SetTaskUserStatus")]
[ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous]
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, [FromBody] List<RecvUserInfo> userInfos)
{
var result = await taskManageService.SetTaskUserStatus(bsno, taskBaseTypeEnum, taskStatusEnum, statusTime, userInfos);
return result;
}
/// <summary>
/// (测试)工作流设置任务状态
/// </summary>
@ -198,8 +208,4 @@ public class TaskManageController : ApiController
return PhysicalFile(fileFullPath, "application/octet-stream", fileName);
}
// /TaskManage/CreateBCTaskJob
// /TaskManage/CreateDRAFTTaskJob
// /TaskManage/CreateAdvisoryTaskJob
// /TaskManage/CreateDRAFTTaskJob
}
Loading…
Cancel
Save