Sp_Calc_sPst (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_sPst'._
Narrative
Business context: 成品库存 → 成品库单据 (and KPI流程操作菜单 → 销售送货流程) — audit / un-audit of a 成品入库 (finished-goods receipt) bill on PitProductInStoreMaster/PitProductInStoreSlave. On approval, qty is posted into PitProductStore, the source work-order (MftWorkOrderMaster/Slave) is back-written with completed quantity, and the linked sales-order slave (salsalesorderslave) is updated to reflect what's now on hand.
What it does: Long body. Validates sGuid, calls Sp_Bill_Used to verify the bill is not consumed downstream; on iFlag=1 cursors slave rows, INSERT INTO PitProductStore and INSERT INTO MitMaterialsStoreVirtual for the receipt, CALL Sp_calc_productstoreLimit/SP_Inventory_ProductCalcQty/SP_Inventory_ProductInOutWareHouse, back-writes mftworkordermaster/mftworkorderslave completed-qty + status, syncs mftproductionplan(slave/billslave), updates eleproduct(stock), posts qlyproducttestmaster (quality test rows), updates sgdsemigoodsmatchbillmaster/slave (半成品 match) and salsalesorderslave; flips PitProductInStoreMaster.bCheck=1. iFlag=0 reverses inventory deltas and master/slave flags. Resolves the inventory form-guid via Sp_Sis_GetProductInventoryFormGuid.
Invocation: Bound to gdsmodule.sProcName on two modules — 成品扫码入库(单据) (sId 101251240115016189918441220, under 现场 → 功能操作) and 成品入库 (sId 192116810113315228246447250, under KPI流程操作菜单 → 销售送货流程). Dispatched by Java BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the audit/un-audit button. Install scripts: script/标版/30100101/Sp_Calc_sPst.sql, an upgrade patch script/标版/upgrade/20220126-2861-仓库冻结后,入库、领料、送货单不可消审/Sp_Calc_sPst.sql, plus customer overrides at script/客户/千彩/ and script/客户/朝阳/ — verify which is deployed per tenant.