Sp_Calc_sPpr.md 2.75 KB

Sp_Calc_sPpr (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_sPpr'._

Narrative

Business context: KPI流程操作菜单 → 订单生产流程 → 产量上报 — production-output reporting (报工) audit on MftProductionReportMaster/Slave. The check posts reported output against work-order slaves and process rows, drives the work-order completion state-machine, recomputes plan-side quantities, and updates the linked sales-order shipment-ready totals. Also serves the mobile variant 内部报工(mobile单据).

What it does: Guards on bInvalid/SysLocking/bFrozen (period). Reads SysSystemSettings.CbxProductionReport mode flag. On iFlag=1: runs Sp_Check_mftProductionReportValue to validate reported quantities, Sp_CheckExceedReport to refuse over-reporting beyond planned qty, Sp_Check_SaveOeeReportCheck to validate against OEE-machine output; calls Sp_CalcAttribDate to roll the report into the correct accounting period; flips counters on mftproductionreportslave, mftproductionplan/mftproductionplanslave, MftWorkOrderProcess, MftWorkOrderControl, mftworkordermaster (status), sgdsemigoodsmatchbillmaster/Slave, salsalesorderslave (shipment-ready); writes employee KPI into mftproductionreportemployee and rolls remaining mould-life into eleknifemould; finally calls Sp_Change_WorkOrderStatus to advance the work-order state-machine and flips bCheck=1, sStatus=1 on the master. iFlag=0 symmetrically reverses.

Invocation: Bound to gdsmodule.sProcName on 产量上报 (sId 19211681019715476042694840, parent 订单生产流程) and 内部报工(mobile单据) (parent 功能操作) — dispatched by BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the audit/un-audit button. Additionally called by OeeServiceImpl (Java field private final static String sProName = "Sp_Calc_sPpr", paired with sFormIdOee = "19211681019715476042694840") when the PLC/OEE feed auto-submits an output report — the service routes the call through BusinessBaseService and follows up with checkOutputReport. xly-src ships script/标版/30100101/Sp_Calc_sPpr.sql (install) plus upgrade patches (20230206上报工资计算, 20220104审核去除结账校验).