error_reporting(E_ALL);
ini_set('max_execution_time', 1800);
if (!defined('WEB_PATH')) {
    define("WEB_PATH", "/data/web/order.valsun.cn/");
}
require_once WEB_PATH . "crontab/scripts.comm.php";
require_once WEB_PATH_CONF_SCRIPTS . "script.ebay.config.php";
/*include_once "/data/scripts/ebay_order_cron_job/ebay_order_cron_config.php";
include_once "/data/scripts/ebay_order_cron_job/function_purchase.php";*/
$mctime = time();
$starttime = $mctime - 60 * 60;
/*$sql = "SELECT * FROM in_warehouse_history where in_time>{$starttime}";
$sql = $dbConn->query($sql);
$in_warehouse_history = $dbConn->fetch_array_all($sql);*/
$in_warehouse_history = WarehouseAPIModel::getInRecords();
//var_dump($in_warehouse_history); exit;
/*$sql0 = "SELECT * FROM out_warehouse_history where out_time>{$starttime}";
$sql0 = $dbConn->query($sql0);
$out_warehouse_history = $dbConn->fetch_array_all($sql0);*/
$out_warehouse_history = WarehouseAPIModel::getOutRecords();
//var_dump($out_warehouse_history); exit;
//$ss0 = "SELECT *FROM  warehouse_history_read SET starttime={$starttime},endtime={$mctime}";
//$ss0 = $dbcon->execute($ss0);
if (empty($in_warehouse_history) && empty($in_warehouse_history)) {
    echo "无出入库记录!";
    exit;
}
$stock = array();
if ($in_warehouse_history) {
    foreach ($in_warehouse_history as $key => $value) {