Commit 14cbcfd930c26e5f07f3ca0e52cd630cc799fab0

Authored by “wangming”
1 parent 72cec4b5

feat: 添加人次记录表和品项分类字段

- 新增人次记录表(lq_person_times_record)及相关实体类和DTO
- 为开单品项明细、开单扣减信息、耗卡品项明细、会员退卡明细表添加品项分类字段(F_ItemCategory)
- 优化预约记录服务,将AddNoDealRemark方法的参数改为实体类
- 更新相关实体类和DTO以支持新字段
Showing 22 changed files with 745 additions and 163 deletions
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbListOutput.cs
1 1 using System;
2 2 using System.Collections.Generic;
  3 +using NCC.Extend.Entitys.Dto.LqKdDeductinfo;
3 4  
4 5 namespace NCC.Extend.Entitys.Dto.LqKdKdjlb
5 6 {
... ... @@ -189,5 +190,10 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb
189 190 /// 科技部老师业绩列表
190 191 /// </summary>
191 192 public List<LqKdKjbsyjInfoOutput> lqKdKjbsyjList { get; set; }
  193 +
  194 + /// <summary>
  195 + /// 储扣扣款信息列表
  196 + /// </summary>
  197 + public List<LqKdDeductinfoInfoOutput> lqKdDeductList { get; set; }
192 198 }
193 199 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPersonTimesRecord/LqPersonTimesRecordCrInput.cs 0 → 100644
  1 +using System;
  2 +
  3 +namespace NCC.Extend.Entitys.Dto.LqPersonTimesRecord
  4 +{
  5 + /// <summary>
  6 + /// 人次记录创建输入参数
  7 + /// </summary>
  8 + public class LqPersonTimesRecordCrInput
  9 + {
  10 + /// <summary>
  11 + /// 主键ID
  12 + /// </summary>
  13 + public string id { get; set; }
  14 +
  15 + /// <summary>
  16 + /// 关联业务记录ID
  17 + /// </summary>
  18 + public string businessId { get; set; }
  19 +
  20 + /// <summary>
  21 + /// 业务类型(耗卡/开单)
  22 + /// </summary>
  23 + public string businessType { get; set; }
  24 +
  25 + /// <summary>
  26 + /// 人员类型(健康师/科技老师)
  27 + /// </summary>
  28 + public string personType { get; set; }
  29 +
  30 + /// <summary>
  31 + /// 人员ID
  32 + /// </summary>
  33 + public string personId { get; set; }
  34 +
  35 + /// <summary>
  36 + /// 人员姓名
  37 + /// </summary>
  38 + public string personName { get; set; }
  39 +
  40 + /// <summary>
  41 + /// 客户ID
  42 + /// </summary>
  43 + public string memberId { get; set; }
  44 +
  45 + /// <summary>
  46 + /// 客户姓名
  47 + /// </summary>
  48 + public string memberName { get; set; }
  49 +
  50 + /// <summary>
  51 + /// 工作日期(用于人次统计,格式:YYYY-MM-DD)
  52 + /// </summary>
  53 + public DateTime? workDate { get; set; }
  54 +
  55 + /// <summary>
  56 + /// 工作月份(用于人头统计,格式:202511)
  57 + /// </summary>
  58 + public string workMonth { get; set; }
  59 +
  60 + /// <summary>
  61 + /// 数量
  62 + /// </summary>
  63 + public decimal? quantity { get; set; }
  64 + }
  65 +}
  66 +
  67 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPersonTimesRecord/LqPersonTimesRecordInfoOutput.cs 0 → 100644
  1 +using System;
  2 +
  3 +namespace NCC.Extend.Entitys.Dto.LqPersonTimesRecord
  4 +{
  5 + /// <summary>
  6 + /// 人次记录信息输出参数
  7 + /// </summary>
  8 + public class LqPersonTimesRecordInfoOutput
  9 + {
  10 + /// <summary>
  11 + /// 主键ID
  12 + /// </summary>
  13 + public string id { get; set; }
  14 +
  15 + /// <summary>
  16 + /// 关联业务记录ID
  17 + /// </summary>
  18 + public string businessId { get; set; }
  19 +
  20 + /// <summary>
  21 + /// 业务类型(耗卡/开单)
  22 + /// </summary>
  23 + public string businessType { get; set; }
  24 +
  25 + /// <summary>
  26 + /// 人员类型(健康师/科技老师)
  27 + /// </summary>
  28 + public string personType { get; set; }
  29 +
  30 + /// <summary>
  31 + /// 人员ID
  32 + /// </summary>
  33 + public string personId { get; set; }
  34 +
  35 + /// <summary>
  36 + /// 人员姓名
  37 + /// </summary>
  38 + public string personName { get; set; }
  39 +
  40 + /// <summary>
  41 + /// 客户ID
  42 + /// </summary>
  43 + public string memberId { get; set; }
  44 +
  45 + /// <summary>
  46 + /// 客户姓名
  47 + /// </summary>
  48 + public string memberName { get; set; }
  49 +
  50 + /// <summary>
  51 + /// 工作日期(用于人次统计,格式:YYYY-MM-DD)
  52 + /// </summary>
  53 + public DateTime? workDate { get; set; }
  54 +
  55 + /// <summary>
  56 + /// 工作月份(用于人头统计,格式:202511)
  57 + /// </summary>
  58 + public string workMonth { get; set; }
  59 +
  60 + /// <summary>
  61 + /// 数量
  62 + /// </summary>
  63 + public decimal? quantity { get; set; }
  64 +
  65 + /// <summary>
  66 + /// 创建时间
  67 + /// </summary>
  68 + public DateTime? createTime { get; set; }
  69 +
  70 + /// <summary>
  71 + /// 是否有效
  72 + /// </summary>
  73 + public int isEffective { get; set; }
  74 + }
  75 +}
  76 +
  77 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPersonTimesRecord/LqPersonTimesRecordListOutput.cs 0 → 100644
  1 +using System;
  2 +
  3 +namespace NCC.Extend.Entitys.Dto.LqPersonTimesRecord
  4 +{
  5 + /// <summary>
  6 + /// 人次记录列表输出参数
  7 + /// </summary>
  8 + public class LqPersonTimesRecordListOutput
  9 + {
  10 + /// <summary>
  11 + /// 主键ID
  12 + /// </summary>
  13 + public string id { get; set; }
  14 +
  15 + /// <summary>
  16 + /// 关联业务记录ID
  17 + /// </summary>
  18 + public string businessId { get; set; }
  19 +
  20 + /// <summary>
  21 + /// 业务类型(耗卡/开单)
  22 + /// </summary>
  23 + public string businessType { get; set; }
  24 +
  25 + /// <summary>
  26 + /// 人员类型(健康师/科技老师)
  27 + /// </summary>
  28 + public string personType { get; set; }
  29 +
  30 + /// <summary>
  31 + /// 人员ID
  32 + /// </summary>
  33 + public string personId { get; set; }
  34 +
  35 + /// <summary>
  36 + /// 人员姓名
  37 + /// </summary>
  38 + public string personName { get; set; }
  39 +
  40 + /// <summary>
  41 + /// 客户ID
  42 + /// </summary>
  43 + public string memberId { get; set; }
  44 +
  45 + /// <summary>
  46 + /// 客户姓名
  47 + /// </summary>
  48 + public string memberName { get; set; }
  49 +
  50 + /// <summary>
  51 + /// 工作日期(用于人次统计,格式:YYYY-MM-DD)
  52 + /// </summary>
  53 + public DateTime? workDate { get; set; }
  54 +
  55 + /// <summary>
  56 + /// 工作月份(用于人头统计,格式:202511)
  57 + /// </summary>
  58 + public string workMonth { get; set; }
  59 +
  60 + /// <summary>
  61 + /// 数量
  62 + /// </summary>
  63 + public decimal? quantity { get; set; }
  64 +
  65 + /// <summary>
  66 + /// 创建时间
  67 + /// </summary>
  68 + public DateTime? createTime { get; set; }
  69 +
  70 + /// <summary>
  71 + /// 是否有效
  72 + /// </summary>
  73 + public int isEffective { get; set; }
  74 + }
  75 +}
  76 +
  77 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqPersonTimesRecord/LqPersonTimesRecordUpInput.cs 0 → 100644
  1 +namespace NCC.Extend.Entitys.Dto.LqPersonTimesRecord
  2 +{
  3 + /// <summary>
  4 + /// 人次记录更新输入参数
  5 + /// </summary>
  6 + public class LqPersonTimesRecordUpInput : LqPersonTimesRecordCrInput
  7 + {
  8 + /// <summary>
  9 + /// 主键ID
  10 + /// </summary>
  11 + public string id { get; set; }
  12 + }
  13 +}
  14 +
  15 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhHyhk/LqXhHyhkCrInput.cs
