From 5eae9da50b74d851c8fcb5740345bd83556e3880 Mon Sep 17 00:00:00 2001 From: qianhy Date: Tue, 7 Feb 2023 14:42:40 +0800 Subject: [PATCH] inve plan add: item.status=0 or item null --- api/controllers/plan/Licheb.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php index e42d7231..65a90e5a 100644 --- a/api/controllers/plan/Licheb.php +++ b/api/controllers/plan/Licheb.php @@ -58,9 +58,21 @@ class Licheb extends HD_Controller } foreach ($res as $k => $v) { $re = $this->mdItems->get(['id' => $v['item_id']]); - if (!$re || $re['bill_time'] != '0000-00-00 00:00:00') { + /*if (!$re || $re['bill_time'] != '0000-00-00 00:00:00') { $this->mdInventoryLog->update(['status' => 1], ['id' => $v['id']]); $log = ['id' => $v['id'], 'item_id' => $v['item_id']]; + }*/ + if (!$re){ + $rtn = $this->mdInventoryLog->delete(['id' => $v['id']]); + $log[] = ['id' => $v['id'], 'item_id' => $v['item_id'], 'rtn' => 'item not found, delete: '.$rtn]; + } + elseif ($re['status'] == 0){ + $rtn = $this->mdInventoryLog->delete(['id' => $v['id']]); + $log[] = ['id' => $v['id'], 'item_id' => $v['item_id'], 'rtn' => 'item.status=0, delete: '.$rtn]; + } + elseif ($re['bill_time'] != '0000-00-00 00:00:00'){ + $rtn = $this->mdInventoryLog->update(['status' => 1], ['id' => $v['id']]); + $log[] = ['id' => $v['id'], 'item_id' => $v['item_id'], 'rtn' => 'set status=1, update: '.$rtn]; } } $redis->save($redisKey, $id, 24 * 3600);//保存最后id