feat: 完善仓库建筑绑定、质检预警规则与大屏展示
这个提交包含在:
@@ -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'])) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户