... ... @@ -84,6 +84,10 @@ namespace NCC.Extend.Entitys.Dto.LqXhHyhk
84 84 /// </summary>
85 85 public decimal? overtimeCoefficient { get; set; } = 0;
86 86  
  87 + /// <summary>
  88 + /// 预约记录ID
  89 + /// </summary>
  90 + public string appointmentId { get; set; }
87 91  
88 92 /// <summary>
89 93 /// 耗卡_品项明细
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhHyhk/LqXhHyhkInfoOutput.cs
1 1 using System;
2 2 using System.Collections.Generic;
  3 +using NCC.Extend.Entitys.Dto.LqPersonTimesRecord;
3 4 using NCC.Extend.Entitys.Dto.LqXhJksyj;
4 5 using NCC.Extend.Entitys.Dto.LqXhKjbsyj;
5 6 using NCC.Extend.Entitys.Dto.LqXhPxmx;
... ... @@ -141,5 +142,15 @@ namespace NCC.Extend.Entitys.Dto.LqXhHyhk
141 142 /// </summary>
142 143 public List<LqXhPxmxInfoOutput> lqXhPxmxList { get; set; }
143 144  
  145 + /// <summary>
  146 + /// 预约记录ID
  147 + /// </summary>
  148 + public string appointmentId { get; set; }
  149 +
  150 + /// <summary>
  151 + /// 人次记录列表
  152 + /// </summary>
  153 + public List<LqPersonTimesRecordListOutput> personTimesRecordList { get; set; }
  154 +
144 155 }
145 156 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhHyhk/LqXhHyhkListOutput.cs
1 1 using System;
2 2 using System.Collections.Generic;
  3 +using NCC.Extend.Entitys.Dto.LqPersonTimesRecord;
3 4 using NCC.Extend.Entitys.Dto.LqXhJksyj;
4 5 using NCC.Extend.Entitys.Dto.LqXhKjbsyj;
5 6 using NCC.Extend.Entitys.Dto.LqXhPxmx;
  7 +using NCC.Extend.Entitys.Dto.LqYyjl;
6 8  
7 9 namespace NCC.Extend.Entitys.Dto.LqXhHyhk
8 10 {
... ... @@ -122,5 +124,15 @@ namespace NCC.Extend.Entitys.Dto.LqXhHyhk
122 124 /// </summary>
123 125 public List<LqXhKjbsyjInfoOutput> lqXhKjbsyjList { get; set; }
124 126  
  127 + /// <summary>
  128 + /// 预约记录ID
  129 + /// </summary>
  130 + public string appointmentId { get; set; }
  131 +
  132 + /// <summary>
  133 + /// 人次记录列表
  134 + /// </summary>
  135 + public List<LqPersonTimesRecordListOutput> personTimesRecordList { get; set; }
  136 +
125 137 }
126 138 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/LqXhPxmxCrInput.cs
1 1 using System;
2 2 using System.Collections.Generic;
  3 +using NCC.Extend.Entitys.Dto.LqXhJksyj;
  4 +using NCC.Extend.Entitys.Dto.LqXhKjbsyj;
3 5  
4 6 namespace NCC.Extend.Entitys.Dto.LqXhPxmx
5 7 {
... ... @@ -66,11 +68,11 @@ namespace NCC.Extend.Entitys.Dto.LqXhPxmx
66 68 /// <summary>
67 69 /// 健康师业绩
68 70 /// </summary>
69   - public List<LqXhJksyj.LqXhJksyjCrInput> lqXhJksyjList { get; set; }
  71 + public List<LqXhJksyjCrInput> lqXhJksyjList { get; set; }
70 72  
71 73 /// <summary>
72 74 /// 科技部老师业绩
73 75 /// </summary>
74   - public List<LqXhKjbsyj.LqXhKjbsyjCrInput> lqXhKjbsyjList { get; set; }
  76 + public List<LqXhKjbsyjCrInput> lqXhKjbsyjList { get; set; }
75 77 }
76 78 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqYyjl/LqYyjlAddNoDealRemarkInput.cs 0 → 100644
  1 +namespace NCC.Extend.Entitys.Dto.LqYyjl
  2 +{
  3 + /// <summary>
  4 + /// 添加未成交说明输入参数
  5 + /// </summary>
  6 + public class LqYyjlAddNoDealRemarkInput
  7 + {
  8 + /// <summary>
  9 + /// 预约记录ID
  10 + /// </summary>
  11 + public string id { get; set; }
  12 +
  13 + /// <summary>
  14 + /// 未成交说明
  15 + /// </summary>
  16 + public string noDealRemark { get; set; }
  17 + }
  18 +}
  19 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_hytk_mx/LqHytkMxEntity.cs
... ... @@ -49,6 +49,12 @@ namespace NCC.Extend.Entitys.lq_hytk_mx
49 49 public string Pxmc { get; set; }
50 50  
51 51 /// <summary>
  52 + /// 品项分类
  53 + /// </summary>
  54 + [SugarColumn(ColumnName = "F_ItemCategory")]
  55 + public string ItemCategory { get; set; }
  56 +
  57 + /// <summary>
52 58 /// 品项价格
53 59 /// </summary>
54 60 [SugarColumn(ColumnName = "pxjg")]
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_kd_deductinfo/LqKdDeductinfoEntity.cs
... ... @@ -66,6 +66,12 @@ namespace NCC.Extend.Entitys.lq_kd_deductinfo
66 66 public string ItemId { get; set; }
67 67  
68 68 /// <summary>
  69 + /// 品项分类
  70 + /// </summary>
  71 + [SugarColumn(ColumnName = "F_ItemCategory")]
  72 + public string ItemCategory { get; set; }
  73 +
  74 + /// <summary>
69 75 /// 创建时间
70 76 /// </summary>
71 77 [SugarColumn(ColumnName = "F_CreateTime")]
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_kd_pxmx/LqKdPxmxEntity.cs
... ... @@ -36,6 +36,12 @@ namespace NCC.Extend.Entitys.lq_kd_pxmx
36 36 public string Pxmc { get; set; }
37 37  
38 38 /// <summary>
  39 + /// 品项分类
  40 + /// </summary>
  41 + [SugarColumn(ColumnName = "F_ItemCategory")]
  42 + public string ItemCategory { get; set; }
  43 +
  44 + /// <summary>
