public function view_index() { // echo 1111; $orderids = trim($_GET['ebay_id']); $id_all = explode(',', $orderids); $array = array(); foreach ($id_all as $id) { $result = WhWaveTrackingBoxModel::select_by_shipOrderId($id); $array[$id] = $result; } // print_r($array); $toptitle = '快递箱号打印'; //顶部链接 $this->smarty->assign('box_arr', $array); $this->smarty->display('expressBox.htm'); }
/** * 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; } } }
/** * pda_ExpressWeighingAct::act_trackingCount() * @author cxy *快递箱子和跟踪号数量添加到数据库 * @return */ public function act_trackingCount() { $userId = $_SESSION['userId']; $ebay_id = trim($_POST['ebay_id']); $count_box = trim(intval($_POST['count_box'])); $tracking_count = trim(intval($_POST['tracking'])); $weighing = trim($_POST['weighing']); $weighing = $weighing * 1000; if (empty($userId)) { self::$errCode = '0'; self::$errMsg = '系统登录超时,请先关闭浏览器 然后登录扫描!!'; return false; } if (empty($ebay_id)) { self::$errCode = 0; self::$errMsg = '请填写单号!'; return; } if ($count_box <= 1) { self::$errCode = 0; self::$errMsg = '请输入正确的箱子数量,最小是2!'; return false; } if ($tracking_count < 1) { self::$errCode = 0; self::$errMsg = '请输入正确的跟踪号数量,最小是1!'; return false; } if ($weighing <= 0) { self::$errCode = 0; self::$errMsg = '请输入正确的重量!'; return; } $where = "where id={$ebay_id}"; $order = orderPartionModel::selectOrder($where); if ($order[0]['transportId'] == 48) { //顺丰快递的跟踪号值能是一个 $tracking_count = 1; } else { if ($tracking_count != $count_box) { self::$errCode = 0; self::$errMsg = '跟踪号数量与箱子数量不相等!'; return; } } //逻辑删除以前称重的记录 $update = WhWaveTrackingBoxModel::update(array('is_delete' => 1), array('shipOrderId' => $ebay_id)); $data = array('boxCount' => $count_box, 'trackingCount' => $tracking_count, 'shipOrderId' => $ebay_id, 'weighTime' => time()); $result = WhWaveTrackingBoxModel::insert($data); if ($result) { WhBaseModel::begin(); $status = PKS_PRINT_SHIPPING_INVOICE; $result = WhShippingOrderModel::update_shipping_order_by_id("id = '{$ebay_id}' and is_delete = 0", "orderStatus = '{$status}',orderWeight = '{$weighing}'"); if (!$result) { WhBaseModel::rollback(); self::$errCode = 0; self::$errMsg = '称重添加失败,请联系负责人'; return false; } $msg = orderWeighingModel::insertRecord($ebay_id, $userId); if (!$msg) { self::$errCode = 511; self::$errMsg = "插入称重记录失败!"; WhBaseModel::rollback(); return false; } $msg_update = orderWeighingModel::updateRecord($ebay_id, $weighing, $userId); if (!$msg_update) { self::$errCode = 512; self::$errMsg = "更新操作记录表失败!"; WhBaseModel::rollback(); return false; } WhPushModel::pushOrderStatus($ebay_id, 'PKS_PRINT_SHIPPING_INVOICE', $_SESSION['userId'], time()); //状态推送,需要改为待打印面单(订单系统提供状态常量) WhBaseModel::commit(); self::$errCode = 200; self::$errMsg = '操作成功,请称重下一个发货单号'; return true; } else { self::$errCode = 211; self::$errMsg = '操作失败,请联系IT部门'; return false; } }
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'); }