mrp_plan
Calculate material requirements by netting open demand and supply through the bill of materials day by day, returning what to buy and make, by when, and why, with a CSV worksheet.
Instructions
Material requirements plan for one company, read-only: nets open sales and job demand, open manufacturing batches and open purchase orders against stock, day by day, through the bill of materials, and returns what to buy and make, by when, and why. ALWAYS ask the user two things first and never assume either: the time frame (through, or days) — 'buy and make what is needed to cover everything due by this date' — and the scope: everything, particular vendors, or particular products. EBMS does not publish vendor lead times, so orders carry a needed-by date; pass leadTimeDays only if the user gives one. Only stocked products and stocked lines are planned; drop-ship, associated and sync lines belong to their own orders. The planner's worksheet comes back attached as CSV: give it to the user as a file in the conversation, unchanged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Time frame as days from today. Give this or through. | |
| items | No | With scope 'products': the product IDs to report. | |
| scope | No | Required. ASK the user: everything, particular vendors, or particular products? Buyers often work one vendor at a time. The whole company is always planned; the scope decides what is reported. | |
| inChat | No | Default true: attach the worksheet's CSV to this result. | |
| saveTo | No | Folder for the worksheet. Default: KOBLE_OUTPUT_DIR, or 'Koble MRP' in the user's Documents. | |
| company | No | Company, by ID or name. May be omitted only when one company is available. | |
| maxRows | No | Rows per section in this result, default 25. The worksheet always has every row. | |
| through | No | Last date to cover, yyyy-mm-dd. Give this or days. | |
| vendors | No | With scope 'vendors': vendor IDs or names. A product belongs to its primary vendor. | |
| alsoMade | No | Product IDs to treat as manufactured although they have never been on a batch. | |
| leadTimes | No | Lead time in days per product ID, overriding leadTimeDays. | |
| worksheet | No | Default true: write the planner's worksheet (CSV). | |
| buyInstead | No | Made products to plan as purchased for this run (not exploded into components). | |
| includeJobs | No | Count job transfers as demand. Default true. | |
| minimumRule | No | How an item that ends the time frame under its minimum is restored. when-crossed (default): the minimum is a reorder point, so the order is dated the day the item went under and can replace an expedite. by-end: the minimum is a level to be back at by the end of the time frame, so the order is dated its last day. It is a company policy; ask once. | |
| leadTimeDays | No | A lead time to assume for every item, only if the user states one. |