39 45 /// 品项价格
40 46 /// </summary>
41 47 [SugarColumn(ColumnName = "pxjg")]
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_person_times_record/LqPersonTimesRecordEntity.cs 0 → 100644
  1 +using System;
  2 +using NCC.Common.Const;
  3 +using NCC.Extend.Entitys.Enum;
  4 +using SqlSugar;
  5 +
  6 +namespace NCC.Extend.Entitys.lq_person_times_record
  7 +{
  8 + /// <summary>
  9 + /// 人次记录表
  10 + /// </summary>
  11 + [SugarTable("lq_person_times_record")]
  12 + [Tenant(ClaimConst.TENANT_ID)]
  13 + public class LqPersonTimesRecordEntity
  14 + {
  15 + /// <summary>
  16 + /// 主键ID
  17 + /// </summary>
  18 + [SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)]
  19 + public string Id { get; set; }
  20 +
  21 + /// <summary>
  22 + /// 关联业务记录ID
  23 + /// </summary>
  24 + [SugarColumn(ColumnName = "F_BusinessId")]
  25 + public string BusinessId { get; set; }
  26 +
  27 + /// <summary>
  28 + /// 业务类型(耗卡/开单)
  29 + /// </summary>
  30 + [SugarColumn(ColumnName = "F_BusinessType")]
  31 + public string BusinessType { get; set; }
  32 +
  33 + /// <summary>
  34 + /// 人员类型(健康师/科技老师)
  35 + /// </summary>
  36 + [SugarColumn(ColumnName = "F_PersonType")]
  37 + public string PersonType { get; set; }
  38 +
  39 + /// <summary>
  40 + /// 人员ID
  41 + /// </summary>
  42 + [SugarColumn(ColumnName = "F_PersonId")]
  43 + public string PersonId { get; set; }
  44 +
  45 + /// <summary>
  46 + /// 人员姓名
  47 + /// </summary>
  48 + [SugarColumn(ColumnName = "F_PersonName")]
  49 + public string PersonName { get; set; }
  50 +
  51 + /// <summary>
  52 + /// 客户ID
  53 + /// </summary>
  54 + [SugarColumn(ColumnName = "F_MemberId")]
  55 + public string MemberId { get; set; }
  56 +
  57 + /// <summary>
  58 + /// 客户姓名
  59 + /// </summary>
  60 + [SugarColumn(ColumnName = "F_MemberName")]
  61 + public string MemberName { get; set; }
  62 +
  63 + /// <summary>
  64 + /// 工作日期(用于人次统计,格式:YYYY-MM-DD)
  65 + /// </summary>
  66 + [SugarColumn(ColumnName = "F_WorkDate")]
  67 + public DateTime? WorkDate { get; set; }
  68 +
  69 + /// <summary>
  70 + /// 工作月份(用于人头统计,格式:202511)
  71 + /// </summary>
  72 + [SugarColumn(ColumnName = "F_WorkMonth")]
  73 + public string WorkMonth { get; set; }
  74 +
  75 + /// <summary>
  76 + /// 数量
  77 + /// </summary>
  78 + [SugarColumn(ColumnName = "F_Quantity")]
  79 + public decimal? Quantity { get; set; }
  80 +
  81 + /// <summary>
  82 + /// 创建时间
  83 + /// </summary>
  84 + [SugarColumn(ColumnName = "F_CreateTime")]
  85 + public DateTime? CreateTime { get; set; }
  86 +
  87 + /// <summary>
  88 + /// 是否有效
  89 + /// </summary>
  90 + [SugarColumn(ColumnName = "F_IsEffective")]
  91 + public int IsEffective { get; set; } = StatusEnum.有效.GetHashCode();
  92 + }
  93 +}
  94 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_xh_pxmx/LqXhPxmxEntity.cs
... ... @@ -42,6 +42,12 @@ namespace NCC.Extend.Entitys.lq_xh_pxmx
42 42 public string Pxmc { get; set; }
43 43  
44 44 /// <summary>
  45 + /// 品项分类
  46 + /// </summary>
  47 + [SugarColumn(ColumnName = "F_ItemCategory")]
  48 + public string ItemCategory { get; set; }
  49 +
  50 + /// <summary>
45 51 /// 品项价格
46 52 /// </summary>
47 53 [SugarColumn(ColumnName = "pxjg")]
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqHytkHytkService.cs
... ... @@ -25,6 +25,7 @@ using NCC.Extend.Entitys.lq_hytk_jksyj;
25 25 using NCC.Extend.Entitys.lq_hytk_kjbsyj;
26 26 using NCC.Extend.Entitys.lq_hytk_mx;
27 27 using NCC.Extend.Entitys.lq_kd_pxmx;
  28 +using NCC.Extend.Entitys.lq_xmzl;
28 29 using NCC.Extend.Interfaces.LqHytkHytk;
29 30 using NCC.FriendlyException;
30 31 using NCC.JsonSerialization;
... ... @@ -408,6 +409,7 @@ namespace NCC.Extend.LqHytkHytk
408 409 SourceType = item.F_SourceType,
409 410 TotalPrice = item.F_TotalPrice ?? (item.pxjg * (item.F_ProjectNumber ?? 1)),
410 411 IsEffective = StatusEnum.有效.GetHashCode(),
  412 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.px).Select(x => x.Qt2).FirstAsync(),
411 413 };
412 414 allMxEntities.Add(lqHytkMxEntity);
413 415  
... ... @@ -559,6 +561,7 @@ namespace NCC.Extend.LqHytkHytk
559 561 ProjectNumber = item.F_ProjectNumber ?? 1,
560 562 SourceType = item.F_SourceType,
561 563 TotalPrice = item.F_TotalPrice ?? (item.pxjg * (item.F_ProjectNumber ?? 1)),
  564 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.px).Select(x => x.Qt2).FirstAsync(),
562 565 };
563 566 allMxEntities.Add(lqHytkMxEntity);
564 567  
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
... ... @@ -363,65 +363,77 @@ namespace NCC.Extend.LqKdKdjlb
363 363 var jksyjList = new List<LqKdJksyjInfoOutput>();
364 364 if (billingIds.Any())
365 365 {
366   - jksyjList = await _db.Queryable<LqKdJksyjEntity>()
367   - .Where(x => billingIds.Contains(x.Glkdbh) && x.IsEffective == StatusEnum.有效.GetHashCode())
368   - .Select(x => new LqKdJksyjInfoOutput
369   - {
370   - id = x.Id,
371   - glkdbh = x.Glkdbh,
372   - kdpxid = x.Kdpxid,
373   - jks = x.Jks,
374   - jksxm = x.Jksxm,
375   - jkszh = x.Jkszh,
376   - jksyj = x.Jksyj,
377   - yjsj = x.Yjsj,
378   - jsj_id = x.Jsj_id,
379   - isEffective = x.IsEffective
380   - })
381   - .ToListAsync();
  366 + jksyjList = await _db.Queryable<LqKdJksyjEntity>().Where(x => billingIds.Contains(x.Glkdbh) && x.IsEffective == StatusEnum.有效.GetHashCode()).Select(x => new LqKdJksyjInfoOutput
  367 + {
  368 + id = x.Id,
  369 + glkdbh = x.Glkdbh,
  370 + kdpxid = x.Kdpxid,
  371 + jks = x.Jks,
  372 + jksxm = x.Jksxm,
  373 + jkszh = x.Jkszh,
  374 + jksyj = x.Jksyj,
  375 + yjsj = x.Yjsj,
  376 + jsj_id = x.Jsj_id,
  377 + isEffective = x.IsEffective
  378 + }).ToListAsync();
382 379 }
383 380  
384 381 // 批量查询科技部老师业绩(性能优化:一次性查询所有开单的科技部老师业绩)
385 382 var kjbsyjList = new List<LqKdKjbsyjInfoOutput>();
386 383 if (billingIds.Any())
387 384 {
388   - kjbsyjList = await _db.Queryable<LqKdKjbsyjEntity>()
389   - .Where(x => billingIds.Contains(x.Glkdbh) && x.IsEffective == StatusEnum.有效.GetHashCode())
390   - .Select(x => new LqKdKjbsyjInfoOutput
  385 + kjbsyjList = await _db.Queryable<LqKdKjbsyjEntity>().Where(x => billingIds.Contains(x.Glkdbh) && x.IsEffective == StatusEnum.有效.GetHashCode()).Select(x => new LqKdKjbsyjInfoOutput
  386 + {
  387 + id = x.Id,
  388 + glkdbh = x.Glkdbh,
  389 + kdpxid = x.Kdpxid,
  390 + kjbls = x.Kjbls,
  391 + kjblsxm = x.Kjblsxm,
  392 + kjblszh = x.Kjblszh,
  393 + kjblsyj = x.Kjblsyj,
  394 + yjsj = x.Yjsj,
  395 + isEffective = x.IsEffective
  396 + })
  397 + .ToListAsync();
  398 + }
  399 +
  400 + // 批量查询储扣扣款信息(性能优化:一次性查询所有开单的储扣扣款信息)
  401 + var deductinfoList = new List<LqKdDeductinfoInfoOutput>();
  402 + if (billingIds.Any())
  403 + {
  404 + deductinfoList = await _db.Queryable<LqKdDeductinfoEntity>().Where(x => billingIds.Contains(x.BillingId) && x.IsEffective == StatusEnum.有效.GetHashCode())
  405 + .Select(x => new LqKdDeductinfoInfoOutput
391 406 {
392 407 id = x.Id,
393   - glkdbh = x.Glkdbh,
394   - kdpxid = x.Kdpxid,
395   - kjbls = x.Kjbls,
396   - kjblsxm = x.Kjblsxm,
397   - kjblszh = x.Kjblszh,
398   - kjblsyj = x.Kjblsyj,
399   - yjsj = x.Yjsj,
400   - isEffective = x.IsEffective
  408 + deductType = x.DeductType,
  409 + deductId = x.DeductId,
  410 + billingId = x.BillingId,
  411 + amount = x.Amount,
  412 + isEffective = x.IsEffective,
  413 + unitPrice = x.UnitPrice,
  414 + itemName = x.ItemName,
  415 + itemId = x.ItemId,
  416 + createTime = x.CreateTime,
  417 + projectNumber = x.ProjectNumber,
  418 +
401 419 })
402 420 .ToListAsync();
403 421 }
404 422  
  423 + // 按开单ID分组储扣扣款信息
  424 + var deductinfoGrouped = deductinfoList.GroupBy(x => x.billingId).ToDictionary(g => g.Key, g => g.ToList());
405 425 // 按开单ID分组健康师业绩
406   - var jksyjGrouped = jksyjList.GroupBy(x => x.glkdbh)
407   - .ToDictionary(g => g.Key, g => g.ToList());
408   -
  426 + var jksyjGrouped = jksyjList.GroupBy(x => x.glkdbh).ToDictionary(g => g.Key, g => g.ToList());
409 427 // 按开单ID分组科技部老师业绩
410   - var kjbsyjGrouped = kjbsyjList.GroupBy(x => x.glkdbh)
411   - .ToDictionary(g => g.Key, g => g.ToList());
  428 + var kjbsyjGrouped = kjbsyjList.GroupBy(x => x.glkdbh).ToDictionary(g => g.Key, g => g.ToList());
412 429  
413 430 // 为每个开单记录分配品项明细、健康师业绩和科技部老师业绩
414 431 foreach (var item in data.list)
415 432 {
416   - item.ItemDetails = itemDetailsGrouped.ContainsKey(item.id)
417   - ? itemDetailsGrouped[item.id]
418   - : new List<LqKdPxmxInfoOutput>();
419   - item.lqKdJksyjList = jksyjGrouped.ContainsKey(item.id)
420   - ? jksyjGrouped[item.id]
421   - : new List<LqKdJksyjInfoOutput>();
422   - item.lqKdKjbsyjList = kjbsyjGrouped.ContainsKey(item.id)
423   - ? kjbsyjGrouped[item.id]
424   - : new List<LqKdKjbsyjInfoOutput>();
  433 + item.ItemDetails = itemDetailsGrouped.ContainsKey(item.id) ? itemDetailsGrouped[item.id] : new List<LqKdPxmxInfoOutput>();
  434 + item.lqKdJksyjList = jksyjGrouped.ContainsKey(item.id) ? jksyjGrouped[item.id] : new List<LqKdJksyjInfoOutput>();
  435 + item.lqKdKjbsyjList = kjbsyjGrouped.ContainsKey(item.id) ? kjbsyjGrouped[item.id] : new List<LqKdKjbsyjInfoOutput>();
  436 + item.lqKdDeductList = deductinfoGrouped.ContainsKey(item.id) ? deductinfoGrouped[item.id] : new List<LqKdDeductinfoInfoOutput>();
425 437 }
426 438  
427 439 return PageResult<LqKdKdjlbListOutput>.SqlSugarPageResult(data);
... ... @@ -802,6 +814,7 @@ namespace NCC.Extend.LqKdKdjlb
802 814 ItemId = item.ItemId,
803 815 IsEffective = StatusEnum.有效.GetHashCode(), // 设置为有效
804 816 CreateTime = DateTime.Now, // 设置创建时间
  817 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.ItemId).Select(x => x.Qt2).FirstAsync(),
