/** * OrderPrintAct::get_tracknumber() * 获取单个发货单跟踪号 * @param mixed $shipOrderId * @return void */ public function get_tracknumber($shipOrderId) { $shipOrderId = intval($shipOrderId); $tracknumber = ''; if ($shipOrderId) { $tracknumber = WhOrderTracknumberModel::getTracknumberByShipOrderOd(array('shipOrderId' => $shipOrderId), TRUE); $tracknumber = $tracknumber['tracknumber']; } return $tracknumber; }
var_dump($params); try { $functions = @$soapclient->AddAPACShippingPackage(array("AddAPACShippingPackageRequest" => $params)); } catch (Exception $e) { print $e->getMessage(); continue; } var_dump($shipOrderId, $APIDevUserID, $functions); foreach ($functions as $aa) { $bb = (array) $aa; $ack = $bb['Ack']; if ($ack != 'Failure') { $TrackCode = $bb['TrackCode']; echo $TrackCode . "\n"; $trackNumberData = array('tracknumber' => $TrackCode, 'shipOrderId' => $shipOrderId, 'createdTime' => time()); if (!WhOrderTracknumberModel::insert($trackNumberData)) { echo $log .= "发货单-{$shipOrderId}插入跟踪号{$TrackCode}信息表失败\n"; } } else { $Message = $bb['Message']; echo "订单编号:" . $ordersn . " EUB订单上传失败,失败原因是:[" . $Message . "]\n"; $err_msg = mysql_real_escape_string($Message); $params = array('Version' => "3.0.0", 'APIDevUserID' => $APIDevUserID, 'APIPassword' => $APIPassword, 'APISellerUserID' => $APISellerUserID, 'MessageID' => "135625622432", 'EBayItemID' => $ebay_itemid, 'EBayTransactionID' => $ebay_tid); $getTrackCode = @$soapclient->GetAPACShippingTrackCode(array("GetAPACShippingTrackCodeRequest" => $params)); if ($getTrackCode->GetAPACShippingTrackCodeResult->Ack == 'Success') { echo "<font color=\"#0000FF\">注意:订单编号" . $ordersn . " EUB订单 已申请,跟踪号为 {$getTrackCode->GetAPACShippingTrackCodeResult->TrackCode}</font>"; } else { var_dump($ordersn, $getTrackCode); $err_msg = "{$err_msg}"; } }
/** * Pda_orderLoadingAct::act_orderExpress() * 如果装车扫描的时候是扫描快递的,那么该模块接收的变量的值是追踪号$ebay_id,发货单号是$shipOrderId * @author cxy * @return */ public function act_orderExpress() { $userId = $_SESSION['userId']; $shipOrderId = trim($_POST['shipOrderId']); //快递单号 $ebay_id = trim($_POST['ebay_id']); //扫描的跟踪号 if (empty($shipOrderId)) { self::$errCode = '201'; self::$errMsg = '请输入发货单号!'; return false; } if (empty($ebay_id)) { self::$errCode = '201'; self::$errMsg = '请输入跟踪号!'; return false; } // $arr_track[] = $ebay_id; //记录表里和发货单关联的跟踪号 $tracknumber = WhOrderTracknumberModel::select_TracknumberByOrderId($shipOrderId); //print_r($tracknumber);exit(); $tracking_arr = array(); foreach ($tracknumber as $track) { $tracking_arr[] = $track['tracknumber']; } // print_r($arr_track); // print_r($tracking_arr);exit; if (!in_array($ebay_id, $tracking_arr)) { self::$errCode = '202'; self::$errMsg = '输入的跟踪号没有和该发货单号绑定!'; return false; } $data = array('packageId' => $shipOrderId, 'scantime' => time(), 'userId' => $userId, 'tracking' => $ebay_id, 'isExpress' => 1); $select_loading = WhWaveOrderLoadingModel::select_loading_express($shipOrderId, $ebay_id); if ($select_loading) { self::$errCode = '003'; self::$errMsg = '该' . $shipOrderId . '下的跟踪号' . $ebay_id . '已经进行过装车扫描了!'; return false; } $insert_loading = WhWaveOrderLoadingModel::insert($data); if (empty($insert_loading)) { self::$errCode = '003'; self::$errMsg = '装车扫描失败,请联系负责人!'; return false; } $count_load = WhWaveOrderLoadingModel::select_loading_count($shipOrderId); //已经装车扫描的记录 //当需要扫描的跟踪号等于已经扫描的跟踪号的时候就改变发货单的状态 if ($count_load['muns'] == count($tracknumber)) { $result = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($shipOrderId, $status = PKS_DONE); if (!$result) { self::$errCode = '003'; self::$errMsg = '更新' . $shipOrderId . '发货单号失败,请联系负责人!'; return false; } WhPushModel::pushOrderStatus($shipOrderId, 'PKS_DONE', $_SESSION['userId'], time()); //状态推送,需要改为已发货(订单系统提供状态常量) self::$errMsg = '扫描' . $shipOrderId . '快递单成功,请扫描下一个发货单号!'; } else { self::$errMsg = '扫描' . $shipOrderId . '快递单的跟踪号成功,请扫描该快递单的下一个跟踪号!'; } self::$errCode = '200'; return true; // WhOrderTracknumberModel::select_ByTracknumber($ebay_id); // echo $ebay_id.'--'.$shipOrderId;exit; }
/** * pda_TrackingAct::act_tracking_binding() * 快递绑定跟踪号 * @author cxy * @return */ public function act_tracking_binding() { $userId = $_SESSION['userId']; $ebay_id = trim($_POST['ebay_id']); $tracking = trim($_POST['tracking']); if (empty($userId)) { self::$errCode = '0'; self::$errMsg = '系统登录超时,请先关闭浏览器 然后登录扫描!!'; return false; } if (empty($ebay_id)) { self::$errCode = 0; self::$errMsg = '请填写单号!'; return; } if (empty($tracking)) { self::$errCode = 0; self::$errMsg = '请输入正确的跟踪号!'; return; } //查询扫描的跟踪号是否已经扫描过了的 $result_select = WhOrderTracknumberModel::select_ByTracknumber($tracking); if ($result_select) { self::$errCode = 211; self::$errMsg = '该跟踪号已经绑定' . $result_select['shipOrderId'] . ',请检查!'; return false; } $data = array('tracknumber' => $tracking, 'shipOrderId' => $ebay_id, 'createdTime' => time()); $array = array('shipOrderId' => $ebay_id, 'is_delete' => 0); //根据发货单号获取快递需要的箱子和跟踪号数量 $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id); //说明该快递单只有一个箱子和一个跟踪号,所以不需要在wh_wave_tracking_box "快递单号的箱子与跟踪号数量表"添加记录 if (empty($result_tracking_count)) { $count_binding = WhOrderTracknumberModel::count($array); //发货单已经绑定跟踪号的数量 if ($count_binding > 0) { self::$errCode = 24; self::$errMsg = '该发货单号已经绑定好跟踪号了,不在需要绑定'; return false; } WhBaseModel::begin(); $result_insert = WhOrderTracknumberModel::insert($data); if (!$result_insert) { WhBaseModel::rollback(); self::$errCode = 20; self::$errMsg = '跟踪号绑定失败,请联系负责人'; return false; } //更新发货表状态 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING); if (!$ostatus) { WhBaseModel::rollback(); self::$errCode = 20; self::$errMsg = '更新发货单状态失败,请联系负责人'; return false; } WhPushModel::pushOrderStatus($ebay_id, 'PKS_WAITING_LOADING', $_SESSION['userId'], time()); //状态推送,需要改为待装车扫描(订单系统提供状态常量) WhBaseModel::commit(); self::$errCode = 200; self::$errMsg = '绑定成功,请扫描另外一个发货单!'; return true; } else { $result_tracking_count = $result_tracking_count['trackingCount']; //发货单需要绑定跟踪号的数量 $count_binding = WhOrderTracknumberModel::count($array); //发货单已经绑定跟踪号的数量 if ($result_tracking_count > $count_binding) { WhBaseModel::begin(); $result_insert = WhOrderTracknumberModel::insert($data); if (!$result_insert) { WhBaseModel::rollback(); self::$errCode = 21; self::$errMsg = '跟踪号绑定失败,请联系负责人'; return false; } $num = $result_tracking_count - $count_binding - 1; if ($num == 0) { //更新发货表状态 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING); if (!$ostatus) { WhBaseModel::rollback(); self::$errCode = 20; self::$errMsg = '更新发货单状态失败,请联系负责人'; return false; } WhPushModel::pushOrderStatus($ebay_id, ' ', $_SESSION['userId'], time()); //状态推送,需要改为待装车扫描(订单系统提供状态常量) WhBaseModel::commit(); self::$errMsg = '绑定成功,该发货单不需要绑定跟踪号了'; self::$errCode = 200; return true; } else { WhBaseModel::commit(); self::$errMsg = '绑定成功,该发货单还需要绑定' . $num . '个跟踪号'; self::$errCode = 400; return true; } } else { self::$errCode = 22; self::$errMsg = '绑定失败,绑定的跟踪号已经够' . $result_tracking_count . '个,请扫描另外一个发货单!'; return true; } } }
public function view_formDataImport() { // $tir_obj = new TrackInfoRecordModel(); $ebay_id = $_POST['order'][1]; $tracking = $_POST['express'][1]; if (empty($ebay_id) && empty($tracking)) { $data = array("data" => array('发货单和跟踪号不能是空!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); } $where = "where id={$ebay_id}"; $order = orderPartionModel::selectOrder($where); if (!$order) { $data = array("data" => array('发货单不存在!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } if ($order[0]['orderStatus'] != PKS_PRINT_SHIPPING_INVOICE) { $data = array("data" => array($ebay_id . '此发货单状态不是在待打印面单状态!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } $array = array('shipOrderId' => $ebay_id, 'is_delete' => 0); //根据发货单号获取快递需要的箱子和跟踪号数量 $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id); $count_binding = WhOrderTracknumberModel::count($array); //发货单已经绑定跟踪号的数量 if (empty($result_tracking_count)) { if ($count_binding > 0) { $data = array("data" => array($ebay_id . "该发货单已经绑定好跟踪号了!"), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } } else { $result_tracking_count = $result_tracking_count['trackingCount']; //发货单需要绑定跟踪号的数量 if ($result_tracking_count <= $count_binding) { $data = array("data" => array($ebay_id . "该发货单已经绑定好跟踪号了!"), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } } //查询扫描的跟踪号是否已经扫描过了的 $result_select = WhOrderTracknumberModel::select_ByTracknumber($tracking); if ($result_select) { $data = array("data" => array('该跟踪号已经绑定' . $result_select['shipOrderId'] . ',请检查!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } $data_insert = array('tracknumber' => $tracking, 'shipOrderId' => $ebay_id, 'createdTime' => time()); $array_count = array('shipOrderId' => $ebay_id, 'is_delete' => 0); //根据发货单号获取快递需要的箱子和跟踪号数量 $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id); //说明该快递单只有一个箱子和一个跟踪号,所以不需要在wh_wave_tracking_box "快递单号的箱子与跟踪号数量表"添加记录 if (empty($result_tracking_count)) { $count_binding = WhOrderTracknumberModel::count($array_count); //发货单已经绑定跟踪号的数量 if ($count_binding > 0) { $data = array("data" => array('该发货单号已经绑定好跟踪号了,不在需要和这个跟踪号绑定!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } WhBaseModel::begin(); $result_insert = WhOrderTracknumberModel::insert($data_insert); if (!$result_insert) { WhBaseModel::rollback(); $data = array("data" => array('跟踪号绑定失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } //更新发货表状态 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING); if (!$ostatus) { WhBaseModel::rollback(); $data = array("data" => array('更新发货单状态失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } WhPushModel::pushOrderStatus($ebay_id, 'PKS_WAITING_LOADING', $_SESSION['userId'], time()); //状态推送,需要改为待装车扫描(订单系统提供状态常量) WhBaseModel::commit(); $data = array("data" => array('绑定成功,请扫描另外一个发货单!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goOkMsgPage($data); } else { $result_tracking_count = $result_tracking_count['trackingCount']; //发货单需要绑定跟踪号的数量 $count_binding = WhOrderTracknumberModel::count($array_count); //发货单已经绑定跟踪号的数量 if ($result_tracking_count > $count_binding) { WhBaseModel::begin(); $result_insert = WhOrderTracknumberModel::insert($data_insert); if (!$result_insert) { WhBaseModel::rollback(); $data = array("data" => array('跟踪号绑定失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } $num = $result_tracking_count - $count_binding - 1; if ($num == 0) { //更新发货表状态 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING); if (!$ostatus) { WhBaseModel::rollback(); $data = array("data" => array('更新发货单状态失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } WhPushModel::pushOrderStatus($ebay_id, ' ', $_SESSION['userId'], time()); //状态推送,需要改为待装车扫描(订单系统提供状态常量) WhBaseModel::commit(); $data = array("data" => array('绑定成功,该发货单不需要绑定跟踪号了!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); } else { WhBaseModel::commit(); $data = array("data" => array('绑定成功,该发货单还需要绑定' . $num . '个跟踪号!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goOkMsgPage($data); } } else { $data = array("data" => array('绑定失败,绑定的跟踪号已经够' . $result_tracking_count . '个,请扫描另外一个发货单!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } } $navlist = array(array('url' => '', 'title' => '出库'), array('url' => 'index.php?mod=expressRecheck&act=ExpressList', 'title' => '快递待复核'), array('url' => '', 'title' => '快递待复核数据导入 ')); $this->smarty->assign('navlist', $navlist); $toptitle = '待复核'; // 顶部链接 $this->smarty->assign('toptitle', $toptitle); $toplevel = 2; // 顶层菜单 $this->smarty->assign('toplevel', $toplevel); $secondlevel = '28'; // 当前的二级菜单 $this->smarty->assign('secondlevel', $secondlevel); $this->smarty->assign('secnev', 3); // 二级导航 $this->smarty->assign('list', TrackInfoRecordModel::$data); $this->smarty->display('tracknumimport.htm'); }