Sp_Calc_sSck (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_sSck'._
Narrative
Business context: 销售管理 → 销售对账单据 (sales reconciliation / salsalescheckingmaster) audit / un-audit. The 对账单 ties together delivered, invoiced and returned quantities so finance can ack the period close.
What it does: Validates sGuid and bInvalid, then on iFlag=1 sets bCheck=1, sCheckPerson, tCheckDate on SalSalesCheckingMaster/SalSalesCheckingSlave; writes-back the upstream rows (UPDATE SalSalesOrderSlave, SalDeliverGoodsSlave, saldelivernotifyslave, SalRejectGoodsSlave, MftWorkOrderSlave, SalQualityAbnormalSlave, cahfinancialadjustslave, accproductinitslave) to mark the corresponding qty as 对账-locked; inserts a CahReceivables row and an optional kpidetail row; updates CahCustomerInit and calls Sp_System_CheckFlow per slave when define-check is on; finally CALL Sp_Bill_Used. iFlag=0 reverses every step.
Invocation: Bound to gdsmodule.sProcName on:
-
销售对账单据(sId11811781131121915184849572550) — also configured withsSaveProName=Sp_Check_sSck,sSaveProNameBefore=Sp_beforeSave_sSck,sDeleteProName=Sp_afterSave_sSck - Repurposed on packaging-related forms
盒型定义,盒数据,盒型组件维护,自动拼版单据— these reuse the audit slot for their own approval flow
Dispatched by BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the 审核/反审核 button. Caveat: the comment 销售对账单存储过程 only describes one of the bound forms — the packaging forms above also call this proc; check whether the body's salsalescheckingmaster lookups silently no-op for those forms or whether a customer override (script/客户/千彩/Sp_Calc_sSck.sql) is in play.