805 818 };
806 819 allDeductEntities.Add(lqKdDeductEntity);
807 820 }
... ... @@ -827,6 +840,7 @@ namespace NCC.Extend.LqKdKdjlb
827 840 Remark = item.remark,
828 841 IsEffective = StatusEnum.有效.GetHashCode(),
829 842 ActivityId = input.activityId,
  843 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.px).Select(x => x.Qt2).FirstAsync(),
830 844 };
831 845 allPxmxEntities.Add(lqKdPxmxEntity);
832 846  
... ... @@ -1546,6 +1560,7 @@ namespace NCC.Extend.LqKdKdjlb
1546 1560 ItemId = item.ItemId,
1547 1561 IsEffective = StatusEnum.有效.GetHashCode(), // 设置为有效
1548 1562 CreateTime = DateTime.Now, // 设置创建时间
  1563 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.DeductId).Select(x => x.Qt2).FirstAsync(),
1549 1564 };
1550 1565 allDeductEntities.Add(lqKdDeductEntity);
1551 1566 }
... ... @@ -1571,6 +1586,7 @@ namespace NCC.Extend.LqKdKdjlb
1571 1586 Remark = item.remark,
1572 1587 IsEffective = StatusEnum.有效.GetHashCode(),
1573 1588 ActivityId = input.activityId,
  1589 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.px).Select(x => x.Qt2).FirstAsync(),
1574 1590 };
1575 1591 allPxmxEntities.Add(lqKdPxmxEntity);
1576 1592  
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs
... ... @@ -16,18 +16,22 @@ using NCC.Common.Model.NPOI;
16 16 using NCC.DataEncryption;
17 17 using NCC.Dependency;
18 18 using NCC.DynamicApiController;
  19 +using NCC.Extend.Entitys.Dto.LqPersonTimesRecord;
19 20 using NCC.Extend.Entitys.Dto.LqXhHyhk;
20 21 using NCC.Extend.Entitys.Dto.LqXhJksyj;
21 22 using NCC.Extend.Entitys.Dto.LqXhKjbsyj;
22 23 using NCC.Extend.Entitys.Dto.LqXhPxmx;
  24 +using NCC.Extend.Entitys.Dto.LqYyjl;
23 25 using NCC.Extend.Entitys.Enum;
24 26 using NCC.Extend.Entitys.lq_kd_kdjlb;
25 27 using NCC.Extend.Entitys.lq_kd_pxmx;
26 28 using NCC.Extend.Entitys.lq_khxx;
  29 +using NCC.Extend.Entitys.lq_person_times_record;
27 30 using NCC.Extend.Entitys.lq_xh_hyhk;
28 31 using NCC.Extend.Entitys.lq_xh_jksyj;
29 32 using NCC.Extend.Entitys.lq_xh_kjbsyj;
30 33 using NCC.Extend.Entitys.lq_xh_pxmx;
  34 +using NCC.Extend.Entitys.lq_xmzl;
31 35 using NCC.Extend.Interfaces.LqXhHyhk;
32 36 using NCC.FriendlyException;
33 37 using NCC.JsonSerialization;
... ... @@ -111,13 +115,12 @@ namespace NCC.Extend.LqXhHyhk
111 115  
112 116 // 2. 查询品项明细列表
113 117 var lqXhPxmxList = await _db.Queryable<LqXhPxmxEntity>().Where(w => w.ConsumeInfoId == entity.Id).ToListAsync();
114   -
115 118 // 3. 查询健康师业绩列表
116 119 var lqXhJksyjList = await _db.Queryable<LqXhJksyjEntity>().Where(w => w.Glkdbh == entity.Id).ToListAsync();
117   -
118 120 // 4. 查询科技部老师业绩列表
119 121 var lqXhKjbsyjList = await _db.Queryable<LqXhKjbsyjEntity>().Where(w => w.Glkdbh == entity.Id).ToListAsync();
120   -
  122 + // 获取人次记录列表
  123 + var personTimesRecordList = await _db.Queryable<LqPersonTimesRecordEntity>().Where(x => x.BusinessId == entity.Id && x.IsEffective == StatusEnum.有效.GetHashCode()).ToListAsync();
