|
@@ -29,14 +29,18 @@ class InvoiceItem extends \think\Model {
|
|
|
$change = $model->getChangedData();
|
|
|
Log::info("修改发票明细状态:".json_encode($change,JSON_UNESCAPED_UNICODE));
|
|
|
Log::info("跟后数据:".json_encode($model->toArray(),JSON_UNESCAPED_UNICODE));
|
|
|
- if(in_array($change["status"],[1,2])){
|
|
|
+ if(in_array($change["status"],[0,1,2])){
|
|
|
$num = self::where(['invoiceCode'=>$code,'order_type'=>$orderType,'status'=>0])->count();
|
|
|
- if($num==0){
|
|
|
if($orderType==1){
|
|
|
$info= InvoicePool::where(['invNo'=>$code,'is_del'=>0])->findOrEmpty();
|
|
|
- if(!$info->isEmpty() && $info->status==10){
|
|
|
- $info->status=11;
|
|
|
- $info->save();
|
|
|
+ if(!$info->isEmpty()){
|
|
|
+ if($num==0 && $info->status==10){
|
|
|
+ $info->status=11;
|
|
|
+ }
|
|
|
+ if($num>0 && $info->status==11){
|
|
|
+ $info->status=10;
|
|
|
+ }
|
|
|
+ $info->save();
|
|
|
}
|
|
|
}
|
|
|
if($orderType==2){
|
|
@@ -44,12 +48,16 @@ class InvoiceItem extends \think\Model {
|
|
|
if(!$info->isEmpty()){
|
|
|
$pay = Pay::where(['payNo'=>$info->payNo,'is_del'=>0])->findOrEmpty();
|
|
|
if(!$pay->isEmpty() && $pay->status==2 &&$info->status==11){
|
|
|
- $info->status=12;
|
|
|
- $info->save();
|
|
|
+ if($num==0 && $info->status==11){
|
|
|
+ $info->status=12;
|
|
|
+ }
|
|
|
+ if($num>0 && $info->status==12){
|
|
|
+ $info->status=11;
|
|
|
+ }
|
|
|
+ $info->save();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|