public function view_applyTheLineEUBTrackNumber() { global $memc_obj; $OmEUBTrackNumberAct = new OmEUBTrackNumberAct(); if (isset($_GET) && !empty($_GET)) { $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : ''; $ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : ''; $otype = isset($_GET['otype']) ? $_GET['otype'] : ''; } $showerrorinfo = ''; //print_r($_POST); if (isset($_FILES) && !empty($_FILES)) { $info = $OmEUBTrackNumberAct->act_applyTheLineEUBTrackNumber(); if ($info) { $showerrorinfo = "<font color=\"green\">上传成功!<br></font><font color=\"red\">" . $OmEUBTrackNumberAct::$errMsg . "</font>"; } else { $showerrorinfo = "<font color=\"red\">上传成功!<br>" . $OmEUBTrackNumberAct::$errMsg . "</font>"; } } $this->smarty->assign('showerrorinfo', $showerrorinfo); $omAvailableAct = new OmAvailableAct(); //平台信息 $platform = $omAvailableAct->act_getTNameList('om_platform', 'id,platform', 'WHERE is_delete=0'); //var_dump($platform); $platformList = array(); foreach ($platform as $v) { $platformList[$v['id']] = $v['platform']; } $this->smarty->assign('platformList', $platformList); /**导航 start**/ $this->smarty->assign('ostatus', $ostatus); $this->smarty->assign('otype', $otype); //二级目录 $StatusMenuAct = new StatusMenuAct(); $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0'); //var_dump($ostatusList); $this->smarty->assign('ostatusList', $ostatusList); $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $ostatus . '" AND is_delete=0'); //var_dump($otypeList); $this->smarty->assign('otypeList', $otypeList); /*$o_secondlevel = $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc'); $this->smarty->assign('o_secondlevel', $o_secondlevel);*/ $second_count = array(); $second_type = array(); foreach ($ostatusList as $o_secondinfo) { $orderStatus = $o_secondinfo['statusCode']; $accountacc = $_SESSION['accountacc']; $oc_where = " where orderStatus='{$orderStatus}' and storeId=1 and is_delete=0 "; if ($accountacc) { $oc_where .= ' AND (' . $accountacc . ') '; } $s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $oc_where); $second_count[$o_secondinfo['statusCode']] = $s_total; $s_type = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$orderStatus}' order by sort asc"); $second_type[$o_secondinfo['statusCode']] = $s_type[0]['statusCode']; } //var_dump($second_count); $this->smarty->assign('second_count', $second_count); $this->smarty->assign('second_type', $second_type); //退款数量 $refund_total = $omAvailableAct->act_getTNameCount("om_order_refund", " where is_delete=0"); $this->smarty->assign('refund_total', $refund_total); //三级目录 $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$ostatus}' order by sort asc"); $this->smarty->assign('o_threelevel', $o_threelevel); $three_count = array(); foreach ($o_threelevel as $o_threeinfo) { $orderType = $o_threeinfo['statusCode']; $s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", " where orderStatus='{$ostatus}' and orderType='{$orderType}' and storeId=1 and is_delete=0"); $three_count[$o_threeinfo['statusCode']] = $s_total; } $this->smarty->assign('three_count', $three_count); $toptitle = '订单显示页面'; //头部title $this->smarty->assign('toptitle', $toptitle); $this->smarty->assign('toplevel', 0); $threelevel = '1'; //当前的三级菜单 $this->smarty->assign('threelevel', $threelevel); $statusMenu = $omAvailableAct->act_getTNameList('om_status_menu', ' * ', 'WHERE is_delete=0 '); $this->smarty->assign('statusMenu', $statusMenu); //var_dump($data); exit; $this->smarty->display('eubTheLineApply.htm'); }
function act_applyTheLineEUBTrackNumber() { global $memc_obj; //调用memcache获取sku信息 //var_dump($SYSTEM_ACCOUNTS); require_once WEB_PATH . "lib/PHPExcel.php"; //PHPExcel //exit; $addUser = $_SESSION['sysUserId']; $filePath = WEB_PATH . "html/upload/eub/"; //var_dump($_FILES); exit; if (!empty($_FILES['theline_upfile']['tmp_name'])) { $uploadfile = date("Y") . date("m") . date("d") . rand(1, 3009) . ".xls"; $filePath .= $uploadfile; //echo $filePath; if (!move_uploaded_file($_FILES['theline_upfile']['tmp_name'], $filePath)) { self::$errCode = '003'; self::$errMsg = "文件上传失败!"; echo self::$errMsg; return false; } } else { self::$errCode = '003'; self::$errMsg = "文件上传不成功!"; echo self::$errMsg; return false; } //var_dump($addUser); $PHPExcel = new PHPExcel(); //var_dump($PHPExcel); exit; $PHPReader = new PHPExcel_Reader_Excel2007(); //var_dump($PHPReader); exit; //exit; //var_dump($PHPReader->canRead($filePath)); exit; if (!$PHPReader->canRead($filePath)) { $PHPReader = new PHPExcel_Reader_Excel5(); //var_dump($PHPReader); exit; if (!$PHPReader->canRead($filePath)) { echo 'no Excel'; return; } } //exit; $PHPExcel = $PHPReader->load($filePath); $excellists = excel2array($PHPExcel, $filePath, 2, 0); //echo "<pre>";print_r($excellists); exit; $adjust_time = date('Y-m-d H:i:s'); $recordnumbers = array(); $tracknumbers = array(); foreach ($excellists as $key => $excellist) { $recordnumbers[] = array_shift($excellist); $tracknumbers[] = array_shift($excellist); } $total = count($recordnumbers); BaseModel::begin(); //开始事务 for ($ii = 1; $ii < $total; $ii++) { $recordnumber = $recordnumbers[$ii]; $tracknumber = $tracknumbers[$ii]; //盘点数量 $row = $ii; if (!preg_match('/^LN[0-9]{9}CN$/', $tracknumber)) { self::$errMsg .= " 第" . $row . "行" . $tracknumber . " 跟踪号格式有误<br>"; } if ($tracknumber == "") { self::$errMsg .= " 第" . $row . "行跟踪号为空请查证<br>"; } if (!OmEUBTrackNumberModel::applyTheLineEUBTrackNumber($recordnumber, $tracknumber)) { BaseModel::rollback(); } } self::$errCode .= OmEUBTrackNumberModel::$errCode; self::$errMsg .= OmEUBTrackNumberModel::$errMsg; BaseModel::commit(); BaseModel::autoCommit(); return true; }