121 124 // 5. 构建品项明细输出,每个品项关联对应的业绩信息
122 125 var pxmxOutputList = new List<LqXhPxmxInfoOutput>();
123 126 foreach (var pxmx in lqXhPxmxList)
... ... @@ -299,8 +302,7 @@ namespace NCC.Extend.LqXhHyhk
299 302 // 如果两个都传入了,需要同时JOIN两个表
300 303 if (!string.IsNullOrEmpty(input.jksId) && !string.IsNullOrEmpty(input.kjblsId))
301 304 {
302   - query = _db.Queryable<LqXhJksyjEntity, LqXhKjbsyjEntity, LqXhHyhkEntity>(
303   - (jksyj, kjbsyj, hyhk) => jksyj.Glkdbh == hyhk.Id && kjbsyj.Glkdbh == hyhk.Id)
  305 + query = _db.Queryable<LqXhJksyjEntity, LqXhKjbsyjEntity, LqXhHyhkEntity>((jksyj, kjbsyj, hyhk) => jksyj.Glkdbh == hyhk.Id && kjbsyj.Glkdbh == hyhk.Id)
304 306 .Where((jksyj, kjbsyj, hyhk) => jksyj.Jkszh == input.jksId && jksyj.IsEffective == StatusEnum.有效.GetHashCode())
305 307 .Where((jksyj, kjbsyj, hyhk) => kjbsyj.Kjblszh == input.kjblsId && kjbsyj.IsEffective == StatusEnum.有效.GetHashCode())
306 308 .Select((jksyj, kjbsyj, hyhk) => hyhk)
... ... @@ -369,6 +371,7 @@ namespace NCC.Extend.LqXhHyhk
369 371 overtimeCoefficient = it.OvertimeCoefficient,
370 372 originalSgfy = it.OriginalSgfy,
371 373 overtimeSgfy = it.OvertimeSgfy,
  374 + appointmentId = it.AppointmentId,
372 375 })
373 376 .MergeTable()
374 377 .OrderBy($"{sidx} {sort}")
... ... @@ -517,101 +520,6 @@ namespace NCC.Extend.LqXhHyhk
517 520 }
518 521 #endregion
519 522  
520   - #region 获取会员耗卡列表(备份)
521   - /// <summary>
522   - /// 获取会员耗卡列表
523   - /// </summary>
524   - /// <param name="input">请求参数</param>
525   - /// <returns></returns>
526   - [HttpGet("GetListBak")]
527   - public async Task<dynamic> GetListBak([FromQuery] LqXhHyhkListQueryInput input)
528   - {
529   - var sidx = input.sidx == null ? "id" : input.sidx;
530   - List<string> queryHksj = input.hksj != null ? input.hksj.Split(',').ToObeject<List<string>>() : null;
531   - DateTime? startHksj = queryHksj != null ? Ext.GetDateTime(queryHksj.First()) : null;
532   - DateTime? endHksj = queryHksj != null ? Ext.GetDateTime(queryHksj.Last()) : null;
533   - var data = await _db.Queryable<LqXhHyhkEntity>()
534   - .WhereIF(!string.IsNullOrEmpty(input.keyword), p => p.Hymc.Contains(input.keyword) || p.Hyzh.Contains(input.keyword) || p.MemberPhone.Contains(input.keyword))
535   - .WhereIF(!string.IsNullOrEmpty(input.id), p => p.Id.Contains(input.id))
536   - .WhereIF(!string.IsNullOrEmpty(input.md), p => p.Md.Equals(input.md))
537   - .WhereIF(!string.IsNullOrEmpty(input.mdbh), p => p.Mdbh.Contains(input.mdbh))
538   - .WhereIF(!string.IsNullOrEmpty(input.mdmc), p => p.Mdmc.Contains(input.mdmc))
539   - .WhereIF(!string.IsNullOrEmpty(input.hy), p => p.Hy.Equals(input.hy))
540   - .WhereIF(!string.IsNullOrEmpty(input.hyzh), p => p.Hyzh.Contains(input.hyzh))
541   - .WhereIF(!string.IsNullOrEmpty(input.hymc), p => p.Hymc.Contains(input.hymc))
542   - .WhereIF(!string.IsNullOrEmpty(input.gklx), p => p.Gklx.Equals(input.gklx))
543   - .WhereIF(!string.IsNullOrEmpty(input.sfykjb), p => p.Sfykjb.Equals(input.sfykjb))
544   - .WhereIF(queryHksj != null, p => p.Hksj >= new DateTime(startHksj.ToDate().Year, startHksj.ToDate().Month, startHksj.ToDate().Day, 0, 0, 0))
545   - .WhereIF(queryHksj != null, p => p.Hksj <= new DateTime(endHksj.ToDate().Year, endHksj.ToDate().Month, endHksj.ToDate().Day, 23, 59, 59))
546   - .WhereIF(!string.IsNullOrEmpty(input.czry), p => p.Czry.Equals(input.czry))
547   - .WhereIF(input.isEffective != 0, p => p.IsEffective == input.isEffective)
548   - .Select(it => new LqXhHyhkListOutput
549   - {
550   - id = it.Id,
551   - md = it.Md,
552   - mdbh = it.Mdbh,
553   - mdmc = it.Mdmc,
554   - hy = it.Hy,
555   - hyzh = it.Hyzh,
556   - hymc = SqlFunc.Subqueryable<LqKhxxEntity>().Where(w => w.Id == it.Hy).Select(w => w.Khmc),
557   - gklx = it.Gklx,
558   - xfje = SqlFunc.ToString(it.Xfje),
559   - sgfy = SqlFunc.ToString(it.Sgfy),
560   - sfykjb = it.Sfykjb,
561   - hksj = it.Hksj,
562   - czry = it.Czry,
563   - memberPhone = SqlFunc.Subqueryable<LqKhxxEntity>().Where(w => w.Id == it.Hy).Select(w => w.Sjh),
564   - isEffective = it.IsEffective,
565   - })
566   - .MergeTable()
567   - .OrderBy(sidx + " " + input.sort)
568   - .ToPagedListAsync(input.currentPage, input.pageSize);
569   -
570   - // 获取当前页的耗卡记录ID列表
571   - var consumeIds = data.list.Select(x => x.id).ToList();
572   -
573   - // 批量查询耗卡明细
574   - var consumeDetails = new List<LqXhPxmxInfoOutput>();
575   - if (consumeIds.Any())
576   - {
577   - consumeDetails = await _db.Queryable<LqXhPxmxEntity>()
578   - .Where(x => consumeIds.Contains(x.ConsumeInfoId) && x.IsEffective == StatusEnum.有效.GetHashCode())
579   - .Select(x => new LqXhPxmxInfoOutput
580   - {
581   - id = x.Id,
582   - consumeInfoId = x.ConsumeInfoId,
583   - billingItemId = x.BillingItemId,
584   - px = x.Px,
585   - pxmc = x.Pxmc,
586   - pxjg = x.Pxjg,
587   - memberId = x.MemberId,
588   - createTime = x.CreateTIme,
589   - projectNumber = x.ProjectNumber,
590   - originalProjectNumber = x.OriginalProjectNumber,
591   - overtimeProjectNumber = x.OvertimeProjectNumber,
592   - sourceType = x.SourceType,
593   - totalPrice = x.TotalPrice,
594   - isEffective = x.IsEffective,
595   - })
596   - .ToListAsync();
597   - }
598   -
599   - // 按耗卡记录ID分组耗卡明细
600   - var consumeDetailsGrouped = consumeDetails.GroupBy(x => x.consumeInfoId)
601   - .ToDictionary(g => g.Key, g => g.ToList());
602   -
603   - // 为每个耗卡记录分配耗卡明细
604   - foreach (var item in data.list)
605   - {
606   - item.ConsumeDetails = consumeDetailsGrouped.ContainsKey(item.id)
607   - ? consumeDetailsGrouped[item.id]
608   - : new List<LqXhPxmxInfoOutput>();
609   - }
610   -
611   - return PageResult<LqXhHyhkListOutput>.SqlSugarPageResult(data);
612   - }
613   - #endregion
614   -
615 523 #region 根据健康师ID获取耗卡列表
616 524 /// <summary>
617 525 /// 根据健康师ID获取耗卡列表
... ... @@ -670,8 +578,7 @@ namespace NCC.Extend.LqXhHyhk
670 578 }
671 579  
672 580 // 通过健康师业绩表关联查询耗卡记录
673   - var data = await _db.Queryable<LqXhJksyjEntity, LqXhHyhkEntity>(
674   - (jksyj, hyhk) => jksyj.Glkdbh == hyhk.Id)
  581 + var data = await _db.Queryable<LqXhJksyjEntity, LqXhHyhkEntity>((jksyj, hyhk) => jksyj.Glkdbh == hyhk.Id)
675 582 .Where((jksyj, hyhk) => jksyj.Jkszh == input.jksId)
676 583 .WhereIF(input.isEffective != 0, (jksyj, hyhk) => jksyj.IsEffective == input.isEffective && hyhk.IsEffective == input.isEffective)
677 584 .WhereIF(input.isEffective == 0, (jksyj, hyhk) => jksyj.IsEffective == StatusEnum.有效.GetHashCode() && hyhk.IsEffective == StatusEnum.有效.GetHashCode())
... ... @@ -705,15 +612,41 @@ namespace NCC.Extend.LqXhHyhk
705 612 .OrderBy($"{sidx} {sort}")
706 613 .ToPagedListAsync(input.currentPage, input.pageSize);
707 614  
  615 +
  616 +
