# `Sp_Mobile_PatrolInspection` (procedure) > @author:zhucx @date:20211108 封存 @describe: 移动端 品质巡检 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `iState` | `int` | | 2 | IN | `sLoginId` | `varchar(100)` | | 3 | IN | `sMachineId_s` | `varchar(100)` | | 4 | IN | `sProceeAllMachine` | `varchar(10)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | IN | `sBrId` | `varchar(100)` | | 7 | IN | `bFilter` | `longtext` | | 8 | IN | `sUnTaskFormId` | `varchar(100)` | | 9 | IN | `pageNum` | `int` | | 10 | IN | `pageSize` | `int` | | 11 | OUT | `totalCount` | `int` | | 12 | IN | `countCloumn` | `varchar(5000)` | | 13 | OUT | `countMapJson` | `longtext` | | 14 | IN | `sFilterOrderBy` | `varchar(5000)` | | 15 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 16 | IN | `sGroupby_group_sql` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Mobile_PatrolInspection`'`._ ## Narrative **Business context:** 过程质量控制(PQC) → 首检巡检 — paged mobile patrol-inspection task list bound to the 品检任务 form. After 首检 (first-piece inspection) is signed off, machines must be revisited at the test-standard's `dQualifyRate` interval (minutes). This proc lists machines that are due, overdue, or coming up for the next patrol. Header comment says 封存 (archived) dated 20211108 — superseded by newer mobile-PQC procs but still bound. **What it does:** Reads `SysSystemSettings.CkxProcessFilter`; if 1 and the user isn't sysadmin, restricts by `Fun_GetLookProcess`. Builds a dynamic INSERT into temporary `p_Tmp_ProductionReport` selecting from `mftProductionPlanSlave A WHERE A.bFirst1Inspection=1 AND A.bFirst2Inspection=1 AND A.bFirst3Inspection=1 AND A.dProcessQty - A.dProductionReportQty > 0` (only lines that finished 首检 and still have remaining quantity). Computes `tFirstInspectionTime` = max of the three 首检 timestamps. Denormalises process names from `eleprocess`. Joins `EleTestStandard` (form `12012615914116371204913630`) by `sProcessId` to pull `sTestName`, `sTestStandardId`, `dQualifyRate`; derives `tThisPatrolInspection = max(tFirstInspectionTime, tPatrolInspection) + dQualifyRate minutes`. Final paged SELECT computes `sFirstInspectionTime` as `HH:mm` and `sPatrolInspection` text like `超期N分 未巡检` / `N分内执行巡检`. **Invocation:** Bound as the data-source of the 品检任务 form `gfm.sId 12012615914116373917917930` via `gdsconfigformmaster.sSqlStr` — under module 首检巡检 (`sId 12012615914116373917917620`) → 功能操作 (subtree of mobile-app procedures). xly-src ships `script/标版/30100101/Sp_Mobile_PatrolInspection.sql` (install script) and `script/标版/20210323/optimizeprocedure.sql` (optimize patch). Sibling: `Sp_Mobile_Inspection`.