Sp_Calc_sOpc (procedure)
@author:zhucx
@date: 2022/12/02
@describe: 发外加工
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | iFlag |
int |
| 2 | IN | iTmpCheck |
int |
| 3 | IN | sFormGuid |
varchar(100) |
| 4 | IN | sGuid |
varchar(100) |
| 5 | IN | sLoginId |
varchar(100) |
| 6 | OUT | sReturn |
varchar(4000) |
| 7 | IN | sBrId |
varchar(100) |
| 8 | IN | sSuId |
varchar(100) |
| 9 | OUT | sCode |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCalc_sOpc'._
Narrative
Business context: Four-way outsourced-process dispatch audit / un-audit on opsoutsideprocessmaster/opsoutsideprocessslave. Bound on four sibling modules across 发外加工流程, 模具管理, and 成品库存: 工序发外, 整单发外, 合格证登记, 刀模外发单据. Approving the dispatch commits that the listed processes / knife-moulds / 合格证 sheets have left the plant for the named vendor; the operation back-writes the dispatched qty onto the work-order route, locks the linked sales-order slave so it can't be cancelled mid-outsourcing, and (for 刀模) reduces the in-house tool inventory.
What it does: Defaults the IN params, branches on iFlag. On iFlag=1 flips opsoutsideprocessmaster.bCheck=1 and OpsOutsideProcessSlave rows, Update MftWorkOrderProcess to back-write the dispatched qty onto the work-order's process slave (so progress dashboards see the outsourcing in-flight), Update salsalesorderslave to mark the linked sales-order line as constrained, and Update EleKnifeMould to debit the tool's in-house count when knife-moulds are dispatched. iFlag=0 reverses each. Note that 整单发外 is bound with a different Sp_Check_sOpp/Sp_beforeSave_sOpp pair — the validators differ even though the audit body is shared.
Invocation: Bound to gdsmodule.sProcName on four modules: 工序发外 (sId 192116810113315232400087230) under 发外加工流程 (with Sp_Check_sOpc / Sp_beforeSave_sOpc), 整单发外 (sId 192116810113315234963208090) under 发外加工流程 (with Sp_Check_sOpp / Sp_beforeSave_sOpp — note the sOpp prefix), 合格证登记 (sId 101251240115016148599285930) under 成品库存 → 成品库单据, and 刀模外发单据 (sId 172129113112117455565837690) under 模具管理. Dispatched by Java BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on 审核/反审核. xly-src ships script/标版/30100101/Sp_Calc_sOpc.sql, script/标版/optimize/Sp_Calc_sOpc.sql, and an upgrade patch at script/标版/upgrade/20220104审核去除结账校验/Sp_Calc_sOpc.sql.