public function view_reculculateShippingWay() { $ids = isset($_GET['ids']) ? trim($_GET['ids']) : ''; $ids = explode(',', $ids); $ids = array_map('intval', $ids); $succesResult = array(); //存储处理成功的结果集 $failureResult = array(); //处理存储失败的结果集 $owOrderMG = new OwOrderManageModel(); $owShipfeeCul = new OwShippingWayDesisionModel(); $oderIndex = new OrderindexAct(); $exApply = new ExpressLabelApplyModel(); foreach ($ids as $orderId) { $orderInfo = $owOrderMG->getOrderInfoById($orderId, array('id', 'recordNumber', 'calcWeight')); if (FALSE == $orderInfo) { $failureResult[] = array('oderid' => $orderId, 'recordNumber' => '', 'calcWeight' => 0, 'errMsg' => '订单不存在'); continue; } if (0 == $orderInfo['calcWeight']) { //重量未0 不予打印 $failureResult[] = array('oderid' => $orderId, 'recordNumber' => $orderInfo['recordNumber'], 'calcWeight' => 0, 'errMsg' => '订单重量为0! 请确认重量!'); continue; } $userInfo = $owOrderMG->getBuyerInfoById($orderId); if (FALSE == $userInfo) { $failureResult[] = array('oderid' => $orderId, 'recordNumber' => $orderInfo['recordNumber'], 'calcWeight' => $orderInfo['calcWeight'], 'errMsg' => '不能获取买家信息!'); continue; } $shipInfo = $owOrderMG->getShippingInfo($orderId); if ($shipInfo) { if ($shipInfo['isCanceled'] == 0) { //之前已经申请过跟踪号 如果未取消则不予重复申请 $failureResult[] = array('oderid' => $orderId, 'recordNumber' => $orderInfo['recordNumber'], 'calcWeight' => $orderInfo['calcWeight'], 'shippingWay' => $shipInfo['shippingWay'], 'errMsg' => '原有跟踪号未取消!', 'trackNumber' => $shipInfo['trackNumber']); continue; } } $skuList = $oderIndex->act_getRealskulist($orderId); $outSide = $owShipfeeCul->culPackageLWH($skuList); $zone = $exApply->getZoneCode($userInfo['zipCode']); $shipingWay = $owShipfeeCul->chooseShippingWay($skuList, $orderInfo['calcWeight'], $outSide, $zone); if (FALSE == $shipingWay) { $failureResult[] = array('oderid' => $orderId, 'recordNumber' => $orderInfo['recordNumber'], 'calcWeight' => $orderInfo['calcWeight'], 'errMsg' => '未找到合适的运输方式!', 'trackNumber' => ''); continue; } else { //执行成功 更新运输方式 $transId = $exApply->reflectCodeToId($shipingWay['shippingCode']); $owOrderMG->updateFeildData(array('transportId' => $transId), $orderId); $owOrderMG->changeOrderStatus(911, 916, $orderId); //移动到待打印 $succesResult[] = array('oderid' => $orderId, 'recordNumber' => $orderInfo['recordNumber'], 'calcWeight' => $orderInfo['calcWeight'], 'errMsg' => '成功!', 'trackNumber' => $shipingWay['shippingCode']); continue; } } // print_r($failureResult); // print_r($succesResult); $this->smarty->assign('success', $succesResult); $this->smarty->assign('failure', $failureResult); $this->smarty->display('owReculShipping.htm'); }
public function view_syncLocalPickUpOrder() { $orderId = isset($_GET['orderId']) ? $_GET['orderId'] : FALSE; $returnData = array('code' => 0, 'msg' => ''); if (FALSE == $orderId) { $returnData['msg'] = ' 未指定订单号'; echo json_encode($returnData); exit; } $owOrderMg = new OwOrderManageModel(); $orderInfo = $owOrderMg->getOrderInfoById($orderId, '*'); if (FALSE == $orderInfo) { $returnData['msg'] = '不存在的订单'; echo json_encode($returnData); exit; } if ($orderInfo['orderStatus'] != 911 || $orderInfo['orderType'] != 928) { $returnData['msg'] = '该订购单不是上门取件订单'; echo json_encode($returnData); exit; } $orderAct = new OrderindexAct(); $orderSync = new OwOrderSyncModel(); $skuList = $orderAct->act_getRealskulist($orderId); //获取sku信息列表 if (empty($skuList)) { $returnData['msg'] = '未找到sku'; echo json_encode($returnData); exit; } $transInfo = $owOrderMg->getShippingInfo($orderId); if (empty($transInfo)) { //获取运输方式信息 $transInfo = array('shippingWay' => 'localPickup', 'tracknumber' => ''); } $platformInfo = $owOrderMg->getPlatformInfoByPid($orderInfo['platformId']); if (FALSE == $platformInfo) { $returnData['msg'] = '无法获取平台信息'; echo json_encode($returnData); exit; } $platSuffix = $platformInfo['suffix']; $extensionTabel = 'om_unshipped_order_extension_' . $platSuffix; //扩展信息表名 $extensionInfo = $owOrderMg->getExtensionInfo($extensionTabel, $orderId); if ($extensionInfo) { if ("amazon" == $platSuffix) { //亚马逊订单 $orderInfo['note'] = $extensionInfo['note']; } else { if ('ebay' == $platSuffix) { //ebay订单 $orderInfo['note'] = $extensionInfo['feedback']; } } } $UserInfo = $owOrderMg->getBuyerInfoById($orderId); $sellerInfo = $owOrderMg->getSellerInfoById($orderInfo['accountId']); //获得卖家账号信息 if ($sellerInfo) { $orderInfo['account'] = $sellerInfo['ebay_account']; } else { $orderInfo['account'] = ''; } $orderInfo['putstatus'] = 16; $submitData = array('orderInfo' => $orderInfo, 'userInfo' => $UserInfo, 'transInfo' => $transInfo, 'skuList' => $skuList); // print_r($submitData);exit; $reuslt = $orderSync->pushPrintedOrderToUsWh($orderId, $submitData); if (TRUE == $reuslt) { $returnData['code'] = 1; } else { $returnData['msg'] = OwOrderSyncModel::$errMsg; } echo json_encode($returnData); }