本文整理汇总了PHP中CommonModel::getSkuInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel::getSkuInfo方法的具体用法?PHP CommonModel::getSkuInfo怎么用?PHP CommonModel::getSkuInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonModel
的用法示例。
在下文中一共展示了CommonModel::getSkuInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actGetSkuInfo
/**
* CommonAct::actGetSkuInfo()
* 获取某个sku的代发货,实际库存等详细数据
* @param string $sku 料号
* @return array
*/
public static function actGetSkuInfo($sku)
{
$sku = isset($sku) ? post_check($sku) : "";
if (empty($sku)) {
self::$errCode = 10000;
self::$errMsg = "sku参数错误";
return false;
}
$res = CommonModel::getSkuInfo($sku);
self::$errCode = CommonModel::$errCode;
self::$errMsg = CommonModel::$errMsg;
return $res;
}
示例2: updateWarnOld
/**
* ProductStockalarmModel::updateWarnOld()
* 更新选择料号的预警信息
* @param array skuArr 料号数组
* @param int gid 采购员I
* @return bool
*/
public static function updateWarnOld($gid, $skuArr)
{
self::initDB();
foreach ($skuArr as $v) {
$res = CommonModel::getSkuInfo($v);
$res = json_decode($res, true);
$days7 = 0.7;
$days15 = 0.2;
$days30 = 0.1;
$dataarray = array();
$run_starttime = time();
$first_sale = $res[0]['first_sale'];
//$first_sale = get_firstSaleTime ($sku);
//echo 'API返回第一次售出时间:'.$first_sale."<br/>";
//$last_sale = get_lastSaleTime($sku);
$last_sale = $res[0]['last_sale'];
$stock_qty = $res[0]['stock_qty'];
// 实际库存
$everyday_sale = $res[0]['everyday_sale'];
// 每日均量
$purchase_days = $res[0]['purchasedays'];
// 采购天数
$alert_days = $res[0]['goods_days'];
// 预警天数
$warehouse_id = 76;
// 仓库编号
$partner_id = 0;
// 供应商编号
$salensend = $res[0]['salensend'];
// 待发货数量
$interceptnums = $res[0]['interceptnums'];
// 拦截数量
$autointerceptnums = $res[0]['autointerceptnums'];
// 自动拦截数量
$end = '1375290061';
$start = '1354294861';
//$rtnnum = get_saleNum ( $start, $end, $sku, 76, $everyday_sale );
// echo 'API返回销量:'.$rtnnum."<br/>";
$auditingnums = $res['auditingnums'];
// 审核数量
//$hasbooknum = PurchaseOrderModel::hasBookNum ( $skuid, $warehouse_id, $purid ); // 已订购数量
$hasbooknum = !empty($hasbooknum) ? $hasbooknum : 0;
if ($first_sale > 0) {
$time = time() - $first_sale;
$saleday = ceil($time / (3600 * 24));
// 至今距离第一次卖出时间天数
$thirtycheck = time() - 30 * 24 * 3600;
// 一个月前
$totalqty = $stock_qty + $hasbooknum;
// 总库存=实际库存+已订购数量
$hasuseqty = $totalqty - $salensend - $interceptnums - $auditingnums - $autointerceptnums;
// 可用库存数量
// $saleday = 35; // 测试
// $thirtycheck = '1243705586';
if ($saleday > 30) {
if ($last_sale > $thirtycheck) {
// 最近一次卖出时间已经超过一个月
$end1 = strtotime(date('Y-m-d') . '23:59:59');
$start1 = $end1 - 7 * 24 * 3600;
$qty1 = 5;
// getSaleNum($start1, $end1, $sku, $warehouse_id, $everyday_sale);//取1~7天销售量
$end2 = $start1;
$start2 = $end1 - 15 * 4 * 600;
$qty2 = 12;
// getSaleNum($start2, $end2, $sku, $warehouse_id, $everyday_sale);//取7~15天销售量
$end3 = $start2;
$start3 = $end1 - 30 * 24 * 3600;
$qty3 = 20;
// getSaleNum($start3, $end3, $sku, $warehouse_id, $everyday_sale);//取16~30天销售量
$everyday_sale = $qty1 / 7 * $days7 + $qty2 / 8 * $days15 + $qty3 / 15 * $days30;
// 每日均量计算
$needqty = ceil($everyday_sale * $alert_days) + $interceptnums;
// 库存预警警数量
$dataarray['everyday_sale'] = $everyday_sale > 0.005 ? round($everyday_sale, 2) : 0;
$dataarray['booknums'] = $hasbooknum;
$dataarray['salensend'] = $salensend;
$dataarray['auditingnums'] = $auditingnums;
$dataarray['interceptnums'] = $interceptnums;
$dataarray['autointerceptnums'] = $autointerceptnums;
$dataarray['is_warning'] = $hasuseqty < 1 || $hasuseqty < $needqty ? 1 : 0;
} else {
$dataarray['everyday_sale'] = 0;
$dataarray['booknums'] = $hasbooknum;
$dataarray['salensend'] = $salensend;
$dataarray['auditingnums'] = $auditingnums;
$dataarray['interceptnums'] = $interceptnums;
$dataarray['autointerceptnums'] = $autointerceptnums;
$dataarray['is_warning'] = $hasuseqty < 0 ? 1 : 0;
}
} else {
$end = strtotime(date('Y-m-d') . '23:59:59');
$start = $end - ($saleday + 1) * 24 * 3600;
$qty = 20;
//.........这里部分代码省略.........