예제 #1
0
 public function act_selectDetail()
 {
     $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : "";
     $ostatus = $_POST['orderStatus'];
     $otype = $_POST['orderType'];
     /*$StatusMenuAct = new StatusMenuAct();
     		$tableName = $StatusMenuAct->act_getOrderNameByStatus($ostatus, $otype);*/
     //echo $tableName; echo "<br>";
     $tableName = 'om_unshipped_order';
     //var_dump($orderid); exit;
     $where = ' WHERE omOrderId = ' . $orderid;
     $detail = OrderindexModel::showOnlyOrderDetailList($tableName, $where);
     //$detail  = splitOrderModel::selectDetail($orderid);
     //var_dump($detail); exit;
     if (!$detail) {
         self::$errCode = 601;
         self::$errMsg = "此订单明细为空,无法拆分!";
         return false;
     }
     if (count($detail) == 1 && $detail[0]['amount'] == 1) {
         self::$errCode = 601;
         self::$errMsg = "此为单料号订单,无法拆分!";
         return false;
     }
     $arr = array();
     //print_r($detail);
     foreach ($detail as $key => $value) {
         $arr[] = $value['sku'] . "*" . $value['amount'];
     }
     $info = join(',', $arr);
     return $info;
 }
예제 #2
0
 public static function update_order_shippedmarked_time($omOrderId)
 {
     global $mctime;
     $tableName = "om_unshipped_order";
     $where = " where id = {$omOrderId} and storeId = 1 and is_delete = 0 ";
     $returnStatus0 = array('marketTime' => $mctime);
     return OrderindexModel::updateOrder($tableName, $returnStatus0, $where);
 }
예제 #3
0
 public static function applyTheLineEUBTrackNumber($recordnumber, $tracknumber)
 {
     !self::$dbConn ? self::initDB() : null;
     $SYSTEM_ACCOUNTS = OmAvailableModel::getPlatformAccount();
     $accountIds = array();
     foreach ($SYSTEM_ACCOUNTS['Amazon'] as $id => $account) {
         $accountIds[] = $id;
     }
     //print_r($SYSTEM_ACCOUNTS['Amazon']);
     $tableName = 'om_unshipped_order';
     $where = " WHERE recordNumber='{$recordnumber}' AND accountId in ('" . join("','", $accountIds) . "') AND is_delete =0 AND storeId=1 ";
     $tinfo = OrderindexModel::showOnlyOrderList($tableName, $where);
     self::$errMsg = '';
     if ($tinfo) {
         $omOrderId = $tinfo[0]['id'];
         $trackinfo = OrderindexModel::selectOrderTracknumber(" WHERE tracknumber = '" . $tracknumber . "' AND is_delete = 0 ");
         //var_dump($trackinfo);
         if ($trackinfo) {
             self::$errCode = "001";
             self::$errMsg = "  第" . $row . "行已经存在跟踪" . $tinfo['ebay_tracknumber'] . " 新跟踪号[{$tracknumber}]更新失败<br>";
             return false;
         } else {
             $data['omOrderId'] = $omOrderId;
             $data['tracknumber'] = $tracknumber;
             $data['addUser'] = $_SESSION['sysUserId'];
             $data['createdTime'] = time();
             $msg = OrderRecordModel::insertOrderTrackRow($data);
             //echo $msg;
             if (!$msg) {
                 self::$errCode = "001";
                 self::$errMsg = "   第" . $row . "行订单号[{$recordnumber}]添加跟踪号[{$tracknumber}]失败<br>";
                 return false;
             }
         }
         self::$errCode = "200";
         self::$errMsg = "获取数据成功";
         return true;
         //失败则设置错误码和错误信息, 返回false
     } else {
         self::$errCode = "001";
         self::$errMsg = "   第" . $row . "行订单号[{$recordnumber}]不是亚马孙订单或者不存在系统<br>";
         return false;
     }
 }
예제 #4
0
 public static function getOrderInfo($tableName, $orderId, $storeId = 1)
 {
     self::initDB();
     $where = " WHERE id = {$orderId} and is_delete = 0 and storeId = " . $storeId;
     $orderList = OrderindexModel::showOrderList($tableName, $where);
     $orderData = $orderList[$orderId];
     $orderInfo = array();
     /*$table = " `om_unshipped_order` a , `om_unshipped_order_detail` b , `om_unshipped_order_extension_ebay` c,`om_unshipped_order_userInfo` d,`om_platform` e ";
       $field = " a.id,a.recordNumber,a.accountId,a.platformId,a.ordersTime,a.paymentTime,a.actualTotal,a.calcShipping,b.sku,b.amount,b.itemPrice,c.PayPalPaymentId,c.currency,d.platformUsername,e.id as platformId,e.platform ";
       $where = " WHERE a.id = '$id' AND a.id = b.omOrderId AND a.id = c.omOrderId AND a.id = d.omOrderId AND a.platformId = e.id ";*/
     if ($orderData) {
         $platformListById = omAccountModel::platformListById();
         $orderInfo['id'] = $orderId;
         $orderInfo['recordNumber'] = $orderData['orderData']['recordNumber'];
         $orderInfo['accountId'] = $orderData['orderData']['accountId'];
         $orderInfo['platformId'] = $orderData['orderData']['platformId'];
         $orderInfo['ordersTime'] = $orderData['orderData']['ordersTime'];
         $orderInfo['paymentTime'] = $orderData['orderData']['paymentTime'];
         $orderInfo['actualTotal'] = $orderData['orderData']['actualTotal'];
         $orderInfo['calcShipping'] = $orderData['orderData']['calcShipping'];
         $orderInfo['countryName'] = $orderData['orderUserInfoData']['countryName'];
         $orderInfo['PayPalPaymentId'] = $orderData['orderExtenData']['PayPalPaymentId'];
         $orderInfo['currency'] = $orderData['orderExtenData']['currency'];
         $orderInfo['platformUsername'] = $orderData['orderUserInfoData']['platformUsername'];
         $orderInfo['platform'] = $platformListById[$orderData['orderData']['platformId']];
         $orderInfo['detail'] = array();
         if ($orderData['orderDetail']) {
             foreach ($orderData['orderDetail'] as $detailData) {
                 //$detail = array();
                 $detail['sku'] = $detailData['orderDetailData']['sku'];
                 $detail['amount'] = $detailData['orderDetailData']['amount'];
                 $detail['itemPrice'] = $detailData['orderDetailData']['itemPrice'];
                 $orderInfo['detail'][] = $detail;
             }
         }
         //$accountId = $orderInfo['accountId'];
         if (!$orderInfo['accountId']) {
             self::$errCode = 04;
             self::$errMsg = '对应账号ID为空!';
             return FALSE;
         }
         if ($orderInfo['platformId'] == 1) {
             //$accountInfo = OrderRefundModel::getTNameList($table, $field, $where);
             $accountInfo = self::getAccountInfo($orderInfo['accountId']);
             if (!$accountInfo) {
                 self::$errCode = 05;
                 self::$errMsg = '没有对应PayPal账号信息!';
                 return FALSE;
             }
             $orderInfo['paypalAccount1'] = $accountInfo['account1'];
             $orderInfo['pass1'] = $accountInfo['pass1'];
             $orderInfo['signature1'] = $accountInfo['signature1'];
             $orderInfo['paypalAccount2'] = $accountInfo['account2'];
             $orderInfo['pass2'] = $accountInfo['pass2'];
             $orderInfo['signature2'] = $accountInfo['signature2'];
         }
     }
     self::$errCode = 200;
     self::$errMsg = '获取信息成功';
     return $orderInfo;
 }
예제 #5
0
 public static function combinePackage($tableName, $plateform_arr, $carrierIds, $id_array, $storeId = 1)
 {
     self::initDB();
     $list = self::selectList($tableName, $plateform_arr, $carrierIds, $id_array);
     //var_dump($list); exit;
     if (!$list) {
         self::$errCode = 301;
         self::$errMsg = "没有需要合并的订单!";
         return false;
     }
     /*foreach($list as $key=>$value){
     			$key = $value['id'];
     		}
     		var_dump($key); exit;*/
     BaseModel::begin();
     $combineNum = 0;
     foreach ($list as $key => $value) {
         $where = "b.userName = '******'userName']}' \n\t\t\t\t\tAND b.countryName = '{$value['countryName']}' \n\t\t\t\t\tAND a.accountId = {$value['accountId']} \n\t\t\t\t\tAND a.transportId = {$value['transportId']} \n\t\t\t\t\tAND b.state='{$value['state']}' \n\t\t\t\t\tAND b.city='{$value['city']}' \n\t\t\t\t\tAND b.street='{$value['street']}' \n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND a.calcWeight<=2 \n\t\t\t\t\tAND a.isLock=0 \n\t\t\t\t\tAND a.is_delete=0 \n\t\t\t\t\tAND a.combinePackage=0 \n\t\t\t\t\tAND a.orderStatus={$value['orderStatus']}\n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND is_delete = 0 AND storeId = " . $storeId;
         $records = combinePackageModel::selectRecord($tableName, $where, $id_array);
         //var_dump($records); exit;
         if (!$records) {
             continue;
         } else {
             $weightlists = array();
             $orderinfo = array();
             $countryName = $records[0]['countryName'];
             $transportId = $records[0]['transportId'];
             foreach ($records as $record) {
                 $omOrderId = $record['id'];
                 $omOrderId = $record['id'];
                 $orderinfo[$record['id']] = $record;
                 $arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
                 //var_dump($arrinfo); exit;
                 $realweight = $arrinfo[0];
                 $realcosts = $arrinfo[2];
                 $itemprices = $arrinfo[3];
                 $weightlists[$omOrderId] = $realweight;
             }
             //var_dump($weightlists); exit;
             $keyarray = array();
             $keyarrays = array();
             $checkweight = 0;
             foreach ($weightlists as $wk => $weightlist) {
                 $checkweight += $weightlist;
                 if ($checkweight > 1.85) {
                     $keyarrays[] = $keyarray;
                     $keyarray = array();
                     $checkweight = $weightlist;
                     $keyarray[] = $wk;
                 } else {
                     $keyarray[] = $wk;
                 }
             }
             if (!empty($keyarray)) {
                 $keyarrays[] = $keyarray;
             }
             //var_dump($keyarrays); echo "<br>";
             foreach ($keyarrays as $orderlist) {
                 if (count($orderlist) < 2) {
                     continue;
                 }
                 $ordervalueweight = array();
                 $ordervalueactualTotal = array();
                 foreach ($orderlist as $orderid) {
                     $ordervalueweight[$orderid] = $weightlists[$orderid];
                     $ordervalueactualTotal[$orderid] = $orderinfo[$orderid]['actualTotal'];
                 }
                 //var_dump($ordervalueactualTotal); exit;
                 //var_dump($ordervalueweight); exit;
                 $firstorder = array_shift($orderlist);
                 //第一个订单编号信息
                 //var_dump($firstorder);
                 $combineInfo = CommonModel::calcshippingfee(array_sum($ordervalueweight), $countryName, array_sum($ordervalueactualTotal), $transportId);
                 //邮寄方式计算
                 //var_dump($combineInfo); exit;
                 $weight2fee = calceveryweight($ordervalueweight, $combineInfo['fee']['fee']);
                 //var_dump($weight2fee); exit;
                 $firstweightfee = array_shift($weight2fee);
                 //第一个订单重量运费信息
                 $data = array();
                 $data['combinePackage'] = 1;
                 $data['orderStatus'] = C('STATEPENDING');
                 $data['orderType'] = C('STATEPENDING_CONPACK');
                 $where = ' WHERE id = ' . $firstorder;
                 if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
                     self::$errCode = 303;
                     self::$errMsg = "更新主订单失败!";
                     BaseModel::rollback();
                     return false;
                 }
                 foreach ($orderlist as $sonorder) {
                     $data['combinePackage'] = 2;
                     $data['orderStatus'] = C('STATEPENDING');
                     $data['orderType'] = C('STATEPENDING_CONPACK');
                     $where = ' WHERE id = ' . $sonorder;
                     if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
                         self::$errCode = 304;
                         self::$errMsg = "更新子订单失败!";
                         BaseModel::rollback();
                         return false;
                     }
                     if (!OrderRecordModel::insertCombineRecord($firstorder, $sonorder)) {
                         self::$errCode = 305;
                         self::$errMsg = "插入订单合并记录失败!";
                         BaseModel::rollback();
                         return false;
                     }
                 }
                 $combineNum++;
             }
         }
     }
     self::$errCode = 200;
     self::$errMsg = "合并包裹操作成功!";
     BaseModel::commit();
     BaseModel::autoCommit();
     return $combineNum;
 }
예제 #6
0
 public static function applyPartPrint($orderid_arr, $ostatus, $otype, $flag, $storeId = 1)
 {
     self::initDB();
     if (!isset($_SESSION['sysUserId'])) {
         self::$errCode = "400";
         self::$errMsg = "登陆过期!";
         return false;
     }
     $tableName = "om_unshipped_order";
     //var_dump($orderid_arr); exit;
     if (!$orderid_arr) {
         self::$errCode = "300";
         self::$errMsg = "传值失败!";
         return false;
     }
     $where = " WHERE is_delete = 0 AND storeId = {$storeId} ";
     if ($ostatus) {
         $where .= ' and orderStatus = ' . $ostatus;
     }
     if ($otype) {
         $where .= ' and orderType = ' . $otype;
     }
     $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 {
         self::$errCode = "500";
         self::$errMsg = "无申请权限!";
         return false;
     }
     $accountsee = array();
     for ($i = 0; $i < count($accountList); $i++) {
         $accountsee[] = $accountList[$i];
     }
     if ($accountsee) {
         $where .= ' AND accountId IN (' . join(",", $accountsee) . ') ';
     } else {
         self::$errCode = "600";
         self::$errMsg = "无申请权限!";
         return false;
     }
     $where .= ' AND id in (' . join(',', $orderid_arr) . ') ';
     //基础信息
     /*$sql = "SELECT id FROM ".self::$table_order.$where;
     		//echo $sql; echo "<br>";
     		$query	= self::$dbConn->query($sql);
     		$orderids = self::$dbConn->fetch_array_all($query);
     		
     		foreach($orderids as $value){
     			$orderid = $value['id'];
     			self::limitApplyPrintInfo($orderid);
     		}*/
     //$where = " WHERE id in (".join(',',$orderids).") AND orderStatus = ".C('STATESHIPPED');
     $returnStatus0 = array('orderStatus' => C("STATESHIPPED"), 'orderType' => C('STATESHIPPED_APPLYPRINT'));
     if (OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
         self::$errCode = "200";
         self::$errMsg = "申请打印成功!";
         return true;
     } else {
         self::$errCode = "002";
         self::$errMsg = "申请打印失败!";
         return false;
     }
     /*foreach($orderids as $value){
     			//echo $value['id']."---".$flag; echo "<br>";
     			self::listPushMessage($value['id'],$flag);
     		}*/
 }
	}*/
