Fun_GetLimitDate.md 1.75 KB

Fun_GetLimitDate (function)

获取任务截至时间

  • Type: FUNCTION
  • Returns: varchar(255)
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sFormId varchar(255)
2 IN tCheckDate datetime
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)

Body

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

Narrative

Business context: KPI/SLA deadline calculator (获取任务截至时间). Given a form id and a starting timestamp, projects a "must-finish-by" datetime using the per-form working-hour configuration stored in kpimodule — used pervasively by the overdue/未付/未收 warning reports (采购预警, 应付/应收, 销售未发货, etc.).

What it does: reads kpimodule.dLimitation/sLimitTime/sWorkDate for the form (matched on sBrandsId, sSubsidiaryId, sModelId = sFormId). Snaps the start time inside the configured working window, then converts the limitation hours into working-minutes and walks forward whole work-days plus a partial day, returning the projected deadline.

Invocation: called from Sp_Cashier_OrderMoneyWarning, Sp_Manufacture_PurPurchaseChecking, Sp_Manufacture_SalSalesChecking, Sp_Manufacture_sSodPurchareMaterials, Sp_NotPayAbles* family, Sp_NotReceivables* family, Sp_OEE_PlanByProcess, Sp_OverdueNoCheck, Sp_OverdueNotReceivables, Sp_Sales_NotDeliverGoodMaterials*, Sp_SalSalesCheck_YanBao — every overdue/limit-aware report runs each row through this. Java references in KpiServiceImpl and CommonFromSqlServiceImpl are commented out; current invocation path is proc-only.