From 14d481451e6fc4ea5621e5b81fa9bd3339fcd6f5 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 11 Oct 2019 13:11:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90D=E5=BA=93=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/DatabaseController.php | 93 +++++++++++++++++++-- frontend/views/database/c-index-search.php | 92 -------------------- frontend/views/database/d-index-search.php | 84 ------------------- frontend/views/database/d-index.php | 73 ++++++++++++++-- 4 files changed, 148 insertions(+), 194 deletions(-) delete mode 100644 frontend/views/database/c-index-search.php delete mode 100644 frontend/views/database/d-index-search.php diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index fffffab..496d21c 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -1533,6 +1533,7 @@ class DatabaseController extends BaseController return $result; } + //D库 //D库列表页 private function getDQuery($request) { @@ -1657,9 +1658,6 @@ class DatabaseController extends BaseController 'invalid_items' => $invalid_items ]); } - public function actionDSearch() { - return $this->render('d-index-search'); - } public function actionDIndexJson() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -1729,11 +1727,15 @@ class DatabaseController extends BaseController $order_row->engine_no = $d_info->car->engine_no; $order_row->car_frame_no = $d_info->car->car_frame_no; $order_row->car_man = $d_info->car->car_man; + $order_row->car_man_number = $d_info->car->car_man_number; + $order_row->car_man_phone = $d_info->car->phone; $order_row->user_id = $user_id; $order_row->status_id = 1; $order_row->id_man = $d_info->car->car_man; + $order_row->id_man_number = $d_info->car->id_number; $order_row->link_man = $d_info->car->car_man; - $order_row->link_phone = $d_info->car->phone; + $order_row->link_man_phone = $d_info->car->phone; + $order_row->link_man_number = $d_info->car->id_number; if(!$order_row->save()) { throw new \Exception(print_r($order_row->getErrors(),true)); } @@ -1896,13 +1898,15 @@ class DatabaseController extends BaseController $order_row->engine_no = $d_info->car->engine_no; $order_row->car_frame_no = $d_info->car->car_frame_no; $order_row->car_man = $d_info->car->car_man; + $order_row->car_man_number = $d_info->car->car_man_number; + $order_row->car_man_phone = $d_info->car->phone; $order_row->user_id = $d_info->user_id; $order_row->status_id = 1; $order_row->id_man = $d_info->car->car_man; + $order_row->id_man_number = $d_info->car->id_number; $order_row->link_man = $d_info->car->car_man; - $order_row->link_phone = $d_info->car->phone; - $order_row->return_status_id = 0; - $order_row->return_remark = ''; + $order_row->link_man_phone = $d_info->car->phone; + $order_row->link_man_number = $d_info->car->id_number; if(!$order_row->save()) { throw new \Exception(print_r($order_row->getErrors(),true)); } @@ -1929,8 +1933,9 @@ class DatabaseController extends BaseController $row->is_first = 1; $row->xdate = date('Y-m-d'); $row->xtime = '09:00'; + $row->xbao = 2; if(!$row->save()) { - throw new \Exception(print_r($row->getErrors(), true)); + throw new \Exception(print_r($row->getErrors(),true)); } //添加历史预约 @@ -1943,8 +1948,9 @@ class DatabaseController extends BaseController $h_row->remark = '首次分配'; $h_row->xdate = date('Y-m-d'); $h_row->xtime = '09:00'; + $h_row->xbao = 2; if(!$h_row->save()) { - throw new \Exception(print_r($h_row->getErrors(), true)); + throw new \Exception(print_r($h_row->getErrors(),true)); } $this->addLog($d_info->id,'从D库分配数据给业务员:'.$d_info->user->getShowName(),1); @@ -1961,6 +1967,75 @@ class DatabaseController extends BaseController } return $result; } + public function actionDReturnAll() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '操作失败'; + + if($request->isPost) { + + $status = $request->post('status'); + $register_begin = $request->post('register_begin'); + $register_end = $request->post('register_end'); + $insurer1_begin = $request->post('insurer1_begin'); + $insurer1_end = $request->post('insurer1_end'); + + $query = CarDT::find() + ->leftJoin('car_t','`car_t`.`id`=`car_d_t`.`id`'); + + if($register_begin != '') { + $query->andWhere('car_t.register_date>="'.$register_begin.'"'); + } + if($register_end != '') { + $query->andWhere('car_t.register_date<="'.$register_end.'"'); + } + if($insurer1_begin != '') { + $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"'); + } + if($insurer1_end != '') { + $query->andWhere('car_t.insurer1_end<="'.$insurer1_end.'"'); + } + $tran = CarT::getDb()->beginTransaction(); + try { + foreach($query->each(1000) as $item) { + //删除预约 + AppointmentT::deleteAll('car_id='.$item->id); + + //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作 + //删除操作人员 + $orders = OrderT::find() + ->where('car_id='.$item->id.' and status_id<5') + ->all(); + foreach($orders as $order_info) { + OrderUserT::deleteAll('order_id='.$order_info->id); + //删除保单 + $order_info->delete(); + } + + $item->user_id = 0; + if(!$item->save()) { + throw new \Exception(print_r($item->getErrors(), true)); + } +// FiltrationT + //删除预约拨打 +// FiltrationT::deleteAll('car_id='.$c_info->id); + $this->addLog($item->id,'从D库业务员手中批量回收数据',1); + } + + $result['success'] = true; + $result['msg'] = '操作成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + } + return $result; + } //无效库列表页 private function getInvalidQuery($request) diff --git a/frontend/views/database/c-index-search.php b/frontend/views/database/c-index-search.php deleted file mode 100644 index 047dd3d..0000000 --- a/frontend/views/database/c-index-search.php +++ /dev/null @@ -1,92 +0,0 @@ - -beginBlock('header_css'); ?> -endBlock(); ?> - -
-
-
-
-
- -
- -
- -
- -
- -
- -
-
-
- -
-
- - - -
-
- -
-
- - - -
-
- -
- -
-
-
- -
- -
- -
- -
-
-
-
- -
-
-
-
-
-
- -beginBlock('footer_js'); ?> - -endBlock('footer_js'); ?> diff --git a/frontend/views/database/d-index-search.php b/frontend/views/database/d-index-search.php deleted file mode 100644 index 3e2dd42..0000000 --- a/frontend/views/database/d-index-search.php +++ /dev/null @@ -1,84 +0,0 @@ - -beginBlock('header_css'); ?> -endBlock(); ?> - -
-
-
-
-
- -
- -
- -
- -
- -
- -
-
-
- -
-
- - - -
-
- -
- -
- -
- -
-
-
- -
- -
-
-
-
- -
-
-
-
-
-
- -beginBlock('footer_js'); ?> - -endBlock('footer_js'); ?> diff --git a/frontend/views/database/d-index.php b/frontend/views/database/d-index.php index cb63974..37c06f5 100644 --- a/frontend/views/database/d-index.php +++ b/frontend/views/database/d-index.php @@ -10,16 +10,50 @@ use \common\libs\MyLib;
D库
-
+ +
+ + +
+
+ + +
+
+ + +
+
+ +
+ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
- - id.'">'.$item->name.''; @@ -89,6 +127,11 @@ use \common\libs\MyLib; } function search() { + o = {}; + var params = $("#searchFrm").serializeArray(); + $.each(params, function(index) { + o[this['name']] = this['value']; + }); $('#listTable').bootstrapTable('destroy'); $('#listTable').bootstrapTable({ url: "/database/d-index-json", @@ -101,6 +144,7 @@ use \common\libs\MyLib; return o; } }); + return false; } $(function() { @@ -164,9 +208,20 @@ use \common\libs\MyLib; // }); }); - $('.btn-clear').click(function() { - o = {}; - search(); + $('.btn-assign-all-return').click(function() { + layer.confirm('是否确认批量收回操作?', { + btn: ['确认','取消'], //按钮 + shade: false //不显示遮罩 + }, function(){ + $.post('/database/d-return-all',o,function(obj){ + layer.msg(obj.msg); + if(obj.success) { + search(); + } + },'json'); + }, function(){ + // + }); }); $('.btn-a-invalid').click(function() { layer.confirm('是否确认移动?', {