#############类或API 实例化##############
$api_cs = new CompleteSaleAPI($__ebayaccount);
$time_start = time();
echo "=====[" . date('Y-m-d H:i:s', $time_start) . "]系统【开始】处理账号【 {$__ebayaccount} 】订单 上传发货信息====>\n";
$handle_idx = 0;
foreach ($orders as $order) {
    $handle_idx++;
    $omOrderId = $order['id'];
    //echo $omOrderId; echo "\n";
    /*if($order['platformId'] != 1){
    			echo "订单编号{$omOrderId}不属于ebay平台\n";
    			continue;	
    		}*/
    $where = " where id = {$omOrderId} and storeId = 1 and is_delete = 0 ";
    $orderList = OrderindexModel::showOrderList($tableName, $where);
    //var_dump($orderList); exit;
    $orderTracknumber = $orderList[$omOrderId]['orderTracknumber'];
    if (empty($orderTracknumber)) {
        continue;
        //无跟踪号不处理
    }
    $orderData = $orderList[$omOrderId]['orderData'];
    $orderExtenData = $orderList[$omOrderId]['orderExtenData'];
    $orderUserInfoData = $orderList[$omOrderId]['orderUserInfoData'];
    $orderDetailList = $orderList[$omOrderId]['orderDetail'];
    $countryName = $orderUserInfoData['countryName'];
    $orderId = $orderExtenData['orderId'];
    $transportId = $orderData['transportId'];
    $tracknumber = $orderTracknumber[0]['tracknumber'];
    $combineOrder = $orderData['combineOrder'];
예제 #8
0
 function act_applyEUBTrackNumber()
 {
     //
     global $memc_obj;
     //调用memcache获取sku信息
     $addUser = $_SESSION['sysUserId'];
     $omData = isset($_POST['omData']) ? $_POST['omData'] : '';
     if (empty($omData)) {
         self::$errCode = '1000';
         self::$errMsg = "订单ID参数为空";
         return false;
     }
     $omOrderId = $omData;
     $tName = 'om_unshipped_order';
     $select = '*';
     $where = "WHERE id='{$omOrderId}'";
     $unShippedOrderList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($unShippedOrderList)) {
         //订单号在未发货表中不存在
         self::$errCode = '0001';
         self::$errMsg = "empty unShippedOrderList";
         return 1;
     }
     $platformId = $unShippedOrderList[0]['platformId'];
     $tName = 'om_platform';
     $select = 'platform';
     $where = "WHERE id='{$platformId}'";
     $platformList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($platformList)) {
         self::$errCode = '0002';
         self::$errMsg = "empty platformList";
         return 2;
     }
     $platform = $platformList[0]['platform'];
     if (strcasecmp(trim($platform), 'ebay') != 0) {
         //订单所在平台不是ebay时
         self::$errCode = '0003';
         self::$errMsg = "is not a ebay order";
         return 3;
     }
     //这里还要判断一下运输方式是不是EUB
     ////////////////////////////////
     //return 4;
     ////////////////////////////////
     $accountId = $unShippedOrderList[0]['accountId'];
     //订单中的账号id
     $tName = 'om_eub_account';
     $select = '*';
     $where = "WHERE accountId='{$accountId}'";
     $accountList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($accountList)) {
         self::$errCode = '0005';
         self::$errMsg = "orderAccountId is not in EubAccount";
         return 5;
     }
     if (!in_array($accountList[0]['account'], array('eshoppingstar75', 'ishoppingclub68', 'newcandy789', 'mysoulfor', 'estore456'))) {
         self::$errCode = '0006';
         self::$errMsg = "目前只有 eshoppingstar75,ishoppingclub68,newcandy789,mysoulfor,estore456 可以执行线上申请跟踪号";
         return false;
     }
     //print_r($accountList);
     $APIDevUserID = $accountList[0]['account'];
     //API参数
     $APISellerUserID = $accountList[0]['dev_id'];
     //API参数
     $APIPassword = $accountList[0]['dev_sig'];
     //API参数
     //揽货地址
     $pname = $accountList[0]['pname'];
     $pcompany = $accountList[0]['pcompany'];
     $pcountry = $accountList[0]['pcountry'];
     $pprovince = $accountList[0]['pprovince'];
     $pcity = $accountList[0]['pcity'];
     $pdis = $accountList[0]['pdis'];
     $pstreet = $accountList[0]['pstreet'];
     $pzip = $accountList[0]['pzip'];
     $ptel = $accountList[0]['ptel'];
     $pte1 = $accountList[0]['pte1'];
     $pemail = $accountList[0]['pemail'];
     //寄件人地址
     $dname = $accountList[0]['dname'];
     $dcompany = $accountList[0]['dcompany'];
     $dcountry = $accountList[0]['dcountry'];
     $dprovince = $accountList[0]['dprovince'];
     $dcity = $accountList[0]['dcity'];
     $ddis = $accountList[0]['ddis'];
     $dstreet = $accountList[0]['dstreet'];
     $dzip = $accountList[0]['dzip'];
     $dtel = $accountList[0]['dtel'];
     $demail = $accountList[0]['demail'];
     $shiptype = $accountList[0]['shiptype'];
     //EMS派送类型,上门或自送
     //退货地址
     $rname = $accountList[0]['rname'];
     $rcompany = $accountList[0]['rcompany'];
     $rcountry = $accountList[0]['rcountry'];
     $rprovince = $accountList[0]['rprovince'];
     $rdis = $accountList[0]['rdis'];
     $rstreet = $accountList[0]['rstreet'];
     $rcity = $accountList[0]['rcity'];
     //收件人地址
     $tName = 'om_unshipped_order_userInfo';
     $select = '*';
     $where = "WHERE omOrderId='{$omOrderId}'";
     $userInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($userInfoList)) {
         self::$errCode = '0006';
         self::$errMsg = "empty userInfoList";
         return 6;
     }
     $tusername = $userInfoList[0]['username'];
     //收件人
     $tstreet = $userInfoList[0]['street'];
     //街道
     $tcity = $userInfoList[0]['city'];
     //城市
     $tstate = $userInfoList[0]['state'];
     //省份
     $tcountry = $userInfoList[0]['countryName'];
     //国家名称
     $tcountryCode = $userInfoList[0]['countrySn'];
     //国家简称
     $tpostcode = $userInfoList[0]['zipCode'];
     //邮编
     $tphone = $userInfoList[0]['phone'] ? $userInfoList[0]['phone'] : $userInfoList[0]['landline'];
     //固话,手机号为空时,用座机号
     $temail = $userInfoList[0]['email'];
     //电邮
     //置入参数数组中
     $PickUpAddress = array('Contact' => $pname, 'Company' => $pcompany, 'Street' => $pstreet, 'District' => $pdis, 'City' => $pcity, 'Province' => $pprovince, 'Postcode' => $pzip, 'Country' => $pcountry, 'Email' => $pemail, 'Mobile' => $ptel, 'Phone' => $pte1);
     $ShipFromAddress = array("Contact" => $dname, "Company" => $dcompany, "Street" => $dstreet, "District" => $ddis, "City" => $dcity, "Province" => $dprovince, "Postcode" => $dzip, "Country" => $dcountry, "Email" => $demail, "Mobile" => $dtel);
     $ReturnAddress = array('Contact' => $rname, 'Company' => $rcompany, 'Street' => $rstreet, 'District' => $rdis, 'City' => $rcity, 'Province' => $rprovince, 'Postcode' => $pzip, 'Country' => '中国');
     $ShipToAddress = array('Email' => $temail, 'Company' => '', 'Contact' => $tusername, 'Phone' => $tphone, 'Street' => $tstreet, 'City' => $tcity, 'Province' => $tstate, 'Postcode' => $tpostcode, 'Country' => $tcountry, 'CountryCode' => $tcountryCode);
     ////////////////////////////
     //Item参数
     //orderDetail
     $omOrderDetailIds = OmEUBTrackNumberModel::getOrderDetailIds($omOrderId);
     //print_r($omOrderDetailIds);
     if (count($omOrderDetailIds) == 1) {
         $info = $omOrderDetailIds[0]['id'];
     } else {
         $info = array();
         foreach ($omOrderDetailIds as $value) {
             $info[] = $value['id'];
         }
         $info = implode(",", $info);
     }
     $tName = 'om_unshipped_order_detail_extension_ebay';
     $select = '*';
     $where = "WHERE omOrderdetailId in ({$info})";
     $ebayOrderDetailList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($ebayOrderDetailList)) {
         self::$errCode = '0007';
         self::$errMsg = "empty ebayOrderDetailList";
         return 7;
     }
     //print_r($ebayOrderDetailList);
     $tName = 'om_unshipped_order_extension_ebay';
     $select = '*';
     $where = "WHERE omOrderId='{$omOrderId}'";
     $ebayShippedOrderList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($ebayShippedOrderList)) {
         self::$errCode = '0008';
         self::$errMsg = "empty ebayShippedOrderList";
         return 8;
     }
     //查询订单下的货品数量
     $tName = 'om_unshipped_order_detail';
     $select = 'count(amount) amount';
     $where = "WHERE omOrderId='{$omOrderId}'";
     $amountList = OmAvailableModel::getTNameList($tName, $select, $where);
     $amounts = $amountList[0]['amount'];
     if (empty($amounts)) {
         self::$errCode = '0009';
         self::$errMsg = "empty amounts";
         return 9;
     }
     $Item = array();
     /*foreach ($ebayOrderDetailList as $ebayOrderDetail) {
     		print_r($ebayShippedOrderList);
     		$EBayItemID = $ebayOrderDetail['itemId']; //API参数,物品号
     		$EBayTransactionID = $ebayOrderDetail['transId']; //API参数,交易号,拍卖物品为0
     		$EBayBuyerID = $userInfoList[0]['platformUsername']; //API参数,买家ID
     		$email = $userInfoList[0]['email']; //API参数,买家ID
     		$PostedQTY = $amounts; //寄货数量
     		$currency = $ebayShippedOrderList[0]['currency'];
     		$omOrderdetailId = $ebayOrderDetail['omOrderdetailId'];
     		$tName = 'om_unshipped_order_detail';
     		$select = '*';
     		$where = "WHERE id='$omOrderdetailId'";
     		$omOrderDetailList = OmAvailableModel :: getTNameList($tName, $select, $where);
     		if (empty ($omOrderDetailList)) {
     			self :: $errCode = '0010';
     			self :: $errMsg = "empty omOrderDetailList";
     			return 10;
     		}
     		$sku = $omOrderDetailList[0]['sku'];
     		$amount = $omOrderDetailList[0]['amount'];
     		$skuInfo = $memc_obj->get_extral("sku_info_" . $sku);
     		$DeclaredValue = $skuInfo['goods_sbjz'] * $amount ? $skuInfo['goods_sbjz'] * $amount : 1; //申报价值
     		$Weight = $skuInfo['goods_weight'] * $amount ? $skuInfo['goods_weight'] * $amount : 0.01; //重量
     		$CustomsTitleCN = $skuInfo['goods_zysbmc'] ? $skuInfo['goods_zysbmc'] : $sku; //中文申报名称
     		$CustomsTitleEN = $skuInfo['goods_ywsbmc'] ? $skuInfo['goods_ywsbmc'] : $sku; //英文申报名称
     		$OriginCountryCode = 'CN'; //原产地简码
     		//echo "##".$EBayItemID."##";
     		/*if((!in_array($ebay_itemid.'-'.$ebay_tid, $unique_item_tid))){
     			$unique_item_tid[] = $ebay_itemid.'-'.$ebay_tid;
     			$item[$i]		= array(
     			'CurrencyCode' => $ebay_currency,
     			'EBayEmail' => $ebay_usermail,
     			'EBayBuyerID' => $ebay_userid,
     			'EBayItemID' => $ebay_itemid,
     			'EBayItemTitle' => $ebay_itemtitle,
     			'EBayMessage' => $ebay_note,
     			'EBaySiteID' => "0",
     			'EBayTransactionID' => $ebay_tid,  
     			'Note' => $ebay_noteb,  
     			'OrderSalesRecordNumber' => $recordnumber,
     			'PaymentDate' => $ebay_paidtime,
     			'PayPalEmail' => "0",
     			'PayPalMessage' => $ebay_note,
     			'PostedQTY' => $ebay_amount,
     			'ReceivedAmount' => $ebay_total,
     			'SalesRecordNumber' => $recordnumber1,
     			'SoldDate'			=> $ebay_createdtime,
     			'SoldPrice'			=> $ebay_itemprice,
     			'SoldQTY' 			=> $ebay_amount,
     			'SKU'				=>array(
     								'SKUID' => $sku,
     								'Weight' => $weight * $ebay_amount,
     								'CustomsTitleCN' => $goods_zysbmc,
     								'CustomsTitleEN' => $goods_ywsbmc.' '.$sku,
     								'DeclaredValue' => $goods_sbjz*$ebay_amount,
     								'OriginCountryName' => "China",
     								'OriginCountryCode' => "CN",
     								)
     			);
     		}*/
     $where = "WHERE omOrderId='{$omOrderId}'";
     $orderarr = OrderindexModel::showSearchOrderList("om_unshipped_order", $where);
     //print_r($orderarr);
     $unique_item_tid = array();
     foreach ($orderarr as $key => $order) {
         foreach ($order['orderDetail'] as $k => $detail) {
             $sku = $detail['orderDetailData']['sku'];
             $amount = $detail['orderDetailData']['amount'];
             //$goods = ExportsToXlsModel::getGoods($detail['orderDetailData']['sku']);
             $skus = GoodsModel::get_realskuinfo($detail['orderDetailData']['sku']);
             foreach ($skus as $k => $v) {
                 $goods = GoodsModel::getSkuList($k);
                 if (!in_array($detail['orderDetailExtenData']['itemId'] . '-' . $detail['orderDetailExtenData']['transId'], $unique_item_tid)) {
                     $unique_item_tid[] = $detail['orderDetailExtenData']['itemId'] . '-' . $detail['orderDetailExtenData']['transId'];
                     $Item[] = array('EBayBuyerID' => $order['orderUserInfoData']['platformUsername'], 'EBayItemID' => $detail['orderDetailExtenData']['itemId'], 'EBayEmail' => $order['orderUserInfoData']['email'], 'EBayTransactionID' => $detail['orderDetailExtenData']['transId'], 'PostedQTY' => $detail['orderDetailData']['amount'], 'EBaySiteID' => "0", 'PayPalEmail' => "0", 'EBayItemTitle' => $detail['orderDetailExtenData']['itemTitle'], 'OrderSalesRecordNumber' => $order['orderData']['recordNumber'], 'EBayMessage' => $order['orderExtenData']['feedback'], 'CurrencyCode' => $order['orderExtenData']['currency'], 'SoldDate' => date("Y-m-d", $order['orderData']['ordersTime']), 'SoldPrice' => $detail['orderDetailData']['itemPrice'], 'SoldQTY' => $detail['orderDetailData']['amount'], 'ReceivedAmount' => $order['orderData']['actualTotal'], 'PayPalMessage' => $order['orderExtenData']['feedback'], 'PaymentDate' => date("Y-m-d", $order['orderData']['paymentTime']), 'SalesRecordNumber' => $order['orderData']['recordNumber'], 'Note' => isset($order['orderNote'][0]['content']) ? $order['orderNote'][0]['content'] : "", 'SKU' => array('SKUID' => $detail['orderDetailData']['sku'], 'Weight' => $goods['goodsWeight'] * $amount * $v, 'CustomsTitleCN' => $goods['goodsName'], 'CustomsTitleEN' => $sku, 'DeclaredValue' => $detail['orderDetailData']['itemPrice'] * $amount * $v, 'OriginCountryName' => "China", 'OriginCountryCode' => "CN"));
                 }
             }
         }
     }
     $url_test = "http://epacketws.pushauction.net/v3/orderservice.asmx?WSDL";
     $url = "http://shippingapi.ebay.cn/production/v3/orderservice.asmx?wsdl";
     $soapclient = new soapclient($url);
     $params = array('Version' => "3.0.0", 'APIDevUserID' => $APIDevUserID, 'APIPassword' => $APIPassword, 'APISellerUserID' => $APISellerUserID, "OrderDetail" => array("PickUpAddress" => $PickUpAddress, "ShipFromAddress" => $ShipFromAddress, "ShipToAddress" => $ShipToAddress, "ItemList" => array("Item" => $Item), "EMSPickUpType" => $shiptype, "ReturnAddress" => $ReturnAddress));
     try {
         //print_r($params);
         $functions = $soapclient->AddAPACShippingPackage(array("AddAPACShippingPackageRequest" => $params));
         //echo "dfg";
         foreach ($functions as $value) {
             $bb = (array) $value;
             $ack = $bb['Ack'];
             if ($ack == 'Success') {
                 $TrackCode = $bb['TrackCode'];
                 //这里插入记录到records表中
                 $tName = 'om_order_tracknumber';
                 $set = "SET omOrderId='{$omOrderId}',addUser='******',tracknumber='{$TrackCode}',createdTime='" . time() . "'";
                 $affectRow = OmAvailableModel::insertRow($tName, $set);
                 if ($affectRow) {
                     self::$errCode = '200';
                     self::$errMsg = "success";
                     return 200;
                 } else {
                     self::$errCode = '0011';
                     self::$errMsg = "添加跟踪号失败";
                     return 11;
                 }
             } else {
                 $tName = 'om_order_notes';
                 $set = "SET omOrderId='{$omOrderId}',content='{$bb['Message']}',userId='{$addUser}',createdTime='" . time() . "'";
                 $affectRow = OmAvailableModel::insertRow($tName, $set);
                 self::$errCode = '0012';
                 self::$errMsg = $bb['Message'];
                 return 12;
             }
         }
     } catch (Exception $e) {
         self::$errCode = '0013';
         self::$errMsg = $e->getMessage();
         return 0;
     }
 }
