Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
data_report
/
data-report
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7ddd22ae
authored
Sep 28, 2026
by
周立明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
营销人员成本计算逻辑调整(店中店/园区店轻改报表)
园区店人员成本同步改为按天折算(已确认)
1 parent
2b5c0fed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
.workbuddy/memory/2026-09-28.md
data-process/light_reform_inshop_processor.py
data-process/light_reform_park_processor.py
.workbuddy/memory/2026-09-28.md
0 → 100644
View file @
7ddd22a
# 2026-09-28 工作日志
## 营销人员成本计算逻辑调整(店中店/园区店轻改报表)
-
文件:
`light_reform_inshop_processor.py:404`
(
`light_reform_park_processor.py`
若同口径需同步,待确认)。
-
原:
`营销人员成本 = 直营人数 * 3500 + 门店总产值 * 4%`
(底薪 3500 固定不折算)。
-
改:底薪 3500 元/人/月
**按统计周期天数折算**
=
`prorate_by_period(3500, period_start, period_end)`
,即
`3500 * 周期天数 / 月份总天数`
(周期天数=period_end-period_start+1 含首尾;月份总天数=period_start 所在月
`calendar.monthrange`
)。
-
验证:2号~6号、30天月 → 3500
*
5/30=583.33;全月1~30号 → 3500.00;跨月9/28~10/5(按9月30天)→ 933.33,均符合预期。
-
4% 提成(门店总产值
*4%)**不折算*
*
,保持原样。非直营门店仍=0。
-
`prorate_by_period`
在处理器 line27 已 import,复用即可;period_start/period_end 来自 task。
-
⚠ 仅改了 inshop(店中店)一处;用户问的「店中店汇总 sheet 营销人员成本」即此字段。park(园区店)同公式是否同步未确认,待用户指认。
## 园区店人员成本同步改为按天折算(已确认)
-
用户确认后,将
`light_reform_park_processor.py:393`
(人员成本
`personnel_cost`
)同步改为按天折算:
`base_salary_prorated = prorate_by_period(Decimal('3500'), period_start, period_end)`
。
-
字段名差异:店中店=
`marketing_personnel_cost`
(提成基数
`store_output_value`
)、园区店=
`personnel_cost`
(提成基数
`store_sales_output`
),比例均为 4%。
-
park 处理器 line33 已 import
`prorate_by_period`
,且装修/房租/耗材(329/332/335)已用它折算,仅人员成本漏改 → 现已补。
-
验证:py_compile 通过;grep 命中行 395 确认落盘(沙箱丢写已复核)。
-
现状:
**店中店 + 园区店**
两处人员/营销人员成本口径已统一(均按天折算底薪)。两处均为处理器代码,需
**重启后端**
页面「重新生成」才生效;msoffcrypto 已装,解密无需重启。
## 后端缺 msoffcrypto 导致人力成本表解密失败(headcount 全 0)
-
现象:页面点「重新生成」后日志
`[人力成本表] msoffcrypto 未安装`
+
`Can't find workbook in OLE2 compound document`
,headcount 退化为 0 → 营销人员成本只算 4% 提成,底薪整段缺失。
-
根因:后端 Flask 跑在
`C:/Users/66/AppData/Roaming/Python/Python314/site-packages`
,该环境未装 msoffcrypto;managed venv 有但后端不用。
-
修复:
`C:/Python314/python.exe -m pip install --target "C:/Users/66/AppData/Roaming/Python/Python314/site-packages" msoffcrypto-tool`
(顺带 cryptography/cffi/olefile/pycparser)。已验证该解释器
`import msoffcrypto`
成功、解密 task 32 人力成本表得
`遵义广新智腾汽车销售有限公司=3`
。
-
关键点:
`parse_labor_cost`
在
**函数内**
`import msoffcrypto`
(report_utils.py:1240),属运行时懒加载 → 装好包后
**下次重新生成即用,无需重启后端**
。
-
建议:重跑 task 32 整体重算,让新公式+正确 headcount 同时生效(此前所有直营店营销成本/毛利均被少算底薪段)。
data-process/light_reform_inshop_processor.py
View file @
7ddd22a
...
...
@@ -404,8 +404,11 @@ class LightReformInshopProcessor:
# 营销人员成本
marketing_personnel_cost
=
Decimal
(
'0'
)
if
operate_type
==
'直营'
:
# 底薪 3500 元/人/月,按统计周期天数折算:3500 * 周期天数 / 月份总天数
# (周期天数 = period_end - period_start + 1,含首尾;月份总天数 = period_start 所在月天数)
base_salary_prorated
=
prorate_by_period
(
Decimal
(
'3500'
),
period_start
,
period_end
)
marketing_personnel_cost
=
(
Decimal
(
str
(
headcount
))
*
Decimal
(
'3500'
)
+
Decimal
(
str
(
headcount
))
*
base_salary_prorated
+
store_output_value
*
Decimal
(
'0.04'
)
)
marketing_personnel_ratio
=
safe_div_pct_decimal
(
marketing_personnel_cost
,
store_output_value
)
...
...
data-process/light_reform_park_processor.py
View file @
7ddd22a
...
...
@@ -390,8 +390,11 @@ class LightReformParkProcessor:
# 人员成本(直营才算)
personnel_cost
=
Decimal
(
'0'
)
if
operate_type
==
'直营'
:
# 底薪 3500 元/人/月,按统计周期天数折算:3500 * 周期天数 / 月份总天数
# (周期天数 = period_end - period_start + 1,含首尾;月份总天数 = period_start 所在月天数)
base_salary_prorated
=
prorate_by_period
(
Decimal
(
'3500'
),
period_start
,
period_end
)
personnel_cost
=
(
Decimal
(
str
(
headcount
))
*
Decimal
(
'3500'
)
+
Decimal
(
str
(
headcount
))
*
base_salary_prorated
+
store_sales_output
*
Decimal
(
'0.04'
)
)
personnel_cost_ratio
=
safe_div_pct_decimal
(
personnel_cost
,
store_sales_output
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment