Sp_Calc_sPkg (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_sPkg'._
Narrative
Business context: KPI流程操作菜单 → 物料采购流程 → 采购对账 — purchase reconciliation (对账) audit on PurPurchaseCheckingMaster. The check matches the supplier's invoice/receipt against the system's stock-in records and posts the reconciliation row into the supplier-payables ledger; the uncheck rolls it back.
What it does: Refuses audit when the master lacks tInvoiceDate, tReceiveDate, or sInvoiceNo (i.e. the invoice meta has not been filled in). On iFlag=1: optionally drives Sp_System_CheckFlow per slave when CkxDefineCheck=1, runs Sp_Bill_Used to verify no downstream rows block the audit, and updates supplier last-price into EleMaterials/EleMaterialsSupply; propagates the checking status into CahSupplyInit, cahfinancialadjustslave, accmaterialsinitslave, PurPurchaseInStoreSlave, PurPurchaseRejectSlave; finally flips bCheck=1, sStatus=1 on PurPurchaseCheckingMaster. iFlag=0 reverses.
Invocation: Bound to gdsmodule.sProcName on 采购对账 (sId 192116810113315220489243410, parent 物料采购流程) — dispatched by BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the audit/un-audit button. xly-src ships script/标版/30100101/Sp_Calc_sPkg.sql (install) and script/标版/upgrade/20220104审核去除结账校验/Sp_Calc_sPkg.sql (patch removing closing-period validation).