|
|
@@ -21,11 +21,11 @@ class StatStockOutClass extends BaseClass
|
|
|
public static function replace($main, $shop, $amount)
|
|
|
{
|
|
|
$sjId = $shop->sjId;
|
|
|
- $shopId = $shop->id;
|
|
|
+ $mainId = $main->id ?? 0;
|
|
|
$time = date('Ymd');
|
|
|
- $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $time], true);
|
|
|
+ $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'time' => $time], true);
|
|
|
if (empty($stat)) {
|
|
|
- $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $time], true);
|
|
|
+ $stat = self::add(['sjId' => $sjId, 'time' => $time, 'mainId' => $mainId], true);
|
|
|
}
|
|
|
$id = $stat->id;
|
|
|
$unique = self::getLockById($id);
|