예제 #9
0
        if (OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
            echo "\n=====同步的订单{$orderid}状态成功======\n";
        }
        $msg = CommonModel::updateWarehouseInfo($orderid, 2, $operateUserId, $operateTime, $actualWeight);
        if ($msg) {
            $where = ' WHERE id in (' . join(",", $orderids) . ') AND orderStatus= ' . C('STATESHIPPED') . ' AND orderType= ' . C('STATEHASSHIPPED_CONV') . ' AND is_delete = 0 ';
            if (OrderindexModel::shiftOrderList($where)) {
                echo "转移成功\n";
            } else {
                echo "转移失败\n";
            }
        }
    } else {
        $where = " WHERE id in (" . join(',', $orderids) . ") AND orderStatus = " . C('STATESHIPPED');
        $returnStatus0 = array('orderType' => C($orderStatus));
        if (OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
            echo "\n=====同步的订单{$orderid}状态成功======\n";
        }
        $msg = commonModel::updateWarehouseInfo($orderid, C($orderStatus), $operateUserId, $operateTime);
        if ($tracknumber) {
            $updateArr = array('omOrderId' => $orderid, 'tracknumber' => $tracknumber, 'createdTime' => time());
            $msg = OrderAddModel::insertOrderTrackRow($updateArr);
        }
    }
};
$channel->basic_consume($queue_name, '', false, true, false, false, $callback);
while (count($channel->callbacks)) {
    $channel->wait();
}
$channel->close();
$connection->close();
예제 #10
0
 public static function combineOrder($orderIdArr)
 {
     self::initDB();
     BaseModel::begin();
     //开始事务
     $serchSql = "SELECT * FROM om_unshipped_order WHERE id in ('" . join("','", $orderIdArr) . "') and is_delete = 0 and storeId = 1 ";
     $querySql = self::$dbConn->query($serchSql);
     $serchSqlArr = self::$dbConn->fetch_array_all($querySql);
     //判断一:订单数量统计
     if (count($serchSqlArr) < 2) {
         self::$errCode = "1111";
         self::$errMsg = "合并订单最少需要选择两个或两个以上的订单!";
         return false;
     }
     $platfrom = omAccountModel::getPlatformSuffixById($serchSqlArr[0]['platformId']);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     $temporderStatus = "";
     //相同状态一
     $temporderStatus2 = "";
     //相同状态二
     $userinfo = array();
     //订单相同条件
     $orderSn = array();
     //订单编号
     $onlineTotal = 0;
     //线上总价
     $actualTotal = 0;
     //实际收款总价
     $calcWeight = 0;
     //估算重量,单位是kg
     $calcShipping = 0;
     //估算运费
     foreach ($serchSqlArr as $selectArr) {
         $orderSn[] = $selectArr['id'];
         $onlineTotal += $selectArr['onlineTotal'];
         $actualTotal += $selectArr['actualTotal'];
         $calcWeight += $selectArr['calcWeight'];
         $calcShipping += $selectArr['calcShipping'];
         //判断二:订单被其他人 <锁定> 订单判断
         if ($selectArr['isLock'] == 1) {
             self::$errCode = "2222";
             self::$errMsg = "订单[" . $selectArr['id'] . "]已经被 [" . UserModel::getUsernameById($selectArr['lockUser']) . "] 锁定,不能合并操作。";
             return false;
         }
         //判断三:已合并订单,无法再次合并判断
         if (in_array($selectArr['combineOrder'], array(1, 2))) {
             self::$errCode = "3333";
             self::$errMsg = "订单[" . $selectArr['id'] . "]已经有订单合并操作,不能重复订单合并。";
             return false;
         }
         //判断四:已合并包裹订单,无法合并判断
         if (in_array($selectArr['combinePackage'], array(1, 2))) {
             self::$errCode = "4444";
             self::$errMsg = "订单[" . $selectArr['id'] . "]是合并包裹订单,不能订单合并操作。";
             return false;
         }
         //判断五:订单信息不相同判断
         $userinfsql = "SELECT * FROM om_unshipped_order_userInfo WHERE omOrderId = {$selectArr['id']}";
         $userinfsql = self::$dbConn->fetch_first($userinfsql);
         $tempArr = array();
         $tempArr['accountId'] = trim($selectArr['accountId']);
         $tempArr['platformUsername'] = trim($userinfsql['platformUsername']);
         $tempArr['username'] = trim($userinfsql['username']);
         $tempArr['countryName'] = trim($userinfsql['countryName']);
         $tempArr['state'] = trim($userinfsql['state']);
         $tempArr['city'] = trim($userinfsql['city']);
         $tempArr['street'] = trim($userinfsql['street']);
         $tempArr['currency'] = trim($userinfsql['currency']);
         //币种判断
         if (!empty($userinfo) && $userinfo != $tempArr) {
             self::$errCode = "5555";
             self::$errMsg = "订单信息不相同,无法合并订单操作。";
             return false;
         }
         $userinfo = $tempArr;
         //订单信息相同,进入下次比较。
         //判断六:同状态判断
         $orderStatus = "";
         //订单状态一
         $orderType = "";
         //订单状态二
         $orderStatus = $selectArr['orderStatus'];
         $orderType = $selectArr['orderType'];
         if (!empty($temporderStatus) && $temporderStatus != $orderStatus) {
             self::$errCode = "6666";
             self::$errMsg = "订单不在同一文件夹,无法合并订单操作。";
             return false;
         }
         $temporderStatus = $orderStatus;
         if (!empty($temporderStatus2) && $temporderStatus2 != $orderType) {
             self::$errCode = "6666";
             self::$errMsg = "订单不在同一文件夹,无法合并订单操作。";
             return false;
         }
         $orderExtensql = "SELECT * FROM om_unshipped_order_extension_" . $extension . " WHERE omOrderId = {$selectArr['id']}";
         $orderExtensql = self::$dbConn->fetch_first($orderExtensql);
         $temporderStatus2 = $orderType;
     }
     $insertOrder = array();
     $insertOrder['orderData'] = $serchSqlArr[0];
     $insert_userinfo = $userinfsql;
     unset($insert_userinfo['omOrderId']);
     $insertOrder['orderUserInfoData'] = $insert_userinfo;
     $insert_orderExtensql = $orderExtensql;
     unset($insert_orderExtensql['omOrderId']);
     $insertOrder['orderExtenData'] = $insert_orderExtensql;
     //$insertOrder['orderNote'] = $userinfsql;
     unset($insertOrder['orderData']['id']);
     $insertOrder['orderData']['onlineTotal'] = $onlineTotal;
     $insertOrder['orderData']['actualTotal'] = $actualTotal;
     $insertOrder['orderData']['calcWeight'] = $calcWeight;
     $insertOrder['orderData']['calcShipping'] = $calcShipping;
     $insertOrder['orderData']['orderAddTime'] = time();
     $insertOrder['orderData']['combineOrder'] = 2;
     $insertOrder['orderData']['orderAttribute'] = 3;
     //$insertOrder['orderDetail'] = array();
     $detailSql = "SELECT * FROM om_unshipped_order_detail WHERE omOrderId in ('" . join("','", $orderIdArr) . "') and is_delete = 0 and storeId = 1 ";
     $detailSql = self::$dbConn->query($detailSql);
     $detailSqlArr = self::$dbConn->fetch_array_all($detailSql);
     $orderDetail = array();
     foreach ($detailSqlArr as $value) {
         //$orderDetailData = array();
         //$orderDetailExtenData = array();
         $obj_orderDetail = $value;
         unset($obj_orderDetail['id']);
         unset($obj_orderDetail['omOrderId']);
         $orderDetailData = $obj_orderDetail;
         $detailExtenSql = "SELECT * FROM om_unshipped_order_detail_extension_" . $extension . " WHERE omOrderdetailId = '" . $value['id'] . "' ";
         $detailExtenSql = self::$dbConn->query($detailExtenSql);
         $detailExtenSqlArr = self::$dbConn->fetch_array($detailExtenSql);
         $obj_orderDetailExten = $detailExtenSqlArr;
         unset($obj_orderDetailExten['omOrderdetailId']);
         $orderDetailExtenData = $obj_orderDetailExten;
         $orderDetail[] = array('orderDetailData' => $orderDetailData, 'orderDetailExtenData' => $orderDetailExtenData);
     }
     $insertOrder['orderDetail'] = $orderDetail;
     //var_dump($insertOrder); exit;
     if ($insertId = OrderAddModel::insertAllOrderRowNoEvent($insertOrder)) {
         //echo $split_log .= 'insert success!' . "\n"; exit;
         //var_dump($_mainId,$_spitId); exit;
         if (!OrderLogModel::insertOrderLog($insertId, '合并产生新订单')) {
             BaseModel::rollback();
             self::$errCode = '001';
             self::$errMsg = "合并失败!";
             return false;
         }
         if (!OrderRecordModel::insertCombineRecord($serchSqlArr[0]['id'], $insertId)) {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "合并订单失败添加记录失败!";
             return false;
         }
         $updateOrder = array();
         $updateOrder['is_delete'] = 1;
         $updateOrder['combineOrder'] = 1;
         if (!OrderindexModel::updateOrder("om_unshipped_order", $updateOrder, " WHERE id in ('" . join("','", $orderSn) . "')")) {
             BaseModel::rollback();
             //事物回滚
             self::$errCode = "0012";
             self::$errMsg = "合并更新原始订单失败!";
             return false;
         }
     } else {
         //$split_log .= '补寄新订单产生失败!' . "\n";
         BaseModel::rollback();
         self::$errCode = '003';
         self::$errMsg = "合并新订单产生失败";
         return false;
     }
     BaseModel::commit();
     self::$errCode = '200';
     self::$errMsg = "合并新订单成功!";
     return TRUE;
 }
예제 #11
0
    			echo $account." add error!\n";
    		}
    	}*/
}
exit;
$tableName = "om_account";
/*$db_config	=	C("DB_CONFIG");
$dbConn		=	new mysql();
$dbConn->connect($db_config["master1"][0],$db_config["master1"][1],$db_config["master1"][2],'');
$dbConn->select_db($db_config["master1"][4]);*/
//echo ' [x] ', json_decode($msg->body), "\n";
//var_dump($msg->body); echo "\n";
$where = ' WHERE orderStatus = 100 and orderType in(101,110) and is_delete = 0 and storeId = 1 ';
$orderNum = OrderindexModel::showOrderNum($tableName, $where);
echo $orderNum;
echo "\n";
$page = 1;
$perpage = 1000;
$totalpage = ceil($orderNum / $perpage);
while ($page <= $totalpage) {
    echo "总共{$totalpage}页---现在是第{$page}页\n";
    //$start_num  = ($page-1)*$perpage;
    $start_num = 0;
    $limit = " ORDER BY id LIMIT {$start_num}, {$perpage}";
    if (OrderindexModel::shiftOrderList($where . $limit)) {
        echo "转移成功\n";
    } else {
        echo "转移失败\n";
    }
    $page++;
}
예제 #12
0
 public function act_ApplicationException($omOrderId, $content)
 {
     $tableName = "om_unshipped_order";
     $storeId = 1;
     if (!$omOrderId || !$content) {
         self::$errCode = '5806';
         self::$errMsg = 'param is error';
         return array();
     }
     $where = " WHERE id = " . $omOrderId . " AND orderStatus = " . C('STATESHIPPED');
     $returnStatus0 = array('orderStatus' => C('STATEINTERCEPTSHIP'), 'orderType' => C('STATEPENDING_APPEXC'));
     if (!OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
         self::$errCode = '5807';
         self::$errMsg = 'update error';
         return false;
     }
     $insertOrderNoteDada = array('omOrderId' => $omOrderId, 'content' => $content, 'userId' => 0, 'createdTime' => time());
     if ($insertOrderNoteids = OrderAddModel::insertOrderNotesRow($insertOrderNoteDada)) {
         self::$errCode = '5808';
         self::$errMsg = 'insert Note error';
         return false;
     }
     self::$errCode = '200';
     self::$errMsg = 'sync success';
     return true;
 }
