diff --git a/en/docs/reference/maintainer/index.md b/en/docs/reference/maintainer/index.md index c362978..dda3b99 100644 --- a/en/docs/reference/maintainer/index.md +++ b/en/docs/reference/maintainer/index.md @@ -15,3 +15,4 @@ metadata table to the `gds*` family, or wire in a new third-party integration. - [Metadata-management services (`xlyManage`)](management-services.md) — the `Gds*ServiceImpl` family behind the BACK builder. - [BI / KPI / Charts engine](bi-engine.md) — the homebrewed dashboard layer. - [Activiti integration](activiti.md) — version skew, schemas, custom delegates. +- [Known issues in stored procedures and functions](known-issues-in-stored-procedures.md) — consolidated index of code-level defects, comment drift, sealed-but-still-bound routines, and other audit signals surfaced while documenting the 1,861 auto-catalog routines. diff --git a/en/docs/reference/maintainer/known-issues-in-stored-procedures.md b/en/docs/reference/maintainer/known-issues-in-stored-procedures.md new file mode 100644 index 0000000..9055808 --- /dev/null +++ b/en/docs/reference/maintainer/known-issues-in-stored-procedures.md @@ -0,0 +1,258 @@ +# Known issues in stored procedures and functions + +A consolidated index of code-level defects, comment drift, sealed-but-still-bound +routines, and other audit signals that the +[auto-catalog narratives](../../auto-catalog/procedures/index.md) surfaced while +documenting xly's 1,684 stored procedures and 177 functions. + +## What this page is, and is not + +**Is:** an index. Each entry points at a routine whose per-routine +[auto-catalog page](../../auto-catalog/procedures/index.md) carries the full +evidence (proc body excerpt, calling-channel analysis, etc.). The categories below +are decision-support — they let a maintainer scan for what to triage first +without reading 1,861 pages. + +**Is not:** a fix plan. None of these defects have been fixed; the procedures +are still running in production. Several are operationally invisible (e.g., a +broken regex that always returns "yes" looks fine if the caller never relied on +the filter). Others are likely intentional (sealed legacy procs kept around for +rollback). **Audit each entry before acting on it** — a flag here is a signal +worth verifying, not a confirmed bug ticket. + +> **Methodology.** Items were captured by the narrative-writing subagents when +> they read the proc/function body to understand what each routine did. The +> agents weren't running a defect audit — they noticed mismatches and bugs as a +> side effect. Pass 3 spot-checked 10 randomly-selected flag claims and all 10 +> verified against the live `SHOW CREATE` output. The list is high-signal but +> incomplete: routines whose body the agents didn't read in depth (huge bodies +> with body-summarization mode) may carry undocumented issues. + +--- + +## Real correctness / runtime bugs + +These will produce wrong results, return wrong values, or fail at runtime under +the documented conditions. **Highest priority for audit.** + +- [`Fun_GetCh`](../../auto-catalog/functions/Fun_GetCh.md) — regex `'[u0391-uFFE5]'` is taken literally (matches `u`/`0`/`3`/…), not as the intended Unicode range `Α-¥`. The "non-Chinese filter" matches nothing; only `-`/`+` stripping survives. Used by `Sp_Create_sControlFaceNameTable*`. +- [`GetChineseChar`](../../auto-catalog/procedures/GetChineseChar.md) — same broken `[u0391-uFFE5]` literal regex; classifies every character as non-Chinese. +- [`GetDispatchUnit`](../../auto-catalog/procedures/GetDispatchUnit.md) — falls back to `eleproduct.sProductUnit` only for one hardcoded GUID; returns `NULL` on any other deployment. +- [`GetPriorProcess`](../../auto-catalog/procedures/GetPriorProcess.md) — one branch references session vars `@uGuid`/`@sCurProcessName` instead of proc-local `uGuid`/`p_sCurProcessName`; that branch always sees NULL. +- [`PRO_ERPMERGEBASEELECUSTOMER`](../../auto-catalog/procedures/PRO_ERPMERGEBASEELECUSTOMER.md) — SET clauses swap `sCustomerName = @sCustomerNo` and `sCustomerNo = @sCustomerName`; label columns are written to the wrong fields. +- [`PRO_ERPMERGEMFTWORKORDER`](../../auto-catalog/procedures/PRO_ERPMERGEMFTWORKORDER.md), [`PRO_ERPMERGEPRODUCTIONREPORT`](../../auto-catalog/procedures/PRO_ERPMERGEPRODUCTIONREPORT.md), [`PRO_ERPMERGESALSALESORDER`](../../auto-catalog/procedures/PRO_ERPMERGESALSALESORDER.md) — `DELETE FROM WHERE sSlaveId = sSlaveId`. IN parameter name shadows the column → tautology → wipes the entire merge table on every call before the single-row re-INSERT. +- [`Sp_AdjustMoney_BtnRepair`](../../auto-catalog/procedures/Sp_AdjustMoney_BtnRepair.md) — empty-memo guard sets `sCode=-1` but does not `LEAVE top`; the empty-memo branch still applies the update. +- [`Sp_AfterPost_sQtt`](../../auto-catalog/procedures/Sp_AfterPost_sQtt.md) — cursor inside `iFlag=1` is bounded by `viw_mftworkorderprocess` count, but the inner SELECT reads from `viw_quoquotation × quoquotationprocess × quoquotationcontrol`; loop bound is wrong. +- [`Sp_addBtn_gdsmodle`](../../auto-catalog/procedures/Sp_addBtn_gdsmodle.md) — BtnExamine `NOT EXISTS` guard checks `sControlName='BtnBsOperation.BtnInvalid'` instead of `BtnExamine`. +- [`Sp_addSysbrands`](../../auto-catalog/procedures/Sp_addSysbrands.md) — `gdsconfigformslave` clone reuses seed `sId` values rather than generating new ones; cross-tenant collision risk. +- [`Sp_Apply_Flow_materialspd`](../../auto-catalog/procedures/Sp_Apply_Flow_materialspd.md), [`Sp_Apply_Flow_productpd`](../../auto-catalog/procedures/Sp_Apply_Flow_productpd.md) — `WHERE iPosition=32 AND (sEmployeeNo='00034' OR iPosition=7)` is malformed; the `iPosition=7` branch is unreachable. +- [`Sp_Apply_Flow_OpsProductMore`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsProductMore.md) — `p_iCount2` calculated but `iOut2` set from `p_iCount4`; variable-name drift. +- [`Sp_Apply_Flow_OpsProductMorebecome`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsProductMorebecome.md) — `p_ThreeFlow` set to 总经理 then immediately overwritten by 财务总鉴 → 总经理 tier never returned. `p_iCount3` assigned twice; `p_iCount4` referenced but never assigned, so `iOut2` is always 0. +- [`Sp_Apply_Flow_PurCheck`](../../auto-catalog/procedures/Sp_Apply_Flow_PurCheck.md) — variance formula multiplies new-price by new-price (`B.dMaterialsPrice*A.dMaterialsPrice`); likely should be `dAuxiliaryQty*dMaterialsPrice`. +- [`Sp_Apply_Flow_PurpurchaseOrder`](../../auto-catalog/procedures/Sp_Apply_Flow_PurpurchaseOrder.md) — `p_iOut1` count of guidance-priced lines lacks `WHERE sParentId=sGuId`; counts across all orders, not just this one. Threshold `30000` hardcoded but header says `20000`. +- [`Sp_Apply_Flow_SalSaleOrder`](../../auto-catalog/procedures/Sp_Apply_Flow_SalSaleOrder.md) — `p_ElevenFlow` and `p_TwelveFlow` both populate from `iPosition=34` (duplicate); `p_MoreFlow` = `p_ThreeFlow` so 会签 collapses to a single party. +- [`Sp_Apply_Flow_SalSalesNotify`](../../auto-catalog/procedures/Sp_Apply_Flow_SalSalesNotify.md) — 烟包 count lookup hits `salsalesinvoiceslave` instead of `saldelivernotifyslave`; `iOut2` is wrong for delivery-notify forms with no companion invoice. +- [`Sp_Apply_Flow_Ystz`](../../auto-catalog/procedures/Sp_Apply_Flow_Ystz.md) — emits `"EightFlow", p_SevenFlow` (assigns 总经理 value to 董事长 slot); `p_EightFlow` populated but never emitted. +- [`Sp_Bd_Root_allstatus26`](../../auto-catalog/procedures/Sp_Bd_Root_allstatus26.md) — temp-table seeding INSERTs/SELECTs column `sMachineNo` that the `CREATE TEMPORARY TABLE` doesn't define. Proc fails at every call. +- [`Sp_beforeSaveReturn_sQtt`](../../auto-catalog/procedures/Sp_beforeSaveReturn_sQtt.md) — body joins `pitproductrejectslave` in a quotation back-writer; copy-paste from `Sp_saveReturn_sPdt`. +- [`Sp_BtnEvent_AccProductUnFrozen`](../../auto-catalog/procedures/Sp_BtnEvent_AccProductUnFrozen.md) — `sFrozenPerson`/`tFrozenDate` overwritten with the unfreezing user/timestamp, losing original-freeze attribution. +- [`Sp_BtnEventCopyUserJurisdiction`](../../auto-catalog/procedures/Sp_BtnEventCopyUserJurisdiction.md), [`Sp_BtnEventCopyGroupJurisdiction`](../../auto-catalog/procedures/Sp_BtnEventCopyGroupJurisdiction.md) — loop-overwrite bug; only the last `(sUserId, sToUserId)` pair is acted on. +- [`Sp_BtnUpdate_OnOpsConfirm`](../../auto-catalog/procedures/Sp_BtnUpdate_OnOpsConfirm.md), [`Sp_BtnUpdate_OnOpsOrder`](../../auto-catalog/procedures/Sp_BtnUpdate_OnOpsOrder.md), [`Sp_BtnUpdate_OnPurOrder`](../../auto-catalog/procedures/Sp_BtnUpdate_OnPurOrder.md) — `WHERE bOutConfirm=0` guard means once a row is confirmed the CASE toggle can never run again; effectively one-way confirm. +- [`Sp_BtnUpdate_RevSupply`](../../auto-catalog/procedures/Sp_BtnUpdate_RevSupply.md) — WHERE/SET column mismatch: guards on `bCheck=0` but mutates `bSubCheck`. Copy-paste from sibling template. +- [`Sp_Calc_plateprocessing`](../../auto-catalog/procedures/Sp_Calc_plateprocessing.md) — `IF iCount > 0` reads an undefined session variable (local is `p_iCount`); "already checked" guard never fires. +- [`Sp_Calc_Product`](../../auto-catalog/procedures/Sp_Calc_Product.md), [`Sp_Calc_sAcod`](../../auto-catalog/procedures/Sp_Calc_sAcod.md) — uncheck branch reads `sNoCanCheckBybCheck` instead of `sNoCanCheckBybUnCheck`. +- [`Sp_Calc_about`](../../auto-catalog/procedures/Sp_Calc_about.md), [`Sp_Calc_borrow`](../../auto-catalog/procedures/Sp_Calc_borrow.md), [`Sp_Calc_Change`](../../auto-catalog/procedures/Sp_Calc_Change.md), [`Sp_Calc_clear`](../../auto-catalog/procedures/Sp_Calc_clear.md) — `sTmpReturn` declared but never assigned; trailing `IF sTmpReturn <> ''` branch dead across the family. +- [`Sp_Calc_pruOrderBgd`](../../auto-catalog/procedures/Sp_Calc_pruOrderBgd.md) — accepts `iFlag` parameter but never branches on it; uncheck path missing entirely. +- [`Sp_Calc_sExp`](../../auto-catalog/procedures/Sp_Calc_sExp.md) — missing `sStatus`-flip and missing already-checked/unchecked guards versus family norm; both branches idempotent. +- [`Sp_Calc_sMat`](../../auto-catalog/procedures/Sp_Calc_sMat.md) — embedded `Sp_System_CheckFlow` loop scans `SalSalesOrderSlave` instead of any `elematerials` slave; copy-paste from 销售订单 template applied to a material-master audit. +- [`Sp_Calc_sMcd`](../../auto-catalog/procedures/Sp_Calc_sMcd.md) — unqualified `sMaterialsId` in the UPDATE SET expression; affects 盘点 profit/loss columns on multi-line counts. +- [`Sp_Calc_sPrw`](../../auto-catalog/procedures/Sp_Calc_sPrw.md) — un-audit guard reads from `salsalesdevmaster` rather than the production-report table. +- [`Sp_Calc_tice`](../../auto-catalog/procedures/Sp_Calc_tice.md), [`Sp_Calc_tore`](../../auto-catalog/procedures/Sp_Calc_tore.md) — column name mis-cased as `sCheckPersON`; case-sensitive on case-sensitive collations. +- [`Sp_history_purpurchaseordermaster`](../../auto-catalog/procedures/Sp_history_purpurchaseordermaster.md) — cursor declares `Cur_OrderSlave_handle1 = 1` (not 0); first row silently skipped (off-by-one). +- [`Sp_MaterialHistoricalComparison`](../../auto-catalog/procedures/Sp_MaterialHistoricalComparison.md) — accepts `sBrId`/`sSuId` but never filters by tenant; every tenant's data mixes. +- [`Sp_PurpurchaseOrder_CheckUpdate`](../../auto-catalog/procedures/Sp_PurpurchaseOrder_CheckUpdate.md) — name+COMMENT say "保存校验" but body is `dOldPrice/Money` back-write, not validation. +- [`Sp_PurchasePriceChart`](../../auto-catalog/procedures/Sp_PurchasePriceChart.md) — opens cursor over `DT` but `DT` is never populated; loop runs zero times. +- [`Sp_Sales_SalesAnalysiseOfCustomerproperty`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfCustomerproperty.md) — receipts subquery groups by `EP.sParentId` instead of `EP.sCustomerPropertyId`; axis mismatch. +- [`Sp_Sales_SalesAnalysiseOfMonth`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfMonth.md), [`Sp_Sales_SalesAnalysiseProductOfMonth`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseProductOfMonth.md) — `IFNULL(p_iStatisticsType, 0)` self-reference typo; input parameter `iStatisticsType` is ignored. +- [`Sp_Sales_SalesAnalysiseOfProfit`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfProfit.md), [`Sp_Sales_SalesAnalysiseOfProfit_Product`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfProfit_Product.md) — swapped-target rate columns: in-store rate writes to delivery's column and vice versa. +- [`Sp_SalOrder_BillForceComplete`](../../auto-catalog/procedures/Sp_SalOrder_BillForceComplete.md) — captured `p_sReason` parsed but never written. +- [`Stuff`](../../auto-catalog/procedures/Stuff.md) — right-slice uses `LOCATE(SUBSTR(str, startIndex, length), str)`; when the deleted substring also appears earlier in `str`, slices from the earlier occurrence. +- [`sp_cursor_test1`](../../auto-catalog/procedures/sp_cursor_test1.md) — `UPDATE eleteststandarditem SET iOrder=(@i:=@i+1)` has no `ORDER BY`; row numbering is non-deterministic. + +## Header / comment drift + +Cosmetic only — the routine works correctly but its `ROUTINE_COMMENT`, header +comment, or page title describes a different routine. Common after a routine +was renamed or cloned from a template without updating the header. + +- [`11`](../../auto-catalog/procedures/11.md) — header `现金日记帐` (cash journal), body is a product-class sales-revenue summary scratchpad. +- [`Fun_Cashier_GetProductPrice`](../../auto-catalog/functions/Fun_Cashier_GetProductPrice.md) — header `获取最近采购价(产品)`, body reads sales views. +- [`fun_get_jurisdiction`](../../auto-catalog/functions/fun_get_jurisdiction.md) — header `获取盒型图片`, body is a permission gate. +- [`Fun_getDhouM`](../../auto-catalog/functions/Fun_getDhouM.md), [`Fun_GetGb`](../../auto-catalog/functions/Fun_GetGb.md), [`Fun_GetTestCount`](../../auto-catalog/functions/Fun_GetTestCount.md), [`Fun_GetTestMaterialsCount`](../../auto-catalog/functions/Fun_GetTestMaterialsCount.md) — all carry the `获取字符串中数字` header copy-pasted from `Fun_GetNum`; bodies do different things. +- [`Fun_getMoneyFormart`](../../auto-catalog/functions/Fun_getMoneyFormart.md) — header `根据key值获取json字符串值`, body is amount-in-words digit splitter. +- [`Fun_getProductMaxStyle`](../../auto-catalog/functions/Fun_getProductMaxStyle.md) — header `根据首字母拼音查询`, unrelated to pinyin. +- [`NewId2`](../../auto-catalog/functions/NewId2.md) — header claims 27-char output; body produces 32 chars. +- [`Sp_addSysbrands`](../../auto-catalog/procedures/Sp_addSysbrands.md) — header `根据模块sId删除模块(包含子模块)`. +- [`Sp_afterSave_sOpkg`](../../auto-catalog/procedures/Sp_afterSave_sOpkg.md) — header references 发外发票, actual binding is 发外对账. +- [`Sp_afterSave_sOpp`](../../auto-catalog/procedures/Sp_afterSave_sOpp.md) — header `成品外购后反写数量`, actual module is 整单发外. +- [`Sp_afterSave_sPct`](../../auto-catalog/procedures/Sp_afterSave_sPct.md) — header references mobile, actual is 工序检验. +- [`Sp_afterSave_sPmt`](../../auto-catalog/procedures/Sp_afterSave_sPmt.md), [`Sp_afterSave_sWod`](../../auto-catalog/procedures/Sp_afterSave_sWod.md) — header says "保存前", routine is after-save. +- [`Sp_afterSave_sPtr`](../../auto-catalog/procedures/Sp_afterSave_sPtr.md) — header `报废单`, current bind is 成品领用. +- [`Sp_afterSave_sSmia`](../../auto-catalog/procedures/Sp_afterSave_sSmia.md), [`Sp_afterSave_sSmo`](../../auto-catalog/procedures/Sp_afterSave_sSmo.md), [`Sp_afterSave_sSmoa`](../../auto-catalog/procedures/Sp_afterSave_sSmoa.md) — headers reference 装配工单, bodies operate on `sgdsemigoods*-apply` tables. +- [`Sp_afterSave_tore`](../../auto-catalog/procedures/Sp_afterSave_tore.md) — header `回厂通知单保存后` copy-pasted from `tice` sibling. +- [`Sp_Apply_Flow_QualityaccidentsSupply_Proc1`](../../auto-catalog/procedures/Sp_Apply_Flow_QualityaccidentsSupply_Proc1.md) — header `供应商扣款单号 过程1` copy-pasted from `QualityaccidentMaterials_Proc1`. +- [`Sp_Apply_Flow_sCustomer`](../../auto-catalog/procedures/Sp_Apply_Flow_sCustomer.md) — `sParentName` JSON label says 供应商分类, body returns `siscustomerclassify.sName`. +- [`Sp_bd_Eqabnormal`](../../auto-catalog/procedures/Sp_bd_Eqabnormal.md) — COMMENT `调机时间分析` copy-pasted from `Sp_bd_EqAdjust`; body is 异常 idle analysis. +- [`Sp_Bd_bi20_hh`](../../auto-catalog/procedures/Sp_Bd_bi20_hh.md), [`Sp_Bd_bi20_ys`](../../auto-catalog/procedures/Sp_Bd_bi20_ys.md), [`Sp_Bd_bi20_2new`](../../auto-catalog/procedures/Sp_Bd_bi20_2new.md) — header `喷码+分切现场`, bodies target 糊盒/印刷/2new. +- [`Sp_Bd_cq_workshop_pj`](../../auto-catalog/procedures/Sp_Bd_cq_workshop_pj.md), [`_pm`](../../auto-catalog/procedures/Sp_Bd_cq_workshop_pm.md), [`_sy`](../../auto-catalog/procedures/Sp_Bd_cq_workshop_sy.md) — `-- call Sp_Bd_cq_workshop_mt(...)` header comment copy-pasted from family root. +- [`Sp_bd_MachineOee`](../../auto-catalog/procedures/Sp_bd_MachineOee.md) — header `设备OEE展示` overstates what the body delivers (4 hardcoded constants). +- [`Sp_beforeSave_sStl`](../../auto-catalog/procedures/Sp_beforeSave_sStl.md) — header is just `前反写数量` with no document name. +- [`Sp_beforeSaveReturn_sRct`](../../auto-catalog/procedures/Sp_beforeSaveReturn_sRct.md) — header `估价单保存前反写状态` mis-copied; body operates on receipt graph. +- [`Sp_BtnEvent_AccProductFrozen`](../../auto-catalog/procedures/Sp_BtnEvent_AccProductFrozen.md), [`_UnFrozen`](../../auto-catalog/procedures/Sp_BtnEvent_AccProductUnFrozen.md) — UnFrozen default `sReturn='送货未开票冻结成功!'` copy-pasted from Frozen. +- [`Sp_BtnEvent_MaterialsItestType`](../../auto-catalog/procedures/Sp_BtnEvent_MaterialsItestType.md) — default `sReturn='财务确认成功!'` wrong for this proc. +- [`Sp_BtnEvent_OpsInstoreComfirm`](../../auto-catalog/procedures/Sp_BtnEvent_OpsInstoreComfirm.md) — default `sReturn='物流单确认成功!'` copy-pasted from `LogisticsComfirm`. +- [`Sp_chart_MonthProfit`](../../auto-catalog/procedures/Sp_chart_MonthProfit.md) — `COMMENT 'PLC数据同步'` leftover; body is sales-vs-cost trend. +- [`Sp_format_column`](../../auto-catalog/procedures/Sp_format_column.md) — `COMMENT '根据模块sId删除模块(包含子模块)'`; body normalises grid-column widths. +- [`Sp_pur_purpurchaseorderOfSupply`](../../auto-catalog/procedures/Sp_pur_purpurchaseorderOfSupply.md) — `COMMENT '现金日记帐'` mislabel. +- [`Sp_PurpurchaseOrder_CheckUpdate`](../../auto-catalog/procedures/Sp_PurpurchaseOrder_CheckUpdate.md) — name+COMMENT say "保存校验", body is back-write. +- [`Sp_reportdata_WorkOrder`](../../auto-catalog/procedures/Sp_reportdata_WorkOrder.md), [`_WorkOrder1`](../../auto-catalog/procedures/Sp_reportdata_WorkOrder1.md), [`_WorkOrder3`](../../auto-catalog/procedures/Sp_reportdata_WorkOrder3.md) — `COMMENT '报价单数据源自定义'` leftover; bodies are 工单 Jasper data-sources. +- [`Sp_Sales_NotDeliverGoodList`](../../auto-catalog/procedures/Sp_Sales_NotDeliverGoodList.md), [`Sp_Sales_NotWorkOrderList`](../../auto-catalog/procedures/Sp_Sales_NotWorkOrderList.md), [`Sp_Sales_PurchaseAnalysiseOfMaterial`](../../auto-catalog/procedures/Sp_Sales_PurchaseAnalysiseOfMaterial.md), [`_OfMaterialClass`](../../auto-catalog/procedures/Sp_Sales_PurchaseAnalysiseOfMaterialClass.md), [`_OfSupply`](../../auto-catalog/procedures/Sp_Sales_PurchaseAnalysiseOfSupply.md) — `现金日记帐` copy-paste on procurement-analysis pivots. +- [`Sp_Sales_SalesAnalysiseOfSalesperson`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfSalesperson.md), [`Sp_Sales_SalesDelivergoodsAnalysiseOfCustomer`](../../auto-catalog/procedures/Sp_Sales_SalesDelivergoodsAnalysiseOfCustomer.md) — `COMMENT '现金日记帐'` mislabel. +- [`Sp_Sys_GetMenu`](../../auto-catalog/procedures/Sp_Sys_GetMenu.md) — auto-catalog header "根据模块sId删除模块" is misleading; body is read-only. +- [`Sp_UnConfirm_Zg`](../../auto-catalog/procedures/Sp_UnConfirm_Zg.md) — COMMENT says "通过", body messages "不通过". +- [`Sp_UndeliverIsRelated`](../../auto-catalog/procedures/Sp_UndeliverIsRelated.md) — COMMENT copy-pasted from `Sp_UnConfirm_Zg`, unrelated to behaviour. + +## Sealed-but-still-bound (`封存` markers retained alongside live bindings) + +These procs carry author-written `封存` (sealed/archived) markers in the body +header but still have live form-master or `gdsmodule` bindings. Either the +marker is informational only (the proc is the canonical one), or the binding +needs to be retired alongside the seal. **Verify per routine before changes.** + +- [`Sp_Bd_Cqzy_workshop5`](../../auto-catalog/procedures/Sp_Bd_Cqzy_workshop5.md), [`_6`](../../auto-catalog/procedures/Sp_Bd_Cqzy_workshop6.md) — 封存 2021-06-20. +- [`Sp_bd_MachinePlanTemplate_1`](../../auto-catalog/procedures/Sp_bd_MachinePlanTemplate_1.md) and 7 siblings — 封存 2021-06-21. +- [`Sp_bd_EqStatus`](../../auto-catalog/procedures/Sp_bd_EqStatus.md), [`_new`](../../auto-catalog/procedures/Sp_bd_EqStatus_new.md) — 封存 2021-06-20. +- [`Sp_CalcCost_BtnEventReCalcCost`](../../auto-catalog/procedures/Sp_CalcCost_BtnEventReCalcCost.md) — 封存 (杨恒林 2021-09-20). +- [`Sp_Calc_sPct1`](../../auto-catalog/procedures/Sp_Calc_sPct1.md), [`_2`](../../auto-catalog/procedures/Sp_Calc_sPct2.md), [`_3`](../../auto-catalog/procedures/Sp_Calc_sPct3.md), [`_OEE`](../../auto-catalog/procedures/Sp_Calc_sPctOEE.md) — `zhucx 2021.11.21 封存`. +- [`Sp_CommonList_BtnEventCheck`](../../auto-catalog/procedures/Sp_CommonList_BtnEventCheck.md), [`_UpdatedDoing`](../../auto-catalog/procedures/Sp_commonList_BtnEventUpdatedDoing.md), [`_UpdatePrice`](../../auto-catalog/procedures/Sp_commonList_BtnEventUpdatePrice.md) — 封存 2021-06-16. +- [`Sp_Customerlist_BtnEventCheck1`](../../auto-catalog/procedures/Sp_Customerlist_BtnEventCheck1.md), [`_UnCheck1`](../../auto-catalog/procedures/Sp_Customerlist_BtnEventUnCheck1.md) — 封存 2021-05-21. +- [`Sp_GetOrder_Process`](../../auto-catalog/procedures/Sp_GetOrder_Process.md) — `@date:20210714 封存` but form binding active. +- [`Sp_Inventory_ProductInOutStoreMoney`](../../auto-catalog/procedures/Sp_Inventory_ProductInOutStoreMoney.md), [`_Stock`](../../auto-catalog/procedures/Sp_Inventory_ProductInOutStoreStock.md) — 封存 2021-05-21. +- [`Sp_Manufacture_BillComplete`](../../auto-catalog/procedures/Sp_Manufacture_BillComplete.md) — 封存 2021-06-07. +- [`Sp_Manufacture_InsertMftPlan`](../../auto-catalog/procedures/Sp_Manufacture_InsertMftPlan.md), [`_Process`](../../auto-catalog/procedures/Sp_Manufacture_InsertMftPlanProcess.md), [`_ToErp`](../../auto-catalog/procedures/Sp_Manufacture_InsertMftPlanToErp.md) — 封存 2021-07-11. +- [`Sp_Manufacture_MftPlanPhase`](../../auto-catalog/procedures/Sp_Manufacture_MftPlanPhase.md), [`_BtnEventCalc`](../../auto-catalog/procedures/Sp_Manufacture_MftPlanPhase_BtnEventCalc.md), [`_product`](../../auto-catalog/procedures/Sp_MftPlanPhaseProduct_BtnEventConvertPlanA.md) (and 3 siblings) — 封存 2022-03. +- [`Sp_Manufacture_ProductionArrange2`](../../auto-catalog/procedures/Sp_Manufacture_ProductionArrange2.md) — 封存 2021-07. +- [`Sp_Manufacture_ReplaceContent`](../../auto-catalog/procedures/Sp_Manufacture_ReplaceContent.md) — 封存 2021-07-06. +- [`Sp_Manufacture_ReportQty_BtnEventCalc`](../../auto-catalog/procedures/Sp_Manufacture_ReportQty_BtnEventCalc.md) — 封存 2022-03-21. +- [`Sp_Manufacture_WorkOrderStatistics`](../../auto-catalog/procedures/Sp_Manufacture_WorkOrderStatistics.md) — 封存 2021-07-14. +- [`Sp_mes_TimeActivation_Machine`](../../auto-catalog/procedures/Sp_mes_TimeActivation_Machine.md) and 6 siblings — body marked 封存. +- [`sp_OEE_adjustmentend`](../../auto-catalog/procedures/sp_OEE_adjustmentend.md), [`_billstartWorking`](../../auto-catalog/procedures/sp_OEE_billstartWorking.md), [`_loading`](../../auto-catalog/procedures/sp_OEE_loading.md), [`_endWorked`](../../auto-catalog/procedures/sp_OEE_endWorked.md), [`_Exit`](../../auto-catalog/procedures/sp_OEE_Exit.md) — 封存 2021-09-08. +- [`Sp_OEE_ScanInsertToERP`](../../auto-catalog/procedures/Sp_OEE_ScanInsertToERP.md), [`_2013`](../../auto-catalog/procedures/Sp_OEE_ScanInsertToERP2013.md) — 封存 2021-08-17. +- [`Sp_PC_FirstInspection`](../../auto-catalog/procedures/Sp_PC_FirstInspection.md), [`Sp_PC_PatrolInspection`](../../auto-catalog/procedures/Sp_PC_PatrolInspection.md), [`Sp_Mobile_PatrolInspection`](../../auto-catalog/procedures/Sp_Mobile_PatrolInspection.md) — 封存 2021-11-08, form bindings still live. +- [`Sp_PLC_ScanInsertToERP`](../../auto-catalog/procedures/Sp_PLC_ScanInsertToERP.md) — 封存. +- [`Sp_Product_BtnEventCheck`](../../auto-catalog/procedures/Sp_Product_BtnEventCheck.md) — `@date:20210521 封存`. +- [`Sp_Quantity_PatrolDailyPaper`](../../auto-catalog/procedures/Sp_Quantity_PatrolDailyPaper.md) — DB COMMENT marks 封存 2021-05-23. +- [`Sp_Reachingrate_Machine`](../../auto-catalog/procedures/Sp_Reachingrate_Machine.md) — 封存 2021-06-21, form binding active. +- [`Sp_Sales_SalesAnalysiseOfProfit`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfProfit.md), [`_Product`](../../auto-catalog/procedures/Sp_Sales_SalesAnalysiseOfProfit_Product.md) — 封存 2021-06-16, still wired (and carry the swapped-column bug above). +- [`Sp_System_AccountSquareCheck`](../../auto-catalog/procedures/Sp_System_AccountSquareCheck.md), [`_New`](../../auto-catalog/procedures/Sp_System_AccountSquareCheck_New.md), [`_material`](../../auto-catalog/procedures/Sp_System_AccountSquareCheck_material.md) — 封存 2021-05-21. +- [`Sp_System_BatchNPriceMoney`](../../auto-catalog/procedures/Sp_System_BatchNPriceMoney.md), [`_quo`](../../auto-catalog/procedures/Sp_System_BatchNPriceMoney_quo.md), [`Sp_System_BatchPriceMoney`](../../auto-catalog/procedures/Sp_System_BatchPriceMoney.md) — 封存 2021-07-07. + +## Tenant-baked GUIDs and hardcoded magic values + +Routines that hardcode specific tenant/customer-specific sIds, dept GUIDs, PLC +numbers, or magic numerics. Cloning to a new deployment requires per-routine +re-mapping; these will silently produce empty/NULL/wrong output on a different +tenant. + +- [`Fun_getDhouM`](../../auto-catalog/functions/Fun_getDhouM.md) — hardcoded machine sIds (e.g. `16500802910009018024524290446000`). +- [`fun_GetPreProcessQty`](../../auto-catalog/functions/fun_GetPreProcessQty.md) — process sId `1691254111216986535515270`. +- [`Fun_getProductMaxStyle`](../../auto-catalog/functions/Fun_getProductMaxStyle.md) — eleprocess sIds tying function to one tenant. +- [`fun_getreportId_byArrMaterialsType`](../../auto-catalog/functions/fun_getreportId_byArrMaterialsType.md), [`_byMaterialsType`](../../auto-catalog/functions/fun_getreportId_byMaterialsType.md), [`Fun_GetReportId_byLogType`](../../auto-catalog/functions/Fun_GetReportId_byLogType.md), [`fun_getreportId_bycus`](../../auto-catalog/functions/fun_getreportId_bycus.md), [`fun_gettzreportId_bycus`](../../auto-catalog/functions/fun_gettzreportId_bycus.md) — encode tenant-specific customer + report sIds. +- [`Fun_GetTrunkQty`](../../auto-catalog/functions/Fun_GetTrunkQty.md) — paper-product-only conversion ratios; non-paper businesses see NULL. +- [`get_config_data_JSON`](../../auto-catalog/procedures/get_config_data_JSON.md) — hardcodes `iIncrement = 1509089`; `sConfigSlaveId` parameter ignored. +- [`Sp_addBtn_gdsmodle`](../../auto-catalog/procedures/Sp_addBtn_gdsmodle.md), [`Sp_Ai_AddCommonAfterNew`](../../auto-catalog/procedures/Sp_Ai_AddCommonAfterNew.md), [`Sp_init_plc_config`](../../auto-catalog/procedures/sp_init_plc_config.md) — hardcoded seed tenant `sBrandsId='1111111111'`. +- [`Sp_Apply_Flow_MachineFix`](../../auto-catalog/procedures/Sp_Apply_Flow_MachineFix.md) — hardcoded machine sId. +- [`Sp_Apply_Flow_OpsCheck`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsCheck.md), [`_OpsProcess`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsProcess.md) — 7 hardcoded exempt-process sIds. +- [`Sp_Apply_Flow_OpsProduct`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsProduct.md), [`_OpsProductMore`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsProductMore.md), [`_OpsProductMorebecome`](../../auto-catalog/procedures/Sp_Apply_Flow_OpsProductMorebecome.md) — dept-root GUIDs `20231120093814639059733069696942` (生产), `17344173190001090119214960551400` (供应链), 烟包 classify root. +- [`Sp_Apply_Flow_OrderChangeNew`](../../auto-catalog/procedures/Sp_Apply_Flow_OrderChangeNew.md) — multiple tenant dept/process/classify GUIDs. +- [`Sp_Apply_Flow_productpd`](../../auto-catalog/procedures/Sp_Apply_Flow_productpd.md), [`_materialspd`](../../auto-catalog/procedures/Sp_Apply_Flow_materialspd.md) — hardcoded 工号 `'00034'` / `'06376'`. +- [`Sp_Apply_Flow_PurOrder`](../../auto-catalog/procedures/Sp_Apply_Flow_PurOrder.md) — hardcoded user literal `"管广飞"`. +- [`Sp_Apply_Flow_salesreturnapply`](../../auto-catalog/procedures/Sp_Apply_Flow_salesreturnapply.md), [`_SalSaleOrder`](../../auto-catalog/procedures/Sp_Apply_Flow_SalSaleOrder.md), [`_sCustomer`](../../auto-catalog/procedures/Sp_Apply_Flow_sCustomer.md), [`_sCustomerAccord`](../../auto-catalog/procedures/Sp_Apply_Flow_sCustomerAccord.md), [`_Supply`](../../auto-catalog/procedures/Sp_Apply_Flow_Supply.md), [`_Ystz`](../../auto-catalog/procedures/Sp_Apply_Flow_Ystz.md), [`_Yzfy`](../../auto-catalog/procedures/Sp_Apply_Flow_Yzfy.md) — 营销一/二部 dept-root GUIDs, 烟包 classify root, supplier-classify GUIDs. +- [`Sp_Apply_Flow_salDesign`](../../auto-catalog/procedures/Sp_Apply_Flow_salDesign.md) — form-sId match filter hardcoded. +- [`Sp_Bd_*`](../../auto-catalog/procedures/) family — extensive PLC-to-slot maps tenant-deployment-specific (Sp_Bd_bi20_hh, _ys, _2new, _cq_workshop_mt/pj/pm/sy/ys_nomes, _workshop1, _Cqzy_workshop1, _Root_allstatus25/26). +- [`Sp_chart_sMachine_speed`](../../auto-catalog/procedures/Sp_chart_sMachine_speed.md) — hardcoded UUID `e748835a-…`. +- [`Sp_interface_login_before`](../../auto-catalog/procedures/Sp_interface_login_before.md) — hardcoded K3 Cloud credentials. +- [`Sp_System_ReCostStructure`](../../auto-catalog/procedures/Sp_System_ReCostStructure.md), [`sp_update_pricecolumn`](../../auto-catalog/procedures/sp_update_pricecolumn.md), [`sp_int_dbSet`](../../auto-catalog/procedures/sp_int_dbSet.md) — hardcoded schema literals (`xlyweberp`, `xlyweberp_jn`, `xlyweberp_saas`). + +## Dead code and unimplemented stubs + +Procs that exist as empty bodies, single-statement placeholders, or developer +scratch never wired in. Safe to delete from a documentation/lint perspective; +verify no customer override calls them before doing so. + +- [`Empty`](../../auto-catalog/procedures/Empty.md) — literal empty body. +- [`ss`](../../auto-catalog/procedures/ss.md) — `SET sReturn = '1111';`. +- [`test`](../../auto-catalog/procedures/test.md), [`test_copy`](../../auto-catalog/procedures/test_copy.md) — scratch. +- [`11`](../../auto-catalog/procedures/11.md), [`sp_cs1`](../../auto-catalog/procedures/sp_cs1.md) — scratch fragments. +- [`Sp_Bill_Used_Base`](../../auto-catalog/procedures/Sp_Bill_Used_Base.md) — stub returning `p_bUsed=0` (customer-override slot). +- [`Sp_Cashier_GetProductPrice`](../../auto-catalog/procedures/Sp_Cashier_GetProductPrice.md) — body entirely commented out, returns `0`. +- [`Sp_chart_home_13`](../../auto-catalog/procedures/Sp_chart_home_13.md) — body commented out, returns NULL. +- [`Sp_Check_sCio`](../../auto-catalog/procedures/Sp_Check_sCio.md), [`_sScd`](../../auto-catalog/procedures/Sp_Check_sScd.md), [`_sSdp`](../../auto-catalog/procedures/Sp_Check_sSdp.md), [`_sSfu`](../../auto-catalog/procedures/Sp_Check_sSfu.md), [`_sStl`](../../auto-catalog/procedures/Sp_Check_sStl.md), [`_sWare`](../../auto-catalog/procedures/Sp_Check_sWare.md) — placeholder stubs. +- [`Sp_Manufacture_PlanStatusSet`](../../auto-catalog/procedures/Sp_Manufacture_PlanStatusSet.md) — 97-char placeholder. +- [`Sp_productionPlanInfo_BtnEventUnChange`](../../auto-catalog/procedures/Sp_productionPlanInfo_BtnEventUnChange.md) — `sCode=-1` then `LEAVE top` immediately; effectively disabled. +- [`Sp_productionPlanInfo_BtnEventExamineDate`](../../auto-catalog/procedures/Sp_productionPlanInfo_BtnEventExamineDate.md) — cursor body empty. +- [`Sp_QlyProcessTestJudge`](../../auto-catalog/procedures/Sp_QlyProcessTestJudge.md) — every UPDATE commented out. +- [`Sp_System_CheckSave`](../../auto-catalog/procedures/Sp_System_CheckSave.md) — approval-routing logic commented out. +- [`Sp_System_CheckSaveFlow`](../../auto-catalog/procedures/Sp_System_CheckSaveFlow.md) — effectively `SET sCode=1; SET sReturn=''` only. +- [`Sp_System_CheckSaveOee`](../../auto-catalog/procedures/Sp_System_CheckSaveOee.md) — gutted to a hardcoded error string. +- [`Sp_System_MonThendCheckOut`](../../auto-catalog/procedures/Sp_System_MonThendCheckOut.md) — body literally `BEGIN END`. +- [`Sp_WorkOrder_CheckUpdateNew`](../../auto-catalog/procedures/Sp_WorkOrder_CheckUpdateNew.md), [`Sp_workorderSave`](../../auto-catalog/procedures/Sp_workorderSave.md) — orphan rewrites. +- [`Sp_WorkWeekReport`](../../auto-catalog/procedures/Sp_WorkWeekReport.md) — returns input date range, no data. + +## Debug leakage left in production + +Stray `SELECT … FROM bbbbb;` or commented-out `-- select aa from bb;` left +inside routine bodies. Mostly harmless (the commented-out forms emit nothing, +the live forms emit a stray result-set caller may ignore) but a maintainer +cleanup target. + +- [`Sp_Add_Flow`](../../auto-catalog/procedures/Sp_Add_Flow.md) — stray `SELECT ddd FROM bbbb;`. +- [`Sp_Apply_Flow_MaterialsBack`](../../auto-catalog/procedures/Sp_Apply_Flow_MaterialsBack.md) — `select p_OneFlow;`. +- [`Sp_beforeSave_sMpa`](../../auto-catalog/procedures/Sp_beforeSave_sMpa.md) — stray `SELECT @sSqlStmt;`. +- [`sp_btn_action`](../../auto-catalog/procedures/sp_btn_action.md) — dead `SELECT … FROM bbbbb / asadasda / adsadaqqqqqqq`. +- [`Sp_BtnEvent_DeliverGoodsFinanceSlave`](../../auto-catalog/procedures/Sp_BtnEvent_DeliverGoodsFinanceSlave.md) — `select p_iSCount;`. +- [`Sp_chart_EquipmentLoad1`](../../auto-catalog/procedures/Sp_chart_EquipmentLoad1.md) — debug `SELECT p_sData, p_sDay, p_sMachines`. +- [`Sp_GetlogisticsPrice`](../../auto-catalog/procedures/SP_GetlogisticsPrice.md), [`sp_getoutsideprocess`](../../auto-catalog/procedures/sp_getoutsideprocess.md), [`Sp_afterSave_sLos`](../../auto-catalog/procedures/Sp_afterSave_sLos.md) — `-- select aa from bb;`. +- [`Sp_ProductionDepartmentsReports`](../../auto-catalog/procedures/Sp_ProductionDepartmentsReports.md) — spurious `select * from xlyweberp.sisprocessclassify;` leaks cross-schema reference. +- [`Sp_QlyProduct_BtnCalculate`](../../auto-catalog/procedures/Sp_QlyProduct_BtnCalculate.md) — `SELECT p_sId, p_sSlaveId;`. +- [`Sp_saleschanceToSop_BtnEventDistribution`](../../auto-catalog/procedures/Sp_saleschanceToSop_BtnEventDistribution.md) — `select p_changeValue, p_sBussinessType;`. +- [`Sp_Supply_refilecheck`](../../auto-catalog/procedures/Sp_Supply_refilecheck.md), [`_setLevel`](../../auto-catalog/procedures/Sp_Supply_setLevel.md), [`_reLevel`](../../auto-catalog/procedures/Sp_Supply_reLevel.md) — stray `SELECT @sSqlStmt;` surfaces assembled SQL in response. +- [`zAddField_Proc`](../../auto-catalog/procedures/zAddField_Proc.md) — `INSERT into aaa(bb) VALUES (sTableName);` fails if table `aaa` is absent. + +## Naming and structural inconsistencies + +- [`Sp_urisdiction`](../../auto-catalog/procedures/Sp_urisdiction.md) — missing leading `j` in "jurisdiction". +- [`Sp_chart_EquipmentLod1`](../../auto-catalog/procedures/Sp_chart_EquipmentLod1.md) — `Lod` typo (vs `Load`); duplicate of `Sp_chart_EquipmentLoad1`. +- [`Sp_Calc_sRetunWork`](../../auto-catalog/procedures/Sp_Calc_sRetunWork.md) — `sRetunWork` missing `r` in 返工 (should be `sReturnWork`). +- [`Sp_Calc_spurded`](../../auto-catalog/procedures/Sp_Calc_spurded.md) — lowercase outlier; should likely be `sPurDed`. +- [`Sp_Procedure_Templet`](../../auto-catalog/procedures/Sp_Procedure_Templet.md) — "Templet" for "Template". +- [`Sp_BtnEvent_LogAheadComfirm`](../../auto-catalog/procedures/Sp_BtnEvent_LogAheadComfirm.md), [`_LogisticsComfirm`](../../auto-catalog/procedures/Sp_BtnEvent_LogisticsComfirm.md), [`_mitOutComfirm`](../../auto-catalog/procedures/Sp_BtnEvent_mitOutComfirm.md), [`_OpsInstoreComfirm`](../../auto-catalog/procedures/Sp_BtnEvent_OpsInstoreComfirm.md) — "Comfirm" misspelling consistent across family. +- [`Sp_Sis_GetMertialsInventoryFormGuid`](../../auto-catalog/procedures/Sp_Sis_GetMertialsInventoryFormGuid.md) — "Mertials" typo; same name exists as both FUNCTION and PROCEDURE. +- [`sp_get_sOppositeColor`](../../auto-catalog/procedures/sp_get_sOppositeColor.md), [`sp_btn_action`](../../auto-catalog/procedures/sp_btn_action.md), [`sp_init_sVersionFlowId`](../../auto-catalog/procedures/sp_init_sVersionFlowId.md), [`sp_cursor_test`](../../auto-catalog/procedures/sp_cursor_test.md), and ~15 more — lowercase `sp_` prefix outliers vs. majority `Sp_*`. + +## Security-adjacent + +- [`sp_btn_action`](../../auto-catalog/procedures/sp_btn_action.md) — dynamic UPDATE concatenates JSON-decoded `p_sId` without `QUOTE()`-escaping; SQL injection surface if `sProInParam` isn't validated upstream. +- [`Sp_interface_login_before`](../../auto-catalog/procedures/Sp_interface_login_before.md) — K3 Cloud credentials hardcoded in proc body (`username='Administrator'`, `password='Hamah@2022'`). Multi-tenant deployments must replace. +- [`Sp_afterSave_sDgda`](../../auto-catalog/procedures/Sp_afterSave_sDgda.md) — raw PREPARE/EXECUTE dynamic SQL, splits on `;` with no escaping. + +--- + +## Cross-cutting observations + +A few patterns worth noting that aren't per-routine flags: + +- **`封存` (sealed) markers are not deletion markers.** Many sealed routines still have live form-master or `gdsmodule` bindings. The convention in this codebase is "keep the body but mark intent"; if you act on a 封存 marker, also unbind the form. +- **Customer overrides live at `xly-src/script/客户//`.** Several routines that look like simple stubs in the standard ship (e.g. `Sp_Bill_Used_Base`) have substantive bodies in customer-override packs. Don't delete a stub before checking `script/客户/`. +- **`_new`/`_NEW`/`_Bak`/`_Test`/date-suffixed variants** are a recurring pattern: a parallel rewrite never promoted to production, kept alongside the wired version. The auto-catalog's [Backup / snapshot variant template](../../auto-catalog/procedures/Sp_Calc_sDgd_20250612.md) covers the basic `_copy1`/`_bak` family; the `_new`/`_NEW` siblings live here. +- **Naming-by-convention dispatchers are invisible to static analysis.** `BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName")` reads the proc name out of `gdsmodule` at runtime; `GenericProcedureCallServiceImpl.doGenericProcedureCall()` reads it from the front-end button action descriptor. The auto-catalog narratives capture these where the agents found them, but the snapshot used here doesn't include front-end button config rows — some routines flagged as orphan in this list may be live via a button binding we couldn't observe. diff --git a/en/mkdocs.yml b/en/mkdocs.yml index fa135a3..4fb7e64 100644 --- a/en/mkdocs.yml +++ b/en/mkdocs.yml @@ -115,6 +115,7 @@ nav: - "Metadata-management services (xlyManage)": reference/maintainer/management-services.md - "BI / KPI / Charts engine": reference/maintainer/bi-engine.md - "Activiti integration": reference/maintainer/activiti.md + - "Known issues in stored procedures and functions": reference/maintainer/known-issues-in-stored-procedures.md - 5. API Reference: - api-reference/index.md - "Internal API (xlyEntry)": api-reference/internal.md