mes-stocktake / engine
WIP and finished-goods stocktake rule engine for small metalworking shops
Package info
github.com/chavarriaannemarie739-boop/mes-stocktake-engine
pkg:composer/mes-stocktake/engine
Requires
- php: ^8.1
Requires (Dev)
- phpunit/phpunit: ^10.5
README
Open-source WIP / finished-goods stocktake rule engine for small and mid-size metalworking shops.
Most inventory libraries stop at warehouses, lots, and FIFO. Shops that cut round bar and machine gears still hand-match four fields, guess process loss, and split WIP by whoever shouted last. This package is that missing rule layer: no database, no ERP screens, no customer data.
What it does
| Rule | Use |
|---|---|
| Round-bar four-field match | Material + diameter + length + optional heat no, with tolerances |
| Finished-goods lookup | Spec / model search after shop-floor normalization (80×120×15 = 80x120x15) |
| Stocktake projection | Book qty ± configurable loss (shrink_remaining, process_yield, consume_uplift) |
| WIP split | Break one WIP qty into process rows by work-report share |
| Bar weight | GB-style round steel kg from diameter × length |
Requirements
- PHP 8.1+
- Composer
Install
composer require mes-stocktake/engine
Until the package is on Packagist, require the GitHub repository:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/chavarriaannemarie739-boop/mes-stocktake-engine"
}
],
"require": {
"mes-stocktake/engine": "^0.1"
}
}
Quick start
use Mes\Stocktake\Engine; $lots = Engine::matchRoundBars( ['material' => '42 Cr Mo', 'diameter' => 'Φ50', 'length' => '6m', 'heatNo' => ''], $yardLots ); $goods = Engine::searchFinishedGoods( ['spec' => '80 x 120 x 15', 'model' => 'GS-200'], $finishedItems, ['modelMode' => 'prefix'] ); $expected = Engine::projectStocktake([ 'opening' => 120, 'inbound' => 30, 'outbound' => 22, 'lossCoefficient' => 0.015, 'counted' => 125.5, ]); $wipRows = Engine::splitWip(80, [ ['processCode' => 'CUT', 'reportedHours' => 3.5], ['processCode' => 'TURN', 'reportedHours' => 8.0], ]);
Demo
composer install composer demo
The demo plant is fictional Acme Metal Bar Works. It is not a real factory.
Design boundaries
This repository is a rule engine, not an ERP.
In scope: matching, projection, WIP split, weight, tests, a runnable demo.
Out of scope: payroll, equipment, menus, mini-programs, live shop Excel, server credentials, or any named customer plant.
Host applications (private MES/ERP) can depend on this package over Composer. Production use is evidence that the rules are maintained; customer names do not belong in this repo.
Versioning
SemVer. v0.1.0 is the first tagged public API.
License
Contributing
See CONTRIBUTING.md. Please read CODE_OF_CONDUCT.md and SECURITY.md before opening issues or PRs.