708 617 // 获取当前页的耗卡记录ID列表
709 618 var consumeIds = data.list.Select(x => x.id).ToList();
710   -
  619 + // 获取人次记录列表
  620 + var personTimesRecordList = await _db.Queryable<LqPersonTimesRecordEntity>().Where(x => consumeIds.Contains(x.BusinessId) && x.IsEffective == StatusEnum.有效.GetHashCode())
  621 + .Select(x => new LqPersonTimesRecordListOutput
  622 + {
  623 + id = x.Id,
  624 + businessId = x.BusinessId,
  625 + businessType = x.BusinessType,
  626 + personType = x.PersonType,
  627 + personId = x.PersonId,
  628 + personName = x.PersonName,
  629 + memberId = x.MemberId,
  630 + memberName = x.MemberName,
  631 + workDate = x.WorkDate,
  632 + workMonth = x.WorkMonth,
  633 + quantity = x.Quantity,
  634 + createTime = x.CreateTime,
  635 + isEffective = x.IsEffective,
  636 + })
  637 + .ToListAsync();
  638 + // 按耗卡记录ID分组人次记录
  639 + var personTimesRecordGrouped = personTimesRecordList.GroupBy(x => x.businessId).ToDictionary(g => g.Key, g => g.ToList());
  640 + // 为每个耗卡记录分配人次记录
  641 + foreach (var item in data.list)
  642 + {
  643 + item.personTimesRecordList = personTimesRecordGrouped.ContainsKey(item.id) ? personTimesRecordGrouped[item.id] : new List<LqPersonTimesRecordListOutput>();
  644 + }
711 645 // 批量查询耗卡明细
712 646 var consumeDetails = new List<LqXhPxmxInfoOutput>();
713 647 if (consumeIds.Any())
714 648 {
715   - consumeDetails = await _db.Queryable<LqXhPxmxEntity>()
716   - .Where(x => consumeIds.Contains(x.ConsumeInfoId) && x.IsEffective == StatusEnum.有效.GetHashCode())
  649 + consumeDetails = await _db.Queryable<LqXhPxmxEntity>().Where(x => consumeIds.Contains(x.ConsumeInfoId) && x.IsEffective == StatusEnum.有效.GetHashCode())
717 650 .Select(x => new LqXhPxmxInfoOutput
718 651 {
719 652 id = x.Id,
... ... @@ -733,19 +666,13 @@ namespace NCC.Extend.LqXhHyhk
733 666 })
734 667 .ToListAsync();
735 668 }
736   -
737 669 // 按耗卡记录ID分组耗卡明细
738   - var consumeDetailsGrouped = consumeDetails.GroupBy(x => x.consumeInfoId)
739   - .ToDictionary(g => g.Key, g => g.ToList());
740   -
  670 + var consumeDetailsGrouped = consumeDetails.GroupBy(x => x.consumeInfoId).ToDictionary(g => g.Key, g => g.ToList());
741 671 // 为每个耗卡记录分配耗卡明细
742 672 foreach (var item in data.list)
743 673 {
744   - item.ConsumeDetails = consumeDetailsGrouped.ContainsKey(item.id)
745   - ? consumeDetailsGrouped[item.id]
746   - : new List<LqXhPxmxInfoOutput>();
  674 + item.ConsumeDetails = consumeDetailsGrouped.ContainsKey(item.id) ? consumeDetailsGrouped[item.id] : new List<LqXhPxmxInfoOutput>();
747 675 }
748   -
749 676 return PageResult<LqXhHyhkListOutput>.SqlSugarPageResult(data);
750 677 }
751 678 catch (Exception ex)
... ... @@ -956,6 +883,7 @@ namespace NCC.Extend.LqXhHyhk
956 883 entity.UpdateTime = DateTime.Now;
957 884 entity.OvertimeCoefficient = input.overtimeCoefficient ?? 0;
958 885 entity.OriginalSgfy = input.sgfy;
  886 + entity.AppointmentId = input.appointmentId;
959 887 //加班手工费 = 原始手工费 * 加班系数
960 888 entity.OvertimeSgfy = entity.OriginalSgfy * entity.OvertimeCoefficient;
961 889 //最终手工费 = 原始手工费 + 加班手工费
... ... @@ -979,6 +907,7 @@ namespace NCC.Extend.LqXhHyhk
979 907 var allPxmxEntities = new List<LqXhPxmxEntity>();
980 908 var allJksyjEntities = new List<LqXhJksyjEntity>();
981 909 var allKjbsyjEntities = new List<LqXhKjbsyjEntity>();
  910 + var allPersonTimesRecordEntities = new List<LqPersonTimesRecordEntity>();
982 911 // 处理品项明细列表
983 912 if (input.lqXhPxmxList != null && input.lqXhPxmxList.Any())
984 913 {
... ... @@ -1002,7 +931,7 @@ namespace NCC.Extend.LqXhHyhk
1002 931 Pxjg = item.pxjg,
1003 932 SourceType = item.sourceType,
1004 933 IsEffective = StatusEnum.有效.GetHashCode(),
1005   -
  934 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.px).Select(x => x.Qt2).FirstAsync(),
1006 935 };
1007 936 allPxmxEntities.Add(lqXhPxmxEntity);
1008 937  
... ... @@ -1074,6 +1003,57 @@ namespace NCC.Extend.LqXhHyhk
1074 1003 }
1075 1004 }
1076 1005 }
  1006 + //获取这次耗卡有多少个健康师
  1007 + var jksCount = allJksyjEntities.GroupBy(x => x.Jks).Count();
  1008 + //添加到人次表里面去
  1009 + foreach (var item in allJksyjEntities.Select(x => x.Jks).Distinct())
  1010 + {
  1011 + LqPersonTimesRecordEntity personTimesRecordEntity = new LqPersonTimesRecordEntity
  1012 + {
  1013 + Id = YitIdHelper.NextId().ToString(),
  1014 + BusinessId = newEntity.Id,
  1015 + BusinessType = "耗卡",
  1016 + PersonType = "健康师",
  1017 + PersonId = item,
  1018 + PersonName = allJksyjEntities.Where(x => x.Jks == item).Select(x => x.Jksxm).First(),
  1019 + MemberId = entity.Hy,
  1020 + MemberName = memberInfo.Khmc,
  1021 + WorkDate = input.hksj,
  1022 + WorkMonth = input.hksj.ToDate().ToString("yyyyMM"),
  1023 + Quantity = 1 / (decimal)jksCount,
  1024 + CreateTime = DateTime.Now,
  1025 + IsEffective = StatusEnum.有效.GetHashCode(),
  1026 + };
  1027 + allPersonTimesRecordEntities.Add(personTimesRecordEntity);
  1028 + }
  1029 + //获取这次耗卡有多少个科技部老师
  1030 + var kjbCount = allKjbsyjEntities.GroupBy(x => x.Kjbls).Count();
  1031 + //添加到人次表里面去
  1032 + foreach (var item in allKjbsyjEntities.Select(x => x.Kjbls).Distinct())
  1033 + {
  1034 + LqPersonTimesRecordEntity personTimesRecordEntity = new LqPersonTimesRecordEntity
  1035 + {
  1036 + Id = YitIdHelper.NextId().ToString(),
  1037 + BusinessId = newEntity.Id,
  1038 + BusinessType = "耗卡",
  1039 + PersonType = "科技部老师",
  1040 + PersonId = item,
  1041 + PersonName = allKjbsyjEntities.Where(x => x.Kjbls == item).Select(x => x.Kjblsxm).First(),
  1042 + MemberId = entity.Hy,
  1043 + MemberName = memberInfo.Khmc,
  1044 + WorkDate = input.hksj,
  1045 + WorkMonth = input.hksj.ToDate().ToString("yyyyMM"),
  1046 + Quantity = 1 / (decimal)kjbCount,
  1047 + CreateTime = DateTime.Now,
  1048 + IsEffective = StatusEnum.有效.GetHashCode(),
  1049 + };
  1050 + allPersonTimesRecordEntities.Add(personTimesRecordEntity);
  1051 + }
  1052 + // 批量插入人次记录
  1053 + if (allPersonTimesRecordEntities.Any())
  1054 + {
  1055 + await _db.Insertable(allPersonTimesRecordEntities).ExecuteCommandAsync();
  1056 + }
