Sp_System_MaterialsReCost.md 2.27 KB

Sp_System_MaterialsReCost (procedure)

@author:杨恒林 @date:20210521 封存 @describe:全月加权计算价格后 期初金额 + 采购入库金额+期它入库金额/ 期初数量 + 采购入库金额+期它入库金额 更新到其它各单据 bUpdate = 0:第一次分摊,分切单主表分摊到从表。 第二次正常分摊

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sProInParam varchar(10000)
2 IN sMakePerson varchar(100)
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 OUT sReturn varchar(4000)
6 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSystem_MaterialsReCost'._

Narrative

Business context: 成本核算 / 期间材料价格重算 — the "re-cost" counterpart to Sp_System_MaterialsCost. Same weighted-average algorithm (期初金额 + 采购入库 + 其它入库 / 同口径数量) but operating from the 月度成本 batch context: takes a JSON list of sysaccountperiod ids, undoes any prior 材料分摊 confirmation, and reruns the price computation. Lets accounting re-issue 材料价 for an already-priced period when adjustments arrive.

What it does: Validates sProInParam ≥ 13 chars and that the JSON $.params[*].value[*].sId list hits sysaccountperiod; for each id reads sPeriodId, refuses when accordercostanalysis iType=1 bConfirm=1 or accproductionmaterialsslave bConfirm=1 exists for the period, then follows the same temp-table / Sp_MaterialsCarryforward / accmaterialsstore / mitmaterialsstoreadjustmoney* rebuild flow as Sp_System_MaterialsCost to refresh prices.

Invocation: Status: appears orphaned at the procedure-call level (no proc-to-proc, gdsmodule, or form-master binding). Signature (sProInParam JSON, sMakePerson, sBrId, sSuId, sReturn, sCode) is the canonical Sp_BtnEvent_* dispatch shape — almost certainly invoked by GenericProcedureCallServiceImpl.doGenericProcedureCall() from a 重新计算材料价 button on the 月度成本 grid. Install script script/标版/30100101/cost/Sp_System_MaterialsReCost.sql.