mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 14:40:44 +00:00
bug修复
This commit is contained in:
parent
837b92e06a
commit
c027c7ef0a
@ -38,7 +38,8 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
|||||||
$headTitle = [
|
$headTitle = [
|
||||||
'商品编码',
|
'商品编码',
|
||||||
'商品名称',
|
'商品名称',
|
||||||
'可售库存',
|
'在售库存',
|
||||||
|
"剩余库存",
|
||||||
'创建时间',
|
'创建时间',
|
||||||
];
|
];
|
||||||
$map = [
|
$map = [
|
||||||
@ -91,17 +92,18 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
|||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
$arr[0] = $item['external_sku_id'];
|
$arr[0] = $item['external_sku_id'];
|
||||||
$arr[1] = $item['name'];
|
$arr[1] = $item['name'];
|
||||||
$arr[2] = $item['sale_stock'] ?? 0;
|
$arr[2] = $item['sale_stock'] ?? '0';
|
||||||
$arr[3] = $item['created_at'];
|
$arr[3] = $item['stock'] ?? '0';
|
||||||
|
$arr[4] = $item['created_at'];
|
||||||
if ('cost' === $this->type) {
|
if ('cost' === $this->type) {
|
||||||
$arr[4] = (string)$item['cost'];
|
$arr[5] = (string)$item['cost'];
|
||||||
$arr[5] = (string)$update[$item['id']]['before_update'];
|
$arr[6] = (string)$update[$item['id']]['before_update'];
|
||||||
$arr[6] = (string)$update[$item['id']]['after_update'];
|
$arr[7] = (string)$update[$item['id']]['after_update'];
|
||||||
}
|
}
|
||||||
if ('inventory' === $this->type) {
|
if ('inventory' === $this->type) {
|
||||||
$arr[4] = (string)$item['stock'];
|
$arr[5] = (string)$item['stock'];
|
||||||
$arr[5] = (string)$update[$item['id']]['inventory'];
|
$arr[6] = (string)$update[$item['id']]['inventory'];
|
||||||
$arr[6] = (string)$update[$item['id']]['arrived_today_num'];
|
$arr[7] = (string)$update[$item['id']]['arrived_today_num'];
|
||||||
}
|
}
|
||||||
$bodyData[] = $arr;
|
$bodyData[] = $arr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,4 +42,34 @@ class GoodsSkuFilter extends Filters
|
|||||||
$end = Carbon::parse($value)->endOfDay()->toDateTimeString();
|
$end = Carbon::parse($value)->endOfDay()->toDateTimeString();
|
||||||
return $this->builder->where('created_at', "<=", $end);
|
return $this->builder->where('created_at', "<=", $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function minStock($value)
|
||||||
|
{
|
||||||
|
return $this->builder->where('stock',">=", $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function maxStock($value)
|
||||||
|
{
|
||||||
|
return $this->builder->where('stock',"<=", $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function minSaleStock($value)
|
||||||
|
{
|
||||||
|
return $this->builder->where('sale_stock',">=", $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function maxSaleStock($value)
|
||||||
|
{
|
||||||
|
return $this->builder->where('sale_stock',"<=", $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function neqSaleStock($value)
|
||||||
|
{
|
||||||
|
return $this->builder->where('sale_stock',"!=", $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function neqStock($value)
|
||||||
|
{
|
||||||
|
return $this->builder->where('stock',"!=", $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,11 @@ class GoodsCombinationController extends Controller
|
|||||||
$orderRestTime = DeveloperConfig::query()
|
$orderRestTime = DeveloperConfig::query()
|
||||||
->where('key', DeveloperConfig::$ORDER_RESET_TIME)
|
->where('key', DeveloperConfig::$ORDER_RESET_TIME)
|
||||||
->value('value');
|
->value('value');
|
||||||
|
$time = date('Y-m-d 07:00:00');
|
||||||
if (is_null($orderRestTime)) {
|
if (is_null($orderRestTime)) {
|
||||||
$orderRestTime = date('Y-m-d 07:00:00');
|
$orderRestTime = $time;
|
||||||
|
} else {
|
||||||
|
$orderRestTime = Carbon::parse($orderRestTime)->lt(Carbon::parse($time)) ? $time : $orderRestTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
$businessOrderItems = BusinessOrderItem::query()
|
$businessOrderItems = BusinessOrderItem::query()
|
||||||
|
|||||||
@ -59,8 +59,11 @@ class GoodsSkusController extends Controller
|
|||||||
$orderRestTime = DeveloperConfig::query()
|
$orderRestTime = DeveloperConfig::query()
|
||||||
->where('key', DeveloperConfig::$ORDER_RESET_TIME)
|
->where('key', DeveloperConfig::$ORDER_RESET_TIME)
|
||||||
->value('value');
|
->value('value');
|
||||||
|
$time = date('Y-m-d 07:00:00');
|
||||||
if (is_null($orderRestTime)) {
|
if (is_null($orderRestTime)) {
|
||||||
$orderRestTime = date('Y-m-d 07:00:00');
|
$orderRestTime = $time;
|
||||||
|
} else {
|
||||||
|
$orderRestTime = Carbon::parse($orderRestTime)->lt(Carbon::parse($time)) ? $time : $orderRestTime;
|
||||||
}
|
}
|
||||||
$businessOrderItems = BusinessOrderItem::query()
|
$businessOrderItems = BusinessOrderItem::query()
|
||||||
->select(DB::raw($fields))
|
->select(DB::raw($fields))
|
||||||
|
|||||||
@ -74,6 +74,7 @@ class CombinationGoodsStockUpdateListener implements ShouldQueue
|
|||||||
$goodsSku->stock = $stock;
|
$goodsSku->stock = $stock;
|
||||||
$goodsSku->sale_stock = $saleStock;
|
$goodsSku->sale_stock = $saleStock;
|
||||||
$goodsSku->save();
|
$goodsSku->save();
|
||||||
|
Log::info("sku 业务订单库存更:{$goodsSku->id},num:{$num}", [$stock, $saleStock]);
|
||||||
$mainGoodsSku = GoodsSku::query()->find($item['goods_sku_id']);
|
$mainGoodsSku = GoodsSku::query()->find($item['goods_sku_id']);
|
||||||
$mainGoodsSku->stock = min($mainGoodsSku->stock, (int)($stock / $item['item_num']));
|
$mainGoodsSku->stock = min($mainGoodsSku->stock, (int)($stock / $item['item_num']));
|
||||||
$mainGoodsSku->sale_stock = min($mainGoodsSku->sale_stock, (int)($saleStock / $item['item_num']));
|
$mainGoodsSku->sale_stock = min($mainGoodsSku->sale_stock, (int)($saleStock / $item['item_num']));
|
||||||
|
|||||||
@ -16,7 +16,13 @@ class GoodsSku extends Model
|
|||||||
'external_sku_id',
|
'external_sku_id',
|
||||||
'is_combination',
|
'is_combination',
|
||||||
"create_time_start",
|
"create_time_start",
|
||||||
"create_time_end"
|
"create_time_end",
|
||||||
|
'min_stock',
|
||||||
|
'max_stock',
|
||||||
|
'min_sale_stock',
|
||||||
|
'max_sale_stock',
|
||||||
|
"neq_stock",
|
||||||
|
"neq_sale_stock",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
|||||||
@ -28,8 +28,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
protected $listen = [
|
protected $listen = [
|
||||||
BusinessOrdersUpdate::class => [
|
BusinessOrdersUpdate::class => [
|
||||||
UpdateBusinessGoodsStock::class,
|
UpdateBusinessGoodsStock::class,
|
||||||
CombinationGoodsStockUpdateListener::class,
|
CombinationGoodsStockUpdateListener::class
|
||||||
BusinessOrderUpdateListener::class
|
|
||||||
],
|
],
|
||||||
BatchStockUpdateEvent::class => [
|
BatchStockUpdateEvent::class => [
|
||||||
BatchStockUpdateListener::class,
|
BatchStockUpdateListener::class,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user