diff --git a/application/admin/controller/Granary.php b/application/admin/controller/Granary.php index ddde372..0d034b2 100644 --- a/application/admin/controller/Granary.php +++ b/application/admin/controller/Granary.php @@ -120,11 +120,17 @@ class Granary extends Backend } $data['content'] = $content; $id = $this->model->where(['num' => $data['num']])->value('id'); - if (isset($data['granary_type']) && in_array(intval($data['granary_type']), [1, 2])) { + if (isset($data['granary_type']) && in_array(intval($data['granary_type']), [1, 2, 3])) { $data['granary_type'] = intval($data['granary_type']); } else { $data['granary_type'] = $data['num'] > 18 ? 2 : 1; } + if ($position !== '') { + $data['granary_type'] = strpos($position, 'center_silo_') === 0 ? 3 : 2; + } + if ($data['granary_type'] === 3) { + $data['content']['warehouseType'] = '立式浅圆仓'; + } $data['content'] = json_encode($data['content']); // 添加 diff --git a/application/admin/view/granary/index.html b/application/admin/view/granary/index.html index 1bd9015..310837a 100644 --- a/application/admin/view/granary/index.html +++ b/application/admin/view/granary/index.html @@ -132,8 +132,9 @@
全部 - 圆型 - 房型 + 油罐 + 平房仓 + 浅圆仓
@@ -209,7 +210,8 @@ align="center"> - + + + + + + + + + +
新仓库请选择对应建筑;现有标记可直接修改仓号,保存后大屏自动同步。
@@ -282,6 +293,7 @@ 立式油罐 (油类) 房型平房仓 (粮类) + 浅圆仓 (粮类)
@@ -295,7 +307,7 @@
- + 稻谷类指标模板 小麦/玉米/杂粮指标模板 diff --git a/application/common/library/GranaryScreen.php b/application/common/library/GranaryScreen.php index 2071781..52e5e3c 100644 --- a/application/common/library/GranaryScreen.php +++ b/application/common/library/GranaryScreen.php @@ -10,6 +10,15 @@ class GranaryScreen return [ 'center_upper_left' => ['x' => 46.8, 'y' => 28.4], 'center_lower_right' => ['x' => 58.8, 'y' => 34.1], + 'center_middle' => ['x' => 44.0, 'y' => 33.5], + 'center_rear' => ['x' => 45.1, 'y' => 18.7], + 'center_silo_1' => ['x' => 52.4, 'y' => 13.5, 'stemY' => 17.2], + 'center_silo_2' => ['x' => 56.6, 'y' => 17.5, 'stemY' => 19.6], + 'center_silo_3' => ['x' => 61.3, 'y' => 13.5, 'stemY' => 22.0], + 'center_silo_4' => ['x' => 66.2, 'y' => 21.0, 'stemY' => 24.1], + 'center_silo_5' => ['x' => 73.2, 'y' => 22.5, 'stemY' => 26.3], + 'center_silo_6' => ['x' => 78.5, 'y' => 26.0, 'stemY' => 28.8], + 'center_silo_7' => ['x' => 84.9, 'y' => 28.0, 'stemY' => 30.7], ]; } diff --git a/ops/test_granary_screen.php b/ops/test_granary_screen.php new file mode 100644 index 0000000..2d8802b --- /dev/null +++ b/ops/test_granary_screen.php @@ -0,0 +1,25 @@ + 200 + $i, 'num' => 46 + $i, 'content' => ['screenPosition' => $position]]; + $coord = GranaryScreen::resolve($item, []); + check($coord['x'] > $lastX, 'Silos must run from left to right'); + check($coord['stemY'] > $coord['y'] && $coord['stemY'] < 32, 'Lead line must point to the silo roof'); + $item['num'] = 900 + $i; + check(GranaryScreen::resolve($item, []) === $coord, 'Renumbering must preserve the building'); + $lastX = $coord['x']; +} +$middle = GranaryScreen::resolve(['id' => 46, 'num' => 43, 'content' => ['screenPosition' => 'center_middle']], []); +$rear = GranaryScreen::resolve(['id' => 114, 'num' => 46, 'content' => ['screenPosition' => 'center_rear']], []); +check($middle !== $rear, '43 and 46 must label two separate buildings'); +check(GranaryScreen::resolve(['id' => 43, 'num' => 14, 'content' => []], [14 => ['x' => 4.8, 'y' => 12.8]]) === ['x' => 4.8, 'y' => 12.8], 'Oil tank numbering must remain separate'); +echo "All building position checks passed\n"; diff --git a/public/assets/js/backend/granary.js b/public/assets/js/backend/granary.js index 1578448..4d8056f 100644 --- a/public/assets/js/backend/granary.js +++ b/public/assets/js/backend/granary.js @@ -290,11 +290,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin let num = parseInt(e, 10); if (isNaN(num)) return; this.formData.num = num; - if (this.title === '添加') { + if (this.title === '添加' && this.formData.granary_type !== 3) { this.formData.granary_type = num > 18 ? 2 : 1; this.changeGranaryType(this.formData.granary_type); } }, + changeScreenPosition(position) { + if (!position) return; + this.changeGranaryType(position.indexOf('center_silo_') === 0 ? 3 : 2); + }, // 自由切换仓型(1: 圆型油罐,2: 房型平房仓) changeGranaryType(type) { this.formData.granary_type = type; @@ -334,11 +338,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin this.varietiesType = 'one'; } else if (e === '小麦' || e === '玉米') { this.contentType = 'three'; - this.formData.granary_type = 2; + this.formData.granary_type = this.formData.granary_type === 3 ? 3 : 2; this.varietiesType = 'two'; } else { this.contentType = 'two'; - this.formData.granary_type = 2; + this.formData.granary_type = this.formData.granary_type === 3 ? 3 : 2; this.varietiesType = 'two'; } } @@ -352,7 +356,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin this.formData.granary_type = 1; this.varietiesType = 'one'; } else { - this.formData.granary_type = 2; + this.formData.granary_type = this.formData.granary_type === 3 ? 3 : 2; this.varietiesType = 'two'; } this.contentFields[this.contentType]['varieties'] = val;