diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs
index 05ea112c..0acca91b 100644
--- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs
+++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs
@@ -64,7 +64,7 @@ namespace DS.Module.Core
///
/// 工作流
///
- [Description("系统")]
+ [Description("工作流")]
WORK_FLOW,
}
}
diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs
new file mode 100644
index 00000000..25c36ca3
--- /dev/null
+++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs
@@ -0,0 +1,26 @@
+using System.ComponentModel;
+
+namespace DS.Module.Core
+{
+ ///
+ /// 任务统计分类枚举
+ ///
+ public enum TaskStatLevelEnum
+ {
+ ///
+ /// 异常
+ ///
+ [Description("异常")]
+ EXCPTION,
+ ///
+ /// 个人
+ ///
+ [Description("个人")]
+ PERSON,
+ ///
+ /// 公共
+ ///
+ [Description("公共")]
+ PUBLIC
+ }
+}
diff --git a/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs b/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs
index 150be6e0..e53ccab8 100644
--- a/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs
+++ b/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs
@@ -1,4 +1,5 @@
-using System.ComponentModel;
+using System.Collections.Concurrent;
+using System.ComponentModel;
using System.Reflection;
namespace DS.Module.Core;
@@ -8,6 +9,9 @@ namespace DS.Module.Core;
///
public static class EnumUtil
{
+ // 枚举显示字典缓存
+ private static readonly ConcurrentDictionary> EnumShowNameDict = new ConcurrentDictionary>();
+
///
/// 字符串转Enum
///
@@ -58,4 +62,39 @@ public static class EnumUtil
return 0;
}
}
+
+
+ ///
+ /// 获取枚举对象Key与名称的字典(缓存)
+ ///
+ ///
+ ///
+ public static Dictionary GetEnumDictionaryWithKey(this Type enumType)
+ {
+ if (!enumType.IsEnum)
+ throw new ArgumentException("Type '" + enumType.Name + "' is not an enum.");
+
+ // 查询缓存
+ var enumDic = EnumShowNameDict.ContainsKey(enumType) ? EnumShowNameDict[enumType] : new Dictionary();
+ if (enumDic.Count != 0)
+ return enumDic;
+
+ string[] fieldstrs = Enum.GetNames(enumType);
+ // 取枚举类型的Key/Value字典集合
+ enumDic = fieldstrs.Select(item =>
+ {
+ object[] arr = enumType.GetField(item).GetCustomAttributes(typeof(DescriptionAttribute), true);
+
+ return new
+ {
+ Key = item,
+ Val = ((DescriptionAttribute)arr[0]).Description
+ };
+ }).ToDictionary(a => a.Key, b => b.Val);
+
+ // 缓存
+ EnumShowNameDict[enumType] = enumDic;
+
+ return enumDic;
+ }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs
new file mode 100644
index 00000000..ed178fc8
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs
@@ -0,0 +1,62 @@
+namespace DS.WMS.Core.TaskPlat.Dtos
+{
+ public class TaskUserStatResultInfo
+ {
+ ///
+ /// 第一层(异常/个人/公共)
+ ///
+ public List LevelTop { get; set; }
+
+ ///
+ /// 第二层(待处理/已完成/已取消/已挂起)
+ ///
+ public List LevelNext { get; set; }
+
+ ///
+ /// 任务类型树(按照任务类型展示)
+ ///
+ public List LevelTree { get; set; }
+ }
+ ///
+ /// 用户任务统计展示
+ ///
+ public class TaskUserStatItem
+ {
+ ///
+ /// 排序值
+ ///
+ public int SortNo { get; set; }
+
+ ///
+ /// 展示代码
+ ///
+ public string Key { get; set; }
+
+ ///
+ /// 展示名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 记录条数
+ ///
+ public int Total { get; set; }
+
+ ///
+ /// 执行KEY
+ ///
+ public string ActionKey { get; set; }
+
+ }
+
+
+ public class TaskUserStatItemNext: TaskUserStatItem
+ {
+ public string TopKey { get; set; }
+ }
+
+ public class TaskUserStatItemTree : TaskUserStatItemNext
+ {
+ public string NextKey { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs
index e87ff106..df95e1eb 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs
@@ -251,11 +251,11 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "批次统计", IsNullable = true, Length = 50)]
public string? BATCH_STATIC { get; set; }
- ///
- /// 大简云userid
- ///
- [SugarColumn(ColumnDescription = "大简云userid", IsNullable = true, Length = 50)]
- public string? DJYUserId { get; set; }
+ /////
+ ///// 大简云userid
+ /////
+ //[SugarColumn(ColumnDescription = "大简云userid", IsNullable = true, Length = 50)]
+ //public string? DJYUserId { get; set; }
}
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 7eb57732..2b72c5d7 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
@@ -6,6 +6,13 @@ namespace DS.WMS.Core.TaskPlat.Interface
{
public interface ITaskManageService
{
+ ///
+ /// 获取登陆人相关的任务统计信息
+ ///
+ /// 是否强制计算
+ /// 返回回执
+ Task> GetCurrentTotalStat(bool isReCalc);
+
///
/// 任务台台账列表查询
///
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 567c2288..51cbef5b 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -7,7 +7,6 @@ using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface;
using Mapster;
-using Masuit.Tools.Systems;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
@@ -160,7 +159,7 @@ namespace DS.WMS.Core.TaskPlat.Method
CUSTOMER_ID = info.Main.CustomerId,
CUSTOMER_NAME = info.Main.CustomerName,
BATCH_STATIC = info.Main.BatchStatic,
- DJYUserId = info.Head.DJYUserId,
+ //DJYUserId = info.Head.DJYUserId,
OUT_BS_NO = info.Head.BSNO,
CreateTime = DateTime.Now,
};
@@ -469,12 +468,12 @@ namespace DS.WMS.Core.TaskPlat.Method
if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE)
{
fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString();
- fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.GetDescription();
+ fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription();
}
else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE)
{
fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC_MODIFY.ToString();
- fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.GetDescription();
+ fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.EnumDescription();
}
}
else
@@ -484,7 +483,7 @@ namespace DS.WMS.Core.TaskPlat.Method
System.Enum.TryParse(file.FileCategory, out fileCategoryEnum);
fileInfo.FILE_CATEGORY = fileCategoryEnum.ToString();
- fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.GetDescription();
+ fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.EnumDescription();
}
if (string.IsNullOrWhiteSpace(fileInfo.FILE_NAME))
@@ -686,108 +685,639 @@ namespace DS.WMS.Core.TaskPlat.Method
{
taskType = (TaskBaseTypeEnum)temp;
};
+
+ var userId = long.Parse(user.UserId);
+ DataResult> result;
switch (taskType)
{
case TaskBaseTypeEnum.BC:
{
- var result = await tenantDb.Queryable()
- .LeftJoin((t, bc) => t.Id == bc.TASK_ID)
- .Where(whereList)
- .Select((t, bc) => new
- {
- Id = t.Id.SelectAll(),
- bc.BUSI_TYPE,
- bc.SHIPPER,
- bc.CONSIGNEE,
- bc.NOTIFYPARTY,
- bc.BC_MODIFY_TIMES,
- bc.BC_MODIFY_DATE,
- //bc.MBL_NO,
- bc.VESSEL,
- bc.VOYNO,
- bc.CARRIER,
- bc.PLACERECEIPT,
- bc.PORTLOAD,
- bc.CLOSING_DATE,
- bc.VGM_CUTOFF_TIME,
- bc.ETA,
- //bc.ETD,
- bc.POD_ETA,
- bc.CUT_SINGLE_TIME,
- bc.PORTDISCHARGE,
- bc.PLACEDELIVERY,
- bc.SHIPPING_METHOD,
- bc.SERVICE,
- bc.PRETRANS_MODE,
- bc.DESCRIPTION,
- bc.ISSUEPLACE,
- bc.COLLECTION_TERMINAL,
- bc.CONTRACTNO,
- bc.PREPARDAT,
- bc.SHIP_AGENT,
- bc.YARD,
- bc.YARD_CONTACT_USR,
- bc.YARD_CONTACT_TEL,
- bc.FST_CUSTOMER_SER_USRNAME,
- bc.FST_CUSTOMER_SER_TEL,
- bc.FST_CUSTOMER_SER_EMAIL,
- bc.REMARK1,
- bc.CY_CUTOFF_TIME,
- bc.CARRIERID,
- bc.LANECODE,
- bc.LANENAME,
- bc.CARRIAGE_TYPE,
- bc.CARRIAGE_TYPE_NAME,
- bc.BOOKING_SLOT_TYPE,
- bc.BOOKING_SLOT_TYPE_NAME,
- bc.CTN_STAT,
- bc.WEEK_AT,
- bc.DETENSION_FREE_DAYS,
- bc.SI_CUT_DATE,
- bc.MANIFEST_CUT_DATE,
- bc.MDGF_CUT_DATE,
- bc.TRANSFER_PORT_1,
- bc.TRANSFER_PORT_2,
- bc.SECOND_VESSEL,
- bc.SECOND_VOYNO,
- bc.SECOND_ETD,
- bc.SECOND_ETA,
- //bc.STATUS,
- bc.FILE_MD5,
- bc.LAST_TOBOOKING_DATE,
- bc.FROM_EMAIL,
- bc.RECV_EMAIL,
- bc.BOOKING_ORDER_ID,
- bc.BOOKING_SLOT_ID,
- bc.BOOKING_COMFIRM_DATE,
- bc.BATCH_NO,
- bc.CUSTOM_SI_CUT_DATE,
- bc.IS_SET_AUTO_EMAIL,
- bc.IS_SEND_EMAIL,
- bc.DIFF_NUM,
- bc.AUTO_SEND_USER,
- bc.PROCESS_STATUS,
- bc.PROCESS_RESULT,
- bc.PROCESS_DATE,
- bc.PRICE_CALCULATION_DATE
- })
- .ToQueryPageAsync(querySearch.PageCondition);
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ Id = t.Id.SelectAll(),
+ bc.BUSI_TYPE,
+ bc.SHIPPER,
+ bc.CONSIGNEE,
+ bc.NOTIFYPARTY,
+ bc.BC_MODIFY_TIMES,
+ bc.BC_MODIFY_DATE,
+ //bc.MBL_NO,
+ bc.VESSEL,
+ bc.VOYNO,
+ bc.CARRIER,
+ bc.PLACERECEIPT,
+ bc.PORTLOAD,
+ bc.CLOSING_DATE,
+ bc.VGM_CUTOFF_TIME,
+ bc.ETA,
+ //bc.ETD,
+ bc.POD_ETA,
+ bc.CUT_SINGLE_TIME,
+ bc.PORTDISCHARGE,
+ bc.PLACEDELIVERY,
+ bc.SHIPPING_METHOD,
+ bc.SERVICE,
+ bc.PRETRANS_MODE,
+ bc.DESCRIPTION,
+ bc.ISSUEPLACE,
+ bc.COLLECTION_TERMINAL,
+ bc.CONTRACTNO,
+ bc.PREPARDAT,
+ bc.SHIP_AGENT,
+ bc.YARD,
+ bc.YARD_CONTACT_USR,
+ bc.YARD_CONTACT_TEL,
+ bc.FST_CUSTOMER_SER_USRNAME,
+ bc.FST_CUSTOMER_SER_TEL,
+ bc.FST_CUSTOMER_SER_EMAIL,
+ bc.REMARK1,
+ bc.CY_CUTOFF_TIME,
+ bc.CARRIERID,
+ bc.LANECODE,
+ bc.LANENAME,
+ bc.CARRIAGE_TYPE,
+ bc.CARRIAGE_TYPE_NAME,
+ bc.BOOKING_SLOT_TYPE,
+ bc.BOOKING_SLOT_TYPE_NAME,
+ bc.CTN_STAT,
+ bc.WEEK_AT,
+ bc.DETENSION_FREE_DAYS,
+ bc.SI_CUT_DATE,
+ bc.MANIFEST_CUT_DATE,
+ bc.MDGF_CUT_DATE,
+ bc.TRANSFER_PORT_1,
+ bc.TRANSFER_PORT_2,
+ bc.SECOND_VESSEL,
+ bc.SECOND_VOYNO,
+ bc.SECOND_ETD,
+ bc.SECOND_ETA,
+ //bc.STATUS,
+ bc.FILE_MD5,
+ bc.LAST_TOBOOKING_DATE,
+ bc.FROM_EMAIL,
+ bc.RECV_EMAIL,
+ bc.BOOKING_ORDER_ID,
+ bc.BOOKING_SLOT_ID,
+ bc.BOOKING_COMFIRM_DATE,
+ bc.BATCH_NO,
+ bc.CUSTOM_SI_CUT_DATE,
+ bc.IS_SET_AUTO_EMAIL,
+ bc.IS_SEND_EMAIL,
+ bc.DIFF_NUM,
+ bc.AUTO_SEND_USER,
+ bc.PROCESS_STATUS,
+ bc.PROCESS_RESULT,
+ bc.PROCESS_DATE,
+ bc.PRICE_CALCULATION_DATE
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
return result;
}
- default:
+ case TaskBaseTypeEnum.SI_FEEDBACK:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.CARRIER,
+ //bc.MBL_NO,
+ bc.TAKE_ISSUETYPE_NAME,
+ bc.ISSUETYPE,
+ bc.NOTICE_DATE,
+ bc.BOOKING_ID,
+ bc.SUBMITTED_DATE,
+ bc.BILLOF_NUM,
+ bc.RELEASE_INSTRUCTION,
+ bc.SI_SUBTYPE,
+ bc.SHIPPER,
+ bc.CONSIGNEE,
+ bc.NOTIFYPARTY,
+ bc.NOTIFYPARTY2,
+ bc.TRANSPORT_RECEIVER,
+ bc.MARKS,
+ bc.HSCODE,
+ bc.DESCRIPTION,
+ bc.PKGS,
+ bc.KINDPKGS,
+ bc.KGS,
+ bc.CBM,
+ bc.VESSEL,
+ bc.VOYNO,
+ bc.COMMODITY,
+ bc.PLACERECEIPTID,
+ bc.PLACERECEIPT,
+ bc.PORTLOADID,
+ bc.PORTLOAD,
+ bc.PORTDISCHARGEID,
+ bc.PORTDISCHARGE,
+ bc.PLACEDELIVERYID,
+ bc.PLACEDELIVERY,
+ bc.PROCESS_STATUS,
+ bc.IS_SET_AUTO_UPD_BOOKING,
+ bc.PROCESS_RESULT,
+ bc.PROCESS_DATE,
+ bc.DIFF_NUM,
+ bc.IS_UPDATE_BOOKING,
+ bc.UPDATE_BOOKING_DATE
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.INVOICE_BILL_MAIL:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_PKID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_PKID,
+ //bc.MBL_NO,
+ bc.INVOICE_NO,
+ bc.CANCEL_NO,
+ bc.TOTAL_AMOUNT,
+ bc.IS_DONGSH_RECV,
+ bc.IS_DONGSH_RESULT,
+ bc.DONGSH_RECV_TIME,
+ bc.DONGSH_RESULT_TIME,
+ bc.DONGSH_RECV_REASON
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.TRUCK_DISPATCH:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.BookingTruckId,
+ bc.BookingId,
+ bc.TruckId,
+ bc.TruckCode,
+ bc.TruckName,
+ bc.ToName,
+ bc.Attn,
+ bc.AttnTel,
+ bc.AttnMail,
+ bc.AttnFax,
+ bc.FromName,
+ bc.FromTel,
+ bc.FromMail,
+ bc.FromMobile,
+ bc.FromFax,
+ bc.KGS,
+ bc.Fee,
+ bc.PayMethod,
+ bc.PayMethodName,
+ bc.TruckTime,
+ bc.YARDID,
+ bc.YARD,
+ bc.YARDCONTRACT,
+ bc.YARDCONTRACTTEL,
+ bc.FactoryId,
+ bc.FactoryCode,
+ bc.FactoryName,
+ bc.FactoryContact,
+ bc.FactoryTel,
+ bc.ReturnTime,
+ bc.InYardID,
+ bc.InYard,
+ bc.InYardContact,
+ bc.InYardContractTel,
+ //bc.NeedArriveTime,
+ bc.ClosingTime,
+ bc.PickUpTime,
+ bc.IsGuaJi,
+ //bc.Status,
+ bc.Attention,
+ bc.Remark,
+ bc.DispatcherId,
+ bc.DispatcherName,
+ bc.TruckFlowNo,
+ bc.TaskNo,
+ bc.Vessel,
+ bc.VoyNo,
+ bc.MBLNo,
+ bc.CntrTotal,
+ bc.FactoryAddr
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.CUT_MODIFY:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.CARRIER,
+ bc.VESSEL,
+ bc.VOYNO,
+ bc.NOTICE_DATE
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.ROLLING_NOMINATION:
+ case TaskBaseTypeEnum.TRANSFER_NOMINATION:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.PLAN_TYPE,
+ bc.BATCH_NO,
+ bc.CARRIERID,
+ bc.CARRIER,
+ bc.CONFIRM_DEAD_LINE,
+ bc.READ_CREATE_TIME,
+ bc.ROLL_DOUBLE_REMARK,
+ bc.PLAN_TXT,
+ //bc.REMARK,
+ bc.TASK_BATCH_TOTAL,
+ bc.TASK_BATCH_PER_TOTAL
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.DRAFT:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.CARRIER,
+ //bc.MBL_NO,
+ bc.BOOKING_ID,
+ bc.IS_CHANGE,
+ bc.IS_EMAIL_SEND,
+ bc.SEND_EMAIL_DATE,
+ bc.NOTICE_DATE,
+ })
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.POD_DISCHARGE_FULL:
+ case TaskBaseTypeEnum.POD_GATEOUT_FULL:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.CARRIER,
+ bc.NOTICE_TYPE,
+ bc.NOTICE_TYPE_NAME,
+ //bc.MBL_NO,
+ bc.NOTICE_DATE
+ }).ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.CAUTION_NOTICE:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.SOURCE_SYSTEM,
+ bc.SOURCE_BUSI_TYPE,
+ bc.SOURCE_BUSI_TYPENAME,
+ bc.NOTIFY_CONTENT,
+ //bc.MBL_NO,
+ bc.CARRIER,
+ bc.CAUTION_NOTICE_TYPE,
+ bc.IS_WEEK_DIFF,
+ bc.IS_PRICE_DATE_DIFF,
+ bc.IS_TRANSFER,
+ bc.IS_VESSEL_CHANGE,
+ bc.IS_CUT_DATE_ADVANCED,
+ bc.BOOKING_ID,
+ bc.BOOKING_SLOT_ID,
+ bc.SOURCE_TASK_ID,
+ bc.OLD_VAL,
+ bc.NEW_VAL,
+ }).ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ case TaskBaseTypeEnum.ROUTE_CUT_CHANGE:
{
- var result = await tenantDb.Queryable()
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID)
.Where(whereList)
- .Select(t => new
- {
- Id = t.Id.SelectAll()
- })
- .ToQueryPageAsync(querySearch.PageCondition);
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select((t, a, bc) => new
+ {
+ PK_ID = t.Id.SelectAll(),
+ bc.TASK_ID,
+ bc.VESSEL,
+ bc.VOYNO,
+ bc.CARRIER,
+ bc.READ_PORTLOAD,
+ bc.ORIG_ETD,
+ bc.MDGF_CUT_DATE,
+ bc.ETA,
+ //bc.ETD,
+ bc.SI_CUT_DATE,
+ bc.TM_SHIFT_CUT_DATE,
+ bc.VGM_CUTOFF_TIME,
+ bc.CY_CUT_DATE,
+ bc.ROUTE_CODE,
+ bc.EMAIL_SUBJECT,
+ bc.WEEK,
+ bc.PORTLOADID,
+ bc.PORTLOAD
+
+ }).ToQueryPageAsync(querySearch.PageCondition);
return result;
}
+ default:
+ {
+ result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId)
+ .Where(whereList)
+ .Where((t, a) => a.UserId == userId || t.CreateBy == userId)
+ .Select(t => t)
+ .ToQueryPageAsync(querySearch.PageCondition);
+ return result;
+ }
+ }
+ }
+ ///
+ /// 获取登陆人相关的任务统计信息
+ ///
+ /// 是否强制计算
+ /// 返回回执
+ public async Task> GetCurrentTotalStat(bool isReCalc)
+ {
+ TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
+ {
+ LevelTop = new List(),
+ LevelNext = new List(),
+ LevelTree = new List()
+ };
+
+ /*
+ 1、首先判断当前登陆人是否有统计记录,如果没有触发统计生成统计记录。
+ 2、如果isReCalc=true,表示强制重新统计数据,并重新更新统计数据。
+ 3、按照统计类型(个人/公共)、任务状态、是否异常分组汇总,并写入统计表。
+ */
+
+ //var userTendInfo = await _sysUserRepository.AsQueryable()
+ // .LeftJoin((usr, ten) => usr.TenantId == ten.Id)
+ // .Where(usr => usr.Id == UserManager.UserId)
+ // .Select((usr, ten) => new { User = usr, Tend = ten }).FirstAsync();
+
+ //if (userTendInfo == null)
+ // throw Oops.Oh($"当前用户关联租户信息获取失败");
+
+ ////var statList = _taskStatManageInfoRepository.AsQueryable().Where(t => (t.USER_ID == userTendInfo.User.Id
+ ////&& t.STAT_TYPE == TaskStatLevelEnum.PERSON.ToString()) || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == TaskStatLevelEnum.PUBLIC.ToString())).ToList();
+
+ ////菜单375504048771141=我的任务台账
+ //List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuTaskManage);
+
+ //bool isAdmin = userlist == null;
+
+ var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
+
+ var userId = long.Parse(user.UserId);
+ //任务列表分组统计
+ var groupList = await tenantDb.Queryable()
+ .LeftJoin((t, a) => t.Id == a.TaskId)
+ .Where((t, a) => t.IS_PUBLIC == 1
+ || t.CreateBy == userId
+ || (t.IS_PUBLIC == 0 && a.UserId == userId))
+ .GroupBy(t => new { t.TASK_TYPE, t.STATUS, t.IS_EXCEPT, t.IS_PUBLIC })
+ .Select(t => new
+ {
+ Total = SqlFunc.AggregateCount(t.Id),
+ TaskType = t.TASK_TYPE,
+ Status = t.STATUS,
+ IsExcept = t.IS_EXCEPT,
+ IsPublic = t.IS_PUBLIC
+ }).ToListAsync();
+
+ var exceptList = groupList
+ .Where(t => t.IsExcept == 1).ToList();
+
+ var personList = groupList
+ .Where(t => t.IsExcept == 0 && t.IsPublic == 0).ToList();
+
+ var publicList = groupList
+ .Where(t => t.IsExcept == 0 && t.IsPublic == 1).ToList();
+
+ #region 异常
+ if (exceptList.Count > 0)
+ {
+ resultInfo.LevelTop.Add(new TaskUserStatItem
+ {
+ Key = TaskStatLevelEnum.EXCPTION.ToString(),
+ Name = TaskStatLevelEnum.EXCPTION.EnumDescription(),
+ Total = exceptList.Sum(t => t.Total),
+ SortNo = (int)TaskStatLevelEnum.EXCPTION,
+ ActionKey = TaskStatLevelEnum.EXCPTION.ToString()
+ });
+
+ var nextList = new List();
+
+ exceptList.GroupBy(t => t.Status)
+ .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
+ .ToList().ForEach(t =>
+ {
+ TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key);
+
+ nextList.Add(new TaskUserStatItemNext
+ {
+ TopKey = TaskStatLevelEnum.EXCPTION.ToString(),
+ Key = currEnum.ToString(),
+ Name = currEnum.EnumDescription(),
+ Total = t.Total,
+ SortNo = (int)currEnum,
+ ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{currEnum.ToString()}"
+ });
+
+ });
+
+ if (nextList.Count > 0)
+ resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
+
+ exceptList.GroupBy(t => new { t.Status, t.TaskType })
+ .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
+ .ToList().ForEach(t =>
+ {
+ //TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType);
+ TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType);
+
+ resultInfo.LevelTree.Add(new TaskUserStatItemTree
+ {
+ TopKey = TaskStatLevelEnum.EXCPTION.ToString(),
+ NextKey = t.Key.Status,
+ Key = currEnum.ToString(),
+ Name = currEnum.EnumDescription(),
+ Total = t.Total,
+ SortNo = (int)currEnum,
+ ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
+ });
+
+ });
+ }
+ #endregion
+
+ #region 个人
+ if (personList.Count > 0)
+ {
+ resultInfo.LevelTop.Add(new TaskUserStatItem
+ {
+ Key = TaskStatLevelEnum.PERSON.ToString(),
+ Name = TaskStatLevelEnum.PERSON.EnumDescription(),
+ Total = personList.Sum(t => t.Total),
+ SortNo = (int)TaskStatLevelEnum.PERSON,
+ ActionKey = TaskStatLevelEnum.PERSON.ToString()
+ });
+
+ var nextList = new List();
+ personList.GroupBy(t => t.Status)
+ .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
+ .ToList().ForEach(t =>
+ {
+ TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key);
+
+ nextList.Add(new TaskUserStatItemNext
+ {
+ TopKey = TaskStatLevelEnum.PERSON.ToString(),
+ Key = currEnum.ToString(),
+ Name = currEnum.EnumDescription(),
+ Total = t.Total,
+ SortNo = (int)currEnum,
+ ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{currEnum.ToString()}"
+ });
+
+ });
+
+ if (nextList.Count > 0)
+ resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
+
+ personList.GroupBy(t => new { t.Status, t.TaskType })
+ .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
+ .ToList().ForEach(t =>
+ {
+ //TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType);
+ TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType);
+
+ resultInfo.LevelTree.Add(new TaskUserStatItemTree
+ {
+ TopKey = TaskStatLevelEnum.PERSON.ToString(),
+ NextKey = t.Key.Status,
+ Key = currEnum.ToString(),
+ Name = currEnum.EnumDescription(),
+ Total = t.Total,
+ SortNo = (int)currEnum,
+ ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
+ });
+
+ });
}
+ #endregion
+
+ #region 公共
+ if (publicList.Count > 0)
+ {
+ resultInfo.LevelTop.Add(new TaskUserStatItem
+ {
+ Key = TaskStatLevelEnum.PUBLIC.ToString(),
+ Name = TaskStatLevelEnum.PUBLIC.EnumDescription(),
+ Total = publicList.Sum(t => t.Total),
+ SortNo = (int)TaskStatLevelEnum.PUBLIC,
+ ActionKey = TaskStatLevelEnum.PUBLIC.ToString()
+ });
+
+ var nextList = new List();
+
+ publicList.GroupBy(t => t.Status)
+ .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
+ .ToList().ForEach(t =>
+ {
+ TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key);
+
+ nextList.Add(new TaskUserStatItemNext
+ {
+ TopKey = TaskStatLevelEnum.PUBLIC.ToString(),
+ Key = currEnum.ToString(),
+ Name = currEnum.EnumDescription(),
+ Total = t.Total,
+ SortNo = (int)currEnum,
+ ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{currEnum.ToString()}"
+ });
+
+ });
+
+ if (nextList.Count > 0)
+ resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList());
+
+ publicList.GroupBy(t => new { t.Status, t.TaskType })
+ .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) })
+ .ToList().ForEach(t =>
+ {
+ //TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType);
+ TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType);
+
+ resultInfo.LevelTree.Add(new TaskUserStatItemTree
+ {
+ TopKey = TaskStatLevelEnum.PUBLIC.ToString(),
+ NextKey = t.Key.Status,
+ Key = currEnum.ToString(),
+ Name = currEnum.EnumDescription(),
+ Total = t.Total,
+ SortNo = (int)currEnum,
+ ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{t.Key.Status}#{currEnum.ToString()}"
+ });
+
+ });
+ }
+ #endregion
+
+ if (resultInfo.LevelTree != null && resultInfo.LevelTree.Count > 0)
+ {
+ resultInfo.LevelTree = resultInfo.LevelTree.OrderBy(x => x.SortNo).ToList();
+ }
+
+ return DataResult.Success(resultInfo);
}
+
+
+
#region 私有方法
///
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
index 791524a4..0c6a6e2f 100644
--- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
@@ -77,6 +77,65 @@ public class TaskManageController : ApiController
return result;
}
+
+ ///
+ /// 获取登陆人相关的任务统计信息
+ ///
+ /// 是否强制计算
+ [HttpPost("GetCurrentTotalStat")]
+ public async Task> GetCurrentTotalStat([FromQuery] bool isReCalc = false)
+ {
+ var result = await taskManageService.GetCurrentTotalStat(isReCalc);
+ return result;
+ }
+
+ ///
+ /// 取消任务(可批量)
+ ///
+ /// 任务主键数组
+ /// 返回结果
+ [HttpPost("CancelTask")]
+ public async Task> CancelTask([FromBody] string[] Ids)
+ {
+ return default;
+ //var result = await taskManageService.GetCurrentTotalStat(isReCalc);
+ //return result;
+ }
+
+
+ ///
+ /// 获取任务台相关的枚举类型的值
+ ///
+ [HttpPost("GetTaskPlatEnumDict")]
+ public DataResult