mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 13:20:43 +00:00
CE-1482: POC of workflow library
This commit is contained in:
214
src/qqq/components/workflows/StepUtils.ts
Normal file
214
src/qqq/components/workflows/StepUtils.ts
Normal file
@ -0,0 +1,214 @@
|
||||
import {Branches, Uid} from "sequential-workflow-designer";
|
||||
import {ContainerStep, OptimizationStepType, SwitchStep, TaskStep, WarehouseOptimizationStep} from "./model";
|
||||
|
||||
export function createTaskStep(): TaskStep
|
||||
{
|
||||
return {
|
||||
id: Uid.next(),
|
||||
componentType: "task",
|
||||
type: "task",
|
||||
name: "blah",
|
||||
properties: {}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
// define all steps //
|
||||
//////////////////////
|
||||
export function createDetermineWarehouseRoutingStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Determine Warehouse", "determineWarehouseRouting");
|
||||
}
|
||||
|
||||
export function createDetermineLineHaulLaneStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Determine Line Haul Lane", "determineLineHaulLane");
|
||||
}
|
||||
|
||||
export function createValidateLineItemsStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Validate Line Items", "validateLineItems");
|
||||
}
|
||||
|
||||
export function createDetermineCoolingCategoryStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Determine Cooling Category", "determineCoolingCategory");
|
||||
}
|
||||
|
||||
export function createValidateOptimizationRulesStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Validate Optimization Rules", "validateOptimizationRules");
|
||||
}
|
||||
|
||||
export function createValidateAddressStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Validate Address", "validateAddress");
|
||||
}
|
||||
|
||||
export function createDetermineCarrierServiceStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Determine Carrier Service", "determineCarrierService");
|
||||
}
|
||||
|
||||
export function createDetermineTNTStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Determine TNT ", "determineTNT");
|
||||
}
|
||||
|
||||
export function createDetermineOrderServiceDatesStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Determine Order Service Dates ", "determineOrderServiceDates");
|
||||
}
|
||||
|
||||
export function createOrderMatchesFilterSelectorStep(): WarehouseOptimizationStep
|
||||
{
|
||||
return createStep("Order Matches Filter Selector", "orderMatchesFilterSelector");
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
// define all outputs //
|
||||
////////////////////////
|
||||
export function createDetermineWarehouseRoutingOuptut(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {Edison: [], Patterson: [], Stockton: []}));
|
||||
}
|
||||
|
||||
export function createDetermineLineHaulLaneOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {Chicago: [], Dallas: [], Sheboygan: []}));
|
||||
}
|
||||
|
||||
export function createValidateLineItemsOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {"Is Valid": [], "Not Valid": []}));
|
||||
}
|
||||
|
||||
export function createDetermineCoolingCategoryOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {"Ambient": [], "Frozen": [], "Other": []}));
|
||||
}
|
||||
|
||||
export function createValidateOptimizationRulesOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {"Is Valid": [], "Not Valid": []}));
|
||||
}
|
||||
|
||||
export function createAddressValidationOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {"Is Valid": [], "Not Valid": []}));
|
||||
}
|
||||
|
||||
export function createDetermineCarrierServiceOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {"Fedex Ground": [], "UPS Ground": [], "OnTrac Ground": []}));
|
||||
}
|
||||
|
||||
export function createDetermineTNTOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {1: [], 2: [], 3: [], "4+": []}));
|
||||
}
|
||||
|
||||
export function createDetermineOrderServiceDatesOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {Monday: [], Tuesday: [], Wednesday: []}));
|
||||
}
|
||||
|
||||
export function createOrderMatchesFilterSelectorOutput(): SwitchStep
|
||||
{
|
||||
return (createOutput("Output", {"Matches": [], "No Match": []}));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// groups of steps + output //
|
||||
//////////////////////////////
|
||||
export function createDetermineWarehouseRoutingGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Determine Warehouse Routing", [createDetermineWarehouseRoutingStep(), createDetermineWarehouseRoutingOuptut()]));
|
||||
}
|
||||
|
||||
export function createDetermineLineHaulLaneGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Determine Line Haul Lane", [createDetermineLineHaulLaneStep(), createDetermineLineHaulLaneOutput()]));
|
||||
}
|
||||
|
||||
export function createValidateLineItemsGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Validate Line Items", [createValidateLineItemsStep(), createValidateLineItemsOutput()]));
|
||||
}
|
||||
|
||||
export function createDetermineCoolingCategoryGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Determine Cooling Category", [createDetermineCoolingCategoryStep(), createDetermineCoolingCategoryOutput()]));
|
||||
}
|
||||
|
||||
export function createValidateOptimizationRulesGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Validate Optimization Rules", [createValidateOptimizationRulesStep(), createValidateOptimizationRulesOutput()]));
|
||||
}
|
||||
|
||||
export function createValidateAddressGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Validate Address", [createValidateAddressStep(), createAddressValidationOutput()]));
|
||||
}
|
||||
|
||||
export function createDetermineCarrierServiceGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Determine Carrier Service", [createDetermineCarrierServiceStep(), createDetermineCarrierServiceOutput()]));
|
||||
}
|
||||
|
||||
export function createDetermineTNTGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Determine TNT", [createDetermineTNTStep(), createDetermineTNTOutput()]));
|
||||
}
|
||||
|
||||
export function createDetermineOrderServiceDatesGroup(): ContainerStep
|
||||
{
|
||||
return (createGroup("Determine Order Service Dates", [createDetermineOrderServiceDatesStep(), createDetermineOrderServiceDatesOutput()]));
|
||||
}
|
||||
|
||||
export function createOrderMatchesFilterSelector(): ContainerStep
|
||||
{
|
||||
return (createGroup("Order Matches Filter Selector", [createOrderMatchesFilterSelectorStep(), createOrderMatchesFilterSelectorOutput()]));
|
||||
}
|
||||
|
||||
|
||||
///////////
|
||||
// utils //
|
||||
///////////
|
||||
export function createStep(name: string, type: OptimizationStepType): WarehouseOptimizationStep
|
||||
{
|
||||
return {
|
||||
id: Uid.next(),
|
||||
componentType: "task",
|
||||
type: type,
|
||||
name: name,
|
||||
properties: {}
|
||||
};
|
||||
}
|
||||
|
||||
export function createOutput(name: string, branches: Branches): SwitchStep
|
||||
{
|
||||
return {
|
||||
id: Uid.next(),
|
||||
componentType: "switch",
|
||||
type: "switch",
|
||||
name: name,
|
||||
properties: {},
|
||||
branches: branches
|
||||
};
|
||||
}
|
||||
|
||||
export function createGroup(name: string, sequence: (WarehouseOptimizationStep | SwitchStep)[]): ContainerStep
|
||||
{
|
||||
return {
|
||||
id: Uid.next(),
|
||||
componentType: "container",
|
||||
type: "container",
|
||||
name: name,
|
||||
properties: {},
|
||||
sequence: sequence
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user