예제 #13
0
 public function act_transportFee()
 {
     $omOrderId = $_POST['id'];
     $tableName = 'om_unshipped_order';
     $where = ' WHERE id = ' . $omOrderId;
     $orderList = OrderindexModel::showOrderList($tableName, $where);
     $orderData = $orderList[$omOrderId];
     $data = array();
     //print_r($orderData);
     $obj_order_detail_data = array();
     foreach ($orderData['orderDetail'] as $sku => $detail) {
         $obj_order_detail_data[] = $detail['orderDetailData'];
     }
     $weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
     $data['calcWeight'] = $weightfee[0];
     $calcShippingInfo = CommonModel::calcAddOrderShippingFee($orderData, 1);
     //计算运费
     //var_dump($calcShippingInfo); exit;
     $calcInfo = CommonModel::calcAddOrderWeight($orderData['orderDetail']);
     //计算重量和包材
     //var_dump($calcInfo); exit;
     $data['calcWeight'] = $calcInfo[0];
     $data['pmId'] = $calcInfo[1];
     $data['calcShipping'] = $calcShippingInfo['fee']['fee'];
     $data['channelId'] = $calcShippingInfo['fee']['channelId'];
     if (OrderindexModel::updateOrder($tableName, $data, $where)) {
         self::$errCode = OrderindexModel::$errCode;
         self::$errMsg = OrderindexModel::$errMsg;
         return true;
     } else {
         self::$errCode = OrderindexModel::$errCode;
         self::$errMsg = OrderindexModel::$errMsg;
         return false;
     }
 }
예제 #14
0
 public function view_exportsToXls3()
 {
     error_reporting(E_ALL);
     $type = isset($_GET['type']) ? $_GET['type'] : "";
     $order = isset($_GET['order']) ? $_GET['order'] : "";
     //echo typeof();
     if ($type == 1) {
         $arr = explode(",", $order);
         $ostatus = $arr[0];
         $otype = $arr[1];
         $where = "where da.orderStatus='{$ostatus}' and da.orderType='{$otype}' and da.is_delete=0";
     } elseif ($type == 2) {
         $where = "where da.id in({$order})";
     }
     //
     $orderarr = OrderindexModel::showSearchOrderList("om_unshipped_order", $where);
     //echo "<pre>"; print_r($orderarr[98]);exit;
     $exporter = new ExportDataExcel("browser", "xls3" . $date . ".xls");
     $exporter->initialize();
     // starts streaming data to web browser
     $exporter->addRow(array("SKU编号", "商品中文名称", "商品英文名称", "重量(3位小数)", "报关价格(整数)", "原寄地", "保存至系统SKU"));
     foreach ($orderarr as $id => $order) {
         foreach ($order['orderDetail'] as $key => $value) {
             //$goods = exportsToXlsModel::getGoods($value['orderDetailData']['sku']);
             $goods = GoodsModel::getSkuList($value['orderDetailData']['sku']);
             //print_r($goods);
             $exporter->addRow(array($value['orderDetailData']['sku'], $goods['goodsName'], $value['orderDetailExtenData']['itemTitle'], $goods['goodsWeight'], "3", "CN", "1"));
         }
     }
     $exporter->finalize();
     // writes the footer, flushes remaining data to browser.
     exit;
 }
