ERP demand to production execution
1. Project background and intended outcomes
WL Plastics is a North American polyethylene-pipe manufacturer whose acquisition of multiple facilities and growing demand made flexible, scalable scheduling necessary. The organization previously relied on older scheduling software with significant customization requirements. The stated purpose was a more flexible, maintainable scheduler capable of supporting future development and enhancements. The design explicitly called for user-experience collaboration, domain modeling, and production-data integration.
The scope included modeling product demand, open orders, product requirements, scheduling rules, work-order generation and SAP as the system of record.
What the system addresses
- Relieves manual transfer of SAP customer demand into an isolated production schedule by retrieving sales orders and inventory programmatically.
- Gives schedulers a consolidated view of product, customer, requested date, fulfilled quantity, available stock, applicable facilities/lines and production rates.
- Translates demand into scheduled line positions and production work orders, including variants and conduit-component needs.
- Makes actual output entries visible against the work order, allowing remaining quantity and remaining runtime to be recalculated.
- Provides an outbound machine/job interface to ShopLogix via file-based XML rather than requiring operators to rekey every work-order parameter.
2. System architecture and integration boundaries
| System / layer | Ownership and verified responsibilities |
|---|---|
| SAP Business ByDesign | Read-only OData analytical query result sets for sales orders and inventory. Filters by selling organization or site. |
| Scheduler API / application | ASP.NET Core/C# services; data reconciliation, demand aggregation, scheduling, work order actions, production entry, exports. |
| Scheduler operational database | Entity Framework Core records open orders, inventory snapshots, schedule lines, production rates, work orders, production events, facilities and maintenance. |
| WLP master-data database | Separate EF DbContext with product masters, BOM components, customer master, locations, base product numbers, print templates and ShopLogix templates. |
| Web application | Vue/TypeScript scheduling board, demand summary, user permissions, work-order modals, production entry and refresh. |
| ShopLogix | Distinct outbound XML file generation through a configurable template and facility export path; no confirmation receiver evidenced. |
| Other user interfaces | Master Products Database; TrackVia; work-order CSV export. |
Facility identification
The scheduler distinguishes a plant/site ID (Location.LocationSapId) from a sales organization (Location.LocationSales). On refresh it retrieves SAP sales orders for the selling organization associated with the selected plant, while inventory is retrieved for the plant code itself. The resulting open-order and stock caches are accordingly keyed by different organizational dimensions. This distinction is essential when implementing additional plants or troubleshooting orders that appear in one plant but not another.
3. SAP transport, API endpoints and authentication
The SAP adapter is SapService (ISapService). It exposes GetSalesOrder(facilityCode) and GetInventory(facilityCode), constructs URLs using string.Format against configured templates, and sends HTTP GET using BaseHttpService. The base HTTP class creates an HttpClient, adds an Authorization header using the configured Basic authentication string, parses the HTTP response as JSON, and surfaces HTTP error reasons through a UserFriendlyException. This is an SAP Business ByDesign analytics OData integration, not an RFC/BAPI or IDoc connector.
| Setting / contract | Observed behavior |
|---|---|
| SAP service root | sap/byd/odata/ana_businessanalytics_analytics.svc on the configured SAP Business ByDesign tenant. |
| Sales-order query entity | analytics query result set. |
| Inventory query entity | analytics query result set. |
| Wire format | OData v2-style JSON wrapper: d.results. |
| Authentication | HTTP Basic authorization from SapConfiguration/AuthSettings. |
| Filters | Sales: sales organization plus product, status and fulfillment predicates. Inventory: site and product group predicate. |
| Limit | Both configured URLs contain $top=400. |
| Writeback | No POST/PATCH/PUT to SAP; GET for both SAP resources. |
The application configuration sets SAP query names and select/filter strings. Changes in a SAP analytical query, tenant, or field identifier may affect the integration.
4. Sales-order extraction: field-level contract
The imported payload corresponds to the Sales Order Detail. Below are key property mappings used in the application.
| Application meaning | Purpose downstream |
|---|---|
| SalesOrderNumber | Unique order document ID |
| SalesItemNumber | Composite order-line reconciliation key |
| CreatedDate | Creation date |
| AccountNumber | Customer master join |
| ProductNumber | Product master join |
| ProductSpec | Product specification text |
| Variant | Conduit/BOM and inventory variant grouping |
| QuantityRequested | Sales demand quantity |
| QuantityFulfilled | Completed fulfillment deduction |
| RequestedDate | Required date/priority context |
| SalesOrganization | Selling organization cache partition |
| StatusHeaderId | Post-query exclusion when equal to "4" |
| ItemStatusId | Selected in API and filtered at server level |
| PurchaseOrderNumber | Mapped locally as PurchaseOrder |
| SpecialInstructions | Preserved through demand/work-order display |
| ShipToCity | Customer destination context |
| ShipToState | Customer destination context |
| Display statuses | Text display status and item lifecycle |
5. Inventory extraction and inventory-use rules
| Mapped value / handling |
|---|
| Site code; response class property is misleadingly named SalesOrderNumber; mapped to InventoryItem.LocationName. |
| PartNumber -> InventoryItem.ProductNumber. |
| IStockId; GetStockId strips the product prefix to provide a stock/batch identifier. |
| UnitOfMeasure -> UnitMeasure. |
| InventoryValue -> QuantityOnHand. SAP metadata labels this measure Un-Restricted Stock. |
| DateLastCounted retained as string. |
| DateLastPickup mapped to LastPickupDate. |
| Variant; used with product number for matching inventory to demand. |
On each direct SyncDemandSummary call, the code filters out entries whose InventoryValue equals zero, deletes all existing local InventoryItem rows for the selected facility, and inserts the newly fetched rows. Thus this is a full facility snapshot refresh, not a stock-movement ledger or incremental difference reconciliation. It provides availability context for planning, not warehouse transaction provenance. The older UpdateInventory background-job class uses an upsert keyed only by ProductNumber and is separate from the primary refresh method; no call site was found for that job in the supplied code.
For ordinary product demand, the code groups inventory by ProductNumber + Variant and aggregates matched amounts; this helps prevent stock belonging to another specification from being treated as interchangeable. For conduit, the code additionally compares identified stock identifiers to correlate finished goods and component inventory.
6. SAP-to-scheduler synchronization
- Resolve the currently selected LocationSapId to a Location master row and fetch its LocationSales value.
- Issue SAP sales-order GET by sales organization, discard select payload records with a certain header status.
- Issue SAP inventory GET by plant/site code, dropping records with an exact zero stock value.
- Load existing scheduler open orders, schedule lines, active work orders and inventory for the facility.
- Before order reconciliation, recalculate existing production-line start dates in line order using previous remaining hours.
- Find orders no longer present in SAP. Delete those without linked noncompleted work orders; retain orders with active linked work orders but set QuantityRequested to zero.
- Insert newly returned order-line pairs and update existing matching pairs (SalesOrderNumber + SalesItemNumber) using bulk repository methods.
- Delete schedule lines not linked to any work order and no longer backed by an open-order row (excluding maintenance lines).
- Bulk delete the facility inventory cache and insert nonzero SAP inventory records.
- Return success. A separate facility-sync-time endpoint writes a timestamp and the frontend invokes it on successful explicit refresh.
7. Demand construction and order-to-product joins
DemandSummary processing combines several sources rather than simply displaying unmodified SAP rows: (1) locally cached open orders; (2) master-data customer name matching; (3) product master and product-child relationships; (4) inventory per plant/product/variant; (5) production rates; and (6) existing schedule/work-order/production records. The code does an inner join between open orders and pipe products, so an SAP product absent from the product master will not enter the resulting product-demand list.
For pressure-pipe (single-stage) demand, the calculation is RequestedQuantity minus QuantityFulfilled when the requested quantity is positive. The demand is grouped by product number, variant and product-specification text. The system tracks each underlying order line/customer as a separate DemandSourceDto, with sales item, customer, order, required date, special instructions, PO, current scheduled quantity and linked work orders.
For conduit (multistage) demand, the system groups by parent finished product and variant, looks up component products/BOM relationships, identifies related component stock, and converts requested finished-product footage into component demand using product master length and BOM InputQuantity. The source explicitly distinguishes conduit from non-conduit products; conduit requirements are not a generic unstructured order list.
8. Production scheduling capabilities
| Capability | Confirmed implementation |
|---|---|
| Facility and line assignment | ScheduleLine records retain Facility, LineNumber and OrderInSchedule; scheduling UI supports selecting a suitable line and inserting/reordering jobs. |
| Product/line compatibility | FacilityLine OD minimum/maximum compared with product support; rates stored per base product, plant and production line. |
| Estimated production time | Quantity (ft) × LbFt = pounds; pounds ÷ configured production rate = hours. |
| Rate selection | DefaultRunRate and CurrentRunRate stored on each scheduled row; editable production rates by line. |
| Sequence and start date | Line rows ordered by OrderInSchedule; start of each following row based on previous row StartDate + HoursRemaining. |
| Maintenance blocks | IsMaintenance and MaintenanceReasonId permit scheduling nonproduction downtime on the same board. |
| Demand visibility | Demand Summary grouped by product and customer, with available inventory, outstanding sales demand and currently scheduled quantity. |
| Line filtering / drag-and-drop | Vue components support line and search filters and draggable scheduling actions. |
| Scheduled versus remaining | ScheduledQuantity persists original planned footage; UpdatedQuantityToProduce represents remaining footage after recording. |
The design addresses a maintenance duration, filtering demand by production line, showing product specifications, and placing demand onto a line by drag-and-drop. These workflows have supporting implementation in the Vue UI and C# services.
9. Scheduling mathematics and production quantities
| Metric | Code-supported derivation | Example (illustrative only) |
|---|---|---|
| Open sales demand | RequestedQuantity − QuantityFulfilled if request > 0 | 10,000 ft − 2,000 ft = 8,000 ft |
| Required production weight | QuantityToProduce × LbFt | 8,000 ft × 4.0 lb/ft = 32,000 lb |
| Estimated hours | QuantityInPounds ÷ line RunRate | 32,000 lb ÷ 2,000 lb/hour = 16 hr |
| Remaining scheduled ft | ScheduledQuantity − Σ WorkOrderProduction.RecordedValue | 8,000 ft − 3,000 ft = 5,000 ft |
| Remaining hours | Remaining ft × LbFt ÷ CurrentRunRate | 5,000 × 4 ÷ 2,000 = 10 hr |
| Conduit component demand | Finished footage ÷ finished piece length × BOM input quantity | 400 ft ÷ 20 ft/piece × 2 = 40 component units (if consistent units) |
| Next scheduled start | Previous scheduled start + previous HoursRemaining | 8:00 + 10 hours = 18:00 (time/calendar rules must be validated) |
For an open work order, GetScheduleBoard recalculates HoursRemaining from UpdatedQuantityToProduce, LbFt and CurrentRunRate, then rounds upward to the next one-tenth of an hour. Production-rate service returns zero estimated time when the configured rate is zero; other paths divide by CurrentRunRate without an explicit local guard, so validation is important. The first line starting at the shift start and subsequent activities chaining from previous durations; the actual code uses a timezone-aware SetToCurrentDate helper and stored start values.
10. Production work orders: creation, enrichment and lifecycle
The scheduler creates a WorkOrder connected to a ScheduleLine (and thus indirectly to an SAP order line when OpenOrderId is populated). The WorkOrder entity retains facility, production line, product number, creation date, work-order number, natural resin, print-line details, special instructions, completion flag, ShopLogix export-failure flag, and linked production entries. The full work-order retrieval joins schedule line, facility information, product master, base product, selected open order and rate information to assemble shop-floor instructions.
The generated work-order information includes customer and plant; scheduled footage, updated remaining footage, run rate, estimated run time and line; product number, description, cut length, OD/diameter and DR; tolerances such as minimum/maximum wall and OD; size system, pressure class, stripes, stamps and standards; resin and relevant plant certification flags; customer number, specification and print-line instructions. This supports accurate manufacturing setup and reduces the need to reconstruct production details manually from separate systems.
Creating a work order saves it and then attempts a ShopLogix XML export. Failure is reported to the UI and the work order is flagged FailedToExportXml for follow-up. The app also offers an XML retrieval/explicit export endpoint, enabling export retrial. Completion changes IsCompleted to true and deletes (soft-deletes under the ScheduleLine model) the related schedule board row.
11. Production recording and WIP-related visibility
The most defensible description is “work-order-level production-progress and remaining-work tracking.” The WorkOrderProduction table holds RecordedValue, ProductionDate, CreationTime and WorkOrderId. An operator uses the Vue production-details screen to enter actual production against a specific work order, after which the application stores the entry and updates the corresponding scheduled board row. Existing production events can also be edited by ID.
On SaveSchedule, the server aggregates WorkOrderProduction.RecordedValue for each ScheduleLineId and sets UpdatedQuantityToProduce = ScheduledQuantity − total recorded production. On the demand summary, it displays CurrentScheduled = sum scheduled quantity − production recorded against linked work orders. This allows a scheduler to distinguish an 8,000-foot job with 3,000 feet produced from a job whose full 8,000 feet remain. An open WorkOrder keeps an associated sales order from being discarded during synchronization even if SAP no longer returns it; the external order’s QuantityRequested is set to zero in that scenario.
WIP View Summary
| Features | Reporting |
|---|---|
| Work orders in progress / completion flag | Financial WIP valuation by labor, material and overhead |
| Per-entry actual production amount and production date | Automated PLC/SCADA machine count acquisition |
| Remaining scheduled footage and run hours | Operation-by-operation routing and percent completion |
| Work order–schedule–SAP order-line traceability | Lot genealogy, consumption journals or quality release |
| Production history tied to a work order | Scrap/rework/variance posting to SAP ERP |
| Plant/line assignment and maintenance schedule | Automatic backflush of resin and components |
| ShopLogix export job template | Verified return telemetry and closed-loop job status |
Important interpretation: WIP is a manufacturing term with several meanings. In this application the code provides operational WIP progress (“what remains to run”), rather than documented inventory accounting status (“what materials/costs currently sit at each manufacturing stage”). Those should not be conflated in commercial or legal claims.
12. Conduit / multistage production and component-level planning
The conduit path is materially more complex than single-stage pipe demand. The master data represents finished products and child component products through ProductComponent, including OutputProductId, InputProductId, ProductSpec, BomId, BomVariant and InputQuantity. For each finished-product order and matching variant, ConduitDemandNewDto discovers child products, converts finished-item demand into component amounts, locates stock matching product and identified-stock suffix, and surfaces separate demand source rows and product information to the scheduler.
A component’s demand includes the customer demand converted by finished-piece length and BOM input quantity. The code can also present combined availability derived from finished-goods equivalent units plus component inventory. This helps planners see that a finished conduit product needs specific precursor material/components even though SAP sales demand is for the finished product. This is evidence of multistage demand decomposition and component-aware scheduling support, not proof that materials were issued, reserved or consumed in SAP.
The separate conduit part-number generator workbook contains unit/component/reel/PSIS request forms, standard data, product lists and identified-stock reference worksheets. It corroborates the business significance of variant-specific manufacturing, but is a reference/master-data aid rather than a demonstrated runtime SAP interface.
13. ShopLogix integration: separate from SAP
The implemented shop-floor output is an XML export, not an SAP OData write. WorkOrderXmlExporter reads a ShopLogix template from the master database, resolves work-order placeholders, XML-serializes a JobScheduleEdit payload, and writes an XML file named after the work-order number in the configured facility ShopLogixPath. The parser supports machine ID, action, job name, description, filters, due date, expected run speed, expected production quantity, cycle factors and setup expectations.
| Template token examples | Source data |
|---|---|
| PlantPrefix; LineNumber; WorkOrderNumber | Plant identification and job key |
| ProductID; ProductDescription; BasePartNumber | Material and product master data |
| ProductSpecification; PrimaryApp; SecondaryApp | Specification and application |
| RequestedDate | Order requested date |
| JobRateValue; JobRateThreshhold | Facility/product production-rate settings |
| LbFt; CycleFactor; InvCycleFactor | Pipe unit weight and derived cycle values |
| QTYInPounds; Length; ProductOD | Production target and dimensions |
The code shows file creation and a success/failure flag but no file acknowledgment, job-completion callback, inbound ShopLogix event feed or downstream SAP confirmation. Accordingly, the system can be described as preparing and transmitting job specifications to shop-floor software via XML. Fully automated ShopLogix production feedback is not proven.
14. Database and entity relationships
| Entity | Key data / relationship |
|---|---|
| OpenOrder | SAP SalesOrderNumber + SalesItemNumber; status, requested/fulfilled quantity, dates, product, customer account and variant. Has many ScheduleLines. |
| InventoryItem | Facility, product, variant, identified stock, unit, quantity, count/pickup dates. Full refreshed snapshot. |
| ScheduleLine | Facility, line, sequence, product, planned amount, remaining amount, start date, run rate, downtime, optional OpenOrderId, many WorkOrders. |
| WorkOrder | WorkOrderNumber, ScheduleLineId, product, facility, resin, line, completed/export statuses; many WorkOrderProductions. |
| WorkOrderProduction | WorkOrderId, RecordedValue, ProductionDate, CreationTime; individual production-progress entries. |
| ProductionRate / ProductionRateLine | Base product and per-facility/line production rate, job threshold. |
| FacilityInfo / FacilityLine | Shift start and supported production lines; per-line operating constraints. |
| ProductMaster / ProductComponent | WLP master DB product attributes and BOM child/parent relationships. |
| Location / Customer | Sales/plant crosswalk; customer account master enrichment. |
| FacilitySyncTime | Per-facility last reported sync timestamp. |
| MaintenanceReason | Categorized production-line downtime item. |
There are two EF Core contexts. WlpSchedulerDbContext stores operational scheduling and production-progress data; WlpMasterDataDbContext holds reference product, customer, location and template data. It is important to preserve cross-database identifiers when migrating the system. The uploaded archive provides entity classes and EF configurations; actual live schema, indexes, migrations deployed to the client and SQL contents have not been authenticated against an operational database.
15. UI and operational workflows
Planner refresh
At the Demand Summary screen, an authorized writer clicks Refresh; SAP open orders and inventory are imported, reconciliation occurs, demand is recalculated and the board is reloaded.
Demand review
Planner searches or filters demand, examines due dates, product specs, inventory and customer/order requirements, and selects a sales demand source.
Scheduling
Planner selects a compatible production line and desired quantity, with run rate and estimated time available, then drags/adds a schedule row; sequence and remaining hours are tracked.
Work order
Authorized planner generates a work order for a scheduled product/line, chooses resin/batch/print details and saves; system tries ShopLogix XML export.
In-process production
Operator opens the work order, adds actual production amount and production date, and sees scheduled remaining quantity reduced.
Maintenance downtime
Planner adds a nonproduction schedule item with duration/reason so a scheduled line accounts for downtime.
Closeout
User marks a work order complete; active schedule line is removed. Production records remain linked historically in the database unless separately removed.
16. Source-to-design comparison
| Key requirements | Observed implementation |
|---|---|
| SAP source of record | SAP inbound sales and inventory OData; no SAP writes |
| Import open orders | Direct service and facility synchronization |
| Display product requirements | Product/demand DTOs + Vue demand screens |
| Rules for scheduling logic | Facility/line compatibility, rates and schedule sequencing |
| Work-order generation | DB work-order creation, rich print information, ShopLogix XML |
| Master Products Database read | Separate EF context and product/BOM joins |
| Export Work Order CSV | Actual implementation exports ShopLogix XML |
| TrackVia reading SQL/file | No direct TrackVia client found in reviewed source |
| Maintenance time on board | IsMaintenance, downtime reason and schedule entries |
| Record production against WO | WorkOrderProduction and operator UI/API |
| Automatic machine-led WIP tracking | No inbound telemetry pipeline found |
19. Business value
This solution demonstrates a significant integration and manufacturing-operations case study: Ayoka built a bridge from ERP customer orders and inventory into a manufacturing planning layer that applied plant-specific run rates, production line suitability, product variations and conduit BOMs. It kept planned production connected to sales-order demand, gave operators structured production work orders, and captured actual completed footage so planners could see the remaining run. A separate ShopLogix export path moved job definitions toward the shop floor.




