Sp_Split_sMpt (procedure)
产品工艺卡拆分
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sTableName |
varchar(100) |
| 2 | IN | sGuid |
varchar(100) |
| 3 | IN | sFormGuid |
varchar(100) |
| 4 | IN | sLoginId |
varchar(100) |
| 5 | IN | sBrId |
varchar(100) |
| 6 | IN | sSuId |
varchar(100) |
| 7 | IN | iFlag |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSplit_sMpt'._
Narrative
Business context: 生产管理 → 产品工艺卡 (mftproductmaster / 印品工艺卡) — splits a multi-line product-craft master into individual one-line masters, one per product. When a craft card carries several products in its slave, the user runs this proc to fan out the master so each product has its own card (a precondition for downstream MRP / 工艺差异 reporting).
What it does: Counts mftproductslave WHERE sParentId=sGuid; if there are 2+ slaves, opens a cursor over them and for each slave (after sId, sCustomerId, sProductId, sProductNo): generates new_masterId/new_slaveId via newId(), skips when an active master for sProductId already exists, requests a fresh sBillNo via CALL SP_Sis_GetMaxNo('mftproductmaster', …), then INSERT INTO mftproductmaster (...) SELECT ... FROM mftproductmaster WHERE sId=sGuid (clones the master with new IDs) and INSERT INTO mftproductslave (...) SELECT ... (clones only that one slave row). Does nothing when the master has 0 or 1 slaves.
Invocation: Install script: script/标版/30100101/Sp_Split_sMpt.sql. No form-master binding, no gdsmodule hook, no other DB caller, no xly-src reference. Status: appears orphaned — likely a manual one-off tool invoked by DBA; candidate for maintainer audit before relying on the cloned-row column list (verify all reserved/extension columns are still covered).