Exemple #1
0
 public function view_addOrder()
 {
     $OmAccountAct = new OmAccountAct();
     $state = isset($_GET['state']) ? post_check($_GET['state']) : '';
     $this->smarty->assign('state', $state);
     //平台
     //$platform_lsit = OmAvailableModel::getTNameList("om_platform","*","where is_delete=0");
     $platform_lsit = $OmAccountAct->act_getPlatformListByPower();
     $tmpPlatformList = array();
     foreach ($platform_lsit as $value) {
         if (in_array($value['id'], array(3))) {
             $tmpPlatformList[] = $value;
         }
     }
     $platform_lsit = $tmpPlatformList;
     $this->smarty->assign('platform_lsit', $platform_lsit);
     //账号
     //$account_lsit = OmAvailableModel::getTNameList("om_account","*","where is_delete=0 and platformId=3");
     $account_lsit = $OmAccountAct->act_getAccountListByPlatform();
     $account_lsit = array();
     $this->smarty->assign('account_lsit', $account_lsit);
     //物流
     $Shiping = CommonModel::getCarrierList();
     $this->smarty->assign('Shiping', $Shiping);
     $toplevel = 2;
     //一级菜单的序号
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = 21;
     //当前的二级菜单
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->assign('toptitle', '订单添加');
     $this->smarty->assign('curusername', $_SESSION['userName']);
     $this->smarty->display('orderAdd.htm');
 }
Exemple #2
0
 public function view_index()
 {
     $toptitle = '报表导出页面';
     //头部title
     $this->smarty->assign('toptitle', $toptitle);
     $this->smarty->assign('toplevel', 5);
     $OmAccountAct = new OmAccountAct();
     $reportAct = new ExcelExportAct();
     $ebayAccountList = $OmAccountAct->act_getEbayAccountList();
     $b2bAccountList = $OmAccountAct->act_getB2BAccountList();
     $neweggAccountList = $OmAccountAct->act_getNeweggAccountList();
     $ebayAccountList = $OmAccountAct->act_ebayaccountAllList();
     $amazonAccountList = $OmAccountAct->act_amazonaccountAllList();
     $dresslinkAccountList = $OmAccountAct->act_dresslinkaccountAllList();
     $aliexpressAccountList = $OmAccountAct->act_getAccountListByPid(2);
     $innerAccountList = $OmAccountAct->act_getINNERAccountList();
     $aliexpressAccountList = json_decode($aliexpressAccountList, true);
     $transAPI = new TransAPIAct();
     $transType = $transAPI->act_getChannelistByApi();
     //var_dump($aliexpressAccountList);
     $allAccountList = $OmAccountAct->act_getAllAccountList();
     $priceInfoUrl = $reportAct->act_priceInfoReport();
     $this->smarty->assign("ebayAccountList", $ebayAccountList);
     $this->smarty->assign("b2bAccountList", $b2bAccountList);
     $this->smarty->assign("neweggAccountList", $neweggAccountList);
     $this->smarty->assign("innerAccountList", $innerAccountList);
     $this->smarty->assign("dresslinkAccountList", $dresslinkAccountList);
     $this->smarty->assign("aliexpressAccountList", $aliexpressAccountList);
     $this->smarty->assign("allAccountList", $allAccountList);
     $this->smarty->assign("amazonAccountList", $amazonAccountList);
     $this->smarty->assign("transType", $transType);
     $this->smarty->assign("priceInfoUrl", $priceInfoUrl);
     $startTime = date('Y-m-d ') . ' 00:00:00';
     $endTime = date('Y-m-d ') . ' 23:59:59';
     $chkTime = date('Y-m-d ');
     $this->smarty->assign("curStartTime", $startTime);
     $this->smarty->assign("curEndTime", $endTime);
     $this->smarty->assign("chkTime", $chkTime);
     //单个时间
     $this->smarty->display("exportXls.htm");
 }
Exemple #3
0
 public function view_abnormalStockList()
 {
     global $memc_obj;
     $pagesize = 200;
     //页面大小
     //var_dump($AbOrderList); exit;
     $omAvailableAct = new OmAvailableAct();
     $TransAPIAct = new TransAPIAct();
     $OrderindexAct = new OrderindexAct();
     $GoodsAct = new GoodsAct();
     $OrderRefundAct = new OrderRefundAct();
     //平台信息
     $OmAccountAct = new OmAccountAct();
     $WarehouseAPIAct = new WarehouseAPIAct();
     $AbOrderList = $WarehouseAPIAct->act_getAbOrderList();
     //var_dump($AbOrderList); exit;
     $AbOrderListArr = array();
     $AbOrderids = array();
     $AbOrderShow = array();
     foreach ($AbOrderList as $orderId) {
         $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($orderId['id']);
         $AbOrderListArr[$orderId['originOrderId']] = $AbOrderInfo;
         $AbOrderids[] = $orderId['originOrderId'];
         $AbOrderShow[$orderId['originOrderId']] = $orderId['id'];
     }
     //var_dump($AbOrderListArr); exit;
     $this->smarty->assign('AbOrderListArr', $AbOrderListArr);
     $this->smarty->assign('AbOrderShow', $AbOrderShow);
     //var_dump($AbOrderListArr); exit;
     $platform = $OmAccountAct->act_getPlatformListByPower();
     $this->smarty->assign('platform', $platform);
     $account = $OmAccountAct->act_accountAllListById();
     //账号信息
     /**导航 start**/
     $ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : 0;
     $this->smarty->assign('ostatus', 770);
     $StatusMenuAct = new StatusMenuAct();
     $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0');
     //var_dump($ostatusList);
     $this->smarty->assign('ostatusList', $ostatusList);
     //二级目录
     /*$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'];
         //echo $orderStatus."============"; echo "<br>";
         $s_total = $OrderindexAct->act_showSearchOrderNum($orderStatus);
         //echo $orderStatus."==".$s_total; echo "<br>";
         $second_count[$o_secondinfo['statusCode']] = $s_total;
         $s_type = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $orderStatus . '" AND is_delete=0 order by sort asc');
         $second_type[$orderStatus] = $s_type[0]['statusCode'];
     }
     $this->smarty->assign('second_count', $second_count);
     $this->smarty->assign('second_type', $second_type);
     //退款数量
     $where = " WHERE is_delete=0 ";
     $accountList = $_SESSION['accountList'];
     $platformList = $_SESSION['platformList'];
     //echo "<pre>"; print_r($accountList); exit;
     $platformsee = array();
     for ($i = 0; $i < count($platformList); $i++) {
         $platformsee[] = $platformList[$i];
     }
     if ($platformsee) {
         $where .= ' AND platformId IN (' . join(",", $platformsee) . ') ';
     } else {
         //$where .= " AND 1=2 ";
     }
     $accountsee = array();
     for ($i = 0; $i < count($accountList); $i++) {
         $accountsee[] = $accountList[$i];
     }
     if ($accountsee) {
         $where .= ' AND accountId IN (' . join(",", $accountsee) . ') ';
     } else {
         //$where .= " AND 1=2 ";
     }
     //if($where){
     //$refund_total = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 ");
     $refund_total = $OrderRefundAct->act_getRecordNums();
     //}else{
     //$refund_total = 0;
     //}
     $this->smarty->assign('refund_total', $refund_total);
     //三级目录
     /*$refund_one = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=0");
     		$this->smarty->assign('refund_one', $refund_one);
     		$refund_two = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=1");
     		$this->smarty->assign('refund_two', $refund_two);
     		$refund_three = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=2");
     		$this->smarty->assign('refund_three', $refund_three);*/
     /**导航 end**/
     $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);
     /* $where =	' WHERE is_delete = 0 '.$where;
        $total = $omAvailableAct->act_getTNameCount('om_order_refund', $where);*/
     $parameterArr = array();
     $parameterArr['AbOrderList'] = $AbOrderids;
     $total = $OrderindexAct->act_showABOrder($ostatus, $otype, '', $parameterArr);
     $this->smarty->assign('abnormal_total', $total);
     //echo $total; exit;
     $num = $pagesize;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     //$limit	=	$page->limit;
     //var_dump($parameterArr);
     $omOrderList = $OrderindexAct->act_showABOrder($ostatus, $otype, $page->limit, $parameterArr);
     $this->smarty->assign('omOrderList', $omOrderList);
     $pm = $GoodsAct->act_getMaterInfoByList();
     $transportationList = $TransAPIAct->act_getCarrierListById();
     $this->smarty->assign('transportationList', $transportationList);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     //获取系统所有状态
     //$statusList = copyOrderModel::selectStatusList();
     //var_dump($statusList); exit;
     //$this->smarty->assign('statusList', $statusList);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('account', $account);
     //$this->smarty->assign('sku', $sku);
     $this->smarty->assign('pm', $pm);
     $this->smarty->assign('omOrderList', $omOrderList);
     $this->smarty->display('orderindex.htm');
 }
