Sp_MaterialCheck_BtnEventMaterialCheck.md 2.62 KB

Sp_MaterialCheck_BtnEventMaterialCheck (procedure)

@author:钱豹 @date:20210602 封存 @describe:按主计划中的 规划中 次序,列出相应工单对应的材料,进行材料核实 1.先做库存匹配 2.逐条核实库存,如果需要采购,需要注明到料日期

  • 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(1000)
6 OUT sCode int

Body

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

Narrative

Business context: 生产管理 — 主辅料稽查 (material check) entry-point. For the 主计划 → 规划中 work-order rows selected by the user, this proc lists the materials each work-order needs, matches them against on-hand elematerialsstock, marks rows that can be fulfilled from stock, and flags the rest as needing a purchase with a 到料日期 placeholder. The header notes "1.先做库存匹配 2.逐条核实库存,如果需要采购,需要注明到料日期" (author 钱豹, 2021-06-02 封存).

What it does: Reads the operator-selected ids from sProInParam. Looks up the warehouse-allow-list constant ComMaterialsWareHouse from gdsformconst. Builds Materials_Tmp (required) and Materials_Tmp_Check (with diff text) plus elematerialsstock_Tmp_Check (live stock snapshot). For each row, compares required dQty vs stock dAuxiliaryQty; on a match writes bPlanMaterialCheck=1, bPlanMaterialCheckResult=1 to mftworkordermaterials; on a shortfall sets bPlanMaterialCheck=1, bPlanMaterialCheckResult=0 with the diff text in sMaterial / sMaterialDiff so the user can resolve via 稽查通过 / 稽查失败.

Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() — the 主辅料稽查 toolbar button names Sp_MaterialCheck_BtnEventMaterialCheck as the action (Sp_<Module>_BtnEvent* pattern). Also CALL-ed inline by the APS-state procs Sp_Manufacture_GetAPSStateOee and Sp_Manufacture_GetPlanAPSstate (which reuse the check logic when refreshing APS planning state). Companions: Sp_MaterialCheck_BtnEventMaterialCheckPass and Sp_MaterialCheck_BtnEventMaterialCheckFail. Install script ships at script/标版/30100101/schedule/Sp_MaterialCheck_BtnEventMaterialCheck.sql (plus a dated variant *MaterialCheck230511.sql).