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

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

查看文件

@@ -99,6 +99,26 @@ class Granary extends Backend
{
$data = $this->request->post();
if (!empty($data)) {
$content = isset($data['content']) && is_array($data['content']) ? $data['content'] : [];
$position = isset($content['screenPosition']) ? $content['screenPosition'] : '';
$positions = \app\common\library\GranaryScreen::extraPositions();
if ($position !== '' && !isset($positions[$position])) {
return json(['code' => 400, 'msg' => '请选择有效的大屏建筑位置']);
}
if ($position !== '') {
if (strpos($data['storage'], '习水') !== false) {
return json(['code' => 400, 'msg' => '此建筑位置属于中心库区']);
}
foreach ($this->model->field('id,content')->select() as $existing) {
$saved = $existing['content'];
if (!is_array($saved)) $saved = json_decode($saved, true);
if ((string)$existing['id'] !== (string)(isset($data['id']) ? $data['id'] : 0)
&& isset($saved['screenPosition']) && $saved['screenPosition'] === $position) {
return json(['code' => 400, 'msg' => '此建筑已绑定仓库,请编辑对应仓库或选择其他位置']);
}
}
}
$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])) {
$data['granary_type'] = intval($data['granary_type']);

查看文件

@@ -113,6 +113,10 @@ class Testing extends Backend
if (!empty($data)) {
$content = $data['content'];
$date = $data['record_date'];
$ruleError = \app\common\library\QualityRule::validate($content);
if ($ruleError !== '') {
return json(['code' => 400, 'msg' => $ruleError]);
}
// 添加
if (empty($data['id'])) {