Exemple #4
0
 public function view_showUserCompense()
 {
     $OmAccountAct = new OmAccountAct();
     $StatusMenuAct = new StatusMenuAct();
     $uid = $_GET['uid'];
     //var_dump($_POST); exit;
     $showinfo = '';
     if (isset($_POST['action']) && !empty($_POST['action'])) {
         if ($OmAccountAct->act_addUserCompense($_POST)) {
             $showinfo = "<font color='green'>添加权限成功!</font>";
         } else {
             $showinfo = "<font color='red'>添加权限失败!</font>";
         }
         $uid = $_POST['uid'];
     }
     if (empty($uid)) {
         header("location:index.php?mod=user&act=index");
         exit;
     }
     $this->smarty->assign('uid', $uid);
     $this->smarty->assign('showinfo', $showinfo);
     $UserCompenseList = $OmAccountAct->act_getUserCompenseList($uid);
     //echo "<pre>";
     //print_r($UserCompenseList); exit;
     //$visible_platform = array();
     //$visible_account  = array();
     //echo "<pre>";
     //var_dump($UserCompenseList);
     //$visible_platform = $UserCompenseList['visible_platform'];
     //$visible_account  = $UserCompenseList['visible_account'];
     $visible_movefolder = json_decode($UserCompenseList['visible_movefolder'], true);
     //$visible_showfolder = $UserCompenseList['visible_showfolder'];
     //$visible_editorder  = $UserCompenseList['visible_editorder'];
     $visible_platform_account = json_decode($UserCompenseList['visible_platform_account'], true);
     //var_dump($visible_platform_account); exit;
     /*if(empty($visible_movefolder)){
     			echo "=============";
     		}*/
     $key_visible_movefolder = array();
     if (is_array($visible_movefolder)) {
         $key_visible_movefolder = array_keys($visible_movefolder);
     }
     $StatusMenu = $StatusMenuAct->act_getStatusMenuListById('*', ' WHERE groupId != 0 ');
     //var_dump($StatusMenu);
     $statusGroupLists = $StatusMenuAct->act_getMenuGroupList();
     //echo "<pre>"; print_r($statusGroupLists); exit;
     //$all_platform = $UserCompenseList['all_platform'];
     //var_dump($all_platform);
     //$all_account = $UserCompenseList['all_account'];
     //$all_account = $UserCompenseList['all_account'];
     $arr_all_platform_account = $UserCompenseList['arr_all_platform_account'];
     $editorder_options = array(1 => '平台', '账号', '买家ID', '订单号', '下单时间', '付款时间', '产品总金额', '物流费用', '订单金额', 'Transaction ID', '币种', '估算重量', '买家选择发货物流', '跟踪号', 'Full name', 'Street1', 'Street2', 'City', 'State', 'Country	', 'Postcode', 'Tel1', 'Tel2', 'Tel3', '买家邮箱1', '买家邮箱2', '买家邮箱3', '订单备注');
     $this->smarty->assign('editorder_options', $editorder_options);
     //$this->smarty->assign('visible_platform', $visible_platform);
     //$this->smarty->assign('visible_account', $visible_account);
     $this->smarty->assign('visible_platform_account', $visible_platform_account);
     $this->smarty->assign('arr_all_platform_account', $arr_all_platform_account);
     $this->smarty->assign('key_visible_movefolder', $key_visible_movefolder);
     $this->smarty->assign('visible_showfolder', $visible_showfolder);
     $this->smarty->assign('visible_editorder', $visible_editorder);
     //$this->smarty->assign('all_platform', $all_platform);
     //$this->smarty->assign('all_account', $all_account);
     $this->smarty->assign('StatusMenu', $StatusMenu);
     $this->smarty->assign('statusGroupLists', $statusGroupLists);
     $this->smarty->assign('toptitle', '订单系统细颗粒度权限控制');
     $this->smarty->assign('toplevel', 3);
     $this->smarty->assign('secondlevel', '32');
     $this->smarty->display("showUserCompense.htm");
 }
 function act_getAllInStatusIds()
 {
     //global $memc_obj; //调用memcache获取sku信息
     //$statusId = isset($_POST['statusId']) ? $_POST['statusId'] : $statusId;
     $addUser = $_SESSION['sysUserId'];
     $OmAccountAct = new OmAccountAct();
     $UserCompenseList = $OmAccountAct->act_getUserCompenseList($addUser);
     //echo "<pre>";
     //var_dump($UserCompenseList);
     //$visible_platform = $UserCompenseList['visible_platform'];
     //$visible_account = $UserCompenseList['visible_account'];
     $visible_movefolder = json_decode($UserCompenseList['visible_movefolder'], true);
     if (!empty($visible_movefolder)) {
         return $visible_movefolder;
     } else {
         return array();
     }
 }
 public function view_guoneiSaleImport()
 {
     //var_dump($_POST);//exit;
     include_once WEB_PATH . "lib/PHPExcel.php";
     //phpexcel
     include_once WEB_PATH . "conf/scripts/script.ebay.config.php";
     //global $SYSTEM_ACCOUNTS,$__liquid_items_fenmocsku,$__liquid_items_BuiltinBattery,$__liquid_items_SuperSpecific,$__liquid_items_Paste;
     $toptitle = '速卖通线下订单导入';
     //头部title
     $this->smarty->assign('toptitle', $toptitle);
     $this->smarty->assign('toplevel', 2);
     $this->smarty->assign('secondlevel', 220);
     $OmAccountAct = new OmAccountAct();
     $aliexpressAccountList = $OmAccountAct->act_getINNERAccountList();
     $this->smarty->assign("aliexpressAccountList", $aliexpressAccountList);
     if (isset($_FILES['aliexpressFile']['tmp_name'])) {
         $filePath = $_FILES['aliexpressFile']['tmp_name'];
         $PHPExcel = new PHPExcel();
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($filePath)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($filePath)) {
                 echo 'no Excel';
                 return;
             }
         }
         $PHPExcel = $PHPReader->load($filePath);
         $currentSheet = $PHPExcel->getSheet(0);
         //$excellists    = excel2array($PHPExcel, $filePath, 0, 0);
         //print_r($excellists);print_r($_SESSION);
         $orderid = array();
         $orderData = array();
         //$orderarr = OrderindexModel::showSearchOrderList("om_unshipped_order","where da.id=14448");
         //echo "<pre>";print_r($orderarr);
         $account = $_POST['aliexpressAccount'];
         $transportation = CommonModel::getCarrierList();
         //所有的
         $c = 2;
         while (true) {
             $aa = 'A' . $c;
             $bb = 'B' . $c;
             $cc = 'C' . $c;
             $dd = 'D' . $c;
             $ee = 'E' . $c;
             $ff = 'F' . $c;
             $gg = 'G' . $c;
             $hh = 'H' . $c;
             $ii = 'I' . $c;
             $jj = 'J' . $c;
             $kk = 'K' . $c;
             $ll = 'L' . $c;
             $mm = 'M' . $c;
             $nn = 'N' . $c;
             $oo = 'O' . $c;
             $pp = 'P' . $c;
             $qq = 'Q' . $c;
             $rr = 'R' . $c;
             $ss = 'S' . $c;
             $tt = 'T' . $c;
             $uu = 'U' . $c;
             $vv = 'V' . $c;
             $ww = 'W' . $c;
             $xx = 'X' . $c;
             $yy = 'Y' . $c;
             $zz = 'Z' . $c;
             $c++;
             $recordNumber = trim($currentSheet->getCell($aa)->getValue());
             $userId = trim($currentSheet->getCell($bb)->getValue());
             $skuStr = trim($currentSheet->getCell($cc)->getValue());
             $amount = trim($currentSheet->getCell($dd)->getValue());
             $countryName = trim($currentSheet->getCell($ee)->getValue());
             $actualTotal = trim($currentSheet->getCell($ff)->getValue());
             $currency = trim($currentSheet->getCell($gg)->getValue());
             $street1 = trim($currentSheet->getCell($hh)->getValue());
             $street2 = trim($currentSheet->getCell($ii)->getValue());
             $carrierNameCn = trim($currentSheet->getCell($jj)->getValue());
             $city = trim($currentSheet->getCell($kk)->getValue());
             $state = trim($currentSheet->getCell($ll)->getValue());
             $zipCode = trim($currentSheet->getCell($mm)->getValue());
             $phone = trim($currentSheet->getCell($nn)->getValue());
             $trackNumber = trim($currentSheet->getCell($oo)->getValue());
             $noteStr = trim($currentSheet->getCell($pp)->getValue());
             $ordersTime = time();
             $paymentTime = time();
             $email = '';
             $onlineTotal = '';
             $shippingFee = '';
             $transId = '';
             $note = '';
             $username = $userId;
             $platformUsername = $userId;
             $PayPalPaymentId = $transId;
             if (empty($recordNumber)) {
                 break;
             }
             $skuArrlist = explode(',', $skuStr);
             $noteArr = explode(',', $noteStr);
             $skuCount = count($skuArrlist);
             for ($i = 0; $i < $skuCount; $i++) {
                 list($sku, $amount) = explode('*', $skuArrlist[$i]);
                 //echo "--sku=$sku---amount=$amount-------";
                 //detail信息
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['sku'] = $sku;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['amount'] = $amount;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['recordNumber'] = $recordNumber;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['createdTime'] = time();
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['itemTitle'] = $noteArr[$i];
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['transId'] = $transId;
                 if (!empty($note)) {
                     $orderData[$recordNumber]['orderNote'][$c]['content'] = $note;
                     $orderData[$recordNumber]['orderNote'][$c]['userId'] = $_SESSION['sysUserId'];
                 }
             }
             //order信息
             $orderData[$recordNumber]['orderData']['recordNumber'] = $recordNumber;
             $orderData[$recordNumber]['orderData']['ordersTime'] = $ordersTime;
             $orderData[$recordNumber]['orderData']['paymentTime'] = $paymentTime;
             $orderData[$recordNumber]['orderData']['onlineTotal'] = $onlineTotal;
             $orderData[$recordNumber]['orderData']['actualTotal'] = $actualTotal;
             $orderData[$recordNumber]['orderData']['actualShipping'] = $shippingFee;
             $orderData[$recordNumber]['orderData']['calcShipping'] = $shippingFee;
             $orderData[$recordNumber]['orderData']['orderAddTime'] = time();
             $orderData[$recordNumber]['orderData']['orderStatus'] = 100;
             $orderData[$recordNumber]['orderData']['orderType'] = 101;
             $SYS_ACCOUNTS = OmAvailableModel::getTNameList("om_account", "*", " where account='{$account}'");
             $orderData[$recordNumber]['orderData']['accountId'] = $SYS_ACCOUNTS[0]['id'];
             $orderData[$recordNumber]['orderData']['platformId'] = $SYS_ACCOUNTS[0]['platformId'];
             $plataccountId = $SYS_ACCOUNTS[0]['id'];
             $platformId = $SYS_ACCOUNTS[0]['platformId'];
             $SYS_ACCOUNTS = OmAvailableModel::getPlatformAccount();
             foreach ($SYS_ACCOUNTS as $platform => $accounts) {
                 foreach ($accounts as $accountId => $accountname) {
                     if ($account == $accountname) {
                         if ($platform == "ebay") {
                             $orderData[$recordNumber]['orderData']['isFixed'] = 2;
                         } else {
                             $orderData[$recordNumber]['orderData']['isFixed'] = 1;
                         }
                     }
                 }
             }
             foreach ($transportation as $tranValue) {
                 if ($tranValue['carrierNameCn'] == $carrierNameCn) {
                     $orderData[$recordNumber]['orderData']['transportId'] = $tranValue['id'];
                     break;
                 }
             }
             if ($trackNumber != '') {
                 $orderData[$recordNumber]['orderTrack']['tracknumber'] = $trackNumber;
                 $orderData[$recordNumber]['orderTrack']['addUser'] = $_SESSION['sysUserId'];
                 $orderData[$recordNumber]['orderTrack']['createdTime'] = time();
             }
             //order扩展信息
             $orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
             $orderData[$recordNumber]['orderExtenData']['paymentStatus'] = "PAY_SUCCESS";
             $orderData[$recordNumber]['orderExtenData']['transId'] = $recordNumber;
             // 交易id;;
             $orderData[$recordNumber]['orderExtenData']['PayPalPaymentId'] = $PayPalPaymentId;
             $orderData[$recordNumber]['orderExtenData']['platformUsername'] = $platformUsername;
             $orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
             //user信息
             $orderData[$recordNumber]['orderUserInfoData']['platformUsername'] = $platformUsername;
             $orderData[$recordNumber]['orderUserInfoData']['username'] = $username;
             $orderData[$recordNumber]['orderUserInfoData']['email'] = $email;
             $orderData[$recordNumber]['orderUserInfoData']['street'] = $street1;
             $orderData[$recordNumber]['orderUserInfoData']['address2'] = ${$street2};
             $orderData[$recordNumber]['orderUserInfoData']['currency'] = $currency;
             //$orderData[$recordNumber]['orderUserInfoData']['address3'] = $address3;
             $orderData[$recordNumber]['orderUserInfoData']['city'] = $city;
             $orderData[$recordNumber]['orderUserInfoData']['state'] = $state;
             $orderData[$recordNumber]['orderUserInfoData']['zipCode'] = $zipCode;
             $orderData[$recordNumber]['orderUserInfoData']['countryName'] = $countryName;
             $orderData[$recordNumber]['orderUserInfoData']['landline'] = $phone;
             $orderData[$recordNumber]['orderUserInfoData']['phone'] = $phone;
             //note信息
             if (!empty($note)) {
                 $orderData[$recordNumber]['orderNote'][$c]['content'] = $note;
                 $orderData[$recordNumber]['orderNote'][$c]['userId'] = $_SESSION['sysUserId'];
             }
         }
         //print_r($orderData);
         //echo "<pre>";print_r($orderData);//exit;
         $message = "";
         foreach ($orderData as $id => $order) {
             //echo $id;
             //$msg = commonModel::checkOrder($id);
             $msg = commonModel::checkRecordNumber($id, $platformId, $plataccountId);
             if ($msg) {
                 $message .= "<font color='red'>订单{$id}已存在!</font><br>";
                 continue;
             }
             //计算订单属性
             if (count($order['orderDetail']) == 1) {
                 $detail = current($order['orderDetail']);
                 if ($detail['orderDetailData']['amount'] == 1) {
                     $orderData[id]['orderData']['orderAttribute'] = 1;
                 } else {
                     $orderData[id]['orderData']['orderAttribute'] = 2;
                 }
             } else {
                 $orderData[id]['orderData']['orderAttribute'] = 3;
             }
             //计算订单重量及包材
             $obj_order_detail_data = array();
             foreach ($order['orderDetail'] as $sku => $detail) {
                 $obj_order_detail_data[] = $detail['orderDetailData'];
             }
             $weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
             $orderData[$id]['orderData']['calcWeight'] = $weightfee[0];
             //$orderData[$value[0]]['orderData']['calcShipping'] = $weightfee[3];
             $orderData[$id]['orderData']['pmId'] = $weightfee[1];
             //计算运费
             $calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, $orderData[$id]['orderData']['isFixed']);
             //计算运费
             $orderData[$id]['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
             //$orderData[$id]['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
             //缺货拦截
             $orderData[$id] = AutoModel::auto_contrast_intercept($orderData[$id]);
             /*$orderData[$id]['orderData']['orderStatus'] = $status['orderStatus'];
             		$orderData[$id]['orderData']['orderType'] = $status['orderType'];*/
             //echo "<pre>";print_r($orderData[$id]);
             //print_r($orderData);
             //exit;
             //插入订单
             $info = OrderAddModel::insertAllOrderRowNoEvent($orderData[$id]);
             if ($info) {
                 $message .= "<font color='green'>订单{$id}上传成功!</font><br>";
             } else {
                 $message .= "<font color='red'>订单{$id}上传失败!</font><br>";
             }
         }
         $this->smarty->assign("showerrorinfo", $message);
         //header("location:index.php?mod=underLineOrderImport&act=importOrder");
     }
     $this->smarty->display('guoneiSaleImport.htm');
 }
