Sp_Calc_sCoach.md 1.86 KB

Sp_Calc_sCoach (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(5000)
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_sCoach'._

Narrative

Business context: 产品指导价 (material guide-price update) — check / uncheck on elematerialscoachmaster. Approving a 指导价 (guide-price) batch posts the new prices back into elematerials.dGuidePrice so later quotation / BOM lookups pick them up.

What it does: Validates sGuid. With iFlag=1: refuses if already checked; sets elematerialscoachmaster.bCheck=1, sStatus=1, sCheckPerson=sLoginId, tCheckDate=NOW(). Then runs UPDATE elematerials A INNER JOIN elematerialscoachslave B ON A.sId=B.sMaterialsId SET A.dGuidePrice=B.dNewPrice WHERE B.sParentId=sGuid — sweeping the new prices onto the live material rows. With iFlag=0: clears the master flags (does not roll back the dGuidePrice writes — flagged below).

Invocation: Status: appears orphaned. No gdsmodule hook, no form-master, no other procedure caller, no xly-src reference. The elematerialscoach* tables exist; the audit handler is unwired in this DB instance. Candidate for maintainer audit.

Flag: the uncheck branch does not reverse the elematerials.dGuidePrice overwrite — once a guide-price batch is checked, the price change sticks even if the batch is later un-audited. Maintainer should confirm this is intended.