feat: 完善仓库建筑绑定、质检预警规则与大屏展示

这个提交包含在:
wikiboss
2026-10-28 17:30:49 +08:00
父节点 d4ff221fa3
当前提交 ffff286274
共有 18 个文件被更改,包括 614 次插入 和 318 次删除

查看文件

@@ -0,0 +1,32 @@
<?php
namespace app\common\library;
/** 建筑位置独立于仓号,修改仓号不会移动大屏标记。 */
class GranaryScreen
{
public static function extraPositions()
{
return [
'center_upper_left' => ['x' => 46.8, 'y' => 28.4],
'center_lower_right' => ['x' => 58.8, 'y' => 34.1],
];
}
public static function resolve($item, $coords)
{
$content = is_array($item['content']) ? $item['content'] : json_decode($item['content'], true);
$position = isset($content['screenPosition']) ? $content['screenPosition'] : '';
$extra = self::extraPositions();
if (isset($extra[$position])) {
return $extra[$position];
}
// 历史记录按数据库 id 锚定原建筑,避免改号后套用另一栋仓库的位置。
$originalNumbers = [27 => 30, 29 => 31, 30 => 32, 31 => 10, 33 => 42,
34 => 33, 36 => 35, 37 => 36, 38 => 12, 39 => 39, 40 => 40,
42 => 41, 43 => 14, 44 => 37, 45 => 15, 46 => 44, 47 => 16,
48 => 17, 49 => 18, 50 => 38, 51 => 43];
$num = isset($originalNumbers[$item['id']]) ? $originalNumbers[$item['id']] : null;
return $num !== null && isset($coords[$num]) ? $coords[$num] : null;
}
}