|
@@ -46,7 +46,7 @@ class DwyController extends BaseController
|
|
|
$return = [
|
|
|
'video' => [],
|
|
|
'img' => [],
|
|
|
- 'limit_time' => 15
|
|
|
+ 'limit_time' => 1
|
|
|
];
|
|
|
foreach ($box_data['data'] as $v){
|
|
|
if(isset($v['poster_attachment']['picture_attachment']['attachFile'])){
|
|
@@ -112,6 +112,7 @@ class DwyController extends BaseController
|
|
|
$device_id = $data['device_code'];
|
|
|
$box_code = $data['box_code'];
|
|
|
$key = $data['type'];
|
|
|
+ $limit = 15;
|
|
|
if ($key === 'UP') {
|
|
|
$num = Redis::get($device_id . 'status_num');
|
|
|
if (empty($num)) $num = 0;
|
|
@@ -119,13 +120,13 @@ class DwyController extends BaseController
|
|
|
|
|
|
if ($num === 1) {
|
|
|
Redis::set($device_id . 'status_num', $num);
|
|
|
- Redis::expire($device_id . 'status_num', 300);
|
|
|
+ Redis::expire($device_id . 'status_num', $limit);
|
|
|
|
|
|
Redis::set($device_id . 'status', 201);
|
|
|
- Redis::expire($device_id . 'status', 300);
|
|
|
+ Redis::expire($device_id . 'status', $limit);
|
|
|
|
|
|
Redis::set($device_id, json_encode([$box_code]));
|
|
|
- Redis::expire($device_id, 300);
|
|
|
+ Redis::expire($device_id, $limit);
|
|
|
} else {
|
|
|
|
|
|
$old = Redis::get($device_id);
|
|
@@ -133,7 +134,7 @@ class DwyController extends BaseController
|
|
|
else $old = json_decode($old, true);
|
|
|
$data = array_merge($old, [$box_code]);
|
|
|
Redis::set($device_id, json_encode($data));
|
|
|
- Redis::expire($device_id, 300);
|
|
|
+ Redis::expire($device_id, $limit);
|
|
|
|
|
|
Redis::del($device_id . 'status');
|
|
|
Redis::del($device_id . 'status_num');
|
|
@@ -141,7 +142,7 @@ class DwyController extends BaseController
|
|
|
|
|
|
} else {
|
|
|
Redis::set($device_id, json_encode([$box_code]));
|
|
|
- Redis::expire($device_id, 300);
|
|
|
+ Redis::expire($device_id, $limit);
|
|
|
}
|
|
|
|
|
|
return ['status' => 200];
|
|
@@ -279,6 +280,7 @@ class DwyController extends BaseController
|
|
|
'safe_stock_qty' => $v['safe_stock_qty'] ?? 0,
|
|
|
'status' => 1, //0设备仓中没有对应库存,1有对应库存,2对应商标仓中还有数量不允许上标
|
|
|
'qty' => 0,
|
|
|
+ 'device_title' => $v['device']['name'] ?? '',
|
|
|
];
|
|
|
$material_list[$v['material_code']][] = $v['box_code'];
|
|
|
}
|
|
@@ -805,10 +807,15 @@ class DwyController extends BaseController
|
|
|
];
|
|
|
$data = $this->post_helper($url, '{"device_code":"'.$mac.'"}', $header);
|
|
|
$data = json_decode($data, true);
|
|
|
-
|
|
|
- usort($data, function ($a,$b){
|
|
|
- return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
|
- });
|
|
|
+ if($mac == 'a6a672c3e458bed2'||$mac == 'DV00001'){
|
|
|
+ usort($data, function ($a,$b){
|
|
|
+ return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ usort($data, function($a, $b) {
|
|
|
+ return $b['qty'] < $a['qty'];
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
//做一个单独的校验,如果数量不够则返回失败
|
|
|
$out_key_list = [];
|
|
@@ -905,7 +912,9 @@ class DwyController extends BaseController
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ foreach ($data as $k=>$d){
|
|
|
+ if($d['send_qty'] <= 0) unset($data[$k]);
|
|
|
+ }
|
|
|
usort($data, function ($a,$b){
|
|
|
return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
|
});
|