예제 #15
0
 public static function killAllOrderRowNoEvent($omOrderId, $platformId, $tableName = 'om_unshipped_order')
 {
     !self::$dbConn ? self::initDB() : null;
     /*$where = ' WHERE id = {$omOrderId} AND storeId = 1 AND is_delete = 0 ';
     		$sql = "SELECT * FROM $tableName $where";
             //echo $sql.'<br>';
     		
     		$query = self :: $dbConn->query($sql);
     		$orderList = self :: $dbConn->fetch_array($query);
     		$orderData = $orderList[$omOrderId];
     		$omOrderId = $orderData['id'];
     		//echo $omOrderId; echo "<br>";
     		$orderList[$omOrderId]['orderData'] = $orderData;*/
     if (!self::killOrder($omOrderId)) {
         self::$errCode = "010";
         self::$errMsg = "删除订单表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     $platfrom = omAccountModel::getPlatformSuffixById($platformId);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     if (!self::killOrderExtenData($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "011";
         self::$errMsg = "删除订单附带表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     //var_dump($orderExtenData);
     if (!self::killOrderUserInfoData($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "012";
         self::$errMsg = "删除订单用户信息表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     if (!self::killOrderWhInfoData($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "013";
         self::$errMsg = "删除订单仓库信息表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     if (!self::killOrderDetailList($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "014";
         self::$errMsg = "删除订单明细表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     /*if(!self::killOrderDetailList($tableName, 'WHERE omOrderId = '.$omOrderId, $extension)){
     			self :: $errCode = "015";
     			self :: $errMsg = "删除订单明细表失败";
     			return false; //失败则设置错误码和错误信息, 返回false	
     		}*/
     return true;
 }
예제 #16
0
 public function act_operateAbOrderAPI()
 {
     if (!isset($_POST['omData'])) {
         self::$errCode = 500;
         self::$errMsg = '未成功接收数据!';
         return false;
     }
     $ostatus = 770;
     $otype = 0;
     $storeId = 1;
     $orderstr = $_POST['omData'];
     $orderstr2 = $_POST['omData2'];
     $orderids = array_unique(explode(',', $orderstr));
     $invoiceids = array_unique(explode(',', $orderstr2));
     if (!$orderids) {
         self::$errCode = 400;
         self::$errMsg = '未获取订单编号信息!';
         return false;
     }
     //var_dump($orderids); exit;
     $OrderindexAct = new OrderindexAct();
     $WarehouseAPIAct = new WarehouseAPIAct();
     foreach ($orderids as $k => $orderId) {
         BaseModel::begin();
         //开始事务
         $insertOrderData = array();
         $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($invoiceids[$k]);
         //var_dump($AbOrderInfo); echo "<br>";
         //exit;
         $where = ' WHERE id = ' . $orderId . ' and is_delete = 0 AND storeId = ' . $storeId . ' LIMIT 1';
         $orderList = $OrderindexAct->act_showOrderList($ostatus, $otype, $where);
         //var_dump($orderList);exit;
         $order = $orderList[$orderId];
         $orderData = $order['orderData'];
         $insert_orderData = $orderData;
         unset($insert_orderData['id']);
         $insert_orderData['orderStatus'] = C('STATEOUTOFSTOCK');
         $insert_orderData['orderType'] = C('STATEOUTOFSTOCK_ABNORMAL');
         $orderExtenData = $order['orderExtenData'];
         $insert_orderExtenData = $orderExtenData;
         unset($insert_orderExtenData['omOrderId']);
         $orderUserInfoData = $order['orderUserInfoData'];
         $insert_orderUserInfoData = $orderUserInfoData;
         unset($insert_orderUserInfoData['omOrderId']);
         //$orderTracknumber = $order['orderTracknumber'];
         //$orderAudit = $order['orderAudit'];
         $orderDetail = $order['orderDetail'];
         $insertOrderData['orderData'] = $insert_orderData;
         $insertOrderData['orderExtenData'] = $insert_orderExtenData;
         $insertOrderData['orderUserInfoData'] = $insert_orderUserInfoData;
         $insert_orderDetail = array();
         $need_delete_ids = array();
         foreach ($orderDetail as $dkey => $detailValue) {
             $orderDetailData = $detailValue['orderDetailData'];
             $orderDetailExtenData = $detailValue['orderDetailExtenData'];
             if (!isset($AbOrderInfo[$orderDetailData['sku']]) || $AbOrderInfo[$orderDetailData['sku']] == 0) {
                 $insert_orderDetailData = $orderDetailData;
                 unset($insert_orderDetailData['id']);
                 unset($insert_orderDetailData['omOrderId']);
                 $insert_orderDetailExtenData = $orderDetailExtenData;
                 unset($insert_orderDetailExtenData['omOrderdetailId']);
                 $insert_orderDetail[$dkey]['orderDetailData'] = $insert_orderDetailData;
                 $insert_orderDetail[$dkey]['orderDetailExtenData'] = $insert_orderDetailExtenData;
                 $need_delete_ids[] = $orderDetailData['id'];
             }
         }
         $insertOrderData['orderDetail'] = $insert_orderDetail;
         $count_insert_orderDetail = count($insert_orderDetail);
         $count_orderDetail = count($orderDetail);
         $tableName = "om_unshipped_order";
         if ($count_insert_orderDetail > 0 && $count_insert_orderDetail < $count_orderDetail) {
             $calcWeight = CommonModel::calcNowOrderWeight($orderId);
             //重新计算原来订单的重量
             if (!OrderindexModel::deleteOrderDetail(array('is_delete' => 1), ' where id in(' . join(',', $need_delete_ids) . ')')) {
                 BaseModel::rollback();
                 self::$errCode = '005';
                 self::$errMsg = "删除原订单明细失败!";
                 return false;
             }
             $insertOrderData['orderData']['isCopy'] = 2;
             $insertOrderData['orderData']['actualTotal'] = 0.0;
             //var_dump($orderData);exit;
             $calcInfo = CommonModel::calcAddOrderWeight($insert_orderDetail);
             //计算重量和包材
             //var_dump($calcInfo); exit;
             $insertOrderData['orderData']['calcWeight'] = $calcInfo[0];
             $insertOrderData['orderData']['pmId'] = $calcInfo[1];
             if (count($insertOrderData['orderDetail']) > 1) {
                 $insertOrderData['orderData']['orderAttribute'] = 3;
             } else {
                 if (isset($insertOrderData['orderDetail'][0]['orderDetailData']['amount']) && $insertOrderData['orderDetail'][0]['orderDetailData']['amount'] > 1) {
                     $insertOrderData['orderData']['orderAttribute'] = 2;
                 }
             }
             $calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, 1);
             //计算运费
             $insertOrderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
             $insertOrderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
             //print_r($insertOrderData); exit;
             if ($_spitId = OrderAddModel::insertAllOrderRowNoEvent($insertOrderData)) {
                 if (!OrderLogModel::insertOrderLog($_spitId, 'INSERT ORDER')) {
                     BaseModel::rollback();
                     self::$errCode = '001';
                     self::$errMsg = "插入订单日志失败!";
                     return false;
                 }
                 if (!OrderRecordModel::insertSpitRecords($orderId, $_spitId)) {
                     BaseModel::rollback();
                     self::$errCode = '002';
                     self::$errMsg = "插入拆分日志失败!";
                     return false;
                 }
             } else {
                 BaseModel::rollback();
                 self::$errCode = '010';
                 self::$errMsg = "插入订单信息失败!";
                 return false;
             }
             $returnStatus0 = array('isCopy' => 1, 'calcWeight' => $calcWeight);
             $rtn = $WarehouseAPIAct->act_operateAbOrder($invoiceids[$k], $calcWeight);
             if (!$rtn) {
                 BaseModel::rollback();
                 self::$errCode = '011';
                 self::$errMsg = "调用仓库系统拆分功能失败!";
                 return false;
             }
         } else {
             $returnStatus0 = array('orderStatus' => $insert_orderData['orderStatus'], 'orderType' => $insert_orderData['orderType']);
         }
         if (!OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "订单移动到缺货异常失败!";
             return false;
         }
         BaseModel::commit();
         BaseModel::autoCommit();
     }
     self::$errCode = 200;
     self::$errMsg = '缺货拆分完成!';
     return true;
 }
예제 #17
0
 function act_updateMenuStatusAPI()
 {
     $orderId = post_check(trim($_REQUEST['orderId']));
     $ebay_status = $_REQUEST['ebay_status'];
     $final_status = $_REQUEST['final_status'];
     $truename = $_REQUEST['username'];
     if (empty($orderId)) {
         self::$errCode = 401;
         self::$errMsg = 'orderId is null';
         return false;
     }
     if (empty($ebay_status)) {
         self::$errCode = 402;
         self::$errMsg = 'ebay_status is null';
         return false;
     }
     if (empty($final_status)) {
         self::$errCode = 403;
         self::$errMsg = 'final_status is null';
         return false;
     }
     if (empty($truename)) {
         self::$errCode = 404;
         self::$errMsg = 'truename is null';
         return false;
     }
     $status1 = getStatusMenuByOldStatus($final_status);
     $orderStatus1 = $status1[0];
     $orderType1 = $status1[1];
     $status2 = getStatusMenuByOldStatus($ebay_status);
     $orderStatus2 = $status2[0];
     $orderType2 = $status2[1];
     $tableName = "om_unshipped_order";
     $data['orderStatus'] = $orderStatus1;
     $data['orderType'] = $orderType1;
     $where = " where id = {$orderId} AND orderStatus = {$orderStatus2} AND orderType = {$orderType2} AND is_delete = 0 ";
     $updatedata = OrderindexModel::updateOrder($tableName, $data, $where);
     if ($updatedata) {
         self::$errCode = 200;
         self::$errMsg = 'update success';
         return true;
     } else {
         self::$errCode = 405;
         self::$errMsg = 'update error';
         return false;
     }
 }
예제 #18
0
 public static function calcNowOrderWeight($omOrderId)
 {
     global $memc_obj;
     //调用memcache对象
     /*$pmList = GoodsModel::getMaterInfo(); //memcache中取得包材信息
     		$orderWeight = 0; //初始化要返回的订单重量变量
     		if (intval($omOrderId) == 0) { //订单号不合法
     			return false;
     		}
     		$tName = 'om_unshipped_order';
     		$select = '*';
     		$where = "WHERE is_delete=0 AND id='$omOrderId'";
     		$omOrderList = OmAvailableModel :: getTNameList($tName, $select, $where);
     		if (empty ($omOrderList)) { //没有对应订单号
     			return false;
     		}
     		$omOrderPmId = $omOrderList[0]['pmId']; //订单的包材号
     		$pmWeight = $pmList[$omOrderPmId]['pmWeight']; //该订单对应的包材重量
     		$orderWeight += $pmWeight; //累加
     	
     		$tName = 'om_unshipped_order_detail';
     		$select = '*';
     		$where = "WHERE omOrderId='$omOrderId'";
     		$omOrderDetailList = OmAvailableModel :: getTNameList($tName, $select, $where);
     		if (empty ($omOrderId)) { //没有对应订单号的订单明细
     			return false;
     		}
     		foreach ($omOrderDetailList as $omOrderDetail) {
     			$sku = $omOrderDetail['sku'];
     			$amount = $omOrderDetail['amount'];
     			$skuInfo = GoodsModel::getSkuList($sku);
     			$skuWeight = $skuInfo['goods_weight'] * $amount;
     			$orderWeight += $skuWeight; //累加sku重量
     		}
     		return $orderWeight;*/
     $tableName = 'om_unshipped_order';
     $where = ' WHERE id = ' . $omOrderId . ' and is_delete = 0 and storeId = 1';
     //$orderData = OrderindexModel::showOnlyOrderList($tableName, $where);
     $orderDetailData = OrderindexModel::showOnlyOrderDetailList($tableName, ' WHERE omOrderId = ' . $omOrderId . ' and is_delete = 0 and storeId = 1');
     //var_dump($orderDetailData); exit;
     return self::calcOrderWeight($orderDetailData);
 }
예제 #19
0
 public function act_recalculated_bak()
 {
     $orderId = isset($_REQUEST['orderid']) ? $_REQUEST['orderid'] : '';
     if (empty($orderId)) {
         self::$errCode = "006";
         self::$errMsg = "订单号错误!";
         return false;
     }
     $tNameUnShipped = 'om_unshipped_order';
     //未發貨订单表
     $where = ' WHERE id = "' . $orderId . '" ';
     $shipOrderList = OrderindexModel::showOrderList($tNameUnShipped, $where);
     $shipOrderList = isset($shipOrderList[$orderId]) ? $shipOrderList[$orderId] : '';
     if (empty($shipOrderList)) {
         self::$errCode = "007";
         self::$errMsg = "查询数据出错!";
         return false;
     }
     $orderDetail = $shipOrderList['orderDetail'];
     $obj_order_detail_data = array();
     foreach ($orderDetail as $k => $v) {
         $orderdata_detail = array();
         $orderdata_detail['recordNumber'] = $v['orderDetailData']['recordNumber'];
         $orderdata_detail['sku'] = $v['orderDetailData']['sku'];
         $orderdata_detail['itemPrice'] = $v['orderDetailData']['itemPrice'];
         $orderdata_detail['amount'] = $v['orderDetailData']['amount'];
         $orderdata_detail['createdTime'] = time();
         $orderDetailExtAli = array();
         $orderDetailExtAli['itemTitle'] = $v['orderDetailExtenData']['itemTitle'];
         $orderDetailExtAli['itemURL'] = $v['orderDetailExtenData']['itemURL'];
         $orderDetailExtAli['itemId'] = $v['orderDetailExtenData']['itemId'];
         $orderDetailExtAli['transId'] = $v['orderDetailExtenData']['transId'];
         $orderDetailExtAli['note'] = $v['orderDetailExtenData']['note'];
         $obj_order_detail_data[] = array('orderDetailData' => $orderdata_detail, 'orderDetailExtenData' => $orderDetailExtAli);
     }
     $calcInfo = CommonModel::calcAddOrderWeight($obj_order_detail_data);
     //计算重量和包材
     if (isset($calcInfo[0])) {
         return $calcInfo[0];
     } else {
         self::$errCode = "008";
         self::$errMsg = "计算数据出错!";
         return false;
     }
 }
예제 #20
0
 public function view_modifyOrderList()
 {
     global $memc_obj;
     $sysUserId = $_SESSION['sysUserId'];
     $modify_showerrorinfo = '';
     $OrderModifyAct = new OrderModifyAct();
     $OrderindexAct = new OrderindexAct();
     $UserCompetenceAct = new UserCompetenceAct();
     //var_dump($_GET); exit;
     if (isset($_GET) && !empty($_GET)) {
         $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : '';
         $ostatus = isset($_GET['edit_ostatus']) ? $_GET['edit_ostatus'] : $_GET['ostatus'];
         $otype = isset($_GET['edit_otype']) ? $_GET['edit_otype'] : $_GET['otype'];
     }
     if (isset($_POST) && !empty($_POST)) {
         //var_dump($_POST); echo "<br>"; exit;
         $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : '';
         $ostatus = isset($_POST['edit_ostatus']) ? $_POST['edit_ostatus'] : $_POST['ostatus'];
         $otype = isset($_POST['edit_otype']) ? $_POST['edit_otype'] : $_POST['otype'];
         $update_order = array();
         $update_userinfo = array();
         $update_tracknumber = array();
         //$orderid = $_POST['orderid'];
         //var_dump($_POST); exit;
         $updatestatus = false;
         if ($_POST['action'] == 'addDetail') {
             //var_dump($_GET); echo "<br>"; exit;
             $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : '';
             $ostatus = isset($_GET['edit_ostatus']) ? $_GET['edit_ostatus'] : $_GET['ostatus'];
             $otype = isset($_GET['edit_otype']) ? $_GET['edit_otype'] : $_GET['otype'];
             if ($OrderModifyAct->act_batchAdd($orderid, $_POST)) {
                 $modify_showerrorinfo = "<font color='green'>添加成功</font>";
             } else {
                 $modify_showerrorinfo = "<font color='red'>添加失败</font>";
             }
         } else {
             if ($_POST['action'] == 'addNote') {
                 //var_dump($_GET); echo "<br>"; exit;
                 $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : '';
                 $ostatus = isset($_GET['edit_ostatus']) ? $_GET['edit_ostatus'] : $_GET['ostatus'];
                 $otype = isset($_GET['edit_otype']) ? $_GET['edit_otype'] : $_GET['otype'];
                 if ($OrderModifyAct->act_addNote($orderid, $_POST)) {
                     $modify_showerrorinfo = "<font color='green'>添加成功</font>";
                 } else {
                     $modify_showerrorinfo = "<font color='red'>添加失败</font>";
                 }
             } else {
                 $visible_movefolder = $UserCompetenceAct->act_getInStatusIds($_POST['otype'], $sysUserId);
                 if (!in_array($_POST['edit_otype'], $visible_movefolder)) {
                     $modify_showerrorinfo = "<font color='red'>您没有改变订单状态的权限</font>";
                 } else {
                     if ($_POST['username'] != $_POST['edit_username']) {
                         $update_userinfo['username'] = $_POST['edit_username'];
                     }
                     if ($_POST['ostatus'] != $_POST['edit_ostatus']) {
                         $update_order['orderStatus'] = $_POST['edit_ostatus'];
                     }
                     if ($_POST['otype'] != $_POST['edit_otype']) {
                         $update_order['orderType'] = $_POST['edit_otype'];
                         $updatestatus = true;
                     }
                     if ($_POST['street'] != $_POST['edit_street']) {
                         $update_userinfo['street'] = $_POST['edit_street'];
                     }
                     if ($_POST['platformUsername'] != $_POST['edit_platformUsername']) {
                         $update_userinfo['platformUsername'] = $_POST['edit_platformUsername'];
                     }
                     if ($_POST['address2'] != $_POST['edit_address2']) {
                         $update_userinfo['address2'] = $_POST['edit_address2'];
                     }
                     if ($_POST['actualShipping'] != $_POST['edit_actualShipping']) {
                         $update_order['actualShipping'] = $_POST['edit_actualShipping'];
                     }
                     if ($_POST['city'] != $_POST['edit_city']) {
                         $update_userinfo['city'] = $_POST['edit_city'];
                     }
                     if ($_POST['state'] != $_POST['edit_state']) {
                         $update_userinfo['state'] = $_POST['edit_state'];
                     }
                     if ($_POST['countryName'] != $_POST['edit_countryName']) {
                         $update_userinfo['countryName'] = $_POST['edit_countryName'];
                     }
                     if ($_POST['zipCode'] != $_POST['edit_zipCode']) {
                         $update_userinfo['zipCode'] = $_POST['edit_zipCode'];
                     }
                     if ($_POST['landline'] != $_POST['edit_landline']) {
                         $update_userinfo['landline'] = $_POST['edit_landline'];
                     }
                     if ($_POST['phone'] != $_POST['edit_phone']) {
                         $update_userinfo['phone'] = $_POST['edit_phone'];
                     }
                     if ($_POST['transportId'] != $_POST['edit_transportId']) {
                         $update_order['transportId'] = $_POST['edit_transportId'];
                     }
                     if ($_POST['edit_tracknumber']) {
                         $update_tracknumber['omOrderId'] = $orderid;
                         $update_tracknumber['tracknumber'] = $_POST['edit_tracknumber'];
                         $update_tracknumber['addUser'] = $sysUserId;
                         $update_tracknumber['createdTime'] = time();
                         //var_dump($update_tracknumber); exit;
                     }
                     BaseModel::begin();
                     //开始事务
                     if ($update_order) {
                         //$sql = "UPDATE om_unshipped_order set ".array2sql($update_order)." WHERE id = ".$orderid;
                         //$msg = OrderLogModel::orderLog($orderid,$update_order['orderStatus'],$update_order['orderType'],$sql);
                         if (OrderindexModel::updateOrder('om_unshipped_order', $update_order, ' WHERE id = ' . $orderid)) {
                             if ($updatestatus) {
                                 $ProductStatus = new ProductStatus();
                                 if (!$ProductStatus->updateSkuStatusByOrderStatus(array($orderid), $batch_ostatus_val, $batch_otype_val)) {
                                     BaseModel::rollback();
                                 }
                             }
                             $modify_showerrorinfo = "<font color='green'>更新成功</font>";
                         } else {
                             $modify_showerrorinfo = "<font color='red'>更新失败</font>";
                             BaseModel::rollback();
                         }
                     }
                     if ($update_userinfo) {
                         //var_dump($update_userinfo);
                         if (OrderindexModel::updateOrder('om_unshipped_order_userInfo', $update_userinfo, ' WHERE omOrderId = ' . $orderid)) {
                             $modify_showerrorinfo = "<font color='green'>更新成功</font>";
                         } else {
                             $modify_showerrorinfo = "<font color='red'>更新失败</font>";
                             BaseModel::rollback();
                         }
                     }
                     if ($update_tracknumber) {
                         //echo $msg;
                         if (!OrderAddModel::insertOrderTrackRow($update_tracknumber)) {
                             /*self :: $errCode = "001";
                             		self :: $errMsg =  "跟踪号插入失败";
                             		return false;*/
                             $modify_showerrorinfo = "<font color='red'>跟踪号插入失败</font>";
                             BaseModel::rollback();
                         }
                     }
                     BaseModel::commit();
                     BaseModel::autoCommit();
                 }
             }
         }
     }
     $this->smarty->assign('modify_showerrorinfo', $modify_showerrorinfo);
     $omAvailableAct = new OmAvailableAct();
     //平台信息
     $platform = $omAvailableAct->act_getTNameList('om_platform', 'id,platform', 'WHERE is_delete=0');
     //var_dump($platform);
     $platformList = array();
     foreach ($platform as $v) {
         $platformList[$v['id']] = $v['platform'];
     }
     $this->smarty->assign('platformList', $platformList);
     /**导航 start**/
     $this->smarty->assign('ostatus', $ostatus);
     $this->smarty->assign('otype', $otype);
     //二级目录
     $StatusMenuAct = new StatusMenuAct();
     $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0');
     //var_dump($ostatusList);
     $this->smarty->assign('ostatusList', $ostatusList);
     $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $ostatus . '" AND is_delete=0');
     //var_dump($otypeList);
     $this->smarty->assign('otypeList', $otypeList);
     /*$o_secondlevel =  $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc');
     		$this->smarty->assign('o_secondlevel', $o_secondlevel);*/
     $second_count = array();
     $second_type = array();
     foreach ($ostatusList as $o_secondinfo) {
         $orderStatus = $o_secondinfo['statusCode'];
         /*$accountacc = $_SESSION['accountacc'];
         		$oc_where = " where orderStatus='$orderStatus' ";
         		if($accountacc){
         			$oc_where .= ' AND ('.$accountacc.') ';
         		}*/
         $s_total = $OrderindexAct->act_showSearchOrderNum($orderStatus);
         //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $oc_where);
         $second_count[$o_secondinfo['statusCode']] = $s_total;
         $s_type = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$orderStatus}' order by sort asc");
         $second_type[$o_secondinfo['statusCode']] = $s_type[0]['statusCode'];
     }
     //var_dump($second_count);
     $this->smarty->assign('second_count', $second_count);
     $this->smarty->assign('second_type', $second_type);
     //退款数量
     $refund_total = $omAvailableAct->act_getTNameCount("om_order_refund", " where is_delete=0");
     $this->smarty->assign('refund_total', $refund_total);
     //三级目录
     $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$ostatus}' order by sort asc");
     $this->smarty->assign('o_threelevel', $o_threelevel);
     $three_count = array();
     foreach ($o_threelevel as $o_threeinfo) {
         $orderType = $o_threeinfo['statusCode'];
         $s_total = $OrderindexAct->act_showSearchOrderNum($ostatus, $orderType);
         //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order"," where orderStatus='$ostatus' and orderType='$orderType' and storeId=1 and is_delete=0");
         $three_count[$o_threeinfo['statusCode']] = $s_total;
     }
     $this->smarty->assign('three_count', $three_count);
     $toptitle = '订单显示页面';
     //头部title
     $this->smarty->assign('toptitle', $toptitle);
     $this->smarty->assign('toplevel', 0);
     $threelevel = '1';
     //当前的三级菜单
     $this->smarty->assign('threelevel', $threelevel);
     $statusMenu = $omAvailableAct->act_getTNameList('om_status_menu', ' * ', 'WHERE is_delete=0 ');
     $this->smarty->assign('statusMenu', $statusMenu);
     $value = '';
     $where = '';
     switch ($searchTransportationType) {
         case '1':
             $transportation = CommonModel::getCarrierList(1);
             //快递
             break;
         case '2':
             $transportation = CommonModel::getCarrierList(0);
             //平邮
             break;
         default:
             $transportation = CommonModel::getCarrierList();
             //所有的
             break;
     }
     //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);
     //var_dump($orderid, $ostatus,$otype);
     $omOrderList = $OrderModifyAct->act_getModifyOrderList($orderid, $ostatus, $otype, $storeId = 1);
     //var_dump($omOrderList);
     //$sku	=	array();
     $account_where = ' WHERE is_delete = 0 ';
     if ($searchPlatformId) {
         $account_where .= ' AND platformId = ' . $searchPlatformId;
     }
     $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();
     //获取系统所有状态
     $statusList = copyOrderModel::selectStatusList();
     $CurrencyAct = new CurrencyAct();
     $currencyList = $CurrencyAct->act_getCurrencyListById();
     //echo "<pre>"; print_r($currencyList); exit;
     $this->smarty->assign('currencyList', $currencyList);
     $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('orderModify.htm');
 }
