wugg 5 months ago
parent
commit
a6bdc86f91
1 changed files with 7 additions and 3 deletions
  1. 7 3
      app/cxinv/controller/InvoiceItem.php

+ 7 - 3
app/cxinv/controller/InvoiceItem.php

@@ -224,12 +224,16 @@ class InvoiceItem extends Base{
         if($pinv['status']!=14) return  error('回票申请状态必须为待确认');
         $this->model->startTrans();
         try{
-            $this->model->saveAll($temop);
-            $this->model->whereIn('id',$remove)->delete();
+            $up=$this->model->saveAll($temop);
+            if($up==false) throw new \Exception("更新失败");
+            $delte=$this->model->whereIn('id',$remove)->select()->delete();
+            if($delte==false) throw new \Exception("删除失败");
+
             $ist = $this->model->where([['invoiceCode',"=",$inoviceCode[0]],["amount","<",0]])->count();
             if($ist==0){
                 $pinv->status=11;
-                $pinv->save();
+                $save=$pinv->save();
+                if($save==false) throw new \Exception("回票申请状态修改失败");
             }
             $this->model->commit();
         }catch (\Exception $e){