# `Sp_Manufacture_ProductionProcess` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sWorkNo` | `varchar(100)` |
| 2 | IN | `sManualNo` | `varchar(100)` |
| 3 | IN | `sOrderNo` | `varchar(100)` |
| 4 | IN | `sCustomerGuid` | `varchar(100)` |
| 5 | IN | `sSaleManGuid` | `varchar(100)` |
| 6 | IN | `iType` | `int` |
| 7 | IN | `tStartDate` | `datetime` |
| 8 | IN | `tEndDate` | `datetime` |
| 9 | IN | `sBrId` | `varchar(100)` |
| 10 | IN | `sSuId` | `varchar(100)` |
| 11 | IN | `bFilter` | `varchar(5000)` |
| 12 | IN | `pageNum` | `int` |
| 13 | IN | `pageSize` | `int` |
| 14 | OUT | `totalCount` | `int` |
| 15 | IN | `countCloumn` | `varchar(5000)` |
| 16 | OUT | `countMapJson` | `longtext` |
| 17 | IN | `sFilterOrderBy` | `varchar(5000)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Manufacture_ProductionProcess`'`._

## Narrative

**Business context:** 生产管理 — work-order production-progress (生产进度排程) report. For each 工单 filtered by work-no / manual-no / order-no / customer / sales-rep / date range, the proc assembles a per-process progress matrix: planned qty vs. reported qty vs. delivered qty, plus material-availability tags ("需采购"/"库存料"/"已采购"), so the production controller can see at-a-glance which orders are ready, blocked, or running.

**What it does:** Builds scratch table `TMP_ProductionArrange` from `Viw_MftWorkOrder` filtered by the bill-no/customer/date inputs, then layers progress from `Viw_MftProductionPlan`, `viw_mftproductionreport`, `mftproductionreportslave`, `MftProductionPlanSlave` joined to `eleMachine`, and outside-process state from `Viw_OpsOutsideProcess`. Material status comes from `MftWorkOrderMaterials` joined against `Viw_PurPurchaseOrder` / `Viw_PurPurchaseInStore`, with the language constants resolved out of `SysSystemSettings (CbxLanguage, CbxProductioning, CbxProductionReport)`. Computes `dRatio = 100 * dProductionReportQty / dProductQty` (or vs. `dPriorReportQty`). Result paged via `Sp_Outstanding_Query`.

**Invocation:** Referenced from `Fun_getInitColumnByProName` (column-init helper that introspects procs by name). No direct form-master binding, no `gdsmodule` hook found. Shipped as `script/标版/30100101/Sp_Manufacture_ProductionProcess.sql`. Most likely bound to a 生产进度 report form via dynamic dispatch (column-init metadata) rather than a literal `sSqlStr` — verify the active form binding before relying on it. Status: likely live but channel not confirmed.
