예제 #1
0
 /**
  * 仓库订单状态实时推送给订单系统
  */
 public static function pushOrderStatus($shipOrderId, $status, $userId, $operateTime, $storeId = 1)
 {
     self::initDB();
     $rmq_config = C("RMQ_CONFIG");
     $rabbitMQClass = new RabbitMQClass($rmq_config['sendOrder'][1], $rmq_config['sendOrder'][2], $rmq_config['sendOrder'][4], $rmq_config['sendOrder'][0]);
     //队列对象
     $orderDataInfo = array();
     //基础信息
     //	$sql = "select originOrderId from `wh_shipping_order_relation` where shipOrderId={$shipOrderId}";
     //$query	   = self::$dbConn->query($sql);
     //	$orderInfo = self::$dbConn->fetch_first($sql);
     $result = WhShippingOrderRelationModel::get_orderId($shipOrderId);
     //  if(is_array($result)){
     //  }
     $orderDataInfo = array('originOrderId' => $result, 'orderStatus' => $status, 'operateUserId' => $userId, 'operateTime' => $operateTime, 'storeId' => $storeId);
     $exchange = 'WH_STATUS_EXCHANGE';
     if ($rabbitMQClass->queue_publish($exchange, json_encode($orderDataInfo), "direct")) {
         self::$errMsg = "推送成功!";
         return true;
     } else {
         self::$errCode = "401";
         self::$errMsg = "推送失败!";
         return false;
     }
 }
예제 #2
0
$log = '';
foreach ($shipOrders as $order) {
    if (empty($order['countryName'])) {
        $log .= "发货单{$order['shipOrderId']}没有国家名称\n";
        continue;
    }
    if (empty($order['orderWeight'])) {
        $log .= "发货单{$order['shipOrderId']}没有重量\n";
        continue;
    }
    if (empty($order['selectShipping'])) {
        $log .= "发货单{$order['shipOrderId']}没有可选择的运输方式\n";
        continue;
    }
    //获取真实订单ID
    $orderId = WhShippingOrderRelationModel::get_orderId($order['shipOrderId']);
    //传递给物流系统的数据
    $data[$orderId] = array('channelId' => $order['selectShipping'], 'country' => rawurlencode($order['countryName']), 'weight' => $order['orderWeight'] / 1000);
    //赛维美国专线传递转运中心和邮编前三位
    if (count(array_intersect(array(115, 119, 116), explode(',', $order['selectShipping']))) > 0) {
        $data[$orderId]['postCode'] = substr($order['zipCode'], 0, 3);
        //邮编前三位
        $data[$orderId]['transitId'] = 2;
        //转运中心
    }
}
$transportInfo = CommonModel::getTransportByApi($data);
//调用物流系统接口
if (empty($transportInfo['data'])) {
    echo '没有获取申请信息';
    exit;
예제 #3
0
$orderids = array();
foreach ($shipOrders as $orderinfo) {
    $orderids[] = WhShippingOrderRelationModel::get_orderId($orderinfo['id']);
}
$orderisStr = implode("','", $orderids);
//调用订单系统接口批量获取订单信息
$orders = CommonModel::get_orderInfoFromOrderSys($orderisStr);
$orders = $orders['data'];
if (empty($orders)) {
    exit('未获取申请跟踪号的订单详细信息');
}
foreach ($shipOrders as $orderinfo) {
    $shipOrderId = $orderinfo['id'];
    $ebay_platformId = $orderinfo['platformId'];
    //平台名称
    $orderId = WhShippingOrderRelationModel::get_orderId($shipOrderId);
    if (!in_array($ebay_platformId, array(1, 14))) {
        echo $ebay_account . "非EBAY账号!\n";
        continue;
    }
    $ebay_username = $orderinfo['username'];
    $ebay_usermail = $orderinfo['email'];
    $ebay_phone = $orderinfo['phone'];
    $ebay_street = $orderinfo['street'] . ' ' . $orderinfo['address2'] . ' ' . $orderinfo['address3'];
    $ebay_city = $orderinfo['city'];
    $ebay_state = $orderinfo['state'];
    $ebay_postcode = $orderinfo['zipCode'];
    $ebay_countryname = $orderinfo['countryName'];
    $ebay_couny = $orderinfo['countrySn'];
    $ebay_currency = $orderinfo['currency'];
    $ebay_userid = $orderinfo['platformUsername'];
예제 #4
0
    $insertData = array('tracknumber' => $transport['trackNums']['trackNumber'], 'status' => 2, 'tracknumberTime' => $nowtime);
    //通过真实订单id获取发货单id
    $shipOrderId = WhShippingOrderRelationModel::get_shipOrderId($orderId);
    if (empty($transport['trackNums']['trackNumber'])) {
        $log .= "发货单:{$shipOrderId}未申请到跟踪号\n";
        continue;
    }
    WhWaveOrderTransportModel::begin();
    //启用事物提价
    //更新申请记录表
    if (!WhWaveOrderTransportModel::update($insertData, ' shipOrderId = ' . $shipOrderId . ' AND status=1')) {
        $log .= "发货单:{$shipOrderId}更新申请跟踪号-{$transport['trackNums']['trackNumber']}记录表失败\n";
        WhWaveOrderTransportModel::rollback();
        continue;
    }
    $trackNumberData = array('tracknumber' => $transport['trackNums']['trackNumber'], 'shipOrderId' => $shipOrderId, 'createdTime' => $nowtime);
    if (!WhOrderTracknumberModel::insert($trackNumberData)) {
        $log .= "发货单-{$shipOrderId}插入跟踪号{$transport['trackNums']['trackNumber']}信息表失败\n";
        WhWaveOrderTransportModel::rollback();
        continue;
    }
    //推送运输方式,跟踪信息,重量到订单系统
    $orderDataInfo = array('orderId' => WhShippingOrderRelationModel::get_orderId($shipOrderId), 'orderWeight' => $orders[$shipOrderId]['orderWeight'], 'transportId' => $orders[$shipOrderId]['transportId'], 'channelId' => $orders[$shipOrderId]['channelId'], 'tracknumber' => $transport['trackNums']['trackNumber'], 'actualShipping' => $orders[$shipOrderId]['actualShipping'], 'tracknumberTime' => $nowtime);
    WhPushModel::pushTransportInfo($orderDataInfo);
    //推送成功还是返回false
    //$log .= "发货单-{$shipOrderId}推送信息".json_encode($orderDataInfo)."失败\n";
    $log .= "发货单:{$shipOrderId}申请跟踪号-{$transport['tracknumber']}记录成功\n";
    WhWaveOrderTransportModel::commit();
}
//写日志
write_log("tracknumber_assign/" . date('Y-m') . "/" . date('H') . ".txt", $log);