using Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
namespace Admin.NET.Plugin.AiDOP.SeedData;
///
/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t2c:S8 订单执行链路 BASELINE_PPT 聚合快照种子。
/// 单条记录:snapshot_code = CHAIN_AGGREGATE_BASELINE / scope_code = BASELINE_PPT / scenario = PPT。
/// stage_snapshots_json 含 5 阶段 PPT 第 1 页真值。onTimeRate 是整数百分比(59/96/85/89/96)。
/// service 层 baseline 读取协议:scope_code=BASELINE_PPT → 取本表行;CURRENT_FILTERED → 实时聚合。
///
[IncreSeed]
public class S8OrderFlowSnapshotSeedData : ISqlSugarEntitySeedData
{
internal const long SnapshotIdBase = 1329909150000L;
public IEnumerable HasData()
{
yield return new AdoS8OrderFlowSnapshot
{
Id = SnapshotIdBase + 1,
TenantId = 1,
FactoryId = 1,
SnapshotCode = "CHAIN_AGGREGATE_BASELINE",
ScopeCode = "BASELINE_PPT",
TotalOrders = 105,
TotalCustomers = 5,
AvgResponseMinutes = 91.2m,
AvgProcessingMinutes = 1060.5m,
AvgLossMinutes = 1472.5m,
StageSnapshotsJson = StageSnapshotsJson,
ScenarioCode = "PPT",
DataSource = "SEED",
CreatedAt = S8OrderFlowDataset.CreatedAt,
UpdatedAt = null,
IsDeleted = false,
};
}
/// BASELINE_PPT 5 阶段聚合 JSON(顺序:评审/排产/测算 → 产品设计 → 材料采购 → 本体生产 → 总装发货)。
private const string StageSnapshotsJson =
"[" +
"{\"orderFlowCode\":\"ORDER_REVIEW_PLAN_CALC\",\"orderFlowName\":\"评审/排产/测算\",\"kpiAvgDays\":5.0,\"actualAvgDays\":6.2,\"onTimeRate\":59,\"green\":0,\"yellow\":0,\"red\":0,\"pending\":0}," +
"{\"orderFlowCode\":\"PRODUCT_DESIGN\",\"orderFlowName\":\"产品设计\",\"kpiAvgDays\":3.0,\"actualAvgDays\":2.6,\"onTimeRate\":96,\"green\":0,\"yellow\":0,\"red\":0,\"pending\":0}," +
"{\"orderFlowCode\":\"MATERIAL_PURCHASE\",\"orderFlowName\":\"材料采购\",\"kpiAvgDays\":14.0,\"actualAvgDays\":15.5,\"onTimeRate\":85,\"green\":0,\"yellow\":0,\"red\":0,\"pending\":0}," +
"{\"orderFlowCode\":\"BODY_PRODUCTION\",\"orderFlowName\":\"本体生产\",\"kpiAvgDays\":6.0,\"actualAvgDays\":6.7,\"onTimeRate\":89,\"green\":0,\"yellow\":0,\"red\":0,\"pending\":0}," +
"{\"orderFlowCode\":\"FINAL_ASSEMBLY_DELIVERY\",\"orderFlowName\":\"总装发货\",\"kpiAvgDays\":3.0,\"actualAvgDays\":2.9,\"onTimeRate\":96,\"green\":0,\"yellow\":0,\"red\":0,\"pending\":0}" +
"]";
}