master
zhaocheng 4 years ago
parent 97a999d30c
commit a9d24fad4c
  1. 22
      extend/service/CarInfoHandle.php

@ -120,6 +120,21 @@ class CarInfoHandle
$where[] = ['is_export_failed_bmc', '=', 0]; $where[] = ['is_export_failed_bmc', '=', 0];
$where[] = ['is_export_none_bmc', '=', 0]; $where[] = ['is_export_none_bmc', '=', 0];
} }
if ($data['export_type'] == 'success_bmc') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '>', 0];
$where[] = ['is_export_bmc', '>', 0];
$insurer_date1 = $data['insurer_date1']??'';
$insurer_date2 = $data['insurer_date2']??'';
if($insurer_date1!=''){
$map_or1[] = ['car_info_t.insurer1_date', '>=', $insurer_date1];
$map_or2[] = ['car_info_t.insurer2_date', '>=', $insurer_date1];
}
if($insurer_date2!=''){
$map_or1[] = ['car_info_t.insurer1_date', '<=', $insurer_date2];
$map_or2[] = ['car_info_t.insurer2_date', '<=', $insurer_date2];
}
}
} }
$insurer_month1 = $data['insurer_month1']??''; $insurer_month1 = $data['insurer_month1']??'';
$insurer_day1 = $data['insurer_day1']??''; $insurer_day1 = $data['insurer_day1']??'';
@ -385,7 +400,6 @@ class CarInfoHandle
$car_info = CarInfoT::where('car_frame_no', $car_frame_no)->find(); $car_info = CarInfoT::where('car_frame_no', $car_frame_no)->find();
if (isset($car_info)) { if (isset($car_info)) {
if ($is_update_failed == 0 && $car_info->is_export_failed > 0) { if ($is_update_failed == 0 && $car_info->is_export_failed > 0) {
$is_update_failed = $car_info->is_export_failed; $is_update_failed = $car_info->is_export_failed;
} }
$car_info->car_no = $car_no != '' ? $car_no : $car_info->car_no; $car_info->car_no = $car_no != '' ? $car_no : $car_info->car_no;
@ -425,7 +439,7 @@ class CarInfoHandle
if($is_update_failed > 0){ if($is_update_failed > 0){
CarInfoT::where('is_export_failed', $is_update_failed) CarInfoT::where('is_export_failed', $is_update_failed)
->update(['is_export_failed' => 0, 'is_update_bhx' => Db::raw('is_update_bhx - 1')]); ->update(['is_export_failed' => 0, 'is_update_bhx' => Db::raw('is_update_bhx - 1')]);
}else if($car_info) { }else if($car_info && $car_info->is_update_bhx <= 0) {
CarInfoT::where('is_update_bhx', 0) CarInfoT::where('is_update_bhx', 0)
->where('is_export_bhx', $car_info->is_export_bhx) ->where('is_export_bhx', $car_info->is_export_bhx)
->update(['is_update_bhx' => -1]); ->update(['is_update_bhx' => -1]);
@ -511,6 +525,7 @@ class CarInfoHandle
} }
FileSystem::appendWriteFile($filename, $content, false); FileSystem::appendWriteFile($filename, $content, false);
$export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]); $export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]);
$export_limit != 0 && $export_type == 'success_bmc' && CarInfoT::where('id', 'in', $ids)->update(['is_export_bmc' => 0]);
} else { } else {
$info = $query->limit(3000)->select(); $info = $query->limit(3000)->select();
$limit = $count; $limit = $count;
@ -527,6 +542,7 @@ class CarInfoHandle
} }
FileSystem::appendWriteFile($filename, $content, false); FileSystem::appendWriteFile($filename, $content, false);
$export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]); $export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]);
$export_limit != 0 && $export_type == 'success_bmc' && CarInfoT::where('id', 'in', $ids)->update(['is_export_bmc' => 0]);
$limit -= 3000; $limit -= 3000;
$end = $info->pop(); $end = $info->pop();
$lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date'); $lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date');
@ -560,6 +576,7 @@ class CarInfoHandle
$this->setProcess($row, $count * 1.2, $id); $this->setProcess($row, $count * 1.2, $id);
} }
$export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]); $export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]);
$export_limit != 0 && $export_type == 'success_bmc' && CarInfoT::where('id', 'in', $ids)->update(['is_export_bmc' => 0]);
} else { } else {
$info = $query->limit(3000)->select(); $info = $query->limit(3000)->select();
$limit = $count; $limit = $count;
@ -574,6 +591,7 @@ class CarInfoHandle
$this->setProcess($row, $count * 1.2, $id); $this->setProcess($row, $count * 1.2, $id);
} }
$export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]); $export_limit != 0 && CarInfoT::where('id', 'in', $ids)->update(['is_export_' . $export_type => $id]);
$export_limit != 0 && $export_type == 'success_bmc' && CarInfoT::where('id', 'in', $ids)->update(['is_export_bmc' => 0]);
$limit -= 3000; $limit -= 3000;
$end = $info->pop(); $end = $info->pop();
$lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date'); $lastRegisterDate = is_array($end) ? $end['register_date'] : $end->getData('register_date');

Loading…
Cancel
Save