导入增加队列名字段(可能没用,模糊搜索)

master
zcstatham 2 years ago
parent 81161e9d49
commit f33f07d6a6
  1. 7
      app/view/task/index.html
  2. 13
      extend/service/CarInfoHandle.php

@ -27,6 +27,12 @@
</button>
</div>
<a href="/static/tpl.xlsx" download="车辆信息导入模板.xlsx" style="color: #009688;">[下载车辆信息导入模板]</a>
<div class="layui-inline task-param" id="export-queue-name" style="display: none;">
<label class="layui-form-label" style="width: 140px;">导出名</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="queue" class="layui-input">
</div>
</div>
</div>
<div class="task-param" id="task-export" style="display: none;">
<div class="layui-form-item">
@ -262,6 +268,7 @@
break;
case 5:
$('#task-import').addClass('active').show();
$('#export-queue-name').addClass('active').show();
break;
}
});

@ -444,6 +444,9 @@ class CarInfoHandle
if (empty($filename) OR !file_exists($filename)) {
return '文件不存在!';
}
$export_id = 0;
if($data['queue'] != '')
$export_id = JobsT::where('payload','like','%'. str_replace(['\\','"'],['_',''],json_encode($data['queue'])) .'%')->value('id');
$spreadRead = Excel::loadFile($filename);
$worksheet = $spreadRead->getSheet(0);
$highestRow = $worksheet->getHighestRow(); // e.g. 10
@ -478,7 +481,12 @@ class CarInfoHandle
if ($car_frame_no == '') {
continue;
}
$car_info = CarInfoT::where('car_frame_no', $car_frame_no)->find();
if ($export_id)
$car_info = CarInfoT::where('car_frame_no', $car_frame_no)->where('is_export_bhx', $export_id)->find();
if (!$car_info)
$car_info = CarInfoT::where('car_frame_no', $car_frame_no)->where('is_export_bhx', '>', 0)->find();
if (!$car_info)
$car_info = CarInfoT::where('car_frame_no', $car_frame_no)->find();
if (isset($car_info)) {
if ($is_update_failed == 0 && $car_info->is_export_failed > 0) {
$is_update_failed = $car_info->is_export_failed;
@ -524,8 +532,9 @@ class CarInfoHandle
CarInfoT::where('is_export_failed', $is_update_failed)
->update(['is_export_failed' => 0, 'is_update_bhx' => Db::raw('is_update_bhx - 1')]);
} else {
$export_id = $export_id ?: $car_info->is_export_bhx;
CarInfoT::where('is_update_bhx', 0)
->where('is_export_bhx', $car_info->is_export_bhx)
->where('is_export_bhx', $export_id)
->update(['is_update_bhx' => -1]);
}
return '操作成功' . "数据总计{$statistical_information['total_all']}条,

Loading…
Cancel
Save