Exemple #7
0
 public function act_showOrder($ostatus, $otype, $limit = '', $parameterArr = '', $storeId = 1)
 {
     $where = ' WHERE da.is_delete = 0 AND da.storeId = ' . $storeId;
     $UserCompetenceAct = new UserCompetenceAct();
     $accountList = $UserCompetenceAct->act_showGlobalUser();
     if (!$accountList) {
         if ($limit != '') {
             return array();
         } else {
             return 0;
         }
     }
     $StatusMenuAct = new StatusMenuAct();
     $tableName = $StatusMenuAct->act_getOrderNameByStatus($ostatus, $otype);
     //$tableName = "om_unshipped_order";
     $searchKeywordsType = isset($parameterArr['searchKeywordsType']) ? $parameterArr['searchKeywordsType'] : '';
     $searchKeywords = isset($parameterArr['searchKeywords']) ? $parameterArr['searchKeywords'] : '';
     $AbOrderList = isset($parameterArr['AbOrderList']) ? $parameterArr['AbOrderList'] : '';
     if (!$AbOrderList) {
         if ($ostatus != '') {
             $where .= ' AND da.orderStatus = ' . $ostatus;
         }
         if ($otype != '') {
             $where .= ' AND da.orderType	= ' . $otype;
         }
     }
     if (is_array($AbOrderList)) {
         $where .= ' AND da.id in ("' . join('","', $AbOrderList) . '") AND orderStatus != ' . C('STATEOUTOFSTOCK') . ' AND orderType != ' . C('STATEOUTOFSTOCK_ABNORMAL');
     } else {
         if ($AbOrderList != '') {
             $where .= ' AND da.id="' . $AbOrderList . '" AND orderStatus != ' . C('STATEOUTOFSTOCK') . ' AND orderType != ' . C('STATEOUTOFSTOCK_ABNORMAL');
         }
     }
     if (!empty($parameterArr) && $searchKeywordsType != '') {
         $searchPlatformId = $parameterArr['searchPlatformId'];
         /*if($searchKeywordsType == 4 && empty($searchPlatformId)){
         			self::$errCode = '0001';
         			self::$errMsg  = '扩展信息请先选择平台!';
         			if($limit != ''){
         				return array();		
         			}else{
         				return 0;	
         			}
         		}*/
         $OmAccountAct = new OmAccountAct();
         $platfrom = $OmAccountAct->act_getPlatformSuffixById($searchPlatformId);
         $extension = $platfrom['suffix'];
         //获取后缀名称
         $searchTable = '';
         if ($searchKeywords) {
             switch ($searchKeywordsType) {
                 case 1:
                     $_where = ' AND platformUsername="******"';
                     $searchTable = $tableName . '_userInfo';
                     break;
                 case 2:
                     $_where = ' AND email="' . $searchKeywords . '"';
                     $searchTable = $tableName . '_userInfo';
                     break;
                 case 3:
                     $where .= ' AND da.recordNumber="' . $searchKeywords . '"';
                     break;
                 case 4:
                     $_where = ' AND PayPalPaymentId="' . $searchKeywords . '"';
                     $searchTable = $tableName . '_extension_' . $extension;
                     break;
                 case 5:
                     $_where = ' AND tracknumber="' . $searchKeywords . '"';
                     $searchTable = 'om_order_tracknumber';
                     break;
                 case 6:
                     $where .= ' AND da.id="' . $searchKeywords . '"';
                     break;
             }
         }
         if ($searchTable != '') {
             //echo $searchTable; echo "<br>";
             //echo $_where; echo "<br>";
             $searchTableList = OmAvailableModel::getTNameList($searchTable, ' * ', ' WHERE 1 ' . $_where);
             //var_dump($searchTableList);
             //$where	=	'';
             if (empty($searchTableList)) {
                 self::$errCode = '0002';
                 self::$errMsg = '无法获取扩展信息!';
                 if ($limit != '') {
                     return array();
                 } else {
                     return 0;
                 }
             }
             //var_dump("--------------");
             $arrayId = '';
             foreach ($searchTableList as $key => $tableValue) {
                 if ($arrayId == '') {
                     $arrayId .= '(' . $tableValue['omOrderId'];
                 } else {
                     $arrayId .= ',' . $tableValue['omOrderId'];
                 }
             }
             $arrayId .= ')';
             $where .= ' AND da.id in ' . $arrayId;
         }
         //order表
         if ($searchPlatformId != '') {
             $where .= ' AND da.platformId = "' . $searchPlatformId . '" ';
             if ($parameterArr['searchAccountId'] != '') {
                 $where .= ' AND da.accountId = "' . $parameterArr['searchAccountId'] . '" ';
             }
         }
         if ($parameterArr['searchIsNote'] != '') {
             switch ($parameterArr['searchIsNote']) {
                 case 1:
                     $where .= ' AND da.isNote = "1" ';
                     break;
                 case 2:
                     $where .= ' AND da.isNote = "0" ';
                     break;
                 default:
                     break;
             }
         }
         if ($parameterArr['searchTransportation'] != '') {
             $where .= ' AND da.transportId = ' . $parameterArr['searchTransportation'];
         } else {
             if ($parameterArr['searchTransportationType'] != '') {
                 if ($parameterArr['searchTransportationType'] == 1) {
                     //快递
                     $kdCarrierIDList = CommonModel::getCarrierExp();
                     //echo "<pre>"; print_r($kdCarrierIDList); echo "<br>";
                     $where .= ' AND da.transportId in (' . join(',', $kdCarrierIDList) . ')';
                 } else {
                     if ($parameterArr['searchTransportationType'] == 2) {
                         //平邮
                         $xbCarrierIDList = CommonModel::getCarrierNoExp();
                         $where .= ' AND da.transportId in (' . join(',', $xbCarrierIDList) . ')';
                     }
                 }
             }
         }
         //echo $where; echo "<br>";
         if ($parameterArr['searchIsBuji'] != '') {
             switch ($parameterArr['searchIsBuji']) {
                 case 1:
                     $where .= ' AND da.isBuji = 2 ';
                     break;
                 case 2:
                     $where .= ' AND da.isBuji != 2 ';
                     break;
                 default:
                     break;
             }
         }
         /*if($parameterArr['searchIsTracknumber'] != ''){
         			switch($parameterArr['searchIsTracknumber']){
         				case 1:
         					$where	.=	' AND da.isBuji = 2 ';
         					break;
         				case 2:
         					$where	.=	' AND da.isBuji != 2 ';
         					break;
         				default:
         					break;
         			}
         		}*/
         if ($parameterArr['searchIsLock'] != '') {
             switch ($parameterArr['searchIsLock']) {
                 case 2:
                     $where .= ' AND da.isLock = 0 ';
                     break;
                 case 1:
                     $where .= ' AND da.isLock = 1 ';
                     break;
                 default:
                     break;
             }
         }
         $id_arr = array();
         if ($parameterArr['searchTimeType'] == 1) {
             if ($parameterArr['searchOrderTime1'] != '' && $parameterArr['searchOrderTime2'] != '') {
                 $where .= ' AND da.paymentTime >= "' . strtotime($parameterArr['searchOrderTime1']) . '" AND da.paymentTime <= "' . strtotime($parameterArr['searchOrderTime2']) . '" ';
             }
         } elseif ($parameterArr['searchTimeType'] == 2) {
             if ($parameterArr['searchOrderTime1'] != '' && $parameterArr['searchOrderTime2'] != '') {
                 $warehouse_where = "where weighTime between " . strtotime($parameterArr['searchOrderTime1']) . " AND " . strtotime($parameterArr['searchOrderTime2']);
                 $warehouse = OmAvailableModel::getTNameList($tableName . "_warehouse", "omOrderId", $warehouse_where);
                 if ($warehouse) {
                     foreach ($warehouse as $key => $value) {
                         $id_arr[] = $value['omOrderId'];
                     }
                     //$where .= ' AND da.id in('.$id_str.') ';
                 }
             }
         } elseif ($parameterArr['searchTimeType'] == 3) {
             //add by zqt ,同步时间搜索
             if ($parameterArr['searchOrderTime1'] != '' && $parameterArr['searchOrderTime2'] != '') {
                 $where .= ' AND da.orderAddTime >= "' . strtotime($parameterArr['searchOrderTime1']) . '" AND da.orderAddTime <= "' . strtotime($parameterArr['searchOrderTime2']) . '" ';
             }
         }
         /*if($otype	!=	''){
         			$where	.=	' AND da.orderType	=	'.$otype;
         		}*/
         //order_detail表
         if ($parameterArr['searchReviews'] != '') {
             switch ($parameterArr['searchReviews']) {
                 case 1:
                     $where .= ' AND db.reviews is NULL ';
                     break;
                 case 2:
                     $where .= ' AND db.reviews = "1" ';
                     break;
                 case 3:
                     $where .= ' AND db.reviews = "2" ';
                     break;
                 case 4:
                     $where .= ' AND db.reviews = "3" ';
                     break;
                 default:
                     break;
             }
         }
         //order_userInfo表
         $userInfo_where = "where 1=1";
         if ($parameterArr['countryName'] != '') {
             $userInfo_where .= ' AND countryName = "' . $parameterArr['countryName'] . '" ';
         }
         if ($parameterArr['state'] != '') {
             $userInfo_where .= ' AND state = "' . $parameterArr['state'] . '" ';
         }
         if ($parameterArr['city'] != '') {
             $userInfo_where .= ' AND city = "' . $parameterArr['city'] . '" ';
         }
         if ($parameterArr['zipCode'] != '') {
             $userInfo_where .= ' AND zipCode = "' . $parameterArr['zipCode'] . '" ';
         }
         if ($userInfo_where != "where 1=1") {
             $userInfo = OmAvailableModel::getTNameList($tableName . "_userInfo", "omOrderId", $userInfo_where);
         }
         if ($userInfo) {
             //$id_arr = array();
             foreach ($userInfo as $key => $value) {
                 $id_arr[] = $value['omOrderId'];
             }
         }
         if ($id_arr) {
             $where .= ' AND da.id in(' . implode(",", $id_arr) . ') ';
         }
         if ($parameterArr['searchSku'] != '') {
             $where .= ' AND db.sku = "' . $parameterArr['searchSku'] . '" ';
         }
         /*if($searchOmOrderId != ''){
         			$where	.=	' AND db.recordNumber = "'.$searchOmOrderId.'" ';
         		}*/
         if ($parameterArr['searchOrderType'] != '') {
             switch ($parameterArr['searchOrderType']) {
                 case 1:
                     $where .= ' AND da.orderAttribute =1 ';
                     break;
                 case 2:
                     $where .= ' AND da.orderAttribute =2 ';
                     break;
                 case 3:
                     $where .= ' AND da.orderAttribute =3 ';
                     break;
             }
         }
     }
     //echo $where;
     if ($limit != '') {
         $extenwhere = ' GROUP BY da.id ORDER BY da.paymentTime ' . $limit;
         //$extenwhere = ' ORDER BY da.paymentTime '.$limit;
         $data = OrderindexModel::showSearchOrderList($tableName, $where, $extenwhere);
         if (empty($data) && empty($ostatus) && empty($otype)) {
             $data = $this->act_showOrder(900, 21, $limit, $parameterArr, $storeId);
         }
     } else {
         //$extenwhere = ' GROUP BY da.id ORDER BY da.paymentTime ';
         $extenwhere = ' ORDER BY da.paymentTime ';
         $data = OrderindexModel::showSearchOrderNum($tableName, $where, $extenwhere);
         if (empty($data) && empty($ostatus) && empty($otype)) {
             $data = $this->act_showOrder(900, 21, $limit, $parameterArr, $storeId);
         }
     }
     //var_dump($data);
     self::$errCode = OrderindexModel::$errCode;
     self::$errMsg = OrderindexModel::$errMsg;
     return $data;
 }
