|
@@ -21,7 +21,7 @@ class InOutOptionService extends Service
|
|
|
if($value['direction'] == '1'){
|
|
|
//(判断到有发货出库的入库标识 存入缓存)
|
|
|
if(Redis::exists($device_id . self::Key)){
|
|
|
- Redis::lpush($device_id . self::Key . Self::OrderKeyQueueInOut, json_encode($value));
|
|
|
+ Redis::lpush($device_id . self::Key . self::OrderKeyQueueInOut, json_encode($value));
|
|
|
}else{
|
|
|
//入库 直接生成入库单
|
|
|
if(! in_array($value['epc'],$in)) $in[] = $value['epc'];
|
|
@@ -29,7 +29,7 @@ class InOutOptionService extends Service
|
|
|
}elseif ($value['direction'] == '2'){
|
|
|
//(判断到有发货出库的出库标识 存入缓存)
|
|
|
if(Redis::exists($device_id . self::Key)){
|
|
|
- Redis::lpush($device_id . self::Key . Self::OrderKeyQueueInOut, json_encode($value));
|
|
|
+ Redis::lpush($device_id . self::Key . self::OrderKeyQueueInOut, json_encode($value));
|
|
|
}else{
|
|
|
//出库 直接生成出库单
|
|
|
if(! in_array($value['epc'],$out)) $out[] = $value['epc'];
|
|
@@ -47,17 +47,20 @@ class InOutOptionService extends Service
|
|
|
$result = [];
|
|
|
|
|
|
//发货出库
|
|
|
- $key = $data['device_id'] . self::Key . Self::OrderKeyQueueInOut;
|
|
|
+ $key = $data['device_id'] . self::Key . self::OrderKeyQueueInOut;
|
|
|
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;
|
|
|
+ $str = @hex2bin($order['epc']);
|
|
|
+ $str = ltrim($str, "\x00");
|
|
|
+ if(! empty($str) && substr($str, 0, 2) === "BZ"){
|
|
|
+ $order['epc'] = $str;
|
|
|
+ $order['site'] = $site;
|
|
|
+ $result[] = $order;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|