Sp_Calc_sPtr (procedure)
产品领用
- 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_sPtr'._
Narrative
Business context: 成品库存 → 出库管理 → 成品领用单据 — audit / un-audit of a 产品领用 (finished-goods issue / retrieval) bill on PitProductRejectMaster/PitProductRejectSlave (the "reject"-named tables also carry internal-issue rows). On approval, the issued qty is taken out of PitProductStore, the consuming work-order / sales-order / outside-process / 半成品 match rows are back-written, and the product master stock (EleProductStock) is decremented.
What it does: Validates sGuid, cursors slave rows, on iFlag=1 INSERT INTO PitProductStore an offsetting (negative) row per slave, CALL Sp_calc_productstoreLimit/SP_Inventory_ProductCalcQty/SP_Inventory_ProductInOutWareHouse, UPDATE EleProductStock to deduct, and back-writes MftWorkOrderSlave, mftproductionplanbillslave, salsalesorderslave, opsoutsideprocessslave, sgdsemigoodsmatchbillslave, PitProductInStoreSlave to reflect consumed quantities; flips PitProductRejectMaster.bCheck=1, sStatus=1, stamps sCheckPerson/tCheckDate. iFlag=0 DELETE FROM PitProductStore the posted rows and reverses every back-write.
Invocation: Bound to gdsmodule.sProcName on 成品领用单据 (sId 101251240115015920999005840) under 成品库存 → 出库管理. Dispatched by Java BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the audit/un-audit button. Install scripts: script/标版/30100101/Sp_Calc_sPtr.sql plus script/标版/30100101/Sp_Check_sPtr.sql (companion pre-audit checker).