Exemple #8
0
 public function view_aliexpressimport()
 {
     $this->smarty->assign('toplevel', 2);
     $this->smarty->assign('secondlevel', 24);
     $OmAccountAct = new OmAccountAct();
     //$aliexpressAccountList = $OmAccountAct->act_getAccountListByPid(2);
     $aliexpressAccountList = $OmAccountAct->act_getAccountListAliexpress();
     var_dump($aliexpressAccountList);
     $aliexpressAccountList = json_decode($aliexpressAccountList, true);
     $this->smarty->assign("aliexpressAccountList", $aliexpressAccountList);
     $this->smarty->display('aliexpressImport.htm');
     include_once WEB_PATH . "lib/PHPExcel.php";
     //phpexcel
     $toptitle = 'underLineOrderImport';
     //头部title
     $this->smarty->assign('toptitle', $toptitle);
     $this->smarty->assign('toplevel', 2);
     $this->smarty->assign('secondlevel', 22);
     if (isset($_FILES['orderUpfile']['tmp_name'])) {
         $filePath = $_FILES['orderUpfile']['tmp_name'];
         $PHPExcel = new PHPExcel();
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($filePath)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($filePath)) {
                 echo 'no Excel';
                 return;
             }
         }
         $PHPExcel = $PHPReader->load($filePath);
         $currentSheet = $PHPExcel->getSheet(0);
         //$excellists    = excel2array($PHPExcel, $filePath, 0, 0);
         //print_r($excellists);print_r($_SESSION);
         $orderid = array();
         $orderData = array();
         //$orderarr = OrderindexModel::showSearchOrderList("om_unshipped_order","where da.id=14448");
         //echo "<pre>";print_r($orderarr);
         $c = 2;
         while (true) {
             $aa = 'A' . $c;
             $bb = 'B' . $c;
             $cc = 'C' . $c;
             $dd = 'D' . $c;
             $ee = 'E' . $c;
             $ff = 'F' . $c;
             $gg = 'G' . $c;
             $hh = 'H' . $c;
             $ii = 'I' . $c;
             $jj = 'J' . $c;
             $kk = 'K' . $c;
             $ll = 'L' . $c;
             $mm = 'M' . $c;
             $nn = 'N' . $c;
             $oo = 'O' . $c;
             $pp = 'P' . $c;
             $qq = 'Q' . $c;
             $rr = 'R' . $c;
             $ss = 'S' . $c;
             $tt = 'T' . $c;
             $uu = 'U' . $c;
             $vv = 'V' . $c;
             $ww = 'W' . $c;
             $xx = 'X' . $c;
             $yy = 'Y' . $c;
             $zz = 'Z' . $c;
             $c++;
             $account = trim($currentSheet->getCell($aa)->getValue());
             $recordNumber = trim($currentSheet->getCell($bb)->getValue());
             $platformUsername = trim($currentSheet->getCell($cc)->getValue());
             $email = trim($currentSheet->getCell($dd)->getValue());
             $ordersTime = trim($currentSheet->getCell($ee)->getValue());
             $paymentTime = trim($currentSheet->getCell($ff)->getValue());
             $sku = trim($currentSheet->getCell($gg)->getValue());
             $amount = trim($currentSheet->getCell($hh)->getValue());
             $itemTitle = trim($currentSheet->getCell($ii)->getValue());
             $note = trim($currentSheet->getCell($jj)->getValue());
             $itemPrice = trim($currentSheet->getCell($kk)->getValue());
             $shippingFee = trim($currentSheet->getCell($ll)->getValue());
             $actualTotal = trim($currentSheet->getCell($mm)->getValue());
             $currency = trim($currentSheet->getCell($nn)->getValue());
             $transId = trim($currentSheet->getCell($oo)->getValue());
             $username = trim($currentSheet->getCell($pp)->getValue());
             $street = trim($currentSheet->getCell($qq)->getValue());
             $address2 = trim($currentSheet->getCell($rr)->getValue());
             $address3 = trim($currentSheet->getCell($ss)->getValue());
             $city = trim($currentSheet->getCell($tt)->getValue());
             $state = trim($currentSheet->getCell($uu)->getValue());
             $zipCode = trim($currentSheet->getCell($vv)->getValue());
             $countryName = trim($currentSheet->getCell($ww)->getValue());
             $landline = trim($currentSheet->getCell($xx)->getValue());
             $carrierNameCn = trim($currentSheet->getCell($yy)->getValue());
             if (empty($account)) {
                 break;
             }
             if (in_array($recordNumber, $orderid)) {
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['sku'] = $sku;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['amount'] = $amount;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['itemPrice'] = $itemPrice;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['shippingFee'] = $shippingFee;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['itemTitle'] = $itemTitle;
                 //$orderData['orderDetail']['orderDetailExtenData']['note'] = $value[10];
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['transId'] = $transId;
                 if (!empty($note)) {
                     $orderData[$recordNumber]['orderNote'][$c]['content'] = $note;
                     $orderData[$recordNumber]['orderNote'][$c]['userId'] = $_SESSION['sysUserId'];
                 }
             } else {
                 $orderid[] = $recordNumber;
                 //order信息
                 $orderData[$recordNumber]['orderData']['recordNumber'] = $recordNumber;
                 $orderData[$recordNumber]['orderData']['ordersTime'] = strtotime($ordersTime);
                 $orderData[$recordNumber]['orderData']['paymentTime'] = strtotime($paymentTime);
                 $orderData[$recordNumber]['orderData']['actualTotal'] = $actualTotal;
                 $orderData[$recordNumber]['orderData']['orderAddTime'] = time();
                 $SYSTEM_ACCOUNTS = OmAvailableModel::getTNameList("om_account", "*", " where account='{$account}'");
                 $orderData[$recordNumber]['orderData']['accountId'] = $SYSTEM_ACCOUNTS[0]['id'];
                 $orderData[$recordNumber]['orderData']['platformId'] = $SYSTEM_ACCOUNTS[0]['platformId'];
                 $SYSTEM_ACCOUNTS = OmAvailableModel::getPlatformAccount();
                 foreach ($SYSTEM_ACCOUNTS as $platform => $accounts) {
                     foreach ($accounts as $accountId => $accountname) {
                         if ($account == $accountname) {
                             if ($platform == "ebay") {
                                 $orderData[$recordNumber]['orderData']['isFixed'] = 2;
                             } else {
                                 $orderData[$recordNumber]['orderData']['isFixed'] = 1;
                             }
                         }
                     }
                 }
                 $transportation = CommonModel::getCarrierList();
                 //所有的
                 foreach ($transportation as $tranValue) {
                     if ($tranValue['carrierNameCn'] == $carrierNameCn) {
                         $orderData[$recordNumber]['orderData']['transportId'] = $tranValue['id'];
                         break;
                     }
                     //$transportationList[$tranValue['id']] = $tranValue['carrierNameCn'];
                 }
                 //order扩展信息
                 $orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
                 $orderData[$recordNumber]['orderExtenData']['paymentStatus'] = "PAY_SUCCESS";
                 $orderData[$recordNumber]['orderExtenData']['transId'] = $recordNumber;
                 // 交易id;;
                 $orderData[$recordNumber]['orderExtenData']['platformUsername'] = $platformUsername;
                 //$orderData[$recordNumber]['orderExtenData']['currency']				=	$currency;
                 //user信息
                 $orderData[$recordNumber]['orderUserInfoData']['platformUsername'] = $platformUsername;
                 $orderData[$recordNumber]['orderUserInfoData']['username'] = $username;
                 $orderData[$recordNumber]['orderUserInfoData']['email'] = $email;
                 $orderData[$recordNumber]['orderUserInfoData']['street'] = $street;
                 $orderData[$recordNumber]['orderUserInfoData']['currency'] = $currency;
                 $orderData[$recordNumber]['orderUserInfoData']['address2'] = $address2;
                 $orderData[$recordNumber]['orderUserInfoData']['address3'] = $address3;
                 $orderData[$recordNumber]['orderUserInfoData']['city'] = $city;
                 $orderData[$recordNumber]['orderUserInfoData']['state'] = $state;
                 $orderData[$recordNumber]['orderUserInfoData']['zipCode'] = $zipCode;
                 $orderData[$recordNumber]['orderUserInfoData']['countryName'] = $countryName;
                 $orderData[$recordNumber]['orderUserInfoData']['landline'] = $landline;
                 //detail信息
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['sku'] = $sku;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['amount'] = $amount;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['itemPrice'] = $itemPrice;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['shippingFee'] = $shippingFee;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['recordNumber'] = $recordNumber;
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['createdTime'] = time();
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['itemTitle'] = $itemTitle;
                 //$orderData['orderDetail']['orderDetailExtenData']['note'] = $value[10];
                 $orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['transId'] = $transId;
                 //note信息
                 if (!empty($note)) {
                     $orderData[$recordNumber]['orderNote'][$c]['content'] = $note;
                     $orderData[$recordNumber]['orderNote'][$c]['userId'] = $_SESSION['sysUserId'];
                 }
             }
         }
         //echo "<pre>";print_r($orderData);
         $message = "";
         foreach ($orderData as $id => $order) {
             $msg = commonModel::checkOrder($id);
             if ($msg) {
                 $message .= "<font color='red'>订单{$id}已存在!</font><br>";
                 continue;
             }
             //计算订单属性
             if (count($order['orderDetail']) == 1) {
                 $detail = current($order['orderDetail']);
                 if ($detail['orderDetailData']['amount'] == 1) {
                     $orderData[id]['orderData']['orderAttribute'] = 1;
                 } else {
                     $orderData[id]['orderData']['orderAttribute'] = 2;
                 }
             } else {
                 $orderData[id]['orderData']['orderAttribute'] = 3;
             }
             //计算订单重量及包材
             $obj_order_detail_data = array();
             foreach ($order['orderDetail'] as $sku => $detail) {
                 $obj_order_detail_data[] = $detail['orderDetailData'];
             }
             $weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
             $orderData[$id]['orderData']['calcWeight'] = $weightfee[0];
             //$orderData[$value[0]]['orderData']['calcShipping'] = $weightfee[3];
             $orderData[$id]['orderData']['pmId'] = $weightfee[1];
             //计算运费
             $calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, $orderData[$id]['orderData']['isFixed']);
             //计算运费
             $orderData[$id]['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
             //缺货拦截
             $status = commonModel::auto_contrast_intercept($orderData[$id]);
             $orderData[$id]['orderData']['orderStatus'] = $status['orderStatus'];
             $orderData[$id]['orderData']['orderType'] = $status['orderType'];
             //print_r($order);
             //插入订单
             $info = OrderAddModel::insertAllOrderRowNoEvent($order);
             if ($info) {
                 $message .= "<font color='green'>订单{$id}上传成功!</font><br>";
             } else {
                 $message .= "<font color='red'>订单{$id}上传失败!</font><br>";
             }
         }
         $this->smarty->assign("showerrorinfo", $message);
         //header("location:index.php?mod=underLineOrderImport&act=importOrder");
     }
     $this->smarty->display('underLineOrderImport.htm');
 }