예제 #21
0
$where = "WHERE channelId=0 ";
$count = OmAvailableModel::getTNameCount($tNameUnShipped, $where);
$start = 0;
$per = 5000;
$page = ceil($count / $per);
echo "totalcount = {$count}";
echo "\n";
echo "totalpage = {$page}";
echo "\n";
for ($i = 0; $i < $page; $i++) {
    echo "currentPage = {$i}";
    echo "\n";
    $start = $start * $i;
    $where = "WHERE channelId=0 ";
    $where .= " limit {$start},{$per}";
    $shipOrderList = OrderindexModel::showOrderList($tNameUnShipped, $where);
    foreach ($shipOrderList as $key => $value) {
        $id = $value['orderData']['id'];
        $weight = $value['orderWhInfoData']['actualWeight'];
        $country = $value['orderUserInfoData']['countryName'];
        $transportId = $value['orderData']['transportId'];
        $shaddr = 1;
        echo "id = {$id}";
        echo "\n";
        if (empty($weight) || empty($country) || empty($transportId)) {
            echo 'weight OR countryName or transportId is Empty!';
            echo "\n";
            continue;
        }
        $ifee = calcshippingfee($shaddr, $weight, $country, $transportId);
        $channelId = '';
예제 #22
0
 public function act_repeatShipments2()
 {
     date_default_timezone_set("Asia/Chongqing");
     error_reporting(0);
     $currenctyList = CurrencyModel::getCurrencyList('currency,rates', 'where 1=1');
     foreach ($currenctyList as $value) {
         $currenctys[$value['currency']] = $value['rates'];
         //汇率数组
     }
     $packinglists = GoodsModel::getMaterInfo();
     //获取全部包材记录
     foreach ($packinglists as $packinglist) {
         $packings[$packinglist['id']]['pmName'] = $packinglist['pmName'];
         $packings[$packinglist['id']]['pmCost'] = $packinglist['pmCost'];
     }
     unset($packinglists);
     $carrierLists = CommonModel::getCarrierList();
     //获取全部运输方式
     foreach ($carrierLists as $carrierList) {
         $carriers[$carrierList['id']] = $carrierList['carrierNameCn'];
     }
     unset($carrierLists);
     $channelLists = CommonModel::getAllChannelList();
     //获取全部运输方式下的渠道记录
     foreach ($channelLists as $channelList) {
         $channels[$channelList['id']] = $channelList['channelName'];
     }
     unset($channelLists);
     $staffInfoLists = CommonModel::getStaffInfoList();
     //获取全部人员
     foreach ($staffInfoLists as $staffInfoList) {
         $staffLists[$staffInfoList['global_user_id']] = $staffInfoList['global_user_name'];
     }
     unset($staffInfoLists);
     //print_r($packings);
     //        exit;
     $ebayaccount = omAccountModel::ebayaccountAllList();
     //获取全部账号信息
     foreach ($ebayaccount as $value) {
         $ebayaccounts[$value['ebay_platform']][] = $value['id'];
         //账号id对应名称
     }
     unset($ebayaccount);
     $accountLists = omAccountModel::accountAllList();
     //获取全部账号信息
     foreach ($accountLists as $value) {
         $accounts[$value['id']] = $value['account'];
         //账号id对应名称
     }
     $time1 = time();
     $start = strtotime($_REQUEST['start']);
     $end = strtotime($_REQUEST['end']);
     $mailway = $_REQUEST['mailway'];
     $account = $_REQUEST['account'];
     ///////////////////////////////////////////////
     $accountStr = '';
     if ($account != '') {
         //组合成sql 中accountId In() 语句
         $account = explode("#", $account);
         foreach ($account as $value) {
             if ($value != '') {
                 $accountStr .= " accountId='" . $value . "' or ";
             }
         }
     }
     $accountStr = substr($accountStr, 0, strlen($accountStr) - 3);
     if (empty($accountStr)) {
         $accountStr = ' 1=1';
     }
     //$shipOrderList = OrderInfoModel :: getShipOrderList($start, $end, $accountStr);
     $tNameUnShipped = 'om_shipped_order';
     //已發貨订单表
     $where = " WHERE id IN ('8344971','8344971','8344971','8849112','9027686','9118441','9253209','9255395','9337524','9337524','9393954','9395762','9423987','9423987','9425121','9437038','9440042','9440042','9440042','9457399','9461841','9465559','9466929','9472244','9472244','9472244','9488351','9488351','9488479','9489408','9489408','9489408','9489408','9499144','9518194','9518200','9518866','9518866','9518866','9518866','9518898','9519076','9522183','9522183','9532719','9535192','9549634','9549634','9549634','9549643','9552004','9552004','9552004','9560244','9560244','9560244','9560244','9576989','9576989','9576989','9596753','9612887','9622477','9622500','9622512','9623276','9623276','9624016','9626076','9626076','9626076','9626076','9626316','9626385','9626385','9626385','9626403','9627404','9628837','9630913','9630913','9640585','9640585','9640585','9640604','9640770','9641002','9641274','9641274','9641274','9641395','9641529','9641529','9641744','9641829','9641829','9641892','9641892','9641946','9642205','9642205','9642380','9642780','9643939','9643939','9644644','9644644','9647186','9648475','9648478','9648478','9649284','9649286','9649649','9649649','9649649','9649652','9649652','9649652','9649885','9649909','9650192','9650192','9650198','9650198','9650241','9650322','9650322','9650322','9650322','9650380','9650381','9650388','9650571','9650571','9650571','9650612','9650615','9650637','9650649','9650673','9650673','9650681','9650685','9650696','9650704','9650704','9650726','9650741','9650741','9650761','9650785','9650826','9650834','9650834','9650834','9650834','9650838','9650841','9650841','9650914','9650937','9650937','9650958','9650958','9650989','9650995','9651008','9651120','9651151','9651333','9651351','9651351','9651351','9651363','9651618','9652039','9652041','9652172','9652197','9652294','9652355','9652355','9652365','9652547','9652570','9652815','9652829','9652829','9652830','9652830','9652830','9652834','9653349','9653350','9653677','9653677','9653784','9653786','9653790','9653790','9653826','9653866','9653866','9653866','9653866','9653868','9653869','9653869','9653869','9653870','9653870','9653871','9653874','9653878','9653878','9653878','9653878','9653879','9653884','9653884','9653959','9654059','9654071','9654332','9654572','9654572','9654572','9654573','9654573','9654778','9654778','9654784','9654792','9654961','9654964','9655556','9655630','9655630','9655643','9655643','9655643','9655646','9655734','9655775','9655777','9656086','9656208','9656209','9656210','9656529','9656529','9656593','9656629','9656634','9656746','9656983','9657511','9657566','9657566','9657566','9657566','9657641','9657641','9657677','9657678','9657680','9657802','9657802','9657803','9657985','9658074','9658081','9658321','9658337','9658449','9658458','9658501','9658501','9658840','9659006','9659144','9659726','9659726','9660877','9661308','9662160','9662162','9663236','9663236','9663236','9663236','9663236','9663236','9663254','9663408','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664338','9664338','9664341','9665707','9667826','9667826','9667826','9667826','9667826','9667826','9667826','9667826','9667835','9667843','9667849','9667849','9667849','9667849','9667849','9670393','9670393','9670393','9670393','9670393','9670393','9670407','9670407','9670407','9670407','9670407','9670417','9670426','9670683','9673777','9673777','9673777','9673777','9673777','9673778','9675229','9675242','9675595','9675595','9675595','8526402','8809110','8842096','8842096','8842096','8862631','8862631','8905974','8905974','8968635','9046612','9162772','9180940','9180940','9180940','9180940','9241329','9241329','9241329','9308486','9308486','9308486','9376347','9378671','9393969','9411833','9457216','9474385','9474385','9474385','9474385','9474603','9476126','9477416','9477416','9478721','9489020','9489608','9489608','9489608','9498874','9505075','9505075','9505075','9505075','9505151','9505151','9505151','9505151','9505733','9510621','9520197','9528779','9537456','9537668','9550596','9550596','9550596','9566234','9566234','9566248','9566248','9592573','9593512','9593512','9593512','9593512','9593512','9593512','9593512','9602420','9602420','9607647','9607647','9607647','9607647','9607647','9610633','9610776','9610776','9611433','9612362','9615401','9618958','9618958','9623437','9628510','9628510','9628655','9628655','9638991','9641400','9649804','9649855','9649855','9649855','9649855','9649894','9650472','9650472','9650552','9650556','9650583','9650585','9651279','9651509','9651712','9652013','9652013','9652273','9652273','9652274','9652274','9652274','9652441','9652483','9652513','9652523','9652523','9652929','9652929','9652929','9652929','9652929','9652929','9652929','9652929','9653014','9653027','9653027','9653027','9653027','9653103','9653345','9653345','9653345','9653345','9653345','9653489','9653567','9653637','9653938','9653938','9653938','9653938','9653938','9653941','9653941','9653941','9654055','9654055','9654055','9654055','9654061','9654075','9654084','9654323','9654641','9655179','9655255','9655255','9655506','9655506','9655538','9655671','9655835','9655967','9655967','9655967','9656198','9656251','9656251','9656251','9656277','9656279','9656329','9656329','9656329','9656329','9656522','9656541','9656541','9656655','9656921','9656921','9656942','9656942','9657107','9657174','9657174','9657175','9657175','9657175','9657345','9657860','9657860','9657994','9658000','9658000','9658004','9658004','9658012','9658030','9658030','9658030','9658030','9658114','9658141','9658141','9658156','9658209','9658286','9658286','9658295','9658295','9658295','9658295','9658296','9658296','9658595','9658595','9658649','9658691','9658784','9658784','9658784','9658784','9658798','9658809','9658834','9658845','9658852','9658852','9658852','9658914','9658914','9659007','9659009','9659083','9659084','9659148','9659151','9659151','9659355','9659378','9659401','9659451','9659451','9659594','9659804','9660076','9660076','9660393','9660399','9660399','9660406','9660453','9660453','9660453','9660453','9660460','9660603','9660603','9660603','9660862','9660862','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660942','9660952','9660952','9661096','9661096','9661156','9661187','9661292','9661481','9661622','9661850','9661890','9661890','9662030','9662113','9662113','9662146','9662146','9662249','9662249','9662343','9662457','9662471','9662471','9662502','9662696','9662732','9662732','9662732','9662733','9662733','9662733','9662832','9662908','9662908','9662909','9662971','9663010','9663010','9663010','9663014','9663380','9663380','9663380','9663386','9663386','9663692','9663693','9663754','9663754','9663826','9663826','9663894','9663998','9664012','9664080','9664090','9664093','9664112','9664112','9664112','9664112','9664175','9664191','9664191','9664192','9664192','9664196','9664554','9664554','9664968','9665016','9665209','9665222','9665222','9665309','9665392','9665396','9665667','9665667','9665667','9665668','9665668','9659581','9660388','9662117','9662117','9664751','9666120','9666124','9666258','9666258','9666262','9666264','9666344','9666377','9666383','9666383','9666383','9666383','9666384','9666384','9666384','9666384','9666828','9666828','9666947','9667031','9667031','9667206','9667206','9667206','9667206','9667332','9667564','9667564','9667564','9667564','9667567','9667567','9667567','9667567','9667567','9667567','9667580','9667580','9667581','9667597','9667754','9667802','9667802','9667802','9667802','9667949','9667949','9668151','9668151','9668683','9668685','9668773','9668802','9668802','9668802','9668808','9668808','9669255','9669262','9669265','9669268','9669268','9669273','9669285','9669541','9669883','9669964','9669964','9669964','9669964','9669964','9669972','9670114','9670129','9670129','9670286','9670338','9670338','9670411','9671287','9671290','9671452','9671531','9671634','9671634','9671634','9671680','9671680','9671693','9671896','9671934','9671973','9671988','9671988','9672000','9672194','9672194','9672339','9672362','9672362','9672698','9672735','9672743','9672751','9672790','9672911','9672911','9672911','9672993','9673004','9673004','9673101','9673218','9673319','9673323','9673380','9673421','9673452','9673475','9673516','9673643','9673643','9673643','9673668','9673747','9673749','9673753','9673753','9673760','9674395','9674395','9674419','9674419','9674848','9674848','9674850','9674850','9674850','9674850','9674852','9674854','9674854','9674854','9674885','9674899','9674899','9674899','9674899','9674899','9674899','9674908','9674913','9674913','9674913','9674920','9674920','9674920','9674920','9675055','9675087','9675087','9675087','9675137','9675137','9675137','9675137','9675137','9675157','9675157','9675157','9675271','9675583','9675584','9675586','9675586','9696845','9696880','9696880','9697073','9697082','9697092','9697095','9697095','9697095','9697095','9697105','9697110','9697110','9697110','9697115','9697115','9697115','9697254','9698356','9632026','9658246','9661119','9661119','9661119','9661119','9661119','9662121','9666751','9697750','9697750','9698264','9698805','9698808','9698810','9698810','9698810','9698810','9698813','9699173','9699175','9699179','9699179','9699179','9699182','9699184','9699267','9699267','9699267','9699821','9699821','9699892','9699900','9699908','9699923','9699924','9699924','9699924','9699927','9699930','9699930','9699976','9700235','9700312','9700333','9700357','9700357','9700399','9700399','9700931','9700973','9701169','9701449','9701648','9704135')";
     //$where = " WHERE `paymentTime` > $start AND `paymentTime` < $end AND `accountId` = '336' LIMIT 1,100";
     $shipOrderList = OrderindexModel::showOrderList($tNameUnShipped, $where);
     $fileName = "repeatShipments" . date('Y-m-d', $end) . ".xls";
     $excel = new ExportDataExcel('browser', $fileName);
     $excel->initialize();
     $row = array('日期', 'ebay store', '交易号', '客户ID', '仓位号', '料号', '数量', '料号重量', '成本', '国家', '包裹总价值', '邮费', '币种', '运输方式', '邮寄公司', '挂号条码', '是/否', '重量', '收件人姓名', '客户电话', '地址', '英文州名', '英文城市名', '邮编', '订单编号', '包装员', '配货员', '扫描员', '分区人员', '料号描述');
     $excel->addRow($row);
     foreach ($shipOrderList as $key => $value) {
         //key代表最外层的维数
         /*$value分别有7个对应的键,分别为
         		  orderData,//订单表头数据记录
         		  orderExtenData,//订单表扩展数据记录
         		  orderUserInfoData,//订单表中客户的数据记录
         		  orderWhInfoData,//物料对订单进行操作的数据记录
         		  orderNote,//订单的备注(销售人员添加)记录
         		  orderTracknumber,//订单的追踪号记录
         		  orderAudit,//订单明细审核记录
         		  orderDetail //订单明细记录
         		*/
         $orderData = $value['orderData'];
         //订单表头数据记录,为一维数组
         $orderExtenData = $value['orderExtenData'];
         //扩展表头数据记录,为一维数组
         $orderUserInfoData = $value['orderUserInfoData'];
         //订单客户数据记录,为一维数组
         $orderWhInfoData = $value['orderWhInfoData'];
         //物料对订单进行操作的数据记录,为一维数组
         $orderNote = $value['orderNote'];
         //订单备注记录,二维数组
         $orderTracknumber = $value['orderTracknumber'];
         //订单跟踪号,二维数组
         $orderAudit = $value['orderAudit'];
         //订单明细审核记录,二维数组
         $orderDetail = $value['orderDetail'];
         //订单明细记录,三维数组
         $orderId = $orderData['id'];
         //****订单编号 $ebay_id
         $orderPaidtime = @date('Y-m-d', $orderData['paymentTime']);
         //****订单付款时间 paidtime
         $orderUserInfoEmail = $orderUserInfoData['email'];
         //****客户邮箱 emial
         $platformUsername = $orderExtenData['platformUsername'];
         //****客户平台登录名称 $ebay_userid,用扩展表中的该字段 ebay_username
         $username = @html_entity_decode($orderUserInfoData['username'], ENT_QUOTES, 'UTF-8');
         //****客户真实名称(收件人) username
         $orderUserInfoStreet1 = @$orderUserInfoData['street'];
         //**** 街道地址 street1
         $orderUserInfoStreet2 = @$orderUserInfoData['address2'];
         //*** 街道地址2 steet2(一般订单会有两个街道地址)
         $orderUserInfoCity = $orderUserInfoData['city'];
         //**** 市 city
         $orderUserInfoState = $orderUserInfoData['state'];
         //**** 州 state
         $orderUserInfoCountryName = $orderUserInfoData['countryName'];
         //**** 国家全名
         //客服部小霞提出 导出列 国家 显示英文 方便退款处理
         //$cnname                   = $country[$countryname];
         $orderUserInfoZip = $orderUserInfoData['zipCode'];
         //**** 邮编 zipCode
         $orderUserInfoTel = $orderUserInfoData['landline'];
         //**** 座机 landline
         $orderWhInfoActualShipping = $orderWhInfoData['actualShipping'];
         //****实际运费,warehouse表中,ebay_shipfee
         $orderExtenFeedback = $orderExtenData['feedback'];
         //****客户留言 ebay_note
         $OrderActualTotal = @round($orderData['actualTotal'], 2);
         //****实际收款总价 $ebay_total
         $orderTracknumberOne = @$orderTracknumber[0]['tracknumber'];
         //****追踪号,这里只读取记录数的第一条记录的追踪号 $ebay_tracknumber
         $accountName = @$accounts[$orderData['accountId']];
         //****账号名称 $ebay_account
         $orderRecordnumber = @$orderData['recordNumber'];
         //****订单编码(对应平台上的编码) $recordnumber0??????
         //$ebay_carrier				= @$shipOrder['transportId'];//transportId ebay_carrier
         $orderUserInfoPhone = $orderUserInfoData['phone'];
         //****客户手机号码 $ebay_phone
         $orderExtenCurrency = $orderExtenData['currency'];
         //****币种 $ebay_currency
         $orderWhInfoPackersId = $orderWhInfoData['packersId'];
         //包装人员Id
         $packinguser = $staffLists[$orderWhInfoPackersId];
         //对应包装人员姓名
         //var_dump($packinguser);
         $OrderChannelId = $orderData['channelId'];
         //渠道Id $channelId
         $orderCalcShipping = $orderData['calcShipping'];
         //估算运费 $ordershipfee
         $orderExtenPayPalPaymentId = $orderExtenData['PayPalPaymentId'];
         //Paypal付款ID $ebay_ptid
         $orderExtenPayPalEmailAddress = $orderExtenData['PayPalEmailAddress'];
         //PayPal付款邮箱地址 $ebay_pp
         $isCopy = $orderData['isCopy'];
         //默认为0为原始订单,1为被复制订单,2为复制订单
         $isCopy = $isCopy == '0' ? '' : ($isCopy == '1' ? '被复制订单' : '复制订单');
         //$ebay_noteb				= $is_main_order==2 ? '复制 订单' : ($is_main_order==1 ? '被复制 订单' : '');
         $isBuji = $orderData['isBuji'];
         //是否补寄订单。默认0正常订单;1为被补寄的订单;2为补寄产生的新订单
         $isBuji = $isBuji == '0' ? '' : ($isBuji == '1' ? '被补寄订单' : '补寄产生新订单');
         //$isBuji					= isset ($sendreplacement[$isBuji]) ? $sendreplacement[$isBuji] : '';
         //$is_sendreplacement		= $isBuji;
         $isSplit = $orderData['isSplit'];
         //默认0正常订单;1为被拆分的订单;2为拆分产生的订单
         $isSplit = $isSplit == '0' ? '' : ($isSplit == '1' ? '被拆分订单' : '拆分产生新订单');
         //$ebay_splitorder
         $isCombinePackage = $orderData['combinePackage'];
         //是否合并包裹。合并包裹状态,0为正常订单;1为合并包裹主订单;2为合并包裹子订单
         $isCombinePackage = $isCombinePackage == '0' ? '' : ($isCombinePackage == '1' ? '合并包裹主订单' : '合并包裹子订单');
         $weighStaffId = isset($orderWhInfoData[0]['weighStaffId']) ? $orderWhInfoData[0]['weighStaffId'] : '';
         //扫描员ID//称重
         $weighStaff = $weighStaffId != '' ? $staffLists[$weighStaffId] : '';
         //扫描员
         $districtStaffId = isset($orderWhInfoData[0]['districtStaffId']) ? $orderWhInfoData[0]['districtStaffId'] : '';
         //分区人员ID
         $districtStaff = $districtStaffId != '' ? $staffLists[$districtStaffId] : '';
         //分区人员
         $OrderTransportId = $orderData['transportId'];
         //运输方式Id $transportId
         $carrierName = $carriers[$OrderTransportId];
         //运输方式名称 $ebay_carrier
         $address = $orderUserInfoStreet1 . "\n" . $orderUserInfoStreet2 . "\n" . $orderUserInfoCity . "\n" . $orderUserInfoState . "\n" . $orderUserInfoZip . "\n" . $orderUserInfoCountryName;
         //字段拼接成地址
         $orderWhInfoWeighTime = date('Y-m-d', $orderWhInfoData['weighTime']);
         //称重时间,亦可以当做发货时间 $scantime
         $OrderCalcWeight = $orderData['calcWeight'];
         //估算重量,单位是kg  $calculate_weight
         $orderWhInfoActualWeight = number_format($orderWhInfoData['actualWeight'] / 1000, 3);
         //实际重量 $orderweight2
         $totalweight = $orderWhInfoActualWeight;
         //总重量
         $mailway_c = $channels[$OrderChannelId];
         //根据运输管理系统的接口获取
         $isContainCombineSku = CommonModel::judge_contain_combinesku($orderId);
         //$ebay_combineorder 判断订单是否包含组合料号,返回true or false
         if (count($orderDetail) == 1) {
             //订单明细中只有一条记录时,订单中只有一种料号
             $orderDetailTotalData = array_pop($orderDetail);
             //取得orderDetail中的这条总记录数据,包括orderDetailData和orderDetailExtenData
             $orderDetailData = $orderDetailTotalData['orderDetailData'];
             //明细中的常用数据
             $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
             //明细中的扩展数据
             $orderDetailSku = $orderDetailData['sku'];
             //该明细下的$sku
             $orderDetailExtenItemId = $orderDetailExtenData['itemId'];
             //itemId $ebay_itemid
             $orderDetailAmount = intval($orderDetailData['amount']);
             //$amount 该明细下的sku对应的数量
             $orderDetailRecordnumber = $orderDetailData['recordNumber'];
             //该明细对应平台的recordnumber $recordnumber
             $orderDetailItemPrice = round($orderDetailData['itemPrice'], 2) * $orderDetailAmount;
             //itemPrice(平台对应的销售单价)*对应数量 $ebay_itemprice
             //	$ebay_shipfee			=	round_num(($OrderActualTotal - $orderDetailItemPrice), 2);
             $ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId);
             //round_num(($OrderActualTotal - $orderDetailItemPrice), 2); //订单总价-sku对应的总价得出运费,$ebay_shipfee
             $ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : '';
             $skus = GoodsModel::get_realskuinfo($orderDetailSku);
             //获取该sku下对应的真实料号信息(包括料号转换及组合料号对应真实料号信息)
             $values_skus = array_values($skus);
             //得到sku的数量
             $goods_location = CommonModel::getPositionBySku($orderDetailSku);
             //仓位
             $goodsInfo = GoodsModel::getSkuinfo($orderDetailSku);
             //获取真实sku的详细信息,包括采购名称和可用库存
             $goodsWeight = $goodsInfo['goodsWeight'];
             //料号重量
             $goods_cost = isset($goodsInfo['goodsCost']) ? round($goodsInfo['goodsCost'], 2) : 0;
             //采购成本
             $pmId = isset($goodsInfo['pmId']) ? $goodsInfo['pmId'] : '';
             //包材Id
             $ebay_packingmaterial = $packings[$pmId]['pmName'];
             //包材名称
             $ebay_packingCost = $packings[$pmId]['pmCost'];
             //包材成本
             $purchaseId = isset($goodsInfo['purchaseId']) ? $goodsInfo['purchaseId'] : '';
             $cguser = $staffLists[$purchaseId];
             //采购名称
             $combineSku = GoodsModel::getCombineSkuinfo($orderDetailSku);
             //判断该sku是否是组合料号,如果是返回combineSku,sku,count关系记录数据,不是则返回false
             if ($combineSku !== false) {
                 //为组合订单
                 $goods_costs = 0;
                 $combine_weight_list = array();
                 $goods_costs_list = array();
                 foreach ($skus as $k => $v) {
                     $goodsInfo2 = GoodsModel::getSkuinfo($k);
                     $combine_weight_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsWeight'];
                     //组合订单重量数组
                     $goods_costs_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsCost'];
                     //货本数组
                     $goods_costs += $orderDetailAmount * $v * $goodsInfo2['goodsCost'];
                 }
                 $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
                 $excel->addRow($row);
                 foreach ($skus as $k => $v) {
                     $goodsInfo3 = GoodsModel::getSkuinfo($k);
                     $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                     $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
                     $goods_location2 = CommonModel::getPositionBySku($k);
                     //仓位
                     $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : '';
                     $ebay_packingmaterial = $packings[$pmId]['pmName'];
                     $ebay_packingCost = $packings[$pmId]['pmCost'];
                     $purchaseId = isset($goodsInfo3[0]['purchaseId']) ? $goodsInfo3[0]['purchaseId'] : '';
                     $cguser = $staffLists[$purchaseId];
                     $ishipfee = round_num($goods_costs_list[$k] / array_sum($goods_costs_list) * $ebay_shipfee, 2);
                     //根据货本比ebay运费
                     $iorderweight2 = round($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderWhInfoActualWeight, 3);
                     $iordershipfee = round_num($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderCalcShipping, 2);
                     $iprice = round_num(($goods_costs_list[$k] + $iordershipfee) / (array_sum($goods_costs_list) + $orderCalcShipping) * $ebay_itemprice, 2);
                     //根据货本比产品价格  last modified by herman.xi @20130916
                     $row = array('', '', '', '', $goods_location2, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                     $excel->addRow($row);
                 }
             } else {
                 //非组合订单
                 $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
                 $excel->addRow($row);
             }
             unset($combine_weight_list);
             unset($goods_costs_list);
         } else {
             //订单详细记录>1
             $cctotal = 0;
             $ebay_itemprice = 0;
             $goods_costs = 0;
             $goods_list = array();
             $goods_lists = array();
             $goods_weight_list = array();
             $goods_costs_list = array();
             $calculate_weight = 0;
             foreach ($orderDetail as $orderDetailTotalData) {
                 //$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData
                 $orderDetailData = $orderDetailTotalData['orderDetailData'];
                 //明细中的常用数据
                 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
                 //明细中的扩展数据
                 $detail_id = $orderDetailData['id'];
                 $sku = $orderDetailData['sku'];
                 $skus = GoodsModel::get_realskuinfo($sku);
                 $_ebay_itemprice = round($orderDetailData['itemPrice'], 2);
                 $ebay_itemprice += $orderDetailData['amount'] * $_ebay_itemprice;
                 foreach ($skus as $k => $v) {
                     $goodsInfo3 = GoodsModel::getSkuinfo($k);
                     $_ebay_amount = intval($orderDetailData['amount'] * $v);
                     $cctotal += $_ebay_amount;
                     $calculate_weight += $_ebay_amount * $goodsInfo3['goodsWeight'];
                     $goods_weight_list[$detail_id . $sku][$k] = $_ebay_amount * $goodsInfo3['goodsWeight'];
                     $goods_costs_list[$detail_id . $sku][$k] = round($goodsInfo3['goodsCost'], 2) * $_ebay_amount;
                     $goods_costs += round($goodsInfo3['goodsCost'], 2) * $_ebay_amount;
                 }
             }
             //echo "---------$ebay_itemprice--------";
             $ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId);
             $ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : '';
             //	$ebay_shipfee = round_num(($OrderActualTotal - $ebay_itemprice), 2);
             $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, '', '', $cctotal, '', $ebay_itemprice, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
             $excel->addRow($row);
             foreach ($orderDetail as $orderDetailTotalData) {
                 //$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData
                 $orderDetailData = $orderDetailTotalData['orderDetailData'];
                 //明细中的常用数据
                 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
                 //明细中的扩展数据
                 $detail_id = $orderDetailData['id'];
                 $skuDe = $orderDetailData['sku'];
                 $recordnumber = $orderDetailData['recordNumber'];
                 $orderDetailExtenItemId = $orderDetailExtenData['itemId'];
                 //itemId $ebay_itemid
                 //$ebay_itemid = $detail_array['ebay_itemid'];
                 $amount = intval($orderDetailData['amount']);
                 $dshipingfee = $orderDetailData['shippingFee'];
                 $debay_itemprice = round($orderDetailData['itemPrice'], 2);
                 $goods_location = CommonModel::getPositionBySku($skuDe);
                 $goodsInfo3 = GoodsModel::getSkuinfo($skuDe);
                 $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                 $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : 0;
                 $ebay_packingmaterial = $packings[$pmId]['pmName'];
                 $ebay_packingCost = $packings[$pmId]['pmCost'];
                 $purchaseId = isset($goodsInfo3['purchaseId']) ? $goodsInfo3['purchaseId'] : '';
                 $cguser = $staffLists[$purchaseId];
                 $dordershipfee = round($orderCalcShipping * (array_sum($goods_weight_list[$detail_id . $skuDe]) / $calculate_weight), 2);
                 $dorderweight2 = round($orderWhInfoActualWeight * (array_sum($goods_weight_list[$detail_id . $skuDe]) / $calculate_weight), 3);
                 $combineSku = GoodsModel::getCombineSkuinfo($skuDe);
                 //$is_combineSku = count($combineSku);
                 if ($combineSku !== false) {
                     //为组合料号
                     $skus = GoodsModel::get_realskuinfo($skuDe);
                     foreach ($skus as $k => $v) {
                         $goods_location = CommonModel::getPositionBySku($k);
                         $goodsInfo3 = GoodsModel::getSkuinfo($k);
                         $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                         $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
                         $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : '';
                         $ebay_packingmaterial = $packings[$pmId]['pmName'];
                         $ebay_packingCost = $packings[$pmId]['pmCost'];
                         $purchaseId = isset($goodsInfo3['purchaseId']) ? $goodsInfo3['purchaseId'] : '';
                         $cguser = $staffLists[$purchaseId];
                         //$iprice = round_num(($goods_costs_list[$detail_id.$k][$k]/array_sum($goods_costs_list[$detail_id.$k])) * $debay_itemprice * $amount,2); //根据货本比产品价格
                         $ishipfee = round_num($goods_costs_list[$detail_id . $skuDe][$k] / array_sum($goods_costs_list[$detail_id . $skuDe]) * $dshipingfee, 2);
                         //根据货本比ebay运费
                         $iorderweight2 = round($goods_weight_list[$detail_id . $skuDe][$k] / array_sum($goods_weight_list[$detail_id . $skuDe]) * $dorderweight2, 3);
                         $iordershipfee = round_num($goods_weight_list[$detail_id . $skuDe][$k] / array_sum($goods_weight_list[$detail_id . $skuDe]) * $dordershipfee, 2);
                         $iprice = round_num(($goods_costs_list[$detail_id . $skuDe][$k] + $iordershipfee) / (array_sum($goods_costs_list[$detail_id . $skuDe]) + $dordershipfee) * $debay_itemprice * $amount, 2);
                         //根据货本比产品价格  last modified by herman.xi @20130916
                         $row = array('', '', '', '', $goods_location, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                         $excel->addRow($row);
                     }
                 } else {
                     $goods_location = CommonModel::getPositionBySku($skuDe);
                     $goodsInfo3 = GoodsModel::getSkuinfo($skuDe);
                     $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                     $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
                     $row = array('', '', '', '', $goods_location, $skuDe, $amount, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                     $excel->addRow($row);
                 }
             }
             unset($goods_weight_list);
             unset($goods_costs_list);
         }
     }
     $excel->finalize();
     exit;
 }
예제 #23
0
 public static function overWeightSplitB2B($omOrderId)
 {
     !self::$dbConn ? self::initDB() : null;
     global $memc_obj;
     //调用memcache获取sku信息
     $mctime = time();
     //var_dump($moOrderIdArr);
     $tableName = 'om_unshipped_order';
     $where = ' WHERE id = ' . $omOrderId . ' and is_delete = 0 and storeId = 1';
     $orderData = OrderindexModel::showOrderList($tableName, $where);
     $orderDetail = $orderData[$omOrderId]['orderDetail'];
     $obj_order_data = $orderData[$omOrderId]['orderData'];
     $orderExtenData = $orderData[$omOrderId]['orderExtenData'];
     $orderUserInfoData = $orderData[$omOrderId]['orderUserInfoData'];
     $_actualTotal = $obj_order_data['actualTotal'];
     $_actualShipping = $obj_order_data['actualShipping'];
     $_platformId = $obj_order_data['platformId'];
     $_mainId = $obj_order_data['id'];
     $_transportId = $obj_order_data['transportId'];
     //var_dump($orderDetail); exit;
     $omAvailableAct = new OmAvailableAct();
     $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 AND platformId in(1,5) ');
     $weightlists = array();
     $skuinfo = array();
     $goods_sn_nums = 0;
     $shippfee_arr = array();
     $ebay_total_be = 0;
     foreach ($orderDetail as $k => $f) {
         $sku = trim($f['orderDetailData']['sku']);
         $amount = $f['orderDetailData']['amount'];
         $shippingFee = $f['orderDetailData']['shippingFee'];
         $goods_sn_nums += $amount;
         $ebay_total_be += $f['orderDetailData']['amount'] * $f['orderDetailData']['itemPrice'];
         $shippfee_arr[$sku] = round($shippingFee / $amount, 3);
         //单个料号的运费
         $skuinfo[$sku] = $f;
         for ($i = 1; $i <= $amount; $i++) {
             $var = $sku;
             $oneskuweight = CommonModel::calcOnlySkuWeight($var, 1);
             //一个sku的重量
             $weightlists[$var][] = $oneskuweight[0];
         }
     }
     $rate = $_actualTotal / $ebay_total_be;
     //var_dump($weightlists); exit;
     if ($goods_sn_nums <= 1) {
         self::$errCode = '0020';
         self::$errMsg = "只有一个料号组成,不允许超重拆分";
         return false;
     }
     //echo "==========="; exit;
     $keyarray = array();
     $keyarrays = array();
     $checkweight = 0;
     $arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
     //var_dump($arrinfo); exit;
     $realweight = $arrinfo[0];
     $realcosts = $arrinfo[2];
     $itemprices = $arrinfo[3];
     foreach ($weightlists as $wk => $wv) {
         foreach ($wv as $weightlist) {
             $checkweight += $weightlist;
             if ($checkweight > 1.85) {
                 $keyarrays[] = $keyarray;
                 $keyarray = array();
                 $checkweight = $weightlist;
                 $keyarray[$wk][] = $wk;
             } else {
                 $keyarray[$wk][] = $wk;
             }
         }
     }
     if (!empty($keyarray)) {
         $keyarrays[] = $keyarray;
     }
     //var_dump($keyarrays); exit;
     BaseModel::begin();
     //开始事务
     $insert_orderData = array();
     foreach ($keyarrays as $keyarray) {
         $ebay_total = 0;
         $totalweight = 0;
         $insert_ebay_ids = array();
         //var_dump($skuinfo); echo "<br>";
         foreach ($keyarray as $k => $kav) {
             //var_dump($skuinfo[$k]['orderDetailData']['itemPrice'], count($kav));
             //$ebay_total += ($skuinfo[$k]['orderDetailData']['itemPrice'] + $shippfee_arr[$k]) * count($kav);
             $ebay_total += $skuinfo[$k]['orderDetailData']['itemPrice'] * count($kav);
         }
         $ebay_total = $rate * $ebay_total;
         $shipfee = 0;
         //$val = generateOrdersn();
         $insert_obj_order_data = $obj_order_data;
         unset($insert_obj_order_data['id']);
         $insert_obj_order_data['actualTotal'] = $ebay_total;
         $insert_obj_order_data['orderType'] = C('STATEPENDING_OWDONE');
         $insert_obj_order_data['orderAddTime'] = $mctime;
         $insert_obj_order_data['isSplit'] = 2;
         $insert_orderExtenData = $orderExtenData;
         unset($insert_orderExtenData['id']);
         $insert_orderUserInfoData = $orderUserInfoData;
         unset($insert_orderUserInfoData['id']);
         $insert_orderData = array('orderData' => $insert_obj_order_data, 'orderExtenData' => $insert_orderExtenData, 'orderUserInfoData' => $insert_orderUserInfoData);
         /*$sql = "insert into ebay_splitorder (recordnumber, main_order_id, split_order_id, create_date) values ('$recordnumber', '$ebay_id', '$insert_ebay_id', '".date("Y-m-d H:i:s")."')";
         		$split_log .= "添加主定单和拆分订单到关系表中\r\n".$sql ."\r\n";
         		$dbcon->execute($sql) or die("Fail : $sql");*/
         $obj_order_detail_data = array();
         foreach ($keyarray as $k => $kav) {
             $sku = $k;
             $amount = count($kav);
             $insert_orderDetailData = $skuinfo[$k]['orderDetailData'];
             unset($insert_orderDetailData['id']);
             $insert_orderDetailData['sku'] = strtoupper($sku);
             $insert_orderDetailData['amount'] = $amount;
             $insert_orderDetailData['createdTime'] = $mctime;
             if (isset($shippfee_arr[$sku])) {
                 $insert_orderDetailData['shippingFee'] = $shippfee_arr[$sku] * $amount;
                 //相同料号运费拆分
             }
             $insert_orderDetailExtenData = $skuinfo[$k]['orderDetailExtenData'];
             unset($insert_orderDetailExtenData['id']);
             $obj_order_detail_data[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData);
         }
         $insert_orderData['orderDetail'] = $obj_order_detail_data;
         //echo "<pre>";
         //var_dump($obj_order_detail_data); exit;
         $calcInfo = CommonModel::calcAddOrderWeight($obj_order_detail_data);
         //计算重量和包材
         //var_dump($calcInfo); exit;
         $insert_orderData['orderData']['calcWeight'] = $calcInfo[0];
         $insert_orderData['orderData']['pmId'] = $calcInfo[1];
         //var_dump($insert_orderData); exit;
         $calcShippingInfo = CommonModel::calcAddOrderShippingFee($insert_orderData, 1);
         //计算运费
         //var_dump($calcShippingInfo); exit;
         $insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
         $insert_orderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
         /*$interceptInfo = CommonModel :: auto_contrast_intercept($orderData);
         		//print_r($interceptInfo); exit;
         		$orderData['orderData']['orderStatus'] = $interceptInfo['orderStatus'];
         		$orderData['orderData']['orderType'] = $interceptInfo['orderType'];*/
         if ($_spitId = OrderAddModel::insertAllOrderRowNoEvent($insert_orderData)) {
             //echo $split_log .= 'insert success!' . "\n"; exit;
             //var_dump($_mainId,$_spitId); exit;
             if (!OrderLogModel::insertOrderLog($_spitId, 'INSERT ORDER')) {
                 BaseModel::rollback();
                 self::$errCode = '0021';
                 self::$errMsg = "split error!";
                 return false;
             }
             if (!OrderRecordModel::insertSpitRecords($_mainId, $_spitId)) {
                 BaseModel::rollback();
                 self::$errCode = '0022';
                 self::$errMsg = "split error!";
                 return false;
             }
         } else {
             $split_log .= 'insert error!' . "\n";
             BaseModel::rollback();
             self::$errCode = '0023';
             self::$errMsg = "split error!";
             return false;
         }
         if (!OrderindexModel::deleteOrderData($tableName, $where)) {
             self::$errCode = '0024';
             self::$errMsg = "split error!";
             return false;
         }
         if (!OrderLogModel::insertOrderLog($_mainId, 'DELETE ORDER')) {
             BaseModel::rollback();
             self::$errCode = '0025';
             self::$errMsg = "split error!";
             return false;
         }
         BaseModel::commit();
         BaseModel::autoCommit();
     }
     self::$errCode = '200';
     self::$errMsg = "split success!";
     return true;
 }
/**
 * 更新订单的ebay_markettime和ShippedTime
 */
function update_order_shippedmarked_time($ebay_ordersn, $mctime)
{
    global $dbConn;
    $tableName = "om_shipped_order";
    $data['marketTime'] = $mctime;
    $data['ShippedTime'] = $mctime;
    $where = " where recordNumber IN ('" . implode("','", $ebay_ordersn) . "') ";
    OrderindexModel::updateOrder($tableName, $data, $where);
    /*$order_db	= mysql_query($sql,$link);*/
    //$dbConn->query($sql);
    //errorLog($sql,'N');
    //echo "\r\n".$sql."\r\n";
    return $order_db;
}
예제 #25
0
 public static function resendOrder($orderid, $note, $type, $old_ostatus, $old_otype)
 {
     !self::$dbConn ? self::initDB() : NULL;
     BaseModel::begin();
     //开始事务
     //$tableName = 'om_unshipped_order';
     //echo $old_ostatus; echo "<br>";
     //echo $old_otype; echo "<br>";
     $StatusMenuAct = new StatusMenuAct();
     $tableName = $StatusMenuAct->act_getOrderNameByStatus($old_ostatus, $old_otype);
     //echo $tableName;
     if ($type == 1) {
         $updatesql = 'update ' . $tableName . ' set isBuji=1,isCopy=1 where id=' . $orderid . ' and is_delete = 0 and storeId = 1';
     } else {
         $updatesql = 'update ' . $tableName . ' set isCopy=1 where id=' . $orderid . ' and is_delete = 0 and storeId = 1';
     }
     if (!self::$dbConn->query($updatesql)) {
         //更新状态失败
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         self::$errCode = '003';
         self::$errMsg = '订单信息不存在,无法复制!';
         return FALSE;
     }
     //产生新订单
     $where = ' WHERE id = ' . $orderid . ' and is_delete = 0 and storeId = 1';
     $orderData = OrderindexModel::showOrderList($tableName, $where);
     $orderDetail = $orderData[$orderid]['orderDetail'];
     if (!$orderDetail) {
         //更新状态失败
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         return FALSE;
     }
     $insert_orderDetail = array();
     foreach ($orderDetail as $detail) {
         $insert_orderDetailData = $detail['orderDetailData'];
         unset($insert_orderDetailData['id']);
         $insert_orderDetailExtenData = $detail['orderDetailExtenData'];
         unset($insert_orderDetailExtenData['omOrderdetailId']);
         $insert_orderDetail[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData);
     }
     $obj_order_data = $orderData[$orderid]['orderData'];
     if ($obj_order_data['isBuji'] == 2) {
         self::$errCode = '003';
         self::$errMsg = "补寄产生订单不能补寄!";
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         return FALSE;
     }
     if ($obj_order_data['isCopy'] == 2) {
         self::$errCode = '003';
         self::$errMsg = "复制产生订单不能复制!";
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         return FALSE;
     }
     unset($obj_order_data['id']);
     $orderExtenData = $orderData[$orderid]['orderExtenData'];
     unset($orderExtenData['omOrderId']);
     $orderUserInfoData = $orderData[$orderid]['orderUserInfoData'];
     unset($orderExtenData['omOrderId']);
     if ($type == 1) {
         $obj_order_data['isCopy'] = 2;
         $obj_order_data['actualTotal'] = 0.0;
     } else {
         $obj_order_data['isCopy'] = 2;
         $obj_order_data['isBuji'] = 2;
         $obj_order_data['actualTotal'] = 0.0;
         $obj_order_data['orderStatus'] = C('STATEBUJI');
         $obj_order_data['orderType'] = C('STATEBUJI_DONE');
     }
     $orderNote = array('content ' => $note, 'userId' => $_SESSION['sysUserId'], 'createdTime' => time());
     $insert_orderData = array();
     $insert_orderData = array('orderData' => $obj_order_data, 'orderExtenData' => $orderExtenData, 'orderUserInfoData' => $orderUserInfoData, 'orderDetail' => $insert_orderDetail, 'orderNote' => $orderNote);
     //$orderNote = $orderData['orderNote'];
     //echo $insertsql;
     //var_dump($insert_orderData); exit;
     if ($insertId = OrderAddModel::insertAllOrderRowNoEvent($insert_orderData)) {
         //echo $split_log .= 'insert success!' . "\n"; exit;
         //var_dump($_mainId,$_spitId); exit;
         if (!OrderLogModel::insertOrderLog($insertId, '补寄产生订单')) {
             BaseModel::rollback();
             self::$errCode = '001';
             self::$errMsg = "补寄失败!";
             return false;
         }
         if (!OrderRecordModel::insertSendRecords($orderid, $insertId)) {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "补寄失败添加记录失败!";
             return false;
         }
     } else {
         //$split_log .= '补寄新订单产生失败!' . "\n";
         BaseModel::rollback();
         self::$errCode = '003';
         self::$errMsg = "补寄新订单产生失败";
         return false;
     }
     BaseModel::commit();
     self::$errCode = '200';
     self::$errMsg = "补寄新订单成功!";
     return TRUE;
 }