Spaces:
Running
Running
Update config.js
Browse files
config.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
// config.js - FACTORY CONFIGURATION FILE -
|
2 |
|
3 |
export const MATERIALS_CONFIG = [
|
4 |
// Frame Materials
|
@@ -56,11 +56,43 @@ export const MATERIALS_CONFIG = [
|
|
56 |
{ name: "Box Sticker", unit: "pcs", maxStock: 500, currentStock: 500, reorderPoint: 50 }
|
57 |
];
|
58 |
|
59 |
-
|
60 |
"Antenna Frame Assembly": { "5/32 x 3/4 Tube": 1, "1/8 x 1/2 Tube": 8, "1/8 x 3/4 Tube": 2, "End Knob Round": 6, "End Knob Square 1/2x1/2": 2, "Dipole (CI Cup)": 1, "U-Clip": 1, "12cm Round Tube 7/8 MF": 2, "15cm Round Tube 5/8 MF": 1, "5/8 x 4 CSK Screw": 2 },
|
61 |
"Booster Assembly": { "Macking Coil": 1, "Coil 28gsm (25cm)": 1, "Coil 26gsm (16cm)": 2, "Resistor 1k": 1, "LED Multicolour": 1, "PF 12": 1, "PF 39": 2, "PF 102 Indian": 1, "PF 102 Normal": 2, "Resistor 100-ohm": 1, "Resistor 68k": 2, "Resistor 2k": 1, "Resistor 150-R": 1, "Capacitor 25v 100uF": 1, "F-Connector Female (2002)": 1, "Transistor (2355)": 2 },
|
62 |
"Power Supply Assembly": { "Plastic Box (Power)": 1, "Transformer": 1, "IN4007 Diode": 2, "Coil 25gsm (36cm)": 1, "5C 2V Wire 3-yard": 1, "4-Antenna Jack": 1, "F-Connector Female (2002)": 1, "Resistor 10k": 1, "PF 102 Normal": 1, "Capacitor 25v 220uF": 1, "3/8 x 4 Screw": 2, "LED 5mm": 1, "AC Cord": 1 },
|
63 |
"Wire Assembly": { "16 1/2 Ygr Wire": 1, "F-Connector Male (4005)": 2 },
|
64 |
"Packaging Set": { "Packing Bag": 1, "Warranty Card": 1, "Round Sticker": 1, "Box Plastic Cover": 1, "Box Sticker": 1 },
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
};
|
|
|
1 |
+
// config.js - FACTORY CONFIGURATION FILE - v3.0 (Debloated & Dynamic)
|
2 |
|
3 |
export const MATERIALS_CONFIG = [
|
4 |
// Frame Materials
|
|
|
56 |
{ name: "Box Sticker", unit: "pcs", maxStock: 500, currentStock: 500, reorderPoint: 50 }
|
57 |
];
|
58 |
|
59 |
+
const subAssemblyRecipes = {
|
60 |
"Antenna Frame Assembly": { "5/32 x 3/4 Tube": 1, "1/8 x 1/2 Tube": 8, "1/8 x 3/4 Tube": 2, "End Knob Round": 6, "End Knob Square 1/2x1/2": 2, "Dipole (CI Cup)": 1, "U-Clip": 1, "12cm Round Tube 7/8 MF": 2, "15cm Round Tube 5/8 MF": 1, "5/8 x 4 CSK Screw": 2 },
|
61 |
"Booster Assembly": { "Macking Coil": 1, "Coil 28gsm (25cm)": 1, "Coil 26gsm (16cm)": 2, "Resistor 1k": 1, "LED Multicolour": 1, "PF 12": 1, "PF 39": 2, "PF 102 Indian": 1, "PF 102 Normal": 2, "Resistor 100-ohm": 1, "Resistor 68k": 2, "Resistor 2k": 1, "Resistor 150-R": 1, "Capacitor 25v 100uF": 1, "F-Connector Female (2002)": 1, "Transistor (2355)": 2 },
|
62 |
"Power Supply Assembly": { "Plastic Box (Power)": 1, "Transformer": 1, "IN4007 Diode": 2, "Coil 25gsm (36cm)": 1, "5C 2V Wire 3-yard": 1, "4-Antenna Jack": 1, "F-Connector Female (2002)": 1, "Resistor 10k": 1, "PF 102 Normal": 1, "Capacitor 25v 220uF": 1, "3/8 x 4 Screw": 2, "LED 5mm": 1, "AC Cord": 1 },
|
63 |
"Wire Assembly": { "16 1/2 Ygr Wire": 1, "F-Connector Male (4005)": 2 },
|
64 |
"Packaging Set": { "Packing Bag": 1, "Warranty Card": 1, "Round Sticker": 1, "Box Plastic Cover": 1, "Box Sticker": 1 },
|
65 |
+
};
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Dynamically generates the recipe for the complete unit by aggregating sub-assemblies.
|
69 |
+
* This prevents data duplication and ensures the master recipe is always up-to-date.
|
70 |
+
* @param {Object} recipes - The collection of all sub-assembly recipes.
|
71 |
+
* @returns {Object} The aggregated recipe for the complete unit.
|
72 |
+
*/
|
73 |
+
function generateCompleteUnitRecipe(recipes) {
|
74 |
+
const completeRecipe = {};
|
75 |
+
const componentAssemblies = [
|
76 |
+
recipes["Antenna Frame Assembly"],
|
77 |
+
recipes["Booster Assembly"],
|
78 |
+
recipes["Power Supply Assembly"],
|
79 |
+
recipes["Wire Assembly"],
|
80 |
+
recipes["Packaging Set"]
|
81 |
+
];
|
82 |
+
|
83 |
+
for (const assembly of componentAssemblies) {
|
84 |
+
for (const material in assembly) {
|
85 |
+
if (completeRecipe[material]) {
|
86 |
+
completeRecipe[material] += assembly[material];
|
87 |
+
} else {
|
88 |
+
completeRecipe[material] = assembly[material];
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
return completeRecipe;
|
93 |
+
}
|
94 |
+
|
95 |
+
export const RECIPES_CONFIG = {
|
96 |
+
...subAssemblyRecipes,
|
97 |
+
"COMPLETE ANTENNA UNIT": generateCompleteUnitRecipe(subAssemblyRecipes)
|
98 |
};
|