onQueue('door_device'); if(! empty($out)) dispatch(new DoorDeviceJob($out,2,$site,$device_id))->onQueue('door_device'); } } public function getOrderNumber($data,$site){ //获取某个站点的数据 $tmp = []; $result = []; //发货出库 $key = $data['device_id'] . self::Key; if(Redis::exists($key)) { //发货 while ($item = Redis::lpop($key)) { $order = json_decode($item, true); $order_it = $order['epc'] . $order['direction']; if(! in_array($order_it, $tmp)){ $order['epc'] = hex2bin($order['epc']); $order['site'] = $site; $result[] = $order; $tmp[] = $order_it; } } return [true, $result]; } //入库 $key = $data['device_id'] . self::OrderKeyQueueIn; $res = Redis::get($key); if(! empty($res)){ $return = json_decode($res,true); foreach ($return as $value){ $result[] = [ 'epc' => $value, 'direction' => '1', ]; } Redis::del($key); return [true, $result]; } //发货 $key = $data['device_id'] . self::OrderKeyQueueOut; $res = Redis::get($key); if(! empty($res)){ $return = json_decode($res,true); foreach ($return as $value){ $result[] = [ 'epc' => $value, 'direction' => '2', ]; } Redis::del($key); return [true, $result]; } return [true, $result]; } //设置为发货出库 public function setFhMessage($data,$site){ $key = $data['device_id'] . self::Key; if(empty($data['fh'])){ //通道门处在出入库屏 删除通道门在发货出库屏下的标识(如果存在) if(Redis::exists($key)) Redis::del($key); }else{ //通道门处在发货出库屏 设置55秒过期 前端50秒请求一次 更新标识时间 if (Redis::setnx($key, 1)) Redis::expire($key, 55); //多少秒后过期 } } }