Exemple #9
0
 function act_accountAllListById()
 {
     $res = omAccountModel::accountAllListById();
     self::$errCode = omAccountModel::$errCode;
     self::$errMsg = omAccountModel::$errMsg;
     return $res;
 }
Exemple #10
0
 public function view_getOrderList()
 {
     global $memc_obj;
     $pagesize = isset($_GET['pnum']) && intval($_GET['pnum']) > 0 && intval($_GET['pnum']) < 101 ? intval($_GET['pnum']) : 20;
     //页面大小
     if ($_GET['debug'] == 1) {
         $starttime = time() + microtime();
         echo microtime() . '-----' . $starttime . "\n";
     }
     //菜单
     $status = '';
     $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
     //搜索时使用的数据
     //order表
     $searchPlatformId = isset($_GET['platformId']) ? $_GET['platformId'] : '';
     //搜索平台
     $searchAccountId = isset($_GET['accountId']) ? $_GET['accountId'] : '';
     //搜索账号
     $searchIsNote = isset($_GET['isNote']) ? $_GET['isNote'] : '';
     //是否有留言
     $searchTransportationType = isset($_GET['transportationType']) ? $_GET['transportationType'] : '';
     //运输类型
     $searchTransportation = isset($_GET['transportation']) ? $_GET['transportation'] : '';
     //运输方式
     $searchIsBuji = isset($_GET['isBuji']) ? $_GET['isBuji'] : '';
     //是否补寄订单
     $searchIsLock = isset($_GET['isLock']) ? $_GET['isLock'] : '';
     //是否锁定
     $searchOrderTime1 = isset($_GET['OrderTime1']) ? $_GET['OrderTime1'] : '';
     //搜索下单初始时间
     $searchOrderTime2 = isset($_GET['OrderTime2']) ? $_GET['OrderTime2'] : '';
     //搜索下单结束时间
     //order_detail表
     $searchReviews = isset($_GET['reviews']) ? $_GET['reviews'] : '';
     //是否评价
     $searchSku = isset($_GET['sku']) ? $_GET['sku'] : '';
     //sku
     //$searchOmOrderId			=	'';																	//订单编号
     $searchOrderType = isset($_GET['selectOrderType']) ? $_GET['selectOrderType'] : '';
     //订单种类
     //order_userInfo表
     //$searchUsername				=	'';																	//买家名
     //$searchEmail				=	'';
     $countryName = isset($_GET['country']) ? $_GET['country'] : "";
     $state = isset($_GET['state']) ? $_GET['state'] : "";
     $city = isset($_GET['city']) ? $_GET['city'] : "";
     $zipCode = isset($_GET['zipCode']) ? $_GET['zipCode'] : "";
     //order_warehouse表
     //$weighTimeStart				= 	isset($_GET['searchTimeStart'])? $_GET['searchTimeStart']:"";
     //$weighTimeEnd				= 	isset($_GET['searchTimeEnd'])? $_GET['searchTimeEnd']:"";
     $searchTimeType = isset($_GET['searchTimeType']) ? $_GET['searchTimeType'] : '';
     //order_tracknumbe表
     //$searchTracknumber			=	'';																	//跟踪号
     //order_extension_ebay表
     //$searchTransId				=	'';																	//交易ID
     $searchKeywordsType = isset($_GET['KeywordsType']) ? $_GET['KeywordsType'] : '';
     //搜索关键字类型
     $searchKeywords = isset($_GET['Keywords']) ? $_GET['Keywords'] : '';
     //搜索关键字
     $this->smarty->assign('searchPlatformId', $searchPlatformId);
     $this->smarty->assign('searchAccountId', $searchAccountId);
     $this->smarty->assign('searchIsNote', $searchIsNote);
     $this->smarty->assign('searchTransportationType', $searchTransportationType);
     $this->smarty->assign('searchTransportation', $searchTransportation);
     $this->smarty->assign('searchIsBuji', $searchIsBuji);
     $this->smarty->assign('searchIsLock', $searchIsLock);
     $this->smarty->assign('searchOrderTime1', $searchOrderTime1);
     $this->smarty->assign('searchOrderTime2', $searchOrderTime2);
     $this->smarty->assign('searchReviews', $searchReviews);
     $this->smarty->assign('searchSku', $searchSku);
     $this->smarty->assign('searchOrderType', $searchOrderType);
     //$this->smarty->assign('searchEmail', $searchEmail);
     $this->smarty->assign('searchKeywordsType', $searchKeywordsType);
     $this->smarty->assign('searchKeywords', $searchKeywords);
     $this->smarty->assign('searchCountry', $countryName);
     $this->smarty->assign('searchState', $state);
     $this->smarty->assign('searchCity', $city);
     $this->smarty->assign('searchZipCode', $zipCode);
     //$this->smarty->assign('searchTimeStart', $weighTimeStart);
     //$this->smarty->assign('searchTimeEnd', $weighTimeEnd);
     $this->smarty->assign('searchTimeType', $searchTimeType);
     if ($_GET['debug'] == 1) {
         $dotime = time() + microtime();
         echo "firsttime ==={$dotime}=== " . ($dotime - $starttime) . "\n\n";
     }
     $OrderRefundAct = new OrderRefundAct();
     $omAvailableAct = new OmAvailableAct();
     $OrderindexAct = new OrderindexAct();
     //平台信息
     $OmAccountAct = new OmAccountAct();
     $WarehouseAPIAct = new WarehouseAPIAct();
     if ($_GET['debug'] == 1) {
         $dotime1 = time() + microtime();
         echo "secondtime === " . ($dotime1 - $dotime) . "\n\n";
     }
     $AbOrderList = $WarehouseAPIAct->act_getAbOrderList();
     //var_dump($AbOrderList); exit;
     if ($_GET['debug'] == 1) {
         $dotime = time() + microtime();
         echo "thirdtime === " . ($dotime - $dotime1) . "\n\n";
     }
     $AbOrderListArr = array();
     $AbOrderids = array();
     $AbOrderShow = array();
     foreach ($AbOrderList as $orderId) {
         $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($orderId['id']);
         $AbOrderListArr[$orderId['originOrderId']] = $AbOrderInfo;
         $AbOrderids[] = $orderId['originOrderId'];
         $AbOrderShow[$orderId['originOrderId']] = $orderId['id'];
     }
     if ($_GET['debug'] == 1) {
         $dotime1 = time() + microtime();
         echo "forthtime === " . ($dotime1 - $dotime) . "\n\n";
     }
     //var_dump($AbOrderListArr); exit;
     $this->smarty->assign('AbOrderListArr', $AbOrderListArr);
     $this->smarty->assign('AbOrderShow', $AbOrderShow);
     //$platform	=  $omAvailableAct->act_getTNameList('om_platform','id,platform','WHERE is_delete=0');
     $platform = $OmAccountAct->act_getPlatformListByPower();
     //var_dump($platform);
     if ($_GET['debug'] == 1) {
         $dotime = time() + microtime();
         echo "fiftytime === " . ($dotime - $dotime1) . "\n\n";
     }
     $this->smarty->assign('platform', $platform);
     /**导航 start**/
     $default_ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : C('STATEPENDING');
     /*if(isset($_GET['ostatus']) && !empty($_GET['ostatus'])){
     			$ostatus = $_GET['ostatus'];
     		}else{
     			$ostatus = C('STATEPENDING');
     		}*/
     $ostatus = $_GET['ostatus'];
     //echo C('STATEPENDING');
     $this->smarty->assign('ostatus', $ostatus);
     $otype = isset($_GET['otype']) ? $_GET['otype'] : '';
     $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);
     if ($ostatus) {
         $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $ostatus . '" AND is_delete=0');
     } else {
         $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $default_ostatus . '" AND is_delete=0');
     }
     if ($_GET['debug'] == 1) {
         $dotime1 = time() + microtime();
         echo "sixtytime === " . ($dotime1 - $dotime) . "\n\n";
     }
     //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();
     $accountacc = $_SESSION['accountacc'];
     //var_dump($ostatusList); echo "<br>";
     foreach ($ostatusList as $o_secondinfo) {
         $orderStatus = $o_secondinfo['statusCode'];
         //echo $orderStatus."============"; echo "<br>";
         $s_total = 0;
         //$OrderindexAct->act_showSearchOrderNum($orderStatus);
         //echo $orderStatus."==".$s_total; echo "<br>";
         $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");
         $s_type = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $orderStatus . '" AND is_delete=0 order by sort asc');
         $second_type[$orderStatus] = $s_type[0]['statusCode'];
     }
     if ($_GET['debug'] == 1) {
         $dotime = time() + microtime();
         echo "seventime === " . ($dotime - $dotime1) . "\n\n";
     }
     //var_dump($second_count);
     $this->smarty->assign('second_count', $second_count);
     $this->smarty->assign('second_type', $second_type);
     //var_dump($second_type);
     //退款数量
     $accountList = $_SESSION['accountList'];
     $platformList = $_SESSION['platformList'];
     //echo "<pre>"; print_r($accountList); exit;
     $where = " WHERE is_delete=0 ";
     $platformsee = array();
     for ($i = 0; $i < count($platformList); $i++) {
         $platformsee[] = $platformList[$i];
     }
     if ($platformsee) {
         $where .= ' AND platformId IN (' . join(",", $platformsee) . ') ';
     } else {
         //$where .= " AND 1=2 ";
     }
     $accountsee = array();
     for ($i = 0; $i < count($accountList); $i++) {
         $accountsee[] = $accountList[$i];
     }
     if ($accountsee) {
         $where .= ' AND accountId IN (' . join(",", $accountsee) . ') ';
     } else {
         //$where .= " AND 1=2 ";
     }
     //echo $where;
     //$refund_total = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 ");
     $refund_total = $OrderRefundAct->act_getRecordNums();
     $this->smarty->assign('refund_total', $refund_total);
     $parameterArr = array();
     //var_dump($AbOrderids);
     $parameterArr['AbOrderList'] = $AbOrderids;
     $total = $OrderindexAct->act_showABOrder($ostatus, $otype, '', $parameterArr);
     $this->smarty->assign('abnormal_total', $total);
     if ($_GET['debug'] == 1) {
         $dotime1 = time() + microtime();
         echo "8time === " . ($dotime1 - $dotime) . "\n\n";
     }
     //三级目录
     $three_count = array();
     if ($ostatus) {
         $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$ostatus}' order by sort asc");
         foreach ($o_threelevel as $o_threeinfo) {
             $orderType = $o_threeinfo['statusCode'];
             /*$or_where = " where orderStatus='$ostatus' and orderType='$orderType' ";
             		if($accountacc){
             			$or_where .= ' AND ('.$accountacc.') ';
             		}*/
             //$s_total = $OrderindexAct->act_showSearchOrderNum($ostatus, $orderType);
             $s_total = $default_ostatus == 900 && $orderType == 21 ? 'n' : $OrderindexAct->act_showSearchOrderNum($default_ostatus, $orderType);
             //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $or_where);
             $three_count[$o_threeinfo['statusCode']] = $s_total;
         }
     } else {
         $or_where = "WHERE is_delete=0 and groupId='{$default_ostatus}' ";
         if ($accountacc) {
             $or_where .= ' AND (' . $accountacc . ') ';
         }
         $or_where .= " order by sort asc";
         $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$default_ostatus}' order by sort asc");
         foreach ($o_threelevel as $o_threeinfo) {
             $orderType = $o_threeinfo['statusCode'];
             /*$or_where = " where orderStatus='$ostatus' and orderType='$orderType' ";
             		if($accountacc){
             			$or_where .= ' AND ('.$accountacc.') ';
             		}*/
             $s_total = $default_ostatus == 900 && $orderType == 21 ? 'n' : $OrderindexAct->act_showSearchOrderNum($default_ostatus, $orderType);
             //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $or_where);
             $three_count[$o_threeinfo['statusCode']] = $s_total;
         }
     }
     //
     if ($_GET['debug'] == 1) {
         $dotime = time() + microtime();
         echo "9time === " . ($dotime - $dotime1) . "\n\n";
     }
     $this->smarty->assign('o_threelevel', $o_threelevel);
     $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);
     $value = '';
     $where = '';
     switch ($searchTransportationType) {
         case '1':
             $transportation = CommonModel::getCarrierList(1);
             //快递
             break;
         case '2':
             $transportation = CommonModel::getCarrierList(0);
             //平邮
             break;
         default:
             $transportation = CommonModel::getCarrierList();
             //所有的
             break;
     }
     if ($_GET['debug'] == 1) {
         $dotime1 = time() + microtime();
         echo "10time === " . ($dotime1 - $dotime) . "\n\n";
     }
     //var_dump($transportation); exit;
     $transportationList = array();
     foreach ($transportation as $tranValue) {
         $transportationList[$tranValue['id']] = $tranValue['carrierNameCn'];
     }
     //var_dump($transportationList); exit;
     $this->smarty->assign('transportation', $transportation);
     $this->smarty->assign('transportationList', $transportationList);
     if ($search == '') {
         /*$where	=	' WHERE is_delete = 0 AND storeId = 1 AND orderStatus = '.$ostatus;
         		if($otype	!=	''){
         			$where	.=	' AND orderType	=	'.$otype;
         		}*/
         //$total = $omAvailableAct->act_getTNameCount($orderForm, $where);
         $total = $OrderindexAct->act_showOrder($ostatus, $otype);
         //echo $total; exit;
         $num = $pagesize;
         //每页显示的个数
         $page = new Page($total, $num, '', 'CN');
         //$where .= " ORDER BY ordersTime " . $page->limit;
         //echo "========订单系统升级中========="; echo "<br>";
         $omOrderList = $OrderindexAct->act_showOrder($ostatus, $otype, $page->limit);
         //echo "<pre>"; var_dump($omOrderList); exit;
         //$omOrderList = $omAvailableAct->act_getTNameList($orderForm, '*', $where);
     } else {
         $parameterArr = array();
         $parameterArr['searchPlatformId'] = $searchPlatformId;
         $parameterArr['searchAccountId'] = $searchAccountId;
         $parameterArr['searchIsNote'] = $searchIsNote;
         $parameterArr['searchTransportationType'] = $searchTransportationType;
         $parameterArr['searchTransportation'] = $searchTransportation;
         $parameterArr['searchIsBuji'] = $searchIsBuji;
         $parameterArr['searchIsLock'] = $searchIsLock;
         $parameterArr['searchOrderTime1'] = $searchOrderTime1;
         $parameterArr['searchOrderTime2'] = $searchOrderTime2;
         $parameterArr['searchReviews'] = $searchReviews;
         $parameterArr['searchSku'] = trim($searchSku);
         $parameterArr['searchOrderType'] = $searchOrderType;
         $parameterArr['searchKeywordsType'] = $searchKeywordsType;
         $parameterArr['countryName'] = trim($countryName);
         $parameterArr['state'] = trim($state);
         $parameterArr['city'] = trim($city);
         $parameterArr['zipCode'] = trim($zipCode);
         $parameterArr['searchTimeType'] = trim($searchTimeType);
         $parameterArr['searchKeywords'] = trim($searchKeywords);
         //$parameterArr['searchKeywords']	=	trim($searchKeywords);
         /*if($_SESSION['sysUserId'] == 8){
         			var_dump($ostatus.'---'.$otype);
         		}*/
         //echo "订单系统升级中。。。。。。。<br>";
         //var_dump($parameterArr); echo "<br>";
         //$total = $OrderindexAct->act_index($parameterArr,$searchKeywordsType,$searchKeywords);
         $total = $OrderindexAct->act_showOrder($ostatus, $otype, '', $parameterArr);
         //echo $total; exit;
         $num = $pagesize;
         //每页显示的个数
         $page = new Page($total, $num, '', 'CN');
         //$limit	=	$page->limit;
         //var_dump($parameterArr);
         $omOrderList = $OrderindexAct->act_showOrder($ostatus, $otype, $page->limit, $parameterArr);
         //var_dump($omOrderList);
         //$omOrderList = OrderindexAct::act_index($parameterArr,$searchKeywordsType,$searchKeywords,$limit,$ostatus);
     }
     if ($_GET['debug'] == 1) {
         $dotime = time() + microtime();
         echo "11time ={$dotime}== " . ($dotime - $dotime1) . "\n\n";
     }
     //$sku	=	array();
     $account_where = ' WHERE is_delete = 0 ';
     if ($searchPlatformId) {
         $account_where .= ' AND platformId = ' . $searchPlatformId;
     }
     $UserCompetenceAct = new UserCompetenceAct();
     $accountList = $UserCompetenceAct->act_showGlobalUser();
     if ($accountList) {
         $account_where .= ' AND id in ( ' . join(',', $accountList) . ' ) ';
     }
     //帐号信息
     $accountList = $omAvailableAct->act_getTNameList('om_account', '*', $account_where);
     //var_dump($accountList); exit;
     $account = array();
     foreach ($accountList as $v) {
         $account[$v['id']] = $v['account'];
     }
     //包材信息
     $pm = GoodsModel::getMaterInfoByList();
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     //var_dump($page);
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     //echo $show_page;
     //获取系统所有状态
     $statusList = copyOrderModel::selectStatusList();
     if ($_GET['debug'] == 1) {
         $dotime1 = time() + microtime();
         echo "12time ={$dotime1}== " . ($dotime1 - $dotime) . "\n\n";
     }
     //echo $show_page;
     $this->smarty->assign('statusList', $statusList);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('account', $account);
     $this->smarty->assign('accountList', $accountList);
     $this->smarty->assign('pm', $pm);
     $this->smarty->assign('omOrderList', $omOrderList);
     $this->smarty->display('orderindex.htm');
 }
 public function view_addMissingOrder()
 {
     $OmAccountAct = new OmAccountAct();
     $message = isset($_GET['message']) ? trim($_GET['message']) : '';
     $aliexpressmessage = isset($_GET['aliexpressmessage']) ? trim($_GET['aliexpressmessage']) : '';
     //echo $message;
     $amazonAccountList = $OmAccountAct->act_getAccountListByPid(11);
     //print_r($amazonAccountList);
     $amazonAccountList = json_decode($amazonAccountList, true);
     $ebayAccountList = $OmAccountAct->act_getEbayAccountList();
     //print_r($ebayAccountList); exit;
     if (isset($_POST['addOrder']) && !empty($_POST)) {
         $addorder = isset($_POST['addOrder']) ? $_POST['addOrder'] : "";
         if ($addorder == "ebay") {
             //$message = "";
             $accountId = isset($_POST['ebay_account']) ? $_POST['ebay_account'] : "";
             $account = OmAvailableModel::getTNameList("om_account", "*", " where id={$accountId}");
             $account = $account[0]['account'];
             //echo $account;
             include WEB_PATH . "conf/scripts/script.ebay.config.php";
             include WEB_PATH . "conf/scripts/script.config.php";
             require_once WEB_PATH . "crontab/scripts.comm.php";
             require_once WEB_PATH_LIB_SCRIPTS_EBAY . "ebay_order_cron_func.php";
             $rmq_config = C("RMQ_CONFIG");
             //echo "<pre>"; var_dump($rmq_config); exit;
             $rabbitMQClass = new RabbitMQClass($rmq_config['fetchOrder'][1], $rmq_config['fetchOrder'][2], $rmq_config['fetchOrder'][4], $rmq_config['fetchOrder'][0]);
             //队列对象
             include WEB_PATH . "lib/sdk/ebay/GetCertainOrder.php";
             require_once WEB_PATH . "lib/PHPExcel.php";
             if (isset($_FILES) && !empty($_FILES['ebay_id']['tmp_name'])) {
                 $ftype1 = $_FILES['ebay_id']['type'];
                 $tmp_name = $_FILES['ebay_id']['tmp_name'];
                 $fsize = $_FILES['ebay_id']['size'];
                 define("MAX_UPLOAD_SIZE", 128 * 1024 * 1024);
                 if ($fsize <= MAX_UPLOAD_SIZE) {
                     //判断文件头2字节
                     $allow_excel_type = array('application/vnd.ms-excel', 'application/octet-stream', 'text/comma-separated-values', 'application/ww-plugin', 'application/npalicdo', 'application/qscall-plugin', 'application/octet-stream', 'text/csv');
                     $allow_excel_ftypecode = array('8397', '349', '983');
                     //csv
                     $f = fopen($tmp_name, 'rb');
                     $bin = fread($f, 2);
                     fclose($f);
                     $strInfo = @unpack('c2chars', $bin);
                     $ftype2 = intval($strInfo['chars1'] . $strInfo['chars2']);
                     if (in_array($ftype1, $allow_excel_type) && in_array($ftype2, $allow_excel_ftypecode)) {
                         $upload_fname = $_FILES['ebay_id']['name'];
                         $ext = 'csv';
                         $f_order = fopen($tmp_name, 'r');
                         $EXCEL_ROW_CNT = 0;
                         $excel_order_cnt = 0;
                         $OrderMatch = array();
                         $OrderMissed = array();
                         //漏单
                         $OrderIDWrong = array();
                         //excel中订单号格式不对
                         $OrderDuplicate = array();
                         //重复的订单号
                         $OrderException = array();
                         //异常订单
                         while ($order_line = fgetcsv($f_order, 1024, ',')) {
                             if ($EXCEL_ROW_CNT == 0) {
                                 $EXCEL_ROW_CNT++;
                                 continue;
                                 //ignore the first line
                             }
                             $ebay_recordnumber = $order_line[0];
                             $ebay_orderid = scientific_convert_digital(trim($order_line[1]));
                             $ebay_itemid = scientific_convert_digital(trim($order_line[2]));
                             $ebay_tranid = scientific_convert_digital(trim($order_line[3]));
                             $EXCEL_ROW_CNT++;
                             $order_line = NULL;
                             unset($order_line);
                             if (empty($ebay_orderid)) {
                                 //column orderid is empty
                                 if (preg_match('#^\\d{12}$#i', $ebay_itemid) && (preg_match('#^\\d{12,14}$#i', $ebay_tranid) || $ebay_tranid == '0')) {
                                     $ebay_orderid = $ebay_itemid . '-' . $ebay_tranid;
                                 } else {
                                     //echo "$ebay_recordnumber 不满足生成orderid的条件,请检查itemid(要求12位),tranid要求(12-14位)<br>";
                                     continue;
                                 }
                             } else {
                                 //wrong format orderid
                                 if (!preg_match('#^\\d{12}$#i', $ebay_orderid)) {
                                     continue;
                                 }
                                 //if all the 3 columns has value,then this is one transaction of a multiple line item order
                                 if (!empty($ebay_itemid) && !empty($ebay_tranid) && !empty($ebay_orderid)) {
                                     continue;
                                 }
                             }
                             $order_info = array('record_no' => $ebay_recordnumber, 'order_id' => $ebay_orderid);
                             $compare_res = fetchEbayOrderModel::checkEbayOrder($ebay_orderid, $ebay_recordnumber, $accountId);
                             //echo "sdg";
                             if ($compare_res == '001') {
                                 $OrderIDWrong[] = $order_info;
                             } else {
                                 if ($compare_res == '002') {
                                     $OrderMissed[] = $order_info;
                                 } else {
                                     if ($compare_res == '100' || $compare_res == '003') {
                                         $OrderDuplicate[] = $order_info;
                                     } else {
                                         if ($compare_res === FALSE) {
                                             $OrderException[] = $order_info;
                                         } else {
                                             //$OrderMatch[]=$order_info;
                                         }
                                     }
                                 }
                             }
                         }
                         fclose($f_order);
                         if (count($OrderIDWrong) != 0) {
                             $message .= "<br><font >以下订单格式错误</font><br>";
                             $i = 0;
                             foreach ($OrderIDWrong as $k => $v) {
                                 $message .= "&nbsp;<font color='red'>{$v['record_no']}</font>&nbsp;";
                                 if ($i >= 3) {
                                     $message .= "<br>";
                                     $i = 0;
                                 }
                                 $i++;
                             }
                         }
                         if (count($OrderMissed) != 0) {
                             $message .= "<br><font>以下为漏单情况</font><br>";
                             $i = 0;
                             foreach ($OrderMissed as $k => $v) {
                                 //$message .= "&nbsp;<font color='red'>{$v['order_id']}</font>&nbsp;";
                                 $message .= "<font color='green'>{$v['order_id']}</font><br>";
                                 /*if($i>=3){
                                 			$message .= "<br>";
                                 			$i = 0;
                                 		}
                                 		$i++;*/
                             }
                         }
                         if (count($OrderDuplicate) != 0) {
                             $message .= "<br><font>以下为重复订单</font><br>";
                             $i = 0;
                             foreach ($OrderDuplicate as $k => $v) {
                                 $message .= "&nbsp;<font color='red'>{$v['record_no']}</font>&nbsp;";
                                 if ($i >= 3) {
                                     $message .= "<br>";
                                     $i = 0;
                                 }
                                 $i++;
                             }
                         }
                         if (count($OrderException) != 0) {
                             $message .= "<br><font >以下为异常订单</font><br>";
                             $i = 0;
                             foreach ($OrderException as $k => $v) {
                                 $message .= "&nbsp;<font color='red'>{$v['record_no']}</font>&nbsp;";
                                 if ($i >= 3) {
                                     $message .= "<br>";
                                     $i = 0;
                                 }
                                 $i++;
                             }
                         }
                     } else {
                         $message .= "[{$ftype1}][{$ftype2}]此处只能上传CSV文件!!!<br/>";
                     }
                 } else {
                     $message .= '你上传的文件有' . $fsize / (1024 * 1024) . 'M,已超过限制' . MAX_UPLOAD_SIZE / (1024 * 1024) . 'M!';
                 }
             }
             //$ebay_id = isset($_POST['ebay_id'])?$_POST['ebay_id']:"";
             $tip = false;
             //echo "<pre>"; print_r($OrderMissed); exit;
             if (count($OrderMissed) == 0) {
                 $message .= "<font color='green'>没有漏单</font><br>";
                 echo $message;
                 exit;
             } else {
                 $ebay_ids = array();
                 foreach ($OrderMissed as $k => $v) {
                     $where = "where orderId='{$v['order_id']}'";
                     //echo $where;
                     $msg = OmAvailableModel::getTNameList("om_unshipped_order_extension_ebay", "*", $where);
                     //print_r($msg);
                     if ($msg) {
                         $message .= "<font color='red'>订单{$id}已存在!</font><br>";
                         continue;
                     }
                     $ebay_ids[] = $v['order_id'];
                 }
                 if (empty($ebay_ids)) {
                     $message .= "<font color='green'>不存在漏单</font><br>";
                 } else {
                     //echo "<pre>"; print_r($ebay_ids); exit;
                     //$ebay_ids = explode(",",$ebay_id);
                     $api_gco = new GetCertainOrderAPI($account);
                     //ob_start();
                     $api_gco->GetCertainOrder($account, $ebay_ids);
                     //监听获取队列信息
                     //ob_end_clean();
                 }
                 /*foreach($ebay_ids as $key=>$id){
                 			$where = "where orderId='{$id}'";
                 			//echo $where;
                 			$msg = OmAvailableModel::getTNameList("om_unshipped_order_extension_ebay","*",$where);
                 			//print_r($msg);
                 			if($msg){
                 				$message .= "<font color='red'>订单{$id}已存在!</font><br>";
                 				continue;
                 			}
                 			$info = $ebay_api->push_ebay_orderid_queue($id,$account,$rabbitMQClass);
                 			$tip=true;
                 		}*/
                 //$info = $ebay_api->
             }
             //ob_start();
             //$message = fetchEbayOrderModel::addOrder($account);
             //ob_end_clean();
             //echo fetchEbayOrderModel::$errMsg;
         } elseif ($addorder == "amazon") {
             $fetch_amazon_order = new fetchAmazonOrderAct();
             $aliexpressmessage = $fetch_amazon_order->act_fetchOrder();
             //header("Location:index.php?mod=missingOrderAdd&act=addMissingOrder&aliexpressmessage={$aliexpressmessage}");
         }
     }
     //print_r($ebayAccountList);
     $this->smarty->assign("ebayAccountList", $ebayAccountList);
     $this->smarty->assign("amazonAccountList", $amazonAccountList);
     $this->smarty->assign('message', $message);
     $this->smarty->assign('aliexpressmessage', $aliexpressmessage);
     $this->smarty->assign('toptitle', '漏单添加');
     $this->smarty->assign('toplevel', 2);
     $this->smarty->assign('secondlevel', '280');
     $this->smarty->display("missingOrderAdd.htm");
 }
