diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotStock.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotStock.cs
index 152053e1..6c518018 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotStock.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotStock.cs
@@ -18,7 +18,7 @@ namespace DS.WMS.Core.Op.Entity
///
/// 船名
///
- [SqlSugar.SugarColumn(ColumnDescription = "舱位主键", Length = 10, IsNullable = true)]
+ [SqlSugar.SugarColumn(ColumnDescription = "船名", Length = 30, IsNullable = true)]
public string Vessel { get; set; }
///
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
index 890a5f13..899df2a4 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs
@@ -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().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().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);
}
}
}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskAllocationDtos.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskAllocationDtos.cs
new file mode 100644
index 00000000..0c97edf8
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskAllocationDtos.cs
@@ -0,0 +1,16 @@
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ public class TaskAllocationSaveDto
+ {
+ ///
+ /// 分配对象编码 Operator=操作 VouchingClerk=单证 Sale=销售 Custom=报关员 FinancialStaff=财务 CustomerService=客服 Driver=司机 Dispatcher=派车调度人员
+ ///
+ public string AllocationTargetCode { get; set; }
+
+
+ ///
+ /// 任务类型编码列表
+ ///
+ public List TaskTypeCodeList { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskAllotSet.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskAllocationtSet.cs
similarity index 76%
rename from ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskAllotSet.cs
rename to ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskAllocationtSet.cs
index 3110b1da..fe5dc0ab 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskAllotSet.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskAllocationtSet.cs
@@ -6,8 +6,8 @@ namespace DS.WMS.Core.TaskPlat.Entity
///
/// 任务分配设置表
///
- [SugarTable("task_allot_set", "任务分配设置表")]
- public class TaskAllotSet : BaseModelV2
+ [SugarTable("task_allocation_set", "任务分配设置表")]
+ public class TaskAllocationtSet : BaseModelV2
{
///
/// 任务类型
@@ -19,48 +19,48 @@ namespace DS.WMS.Core.TaskPlat.Entity
/// 是否分配至操作
///
[SugarColumn(ColumnDescription = "是否分配至操作", IsNullable = false)]
- public bool AllotOperator { get; set; }
+ public bool IsAllotOperator { get; set; }
///
/// 是否分配至单证
///
[SugarColumn(ColumnDescription = "是否分配至单证", IsNullable = false)]
- public bool AllotVouchingClerk { get; set; }
+ public bool IsAllotVouchingClerk { get; set; }
///
/// 是否分配至销售
///
[SugarColumn(ColumnDescription = "是否分配至销售", IsNullable = false)]
- public bool AllotSale { get; set; }
+ public bool IsAllotSale { get; set; }
///
/// 是否分配至报关员
///
[SugarColumn(ColumnDescription = "是否分配至报关员", IsNullable = false)]
- public bool AllotCustom { get; set; }
+ public bool IsAllotCustom { get; set; }
///
/// 是否分配至财务
///
[SugarColumn(ColumnDescription = "是否分配至财务", IsNullable = false)]
- public bool AllotFinancialStaff { get; set; }
+ public bool IsAllotFinancialStaff { get; set; }
///
/// 是否分配至客服
///
[SugarColumn(ColumnDescription = "是否分配至客服", IsNullable = false)]
- public bool AllotCustomerService { get; set; }
+ public bool IsAllotCustomerService { get; set; }
///
/// 是否分配至司机
///
[SugarColumn(ColumnDescription = "是否分配至司机", IsNullable = false)]
- public bool AllotDriver { get; set; }
+ public bool IsAllotDriver { get; set; }
///
/// 是否分配至派车调度人员
///
[SugarColumn(ColumnDescription = "是否分配至派车调度人员", IsNullable = false)]
- public bool AllotDispatcher { get; set; }
+ public bool IsAllotDispatcher { get; set; }
}
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs
index 3235be40..e862a6aa 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseAllocation.cs
@@ -27,6 +27,25 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "所属人员姓名", IsNullable = false, Length = 255)]
public string UserName { get; set; }
+ ///
+ /// 状态 Create-待处理;Retransmit-已转发;Complete-已完成;Cancel-已取消;Pending-已挂起
+ ///
+ [SugarColumn(ColumnDescription = "状态 Create-待处理;Retransmit-已转发;Complete-已完成;Cancel-已取消;Pending-已挂起", IsNullable = false, Length = 20, DefaultValue = "")]
+ public string Status { get; set; } = "";
+
+ ///
+ /// 状态名称
+ ///
+ [SugarColumn(ColumnDescription = "状态名称", IsNullable = true, Length = 50)]
+ public string? StatusName { get; set; }
+
+ ///
+ /// 状态发生时间
+ ///
+ [SugarColumn(ColumnDescription = "状态发生时间", IsNullable = true)]
+ public DateTime? StatusTime { get; set; }
+
+
///
/// 所属机构主键
///
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskAllocation.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskAllocation.cs
new file mode 100644
index 00000000..1654f3eb
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskAllocation.cs
@@ -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
+ {
+ }
+}
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 790dd70e..c9b59734 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
@@ -42,6 +42,15 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// 返回回执
Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null);
+ ///
+ /// 工作流设置任务在个人下的状态
+ ///
+ /// 业务主键
+ /// 业务类型
+ /// 业务状态
+ /// 状态发生时间
+ /// 要设置任务状态的人员列表
+ Task SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List userInfos);
///
/// 工作流设置任务状态
///
@@ -50,7 +59,6 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// 业务状态
/// 状态发生时间
Task SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime);
-
///
/// 工作流任务转交
///
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs
new file mode 100644
index 00000000..045a829c
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskAllocationService.cs
@@ -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 logger,
+ ISaasDbService saasDbService,
+ IServiceProvider serviceProvider,
+ IWebHostEnvironment environment)
+ { }
+
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
index 437460b8..774a9adf 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
@@ -28,14 +28,17 @@ namespace DS.WMS.Core.TaskPlat.Method
///
public class TaskManageBCService : TaskManageBaseService, 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 bookingSlotService;
+ private Lazy seaExportService;
+ private Lazy djyServiceStatusService;
+
public TaskManageBCService(IUser user,
ILogger 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(serviceProvider.GetRequiredService);
+ seaExportService = new Lazy(serviceProvider.GetRequiredService);
+ djyServiceStatusService = new Lazy(serviceProvider.GetRequiredService);
}
///
@@ -140,8 +147,13 @@ namespace DS.WMS.Core.TaskPlat.Method
var slotFileList = opFileService.GetOpFileList(bookingSlot.Id.ToString()).Data;
+ //if (bookingSlotService == null)
+ //{
+ // bookingSlotService = serviceProvider.GetRequiredService();
+ //}
+
//推送订舱订单
- 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();
baseInfo.Id = bookingSlot.Id;
baseInfo.CtnList = slotInfo.CtnList.Adapt>();
@@ -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().UpdateColumns(it => new
+ await tenantDb.Updateable(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().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();
+ //}
+ 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();
baseInfo.Id = bookingSlot.Id;
baseInfo.CtnList = slotInfo.CtnList.Adapt>();
@@ -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().UpdateColumns(it => new
+ await tenantDb.Updateable(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().UpdateColumns(it => new
+ await tenantDb.Updateable(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.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();
-
- 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();
-
//写入服务项目
- var prjRlt = djyServiceStatusService.SaveServiceProject(new EmbedServiceProjectDto
+ var prjRlt = djyServiceStatusService.Value.SaveServiceProject(new EmbedServiceProjectDto
{
BusinessId = id.ToString(),
ProjectCodes = generateModel.ProjectList.Distinct().ToArray(),
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 63e694df..8e2b2b14 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -28,6 +28,51 @@ namespace DS.WMS.Core.TaskPlat.Method
{ }
#region 对工作流提供的接口
+ ///
+ /// 工作流设置任务在个人下的状态
+ ///
+ /// 业务主键
+ /// 业务类型
+ /// 业务状态
+ /// 状态发生时间
+ /// 要设置任务状态的人员列表
+ public async Task SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List userInfos)
+ {
+ SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
+
+ TaskBaseInfo taskInfo = await tenantDb.Queryable()
+ .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().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)));
+ }
+
///
/// 设置任务状态
///
@@ -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().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? whereList = null;
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
@@ -757,10 +830,11 @@ namespace DS.WMS.Core.TaskPlat.Method
{
case TaskBaseTypeEnum.BC:
{
- var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
- .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID);
+ var queryable = tenantDb.Queryable()
+ .LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((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((t, a, bc) => new
{
@@ -848,7 +922,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((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().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((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().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((t, a, bc) => new
{
@@ -991,7 +1065,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((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().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((t, a, bc) => new
{
@@ -1037,7 +1111,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((t, a, bc) => new
{
@@ -1060,7 +1134,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((t, a, bc) => new
{
@@ -1079,7 +1153,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((t, a, bc) => new
{
@@ -1110,7 +1184,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
.LeftJoin((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((t, a, bc) => new
{
@@ -1141,7 +1215,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{
var queryable = tenantDb.Queryable().LeftJoin((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(t => t).ToQueryPageAsync(querySearch.PageCondition);
@@ -1650,32 +1724,40 @@ namespace DS.WMS.Core.TaskPlat.Method
/// 设置条件的方法,用于
///
private void SetCondition(ISugarQueryable queryable,
- List? whereList,
- TaskBaseTypeEnum? taskType,
- TaskStatLevelEnum taskStatLevel,
- long userId)
+ List? 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)
}
///
/// 设置条件的方法,用于
///
private void SetCondition(ISugarQueryable queryable,
- List? whereList,
- TaskBaseTypeEnum? taskType,
- TaskStatLevelEnum taskStatLevel,
- long userId)
+ List? 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)
}
}
}
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs
new file mode 100644
index 00000000..9503ed79
--- /dev/null
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs
@@ -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;
+
+
+///
+/// 任务分配相关接口
+///
+public class TaskAllocationController : ApiController
+{
+ private readonly ITaskManageService taskManageService;
+
+
+ public TaskAllocationController(ITaskManageService taskManageService)
+ {
+ this.taskManageService = taskManageService;
+ }
+ ///
+ /// 获取未设置分配的任务类型列表
+ ///
+ [HttpGet("GetUnSetTaskTypeList")]
+ public async Task GetUnSetTaskTypeList([FromQuery] long[] taskIds, [FromBody] List userInfo)
+ {
+ //await taskManageService.SetTaskOwner(taskIds, userInfo);
+ //return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.OperationSuccess));
+ return default;
+ }
+
+ ///
+ /// 任务分配设置保存
+ ///
+ [HttpPost("Save")]
+ public async Task Save()
+ {
+ //await taskManageService.SetTaskOwner(taskIds, userInfo);
+ //return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.OperationSuccess));
+ return default;
+ }
+}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
index 463abcc6..5b1edc8a 100644
--- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
@@ -56,6 +56,16 @@ public class TaskManageController : ApiController
}
+ ///
+ /// (测试)工作流设置任务在个人下的状态
+ ///
+ [HttpPost("SetTaskUserStatus")]
+ [ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous]
+ public async Task SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, [FromBody] List userInfos)
+ {
+ var result = await taskManageService.SetTaskUserStatus(bsno, taskBaseTypeEnum, taskStatusEnum, statusTime, userInfos);
+ return result;
+ }
///
/// (测试)工作流设置任务状态
///
@@ -198,8 +208,4 @@ public class TaskManageController : ApiController
return PhysicalFile(fileFullPath, "application/octet-stream", fileName);
}
- // /TaskManage/CreateBCTaskJob
- // /TaskManage/CreateDRAFTTaskJob
- // /TaskManage/CreateAdvisoryTaskJob
- // /TaskManage/CreateDRAFTTaskJob
}
\ No newline at end of file