Commit 656991809fae8929dc5125fc6e8232e3e86d4644

Authored by “wangming”
1 parent bdb9fb61

feat: 在GetStorePerformanceComparison中新增消耗业绩统计

- 新增ActualConsumePerformance字段到StorePerformanceComparisonOutput
- SQL查询关联lq_xh_hyhk表统计消耗业绩
- 统计指定时间范围内的消耗总金额
- 更新API注释,添加ActualConsumePerformance字段说明
antis-ncc-admin/.env.development
... ... @@ -2,6 +2,6 @@
2 2  
3 3 VUE_CLI_BABEL_TRANSPILE_MODULES = true
4 4 # VUE_APP_BASE_API = 'https://erp.lvqianmeiye.com'
5   -VUE_APP_BASE_API = 'http://erp_test.lvqianmeiye.com'
6   -# VUE_APP_BASE_API = 'http://localhost:2011'
  5 +# VUE_APP_BASE_API = 'http://erp_test.lvqianmeiye.com'
  6 +VUE_APP_BASE_API = 'http://localhost:2011'
7 7 VUE_APP_BASE_WSS = 'ws://192.168.110.45:2011/websocket'
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqReport/StorePerformanceComparisonOutput.cs
... ... @@ -39,5 +39,10 @@ namespace NCC.Extend.Entitys.Dto.LqReport
39 39 /// 是否达标(实际业绩 >= 目标业绩)
40 40 /// </summary>
41 41 public bool IsTargetAchieved { get; set; }
  42 +
  43 + /// <summary>
  44 + /// 实际消耗业绩
  45 + /// </summary>
  46 + public decimal ActualConsumePerformance { get; set; }
42 47 }
43 48 }
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqReportService.cs
... ... @@ -1047,6 +1047,7 @@ namespace NCC.Extend
1047 1047 /// - StoreName: 门店名称
1048 1048 /// - TargetPerformance: 目标业绩(来自门店资料表xsyj字段)
1049 1049 /// - ActualPerformance: 实际开单业绩(统计期间内的开单业绩总和)
  1050 + /// - ActualConsumePerformance: 实际消耗业绩(统计期间内的消耗业绩总和)
1050 1051 /// - CompletionRate: 完成率(实际业绩/目标业绩 × 100%)
1051 1052 /// - Difference: 差额(实际业绩-目标业绩)
1052 1053 /// - IsTargetAchieved: 是否达标(实际业绩 >= 目标业绩)
... ... @@ -1071,21 +1072,27 @@ namespace NCC.Extend
1071 1072 md.F_Id as store_id,
1072 1073 md.dm as store_name,
1073 1074 COALESCE(CAST(md.xsyj AS DECIMAL(18,2)), 0) as target_performance,
1074   - COALESCE(SUM(CAST(kd.sfyj AS DECIMAL(18,2))), 0) as actual_performance
  1075 + COALESCE(SUM(CAST(kd.sfyj AS DECIMAL(18,2))), 0) as actual_performance,
  1076 + COALESCE(SUM(CAST(xh.xfje AS DECIMAL(18,2))), 0) as actual_consume_performance
1075 1077 FROM lq_mdxx md
1076 1078 LEFT JOIN lq_kd_kdjlb kd ON md.F_Id = kd.djmd
1077 1079 AND kd.F_IsEffective = 1
1078 1080 AND kd.kdrq >= @startTime
1079   - AND kd.kdrq <= @endTime";
  1081 + AND kd.kdrq <= @endTime
  1082 + LEFT JOIN lq_xh_hyhk xh ON md.F_Id = xh.md
  1083 + AND xh.F_IsEffective = 1
  1084 + AND xh.hksj >= @startTime
  1085 + AND xh.hksj <= @endTime";
1080 1086  
1081 1087 object parameters;
1082 1088 if (input.StoreIds != null && input.StoreIds.Any())
1083 1089 {
1084   - sql += " AND md.F_Id IN @storeIds";
  1090 + sql += " WHERE md.F_Id IN @storeIds";
1085 1091 parameters = new { startTime, endTime, storeIds = input.StoreIds };
1086 1092 }
1087 1093 else
1088 1094 {
  1095 + sql += " WHERE 1=1";
1089 1096 parameters = new { startTime, endTime };
1090 1097 }
1091 1098  
... ... @@ -1101,6 +1108,7 @@ namespace NCC.Extend
1101 1108 var storeName = item.store_name?.ToString();
1102 1109 var targetPerformance = Convert.ToDecimal(item.target_performance ?? 0);
1103 1110 var actualPerformance = Convert.ToDecimal(item.actual_performance ?? 0);
  1111 + var actualConsumePerformance = Convert.ToDecimal(item.actual_consume_performance ?? 0);
1104 1112  
1105 1113 // 计算完成率
1106 1114 var completionRate = targetPerformance > 0
... ... @@ -1119,6 +1127,7 @@ namespace NCC.Extend
1119 1127 StoreName = storeName,
1120 1128 TargetPerformance = targetPerformance,
1121 1129 ActualPerformance = actualPerformance,
  1130 + ActualConsumePerformance = actualConsumePerformance,
1122 1131 CompletionRate = completionRate,
1123 1132 Difference = difference,
1124 1133 IsTargetAchieved = isTargetAchieved
... ...