1077 1057 // 批量插入品项明细
1078 1058 if (allPxmxEntities.Any())
1079 1059 {
... ... @@ -1264,6 +1244,7 @@ namespace NCC.Extend.LqXhHyhk
1264 1244 entity.OriginalSgfy = input.sgfy;
1265 1245 entity.OvertimeSgfy = (decimal)(entity.OvertimeCoefficient * input.sgfy);
1266 1246 entity.Sgfy = entity.OriginalSgfy + entity.OvertimeSgfy;
  1247 + entity.AppointmentId = input.appointmentId;
1267 1248 //更新会员耗卡记录
1268 1249 await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
1269 1250  
... ... @@ -1280,10 +1261,12 @@ namespace NCC.Extend.LqXhHyhk
1280 1261 await _db.Deleteable<LqXhJksyjEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync();
1281 1262 await _db.Deleteable<LqXhKjbsyjEntity>().Where(u => u.Glkdbh == id).ExecuteCommandAsync();
1282 1263 await _db.Deleteable<LqXhPxmxEntity>().Where(u => u.ConsumeInfoId == id).ExecuteCommandAsync();
  1264 + await _db.Deleteable<LqPersonTimesRecordEntity>().Where(u => u.BusinessId == id).ExecuteCommandAsync();
1283 1265 // 收集所有需要插入的实体,然后批量插入
1284 1266 var allPxmxEntities = new List<LqXhPxmxEntity>();
1285 1267 var allJksyjEntities = new List<LqXhJksyjEntity>();
1286 1268 var allKjbsyjEntities = new List<LqXhKjbsyjEntity>();
  1269 + var allPersonTimesRecordEntities = new List<LqPersonTimesRecordEntity>();
1287 1270 // 处理品项明细列表
1288 1271 if (input.lqXhPxmxList != null && input.lqXhPxmxList.Any())
1289 1272 {
... ... @@ -1307,6 +1290,7 @@ namespace NCC.Extend.LqXhHyhk
1307 1290 OriginalProjectNumber = item.projectNumber ?? 0,
1308 1291 OvertimeProjectNumber = (decimal)(entity.OvertimeCoefficient * (item.projectNumber ?? 0)),
1309 1292 ProjectNumber = (decimal)((item.projectNumber ?? 0) + (entity.OvertimeCoefficient * (item.projectNumber ?? 0))),
  1293 + ItemCategory = await _db.Queryable<LqXmzlEntity>().Where(x => x.Id == item.px).Select(x => x.Qt2).FirstAsync(),
1310 1294 };
1311 1295 allPxmxEntities.Add(lqXhPxmxEntity);
1312 1296  
... ... @@ -1376,6 +1360,57 @@ namespace NCC.Extend.LqXhHyhk
1376 1360 }
1377 1361 }
1378 1362 }
  1363 + //获取这次耗卡有多少个健康师
  1364 + var jksCount = allJksyjEntities.GroupBy(x => x.Jks).Count();
  1365 + //添加到人次表里面去
  1366 + foreach (var item in allJksyjEntities.Select(x => x.Jks).Distinct())
  1367 + {
  1368 + LqPersonTimesRecordEntity personTimesRecordEntity = new LqPersonTimesRecordEntity
  1369 + {
  1370 + Id = YitIdHelper.NextId().ToString(),
  1371 + BusinessId = input.id,
  1372 + BusinessType = "耗卡",
  1373 + PersonType = "健康师",
  1374 + PersonId = item,
  1375 + PersonName = allJksyjEntities.Where(x => x.Jks == item).Select(x => x.Jksxm).First(),
  1376 + MemberId = entity.Hy,
  1377 + MemberName = memberInfo.Khmc,
  1378 + WorkDate = input.hksj,
  1379 + WorkMonth = input.hksj.ToDate().ToString("yyyyMM"),
  1380 + Quantity = 1 / (decimal)jksCount,
  1381 + CreateTime = DateTime.Now,
  1382 + IsEffective = StatusEnum.有效.GetHashCode(),
  1383 + };
  1384 + allPersonTimesRecordEntities.Add(personTimesRecordEntity);
  1385 + }
  1386 + //获取这次耗卡有多少个科技部老师
  1387 + var kjbCount = allKjbsyjEntities.GroupBy(x => x.Kjbls).Count();
  1388 + //添加到人次表里面去
  1389 + foreach (var item in allKjbsyjEntities.Select(x => x.Kjbls).Distinct())
  1390 + {
  1391 + LqPersonTimesRecordEntity personTimesRecordEntity = new LqPersonTimesRecordEntity
  1392 + {
  1393 + Id = YitIdHelper.NextId().ToString(),
  1394 + BusinessId = input.id,
  1395 + BusinessType = "耗卡",
  1396 + PersonType = "科技部老师",
  1397 + PersonId = item,
  1398 + PersonName = allKjbsyjEntities.Where(x => x.Kjbls == item).Select(x => x.Kjblsxm).First(),
  1399 + MemberId = entity.Hy,
  1400 + MemberName = memberInfo.Khmc,
  1401 + WorkDate = input.hksj,
  1402 + WorkMonth = input.hksj.ToDate().ToString("yyyyMM"),
  1403 + Quantity = 1 / (decimal)kjbCount,
  1404 + CreateTime = DateTime.Now,
  1405 + IsEffective = StatusEnum.有效.GetHashCode(),
  1406 + };
  1407 + allPersonTimesRecordEntities.Add(personTimesRecordEntity);
  1408 + }
  1409 + // 批量插入人次记录
  1410 + if (allPersonTimesRecordEntities.Any())
  1411 + {
  1412 + await _db.Insertable(allPersonTimesRecordEntities).ExecuteCommandAsync();
  1413 + }
1379 1414 // 批量插入品项明细
1380 1415 if (allPxmxEntities.Any())
1381 1416 {
... ... @@ -1430,6 +1465,9 @@ namespace NCC.Extend.LqXhHyhk
1430 1465 //清空子表数据
1431 1466 await _db.Deleteable<LqXhPxmxEntity>().Where(u => u.ConsumeInfoId == id).ExecuteCommandAsync();
1432 1467  
  1468 + //清空子表数据
  1469 + await _db.Deleteable<LqPersonTimesRecordEntity>().Where(u => u.BusinessId == id).ExecuteCommandAsync();
  1470 +
1433 1471 //关闭事务
1434 1472 _db.CommitTran();
1435 1473 }
... ... @@ -1550,6 +1588,8 @@ namespace NCC.Extend.LqXhHyhk
1550 1588 await _db.Updateable<LqXhJksyjEntity>().SetColumns(it => new LqXhJksyjEntity { IsEffective = StatusEnum.无效.GetHashCode() }).Where(w => w.Glkdbh == id).ExecuteCommandAsync();
1551 1589 //更新科技部老师业绩表状态
1552 1590 await _db.Updateable<LqXhKjbsyjEntity>().SetColumns(it => new LqXhKjbsyjEntity { IsEffective = StatusEnum.无效.GetHashCode() }).Where(w => w.Glkdbh == id).ExecuteCommandAsync();
  1591 + //更新人次记录表状态
  1592 + await _db.Updateable<LqPersonTimesRecordEntity>().SetColumns(it => new LqPersonTimesRecordEntity { IsEffective = StatusEnum.无效.GetHashCode() }).Where(w => w.BusinessId == id).ExecuteCommandAsync();
1553 1593 //关闭事务
1554 1594 _db.CommitTran();
1555 1595 return LqhyhkInfo;
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqYaoyjlService.cs
... ... @@ -61,7 +61,7 @@ namespace NCC.Extend.LqYaoyjl
61 61 {
62 62 var entity = await _db.Queryable<LqYaoyjlEntity>().FirstAsync(p => p.Id == id);
63 63 var output = entity.Adapt<LqYaoyjlInfoOutput>();
64   - output.storeName = SqlFunc.Subqueryable<LqMdxxEntity>().Where(u => u.Id == entity.StoreId).Select(u => u.Dm);
  64 + output.storeName = _db.Queryable<LqMdxxEntity>().Where(u => u.Id == entity.StoreId).Select(u => u.Dm).First();
65 65 return output;
66 66 }
67 67 #endregion
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqYyjlService.cs
... ... @@ -362,15 +362,14 @@ namespace NCC.Extend.LqYyjl
362 362 /// <summary>
363 363 /// 添加未成交说明
364 364 /// </summary>
365   - /// <param name="id">主键</param>
366 365 /// <param name="input">参数</param>
367 366 /// <returns></returns>
368   - [HttpPost("AddNoDealRemark/{id}")]
369   - public async Task AddNoDealRemark(string id, [FromBody] string noDealRemark)
  367 + [HttpPost("AddNoDealRemark")]
  368 + public async Task AddNoDealRemark([FromBody] LqYyjlAddNoDealRemarkInput input)
