Ejemplo n.º 1
0
 public static function get_waiting_sale($sku)
 {
     //获取海外仓待发货数据 Herman.Xi
     $totalnums = 0;
     $combineskus = GoodsModel::getCombineBySku($sku);
     $skus = array($sku => 1) + $combineskus;
     /*$combineskus = get_combinesku($sku);
     		$skus = empty($combineskus) ? array() : array_keys($combineskus);
     		array_push($skus, $sku);*/
     $StatusMenuAct = new StatusMenuAct();
     $menuList = $StatusMenuAct->act_getStatusMenuList("*", " where dStatus = 1 and groupId = 0 and is_delete=0 and storeId= {$storeId} ");
     //var_dump($menuList); exit;
     $dStatusCodes = array();
     foreach ($menuList as $value) {
         $dStatusCodes[] = $value['statusCode'];
     }
     //var_dump($dStatusCodes);
     foreach ($skus as $_sku => $_num) {
         $ordersql = "SELECT \t\ta.id,b.sku,b.amount\n\t\t\t\t\t\tFROM \t\t\tom_unshipped_order AS a \n\t\t\t\t\t\tLEFT JOIN       om_unshipped_order_detail AS b \n\t\t\t\t\t\tON \t\t\t\tb.omOrderId = a.id \n\t\t\t\t\t\tWHERE \t\t\ta.orderStatus NOT IN (" . join(',', $dStatusCodes) . ") \n\t\t\t\t\t\tAND \t\t\ta.is_delete = 0 \n\t\t\t\t\t\tAND \t\t\tb.sku='{$_sku}' \n\t\t\t\t\t\tAND\t\t\t\ta.storeId = " . $storeId;
         //echo $ordersql;
         $query = self::$dbConn->query($ordersql);
         $ebay_ids = self::$dbConn->fetch_array_all($query);
         if (!empty($ebay_ids)) {
             foreach ($ebay_ids as $ebay_id) {
                 $realtimes = self::get_realtime($sku_info["sku"]);
                 $totalnums += $sku_info["amount"] * $realtimes;
             }
         }
     }
     return $totalnums;
     /*$sql = "SELECT b.ebay_amount ,b.sku
     						FROM ebay_order AS a 
     						LEFT JOIN ebay_orderdetail AS b ON a.ebay_ordersn = b.ebay_ordersn 
     						WHERE a.ebay_status  IN (705,706,707,710)
     						AND b.sku in ({$skus_str})
     						AND a.ebay_combine!='1'
     						"; 
     		$sql = $dbcon->execute($sql);
     		$skunums = $dbcon->getResultArray($sql);
     		foreach($skunums as $sku_info){
     			$realtimes = get_realtime($sku_info["sku"]);
     			$totalnums += ($sku_info["ebay_amount"]*$realtimes);
     		}
     		return $totalnums;*/
 }