Browse Source

Merge branch 'dev_wf' of wugg/phpstock into version1.5

wufeng 2 years ago
parent
commit
1c8ec84ba4
1 changed files with 9 additions and 4 deletions
  1. 9 4
      app/abutment/logic/Filing.php

+ 9 - 4
app/abutment/logic/Filing.php

@@ -153,19 +153,24 @@ class Filing
     //取消转单
     public static function cancel(array $data = [])
     {
+        $where = [
+            ['is_del', '=', 0],
+            ['id', '=', $data['id']],
+            ['supplierNo', '=', $data['supplierNo']],
+            ['status', 'in', [0, 1, 2, 4]]
+        ];
 
         $rs = Db::name('filing')
             ->field('id,status')
-            ->where(['is_del' => 0, 'id' => $data['id'], 'status' => 2, 'supplierNo' => $data['supplierNo']])
+            ->where($where)
             ->findOrEmpty();
-        if (empty($rs)) return json_show(1005, '该报备单不存在或不是待转单状态');
+        if (empty($rs)) return json_show(1005, '该报备单不存在或不允许取消');
 
         $res = Db::name('filing')
-            ->where(['is_del' => 0, 'id' => $data['id'], 'status' => 2])
+            ->where($where)
             ->update(['status' => 5, 'updatetime' => date('Y-m-d H:i:s')]);
         return $res ? json_show(0, '操作成功') : json_show(1004, '操作失败');
 
-
     }
 
     //转单