| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
- namespace Admin.NET.Plugin.AiDOP.SeedData;
- /// <summary>
- /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t2c:S8 订单执行链路材料采购透视表 baseline 种子。
- /// 3 materials (XX/YY/ZZ) × 4 suppliers (A/B/C/TOTAL) × 4 specs (L4.5*11.2/MT2*6.3/MT1*5.4/TOTAL) = 48 行。
- /// YY 16 单元为 PPT 第 4 页真值;XX/ZZ 16 单元各自按确定性 multiplier 派生(无随机 / 无 Now)。
- /// status 在 seed 时确定,不允许 service/前端动态重判;按 cycle_days 三档阈值固化(≤15 green / 15..20 yellow / >20 red)。
- /// order_id / order_code 全部 NULL(baseline 行)。
- /// </summary>
- [IncreSeed]
- public class S8OrderFlowProcurementPivotSeedData : ISqlSugarEntitySeedData<AdoS8OrderFlowProcurementPivot>
- {
- public IEnumerable<AdoS8OrderFlowProcurementPivot> HasData() => S8OrderFlowProcurementPivotDataset.BuildRows();
- }
- internal static class S8OrderFlowProcurementPivotDataset
- {
- internal const long PivotIdBase = 1329909140000L;
- internal static readonly string[] Suppliers = { "A", "B", "C", "TOTAL" };
- internal static readonly string[] Specs = { "L4.5*11.2", "MT2*6.3", "MT1*5.4", "TOTAL" };
- /// <summary>YY (PPT 第 4 页) 真值矩阵 [supplierIdx, specIdx];保留 3 位小数精度。</summary>
- private static readonly decimal[,] YyCycleDays =
- {
- // L4.5*11.2 | MT2*6.3 | MT1*5.4 | TOTAL
- { 14.800m, 11.000m, 11.000m, 13.000m }, // A
- { 14.050m, 17.150m, 17.150m, 15.600m }, // B
- { 14.050m, 23.925m, 23.850m, 20.100m }, // C
- { 14.500m, 17.400m, 14.800m, 15.300m }, // TOTAL
- };
- /// <summary>派生 XX / ZZ 单元值的 multiplier。XX 偏低、ZZ 偏高,便于 DEMO 拉开差异。</summary>
- private const decimal XxMultiplier = 0.85m;
- private const decimal ZzMultiplier = 1.10m;
- public static IEnumerable<AdoS8OrderFlowProcurementPivot> BuildRows()
- {
- long seq = 0;
- foreach (var (material, scenario, mult) in new[]
- {
- ("XX", "DEMO", XxMultiplier),
- ("YY", "PPT", 1.0m),
- ("ZZ", "DEMO", ZzMultiplier),
- })
- {
- for (var s = 0; s < Suppliers.Length; s++)
- {
- for (var p = 0; p < Specs.Length; p++)
- {
- var rawCycle = YyCycleDays[s, p];
- var cycleDays = material == "YY"
- ? rawCycle
- : decimal.Round(rawCycle * mult, 3);
- yield return new AdoS8OrderFlowProcurementPivot
- {
- Id = PivotIdBase + (++seq),
- OrderId = null,
- OrderCode = null,
- MaterialCode = material,
- SupplierCode = Suppliers[s],
- SpecCode = Specs[p],
- CycleDays = cycleDays,
- Status = ClassifyStatus(cycleDays),
- ScenarioCode = scenario,
- DataSource = "SEED",
- TenantId = 1,
- FactoryId = 1,
- CreatedAt = S8OrderFlowDataset.CreatedAt,
- UpdatedAt = null,
- IsDeleted = false,
- };
- }
- }
- }
- }
- /// <summary>fixture 级 status 分类(seed-time once),运行期不再重算。</summary>
- private static string ClassifyStatus(decimal cycleDays)
- {
- if (cycleDays <= 15.0m) return "green";
- if (cycleDays <= 20.0m) return "yellow";
- return "red";
- }
- }
|