本文整理汇总了PHP中Prefs::GetBatchId方法的典型用法代码示例。如果您正苦于以下问题:PHP Prefs::GetBatchId方法的具体用法?PHP Prefs::GetBatchId怎么用?PHP Prefs::GetBatchId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prefs
的用法示例。
在下文中一共展示了Prefs::GetBatchId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateStock
public static function updateStock($data, $positive = 'available', $negative = 'deleted')
{
//print_r($data);
$outlets = $data['outlets'];
$outletNames = $data['outletNames'];
$addQty = $data['addQty'];
$adjustQty = $data['adjustQty'];
unset($data['outlets']);
unset($data['outletNames']);
unset($data['addQty']);
unset($data['adjustQty']);
$productDetail = Product::find($data['id'])->toArray();
// year and month used fro batchnumber
$year = date('Y', time());
$month = date('m', time());
for ($i = 0; $i < count($outlets); $i++) {
$su = array('outletId' => $outlets[$i], 'outletName' => $outletNames[$i], 'productId' => $data['id'], 'SKU' => $data['SKU'], 'productDetail' => $productDetail, 'status' => $positive, 'createdDate' => new MongoDate(), 'lastUpdate' => new MongoDate());
if ($addQty[$i] > 0) {
for ($a = 0; $a < $addQty[$i]; $a++) {
$su['_id'] = str_random(8);
$batchnumber = Prefs::GetBatchId($data['SKU'], $year, $month);
$su['_id'] = $data['SKU'] . '|' . $batchnumber;
$history = array('datetime' => new MongoDate(), 'action' => 'init', 'price' => $productDetail['priceRegular'], 'status' => $su['status'], 'outletName' => $su['outletName']);
$su['history'] = array($history);
Stockunit::insert($su);
}
}
if ($adjustQty[$i] > 0) {
$td = Stockunit::where('outletId', $outlets[$i])->where('productId', $data['id'])->where('SKU', $data['SKU'])->where('status', 'available')->orderBy('createdDate', 'asc')->take($adjustQty[$i])->get();
foreach ($td as $d) {
$d->status = $negative;
$d->lastUpdate = new MongoDate();
$d->save();
$history = array('datetime' => new MongoDate(), 'action' => 'delete', 'price' => $d->priceRegular, 'status' => $d->status, 'outletName' => $d->outletName);
$d->push('history', $history);
}
}
}
}