Exemple #12
0
 public function view_orderRefundList()
 {
     global $memc_obj;
     $pagesize = 200;
     //页面大小
     //菜单
     $status = '';
     //print_r($_GET);
     //搜索时使用的数据
     //order表
     $searchPlatformId = isset($_GET['platformId']) ? $_GET['platformId'] : '';
     //搜索平台
     $searchRefundType = isset($_GET['refundType']) ? $_GET['refundType'] : '';
     //退款类型
     $searchRefundStatus = isset($_GET['refundStatus']) ? $_GET['refundStatus'] : '';
     //
     $searchOmOrderId = isset($_GET['omOrderId']) ? $_GET['omOrderId'] : '';
     //订单编号
     $searchTransId = isset($_GET['transId']) ? $_GET['transId'] : '';
     //交易ID
     $searchApplyTime1 = isset($_GET['applyTime1']) ? $_GET['applyTime1'] : '';
     //初始时间
     $searchApplyTime2 = isset($_GET['applyTime2']) ? $_GET['applyTime2'] : '';
     //结束时间
     $status = isset($_GET['status']) ? $_GET['status'] : 0;
     //操作状态
     $orderType = isset($_GET['orderType']) ? $_GET['orderType'] : 1;
     //单据种类
     $ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : 0;
     //一级分类
     //echo "------------------$searchOmOrderId----------------";
     $where = ' where is_delete=0 ';
     if ($searchPlatformId != '') {
         $where .= ' AND platformId = ' . $searchPlatformId;
     }
     if ($searchRefundType != '') {
         $where .= ' AND refundType = ' . $searchRefundType;
     }
     if ($searchTransId != '') {
         $where .= ' AND transId = ' . $searchTransId;
     }
     if ($searchOmOrderId != '') {
         $where .= ' AND omOrderId = ' . $searchOmOrderId;
     }
     if ($status != '') {
         $where .= ' AND status = ' . $status;
     }
     if ($searchApplyTime1 != '' && $searchApplyTime2 != '') {
         $where .= ' AND addTime >= "' . strtotime($searchApplyTime1) . '" AND addTime <= "' . strtotime($searchApplyTime2) . '" ';
     }
     $accountList = $_SESSION['accountList'];
     $platformList = $_SESSION['platformList'];
     //echo "<pre>"; print_r($accountList); exit;
     $platformsee = array();
     for ($i = 0; $i < count($platformList); $i++) {
         $platformsee[] = $platformList[$i];
     }
     if ($platformsee) {
         $where .= ' AND platformId IN (' . join(",", $platformsee) . ') ';
     } else {
         $where .= " AND 1=2 ";
     }
     $accountsee = array();
     for ($i = 0; $i < count($accountList); $i++) {
         $accountsee[] = $accountList[$i];
     }
     if ($accountsee) {
         $where .= ' AND accountId IN (' . join(",", $accountsee) . ') ';
     } else {
         $where .= " AND 1=2 ";
     }
     $this->smarty->assign('searchPlatformId', $searchPlatformId);
     $this->smarty->assign('searchRefundType', $searchRefundType);
     $this->smarty->assign('searchRefundStatus', $searchRefundStatus);
     $this->smarty->assign('searchOmOrderId', $searchOmOrderId);
     $this->smarty->assign('searchTransId', $searchTransId);
     $this->smarty->assign('searchApplyTime1', $searchApplyTime1);
     $this->smarty->assign('searchApplyTime2', $searchApplyTime2);
     $omAvailableAct = new OrderRefundAct();
     $OrderindexAct = new OrderindexAct();
     //平台信息
     $OmAccountAct = new OmAccountAct();
     $WarehouseAPIAct = new WarehouseAPIAct();
     $AbOrderList = $WarehouseAPIAct->act_getAbOrderList();
     //var_dump($AbOrderList); exit;
     $AbOrderListArr = array();
     $AbOrderids = array();
     $AbOrderShow = array();
     foreach ($AbOrderList as $orderId) {
         $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($orderId['id']);
         $AbOrderListArr[$orderId['originOrderId']] = $AbOrderInfo;
         $AbOrderids[] = $orderId['originOrderId'];
         $AbOrderShow[$orderId['originOrderId']] = $orderId['id'];
     }
     //var_dump($AbOrderListArr); exit;
     $this->smarty->assign('AbOrderListArr', $AbOrderListArr);
     $this->smarty->assign('AbOrderShow', $AbOrderShow);
     //$platform	=  $omAvailableAct->act_getTNameList('om_platform','id,platform','WHERE is_delete=0');
     $platform = $OmAccountAct->act_getPlatformListByPower();
     $this->smarty->assign('platform', $platform);
     /**导航 start**/
     $this->smarty->assign('ostatus', $ostatus);
     $this->smarty->assign('status', $status);
     $this->smarty->assign('refund_status', $status);
     $StatusMenuAct = new StatusMenuAct();
     $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0');
     /*var_dump($ostatusList);*/
     $this->smarty->assign('ostatusList', $ostatusList);
     //二级目录
     /*$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'];
         //echo $orderStatus."============"; echo "<br>";
         $s_total = $OrderindexAct->act_showSearchOrderNum($orderStatus);
         //echo $orderStatus."==".$s_total; echo "<br>";
         $second_count[$o_secondinfo['statusCode']] = $s_total;
         $s_type = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $orderStatus . '" AND is_delete=0 order by sort asc');
         $second_type[$orderStatus] = $s_type[0]['statusCode'];
     }
     $this->smarty->assign('second_count', $second_count);
     $this->smarty->assign('second_type', $second_type);
     //退款数量
     //echo $where;
     //$refund_total = $omAvailableAct->act_getTNameCount("om_order_refund", " where is_delete=0 ");
     $refund_total = $omAvailableAct->act_getRecordNums();
     $this->smarty->assign('refund_total', $refund_total);
     $parameterArr = array();
     //var_dump($AbOrderids);
     $parameterArr['AbOrderList'] = $AbOrderids;
     $total = $OrderindexAct->act_showABOrder($ostatus, $otype, '', $parameterArr);
     $this->smarty->assign('abnormal_total', $total);
     //三级目录
     /*$refund_one = $omAvailableAct->act_getTNameCount("om_order_refund",$where." and status=0");
     		$this->smarty->assign('refund_one', $refund_one);
     		$refund_two = $omAvailableAct->act_getTNameCount("om_order_refund",$where." and status=1");
     		$this->smarty->assign('refund_two', $refund_two);
     		$refund_three = $omAvailableAct->act_getTNameCount("om_order_refund",$where." and status=2");
     		$this->smarty->assign('refund_three', $refund_three);*/
     /**导航 end**/
     $refund_status = array('671' => array(1, 0), '673' => array(1, 1), '674' => array(1, 2), '675' => array(2, 0), '676' => array(2, 1), '677' => array(2, 2), '678' => array(3, 0), '679' => array(3, 1));
     $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$ostatus}' order by sort asc");
     //var_dump($o_threelevel);
     $extral_str = array();
     foreach ($o_threelevel as $o_threeinfo) {
         $statusCode = $o_threeinfo['statusCode'];
         $torderType = $refund_status[$statusCode][0];
         $tostatus = $refund_status[$statusCode][1];
         $where = " WHERE orderType = '{$torderType}' and status = '{$tostatus}' and is_delete = 0 ";
         //echo $where; echo "<br>";
         $s_total = $omAvailableAct->act_getRecordNums($where);
         //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $or_where);
         $three_count[$o_threeinfo['statusCode']] = $s_total;
         $extral_str[$o_threeinfo['statusCode']] = "orderType={$torderType}&status={$tostatus}";
     }
     $this->smarty->assign('extral_str', $extral_str);
     $this->smarty->assign('o_threelevel', $o_threelevel);
     $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);
     //print_r($orderRefundList);//exit;
     //$where =	' WHERE is_delete = 0 '.$where;
     $where = " WHERE orderType = '{$orderType}' and status = '{$status}' and is_delete = 0 ";
     //echo $where;
     //$total = $omAvailableAct->act_getTNameCount('om_order_refund', $where);
     $total = $omAvailableAct->act_getRecordNums($where);
     $num = 100;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     //$where .= " ORDER BY id " . $page->limit;
     //$orderRefundList = $omAvailableAct->act_getTNameList('om_order_refund', '*', $where);
     $orderRefundList = $omAvailableAct->act_getRefundList($where);
     //echo $where;
     if (empty($orderRefundList)) {
         $orderRefundList = array();
     }
     $this->smarty->assign('orderRefundList', $orderRefundList);
     $where = ' WHERE is_delete = 0 ';
     //$where = ' WHERE is_delete = 0 AND orderRefundId in('.$value.') '.$where;
     if (!empty($orderRefundList)) {
         foreach ($orderRefundList as $k => $v) {
             if ($value == '') {
                 $value = $v['id'];
             } else {
                 $value .= ',' . $v['id'];
             }
         }
         $where = ' WHERE is_delete = 0 AND orderRefundId in(' . $value . ') ';
     } else {
         $where .= " AND 1=2 ";
     }
     $orderRefundDetailList = $omAvailableAct->act_getTNameList('om_order_refund_detail', '*', $where);
     /*if(empty($orderRefundDetailList)){
     			$status	=	'无符合条件的订单';
     			$this->smarty->assign('status', $status);
     			$this->smarty->display('orderRefund.htm.htm');
     			exit;
     		}*/
     //print_r($orderRefundDetailList);
     if (empty($orderRefundDetailList)) {
         $orderRefundDetailList = array();
     }
     $this->smarty->assign('orderRefundDetailList', $orderRefundDetailList);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     //获取系统所有状态
     $statusList = copyOrderModel::selectStatusList();
     $this->smarty->assign('status', $status);
     $this->smarty->assign('statusList', $statusList);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('account', $account);
     $this->smarty->assign('sku', $sku);
     $this->smarty->assign('pm', $pm);
     $this->smarty->assign('orderdEtailExtensionEbay', $orderdEtailExtensionEbay);
     $this->smarty->assign('omOrderList', $omOrderList);
     $this->smarty->assign('omOrderDetail', $omOrderDetail);
     //$this->smarty->assign('orderTracknumber', $orderTracknumber);
     $this->smarty->assign('omOrderExtensionEbay', $omOrderExtensionEbay);
     $this->smarty->assign('omOrderUserInfo', $omOrderUserInfo);
     $this->smarty->display('orderRefund.htm');
 }