|
@@ -61,12 +61,14 @@ class Cabinet extends Base
|
|
|
$url = urldecode($param['url']);
|
|
|
$alias = $param['alias'];
|
|
|
$count = intval($param['count']);
|
|
|
+ $number = $param['number'];
|
|
|
+ $login_key = $param['login_key'];
|
|
|
if($count < 0 || empty($url)) {
|
|
|
return json(json_error_exception('1006','参数不正确'));
|
|
|
}
|
|
|
|
|
|
$CabinetModel = new CabinetModel();
|
|
|
- $flag = $CabinetModel->insertCabinet($url,$alias,$count);
|
|
|
+ $flag = $CabinetModel->insertCabinet($url,$alias,$count,$number,$login_key);
|
|
|
if($flag['code'] != 1){
|
|
|
return json(json_error_exception('1006',$flag['msg']));
|
|
|
}
|
|
@@ -76,19 +78,20 @@ class Cabinet extends Base
|
|
|
public function OpenBox()
|
|
|
{
|
|
|
$params['id'] = $this->getid();
|
|
|
- $params['cabinet_code'] = input('param.cabinet_number');
|
|
|
+ $cabinet_code = input('param.cabinet_number');
|
|
|
$box_number = input('param.box_number');
|
|
|
$box_position_list[] = $box_number;
|
|
|
$params['box_position_list'] = $box_position_list;
|
|
|
$params['delay_time'] = 0;
|
|
|
|
|
|
- $cabinet = $this->get_cabinet($params['cabinet_code']);
|
|
|
+ $cabinet = $this->get_cabinet($cabinet_code);
|
|
|
if($cabinet == false){
|
|
|
return json(json_error_exception('1008'));
|
|
|
}
|
|
|
$params['ret_queue'] = 'RET' . session_id();
|
|
|
$params['req_url'] = $cabinet['req_url'];
|
|
|
$params['key'] = $cabinet['login_key'];
|
|
|
+ $params['cabinet_code'] = $cabinet['number'];
|
|
|
$params['method'] = 'OpenBoxR';
|
|
|
|
|
|
$result = $this->proc_request(self::queue_name,'OpenBox',$params);
|
|
@@ -103,9 +106,9 @@ class Cabinet extends Base
|
|
|
public function LockCabinet()
|
|
|
{
|
|
|
$params['id'] = $this->getid();
|
|
|
- $params['cabinet_code'] = input('param.cabinet_number');
|
|
|
+ $cabinet_code = input('param.cabinet_number');
|
|
|
|
|
|
- $cabinet = $this->get_cabinet($params['cabinet_code']);
|
|
|
+ $cabinet = $this->get_cabinet($cabinet_code);
|
|
|
$params['delay_time'] = 0;
|
|
|
if($cabinet == false){
|
|
|
return json(json_error_exception('1008'));
|
|
@@ -114,6 +117,7 @@ class Cabinet extends Base
|
|
|
$params['ret_queue'] = 'RET' . session_id();
|
|
|
$params['req_url'] = $cabinet['req_url'];
|
|
|
$params['key'] = $cabinet['login_key'];
|
|
|
+ $params['cabinet_code'] = $cabinet['number'];
|
|
|
$params['method'] = 'LockCabinetR';
|
|
|
|
|
|
$result = $this->proc_request(self::queue_name,'LockCabinet',$params);
|
|
@@ -127,9 +131,9 @@ class Cabinet extends Base
|
|
|
public function UnLockCabinet()
|
|
|
{
|
|
|
$params['id'] = $this->getid();
|
|
|
- $params['cabinet_code'] = input('param.cabinet_number');
|
|
|
+ $cabinet_code = input('param.cabinet_number');
|
|
|
|
|
|
- $cabinet = $this->get_cabinet($params['cabinet_code']);
|
|
|
+ $cabinet = $this->get_cabinet($cabinet_code);
|
|
|
$params['delay_time'] = 0;
|
|
|
if($cabinet == false){
|
|
|
return json(json_error_exception('1008'));
|
|
@@ -138,6 +142,7 @@ class Cabinet extends Base
|
|
|
$params['ret_queue'] = 'RET' . session_id();
|
|
|
$params['req_url'] = $cabinet['req_url'];
|
|
|
$params['key'] = $cabinet['login_key'];
|
|
|
+ $params['cabinet_code'] = $cabinet['number'];
|
|
|
$params['method'] = 'UnLockCabinetR';
|
|
|
|
|
|
$result = $this->proc_request(self::queue_name,'UnLockCabinet',$params);
|
|
@@ -151,10 +156,10 @@ class Cabinet extends Base
|
|
|
public function ReleaseAlarm()
|
|
|
{
|
|
|
$params['id'] = $this->getid();
|
|
|
- $params['cabinet_code'] = input('param.cabinet_number');
|
|
|
+ $cabinet_code = input('param.cabinet_number');
|
|
|
$params['delay_time'] = 0;
|
|
|
|
|
|
- $cabinet = $this->get_cabinet($params['cabinet_code']);
|
|
|
+ $cabinet = $this->get_cabinet($cabinet_code);
|
|
|
if($cabinet == false){
|
|
|
return json(json_error_exception('1008'));
|
|
|
}
|
|
@@ -162,6 +167,7 @@ class Cabinet extends Base
|
|
|
$params['ret_queue'] = 'RET' . session_id();
|
|
|
$params['req_url'] = $cabinet['req_url'];
|
|
|
$params['key'] = $cabinet['login_key'];
|
|
|
+ $params['cabinet_code'] = $cabinet['number'];
|
|
|
$params['method'] = 'ReleaseAlarmR';
|
|
|
|
|
|
$result = $this->proc_request(self::queue_name,'ReleaseAlarm',$params);
|
|
@@ -175,10 +181,10 @@ class Cabinet extends Base
|
|
|
public function Reboot()
|
|
|
{
|
|
|
$params['id'] = $this->getid();
|
|
|
- $params['cabinet_code'] = input('param.cabinet_number');
|
|
|
+ $cabinet_code = input('param.cabinet_number');
|
|
|
$params['delay_time'] = 0;
|
|
|
|
|
|
- $cabinet = $this->get_cabinet($params['cabinet_code']);
|
|
|
+ $cabinet = $this->get_cabinet($cabinet_code);
|
|
|
if($cabinet == false){
|
|
|
return json(json_error_exception('1008'));
|
|
|
}
|
|
@@ -186,6 +192,7 @@ class Cabinet extends Base
|
|
|
$params['ret_queue'] = 'RET' . session_id();
|
|
|
$params['req_url'] = $cabinet['req_url'];
|
|
|
$params['key'] = $cabinet['login_key'];
|
|
|
+ $params['cabinet_code'] = $cabinet['number'];
|
|
|
$params['method'] = 'RebootR';
|
|
|
|
|
|
$result = $this->proc_request(self::queue_name,'Reboot',$params);
|
|
@@ -199,10 +206,10 @@ class Cabinet extends Base
|
|
|
public function QueryState()
|
|
|
{
|
|
|
$params['id'] = $this->getid();
|
|
|
- $params['cabinet_code'] = input('param.cabinet_number');
|
|
|
+ $cabinet_code = input('param.cabinet_number');
|
|
|
$params['delay_time'] = 0;
|
|
|
|
|
|
- $cabinet = $this->get_cabinet($params['cabinet_code']);
|
|
|
+ $cabinet = $this->get_cabinet($cabinet_code);
|
|
|
if($cabinet == false){
|
|
|
return json(json_error_exception('1008'));
|
|
|
}
|
|
@@ -210,6 +217,7 @@ class Cabinet extends Base
|
|
|
$params['ret_queue'] = 'RET' . session_id();
|
|
|
$params['req_url'] = $cabinet['req_url'];
|
|
|
$params['key'] = $cabinet['login_key'];
|
|
|
+ $params['cabinet_code'] = $cabinet['number'];
|
|
|
$params['method'] = 'RebootR';
|
|
|
|
|
|
$result = $this->proc_request(self::queue_name,'QueryState',$params);
|
|
@@ -227,7 +235,7 @@ class Cabinet extends Base
|
|
|
$cabinet_status = ['1' => '运行中' , '2' => '已锁定'];
|
|
|
// 拼装参数
|
|
|
foreach($selectResult as $key=>$vo){
|
|
|
- $selectResult[$key]['cabinet_status'] = $cabinet_status[$vo['cabinet_status']];
|
|
|
+ $selectResult[$key]['status_text'] = $cabinet_status[$vo['cabinet_status']];
|
|
|
}
|
|
|
$return['total'] = $CabinetModel->getAllCabinets(); //总数量
|
|
|
$return['rows'] = $selectResult;
|
|
@@ -236,14 +244,16 @@ class Cabinet extends Base
|
|
|
|
|
|
public function BoxList(){
|
|
|
$cabinet_number = input('cabinet_number');
|
|
|
-
|
|
|
+ if(empty($cabinet_number)){
|
|
|
+ json_error(1007 , '柜子号码不能为空');
|
|
|
+ }
|
|
|
$BoxModel = new BoxModel();
|
|
|
- $where['cabinet_number'] = $cabinet_number;
|
|
|
+ $where['sc_box.cabinet_number'] = $cabinet_number;
|
|
|
$selectResult = $BoxModel->getBoxsByWhere($where);
|
|
|
$box_status = ['1' => '空闲' , '2' => '已使用' , '3' => '锁定中'];
|
|
|
// 拼装参数
|
|
|
foreach($selectResult as $key=>$vo){
|
|
|
- $selectResult[$key]['box_status'] = $box_status[$vo['box_status']];
|
|
|
+ $selectResult[$key]['status_text'] = $box_status[$vo['box_status']];
|
|
|
}
|
|
|
$return['total'] = $BoxModel->getAllCounts(); //总数量
|
|
|
$return['rows'] = $selectResult;
|
|
@@ -251,6 +261,9 @@ class Cabinet extends Base
|
|
|
}
|
|
|
public function BoxActionList(){
|
|
|
$param = input('param.');
|
|
|
+ if(empty($param['cabinet_number']) || empty($param['box_number'])){
|
|
|
+ json_error(1007 , '柜子号码或箱子号码不能为空');
|
|
|
+ }
|
|
|
$where['cabinet_number'] = $param['cabinet_number'];
|
|
|
$where['box_number'] = $param['box_number'];
|
|
|
$limit = isset($param['pageSize']) ? $param['pageSize'] : 10;
|
|
@@ -262,7 +275,7 @@ class Cabinet extends Base
|
|
|
$status = ['1' => '开箱' , '2' => '关箱'];
|
|
|
// 拼装参数
|
|
|
foreach($selectResult as $key=>$vo){
|
|
|
- $selectResult[$key]['type'] = $status[$vo['type']];
|
|
|
+ $selectResult[$key]['status_text'] = $status[$vo['type']];
|
|
|
}
|
|
|
$return['total'] = $BoxActionModel->getAllCounts($where); //总数量
|
|
|
$return['rows'] = $selectResult;
|