370 369 {
371   - var entity = await _db.Queryable<LqYyjlEntity>().FirstAsync(p => p.Id == id);
  370 + var entity = await _db.Queryable<LqYyjlEntity>().FirstAsync(p => p.Id == input.id);
372 371 _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005);
373   - entity.NoDealRemark = noDealRemark;
  372 + entity.NoDealRemark = input.noDealRemark;
374 373 var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
375 374 if (!(isOk > 0))
376 375 throw NCCException.Oh(ErrorCode.COM1001);
... ...
sql/创建人次记录表.sql 0 → 100644
  1 +-- ============================================
  2 +-- 创建人次记录表(lq_person_times_record)
  3 +-- ============================================
  4 +-- 说明:用于记录耗卡/开单时健康师或科技老师的工作人次
  5 +-- 支持人头统计(按健康师+月份+客户去重累加)和人次统计(按健康师+日期+客户去重累加)
  6 +--
  7 +-- 业务场景:
  8 +-- 1. 耗卡时记录健康师或科技老师的工作人次
  9 +-- 2. 未来可能记录开单时的工作人次
  10 +--
  11 +-- 统计规则:
  12 +-- - 人头统计:按健康师+月份+客户去重,累加数量
  13 +-- - 人次统计:按健康师+日期+客户去重,累加数量
  14 +-- ============================================
  15 +
  16 +CREATE TABLE IF NOT EXISTS `lq_person_times_record` (
  17 + `F_Id` VARCHAR(50) NOT NULL COMMENT '主键ID',
  18 + `F_BusinessId` VARCHAR(50) NULL COMMENT '关联业务记录ID',
  19 + `F_BusinessType` VARCHAR(20) NULL COMMENT '业务类型(耗卡/开单)',
  20 + `F_PersonType` VARCHAR(20) NULL COMMENT '人员类型(健康师/科技老师)',
  21 + `F_PersonId` VARCHAR(50) NULL COMMENT '人员ID',
  22 + `F_PersonName` VARCHAR(100) NULL COMMENT '人员姓名',
  23 + `F_MemberId` VARCHAR(50) NULL COMMENT '客户ID',
  24 + `F_MemberName` VARCHAR(100) NULL COMMENT '客户姓名',
  25 + `F_WorkDate` DATE NULL COMMENT '工作日期(用于人次统计,格式:YYYY-MM-DD)',
  26 + `F_WorkMonth` VARCHAR(6) NULL COMMENT '工作月份(用于人头统计,格式:202511)',
  27 + `F_Quantity` DECIMAL(10,2) NULL COMMENT '数量',
  28 + `F_CreateTime` DATETIME NULL COMMENT '创建时间',
  29 + `F_IsEffective` INT NULL DEFAULT 1 COMMENT '是否有效',
  30 + PRIMARY KEY (`F_Id`),
  31 + INDEX `idx_person_month_member` (`F_PersonId`, `F_WorkMonth`, `F_MemberId`) COMMENT '人头统计索引(健康师+月份+客户)',
  32 + INDEX `idx_person_date_member` (`F_PersonId`, `F_WorkDate`, `F_MemberId`) COMMENT '人次统计索引(健康师+日期+客户)',
  33 + INDEX `idx_business` (`F_BusinessId`, `F_BusinessType`) COMMENT '业务查询索引'
  34 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='人次记录表';
  35 +
  36 +-- ============================================
  37 +-- 验证表结构
  38 +-- ============================================
  39 +-- SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, COLUMN_COMMENT
  40 +-- FROM INFORMATION_SCHEMA.COLUMNS
  41 +-- WHERE TABLE_NAME = 'lq_person_times_record'
  42 +-- ORDER BY ORDINAL_POSITION;
  43 +
  44 +-- ============================================
  45 +-- 验证索引
  46 +-- ============================================
  47 +-- SHOW INDEX FROM lq_person_times_record;
  48 +
... ...
sql/添加品项分类字段.sql 0 → 100644
  1 +-- ============================================
  2 +-- 为品项明细表添加品项分类字段
  3 +-- ============================================
  4 +-- 说明:此脚本为品项明细相关表添加品项分类字段,用于存储品项的分类(医美、科美、生美)
  5 +--
  6 +-- 字段说明:
  7 +-- F_ItemCategory:品项分类,用于存储"医美"、"科美"、"生美"等分类值
  8 +--
  9 +-- 业务含义:
  10 +-- - 品项分类用于区分不同类型的品项,便于统计和分析
  11 +-- - 分类值来源于项目资料表(lq_xmzl)的 qt2 字段
  12 +--
  13 +-- 注意事项:
  14 +-- - 字段类型为VARCHAR(20),可存储"医美"、"科美"、"生美"等分类值
  15 +-- - 所有字段允许为NULL,因为历史数据可能没有这些分类信息
  16 +-- - 字段位置:放在品项相关字段(px、pxmc)之后
  17 +
  18 +-- ============================================
  19 +-- 1. lq_kd_pxmx(开单品项明细表) - 添加品项分类字段
  20 +-- ============================================
  21 +ALTER TABLE lq_kd_pxmx
  22 +ADD COLUMN F_ItemCategory VARCHAR(20) NULL COMMENT '品项分类(医美/科美/生美)' AFTER pxmc;
  23 +
  24 +-- ============================================
  25 +-- 2. lq_kd_deductinfo(开单扣减信息表) - 添加品项分类字段
  26 +-- ============================================
  27 +ALTER TABLE lq_kd_deductinfo
  28 +ADD COLUMN F_ItemCategory VARCHAR(20) NULL COMMENT '品项分类(医美/科美/生美)' AFTER F_ItemName;
  29 +
  30 +-- ============================================
  31 +-- 3. lq_xh_pxmx(耗卡品项明细表) - 添加品项分类字段
  32 +-- ============================================
  33 +ALTER TABLE lq_xh_pxmx
  34 +ADD COLUMN F_ItemCategory VARCHAR(20) NULL COMMENT '品项分类(医美/科美/生美)' AFTER pxmc;
  35 +
  36 +-- ============================================
  37 +-- 4. lq_hytk_mx(会员退卡明细表) - 添加品项分类字段
  38 +-- ============================================
  39 +ALTER TABLE lq_hytk_mx
  40 +ADD COLUMN F_ItemCategory VARCHAR(20) NULL COMMENT '品项分类(医美/科美/生美)' AFTER pxmc;
  41 +
  42 +-- ============================================
  43 +-- 5. 验证字段创建
  44 +-- ============================================
  45 +-- 验证 lq_kd_pxmx 表
  46 +-- SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_COMMENT
  47 +-- FROM INFORMATION_SCHEMA.COLUMNS
  48 +-- WHERE TABLE_NAME = 'lq_kd_pxmx'
  49 +-- AND COLUMN_NAME = 'F_ItemCategory';
  50 +
  51 +-- 验证 lq_kd_deductinfo 表
  52 +-- SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_COMMENT
  53 +-- FROM INFORMATION_SCHEMA.COLUMNS
  54 +-- WHERE TABLE_NAME = 'lq_kd_deductinfo'
  55 +-- AND COLUMN_NAME = 'F_ItemCategory';
  56 +
  57 +-- 验证 lq_xh_pxmx 表
  58 +-- SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_COMMENT
  59 +-- FROM INFORMATION_SCHEMA.COLUMNS
  60 +-- WHERE TABLE_NAME = 'lq_xh_pxmx'
  61 +-- AND COLUMN_NAME = 'F_ItemCategory';
  62 +
  63 +-- 验证 lq_hytk_mx 表
  64 +-- SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_COMMENT
  65 +-- FROM INFORMATION_SCHEMA.COLUMNS
  66 +-- WHERE TABLE_NAME = 'lq_hytk_mx'
  67 +-- AND COLUMN_NAME = 'F_ItemCategory';
  68 +
... ...