新增模块

This commit is contained in:
2026-10-18 15:27:02 +08:00
parent 5b7d1e8f64
commit f2e6d2b3f1
228 changed files with 46089 additions and 11 deletions
+76
View File
@@ -0,0 +1,76 @@
import { yuan } from "./format";
/** 研发填报动态推导(规格 V1.3):模具/项目周期按数量,回收期按本单毛利额(假设年 1 单) */
export const RND_INVEST_TOTAL = 112_000;
export const RND_INVEST_ITEMS = [
{ name: "模具投入", amount: 80_000 },
{ name: "工装投入", amount: 20_000 },
{ name: "试产费用", amount: 12_000 },
];
export interface FilingValues {
moldDays: number;
projectDays: number;
paybackMonths: number;
paybackLabel: string;
paybackPass: boolean;
moldSteps: Array<{ name: string; days: number }>;
projectSteps: Array<{ name: string; days: number }>;
investCalc: string;
values: [string, string, string];
}
export function deriveFiling(quantity: number, grossProfit: number): FilingValues {
const moldDays = quantity <= 200 ? 2 : 3;
const projectDays = quantity <= 200 ? 8 : 10;
const moldSteps =
moldDays === 2
? [
{ name: "模具设计", days: 0.5 },
{ name: "CNC 加工", days: 1 },
{ name: "试模确认", days: 0.5 },
]
: [
{ name: "模具设计", days: 0.5 },
{ name: "CNC 加工", days: 1.5 },
{ name: "试模确认", days: 1 },
];
const projectSteps =
projectDays === 8
? [
{ name: "工艺与工装准备", days: 2 },
{ name: "316L 钢卷采购", days: 2 },
{ name: "冲压 + 铜钎焊生产", days: 3 },
{ name: "检验入库", days: 1 },
]
: [
{ name: "工艺与工装准备", days: 2 },
{ name: "316L 钢卷采购", days: 2 },
{ name: "冲压 + 铜钎焊生产(批量排产)", days: 5 },
{ name: "检验入库", days: 1 },
];
const paybackMonths = (RND_INVEST_TOTAL / grossProfit) * 12;
const paybackPass = paybackMonths <= 12;
const paybackLabel = !paybackPass
? `${(paybackMonths / 12).toFixed(1)} 年`
: paybackMonths < 1
? "约 1 个月"
: Math.abs(paybackMonths - 6) < 0.05
? "半年"
: `${Math.round(paybackMonths)} 个月`;
const profitWan = (grossProfit / 10_000).toLocaleString("zh-CN", { maximumFractionDigits: 1 });
const investCalc = paybackPass
? `投入 ${yuan(RND_INVEST_TOTAL)} 元 < 本单毛利 ${profitWan} 万,本单周期内全额回收(假设年 1 单)→ 投资回收期 ${paybackLabel}`
: `投入 ${yuan(RND_INVEST_TOTAL)} 元 > 本单毛利 ${profitWan} 万,一年内无法回收 → 投资回收期 ${paybackLabel}(不满足 ≤1 年)`;
return {
moldDays,
projectDays,
paybackMonths,
paybackLabel,
paybackPass,
moldSteps,
projectSteps,
investCalc,
values: [`${moldDays} 天`, `${projectDays} 天`, paybackLabel],
};
}