Compare commits

..

2 Commits

  1. 117
      frontend/controllers/DatabaseController.php

@ -298,6 +298,12 @@ class DatabaseController extends BaseController
if(!$b_info->save(false)) { if(!$b_info->save(false)) {
throw new Exception(print_r($b_info->getFirstErrors(),true)); throw new Exception(print_r($b_info->getFirstErrors(),true));
} }
} else {
$b_info->user_id = 0;
if(!$b_info->save(false)) {
throw new Exception(print_r($b_info->getFirstErrors(),true));
}
$this->addLog($car_info->id,'从B库回收成未分配状态',1);
} }
$this->addLog($car_info->id,'从A库分配到B库',1); $this->addLog($car_info->id,'从A库分配到B库',1);
} }
@ -346,6 +352,12 @@ class DatabaseController extends BaseController
if(!$b_info->save(false)) { if(!$b_info->save(false)) {
throw new Exception(print_r($b_info->getFirstErrors(),true)); throw new Exception(print_r($b_info->getFirstErrors(),true));
} }
} else {
$b_info->user_id = 0;
if(!$b_info->save(false)) {
throw new Exception(print_r($b_info->getFirstErrors(),true));
}
$this->addLog($car_info->id,'从B库回收成未分配状态',1);
} }
$this->addLog($car_info->id,'从A库分配到B库',1); $this->addLog($car_info->id,'从A库分配到B库',1);
} }
@ -396,6 +408,12 @@ class DatabaseController extends BaseController
if(!$c_info->save(false)) { if(!$c_info->save(false)) {
throw new Exception(print_r($c_info->getFirstErrors(),true)); throw new Exception(print_r($c_info->getFirstErrors(),true));
} }
} else {
$c_info->user_id = 0;
if(!$c_info->save(false)) {
throw new Exception(print_r($c_info->getFirstErrors(),true));
}
$this->addLog($car_info->id,'从C库回收成未分配状态',1);
} }
$this->addLog($car_info->id,'从A库分配到C库',1); $this->addLog($car_info->id,'从A库分配到C库',1);
} }
@ -988,20 +1006,23 @@ class DatabaseController extends BaseController
} }
$b_info = CarBT::findOne(['id'=>$id]); $b_info = CarBT::findOne(['id'=>$id]);
if($b_info->user_id > 0) { if($b_info) {
//删除预约 if($b_info->user_id > 0) {
AppointmentT::deleteAll('car_id='.$b_info->id); //删除预约
AppointmentT::deleteAll('car_id='.$b_info->id);
//删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
//删除操作人员 //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
$orders = OrderT::find() //删除操作人员
->where('car_id='.$b_info->id.' and status_id<5') $orders = OrderT::find()
->all(); ->where('car_id='.$b_info->id.' and status_id<5')
foreach($orders as $order_info) { ->all();
OrderUserT::deleteAll('order_id='.$order_info->id); foreach($orders as $order_info) {
//删除保单 OrderUserT::deleteAll('order_id='.$order_info->id);
$order_info->delete(); //删除保单
$order_info->delete();
}
} }
$b_info->delete();
} }
$this->addLog($car_info->id,'从B库移动到无效库',1); $this->addLog($car_info->id,'从B库移动到无效库',1);
} }
@ -1555,6 +1576,12 @@ class DatabaseController extends BaseController
if(!$d_info->save(false)) { if(!$d_info->save(false)) {
throw new Exception(print_r($d_info->getFirstErrors(),true)); throw new Exception(print_r($d_info->getFirstErrors(),true));
} }
} else {
$d_info->user_id = 0;
if(!$d_info->save(false)) {
throw new Exception(print_r($d_info->getFirstErrors(),true));
}
$this->addLog($car_info->id,'从D库回收成未分配状态',1);
} }
$this->addLog($car_info->id,'从C库分配到D库',1); $this->addLog($car_info->id,'从C库分配到D库',1);
} }
@ -1601,6 +1628,12 @@ class DatabaseController extends BaseController
if(!$d_info->save(false)) { if(!$d_info->save(false)) {
throw new Exception(print_r($d_info->getFirstErrors(),true)); throw new Exception(print_r($d_info->getFirstErrors(),true));
} }
} else {
$d_info->user_id = 0;
if(!$d_info->save(false)) {
throw new Exception(print_r($d_info->getFirstErrors(),true));
}
$this->addLog($car_info->id,'从D库回收成未分配状态',1);
} }
$this->addLog($car_info->id,'从C库分配到D库',1); $this->addLog($car_info->id,'从C库分配到D库',1);
} }
@ -1659,20 +1692,23 @@ class DatabaseController extends BaseController
} }
$c_info = CarCT::findOne(['id'=>$id]); $c_info = CarCT::findOne(['id'=>$id]);
if($c_info->user_id > 0) { if($c_info) {
//删除预约 if($c_info->user_id > 0) {
AppointmentT::deleteAll('car_id='.$c_info->id); //删除预约
AppointmentT::deleteAll('car_id='.$c_info->id);
//删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
//删除操作人员 //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
$orders = OrderT::find() //删除操作人员
->where('car_id='.$c_info->id.' and status_id<5') $orders = OrderT::find()
->all(); ->where('car_id='.$c_info->id.' and status_id<5')
foreach($orders as $order_info) { ->all();
OrderUserT::deleteAll('order_id='.$order_info->id); foreach($orders as $order_info) {
//删除保单 OrderUserT::deleteAll('order_id='.$order_info->id);
$order_info->delete(); //删除保单
$order_info->delete();
}
} }
$c_info->delete();
} }
$this->addLog($car_info->id,'从C库移动到无效库',1); $this->addLog($car_info->id,'从C库移动到无效库',1);
} }
@ -2236,20 +2272,23 @@ class DatabaseController extends BaseController
} }
$d_info = CarDT::findOne(['id'=>$id]); $d_info = CarDT::findOne(['id'=>$id]);
if($d_info->user_id > 0) { if($d_info) {
//删除预约 if($d_info->user_id > 0) {
AppointmentT::deleteAll('car_id='.$d_info->id); //删除预约
AppointmentT::deleteAll('car_id='.$d_info->id);
//删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
//删除操作人员 //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
$orders = OrderT::find() //删除操作人员
->where('car_id='.$d_info->id.' and status_id<5') $orders = OrderT::find()
->all(); ->where('car_id='.$d_info->id.' and status_id<5')
foreach($orders as $order_info) { ->all();
OrderUserT::deleteAll('order_id='.$order_info->id); foreach($orders as $order_info) {
//删除保单 OrderUserT::deleteAll('order_id='.$order_info->id);
$order_info->delete(); //删除保单
$order_info->delete();
}
} }
$d_info->deletel();
} }
$this->addLog($car_info->id,'从C库移动到无效库',1); $this->addLog($car_info->id,'从C库移动到无效库',1);
} }

Loading…
Cancel
Save