Sp_Manufacture_BillComplete.md 2.15 KB

Sp_Manufacture_BillComplete (procedure)

@author:qmj @date:20210607 封存 @describe iFlag 标志,1 完工,0 取消完工

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

Parameters

# Mode Name Type
1 IN sGuid varchar(1000)
2 IN sMakePerson varchar(100)
3 IN iFlag int
4 IN sLoginId varchar(100)
5 IN sBrId varchar(100)
6 IN sSuId varchar(100)
7 OUT sReturn varchar(1000)
8 OUT sCode int

Body

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

Narrative

Business context: 生产管理 → 生产计划 → 主计划 — 整单完工 / 取消整单完工 toggle. Marks an entire 主计划 (mftproductionplan) as complete and cascades to its 机台计划从表 and the parent 工单. Author comment marks the proc 封存 (sealed / archived) as of 2021-06-07.

What it does: With iFlag=1 (完工): UPDATE mftproductionplanslave set sState='5', iComplete=1 for all rows under the same sWorkOrderId as the main plan sGuid; UPDATE mftproductionplan set sState='6' on sId=sGuid; UPDATE mftworkordermaster.bBillComplete=1 for the linked 工单 via INNER JOIN mftproductionplan. With iFlag=0 (取消完工): re-evaluates mftworkordermaster.bBillComplete against viw_mftworkorder aggregates (dProductQty vs dProductInStoreQty and vs dDeliverQty) and only clears it when actuals fall short of plan, writing an audit trail into sCompletePerson.

Invocation: Status: appears orphaned. Author comment marks it 封存. No gdsmodule.sProcName hook, no form-master binding, no other-routine reference. xly-src ships script/标版/30100101/Sp_Manufacture_BillComplete.sql (install script) — preserved for reference but the live UI presumably uses a successor flow. Calc-style signature (sGuid, sMakePerson, iFlag, sLoginId, sBrId, sSuId, OUT sReturn, OUT sCode) would normally bind via gdsmodule.sProcName on the 主计划 form's 审核 slot — that binding is absent.