mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
库存扣减
This commit is contained in:
parent
5b73d0641e
commit
d1b2d06c6b
@ -16,7 +16,7 @@ class KttOrderSyncStatus extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ktt:order_sync_status';
|
||||
protected $signature = 'ktt:order_sync_status {ids?}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@ -43,8 +43,15 @@ class KttOrderSyncStatus extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$ids = $this->argument('ids');
|
||||
if (!empty($ids)) {
|
||||
$ids = explode(",", $ids);
|
||||
}
|
||||
$startTime = Carbon::now()->subDays(15)->getPreciseTimestamp(3);
|
||||
BusinessOrder::query()->where('confirm_at', '>=', $startTime)
|
||||
BusinessOrder::query()->when($ids, function ($query) use ($ids) {
|
||||
$query->whereIn('id',$ids);
|
||||
})
|
||||
->where('confirm_at', '>=', $startTime)
|
||||
->where('shipping_status', BusinessOrderShippingStatus::UNSHIP)
|
||||
->where('cancel_status', 0)
|
||||
->chunk(200, function ($orders) {
|
||||
|
||||
@ -196,6 +196,11 @@ class KuaiTuanTuan extends BusinessClient
|
||||
$order->cancel_status = $queryOrder['cancel_status'];
|
||||
$needUpdate = true;
|
||||
}
|
||||
if ($order->after_sales_status!= $queryOrder['cancel_status']) {
|
||||
//售后状态更新
|
||||
$order->after_sales_status = $queryOrder['after_sales_status'];
|
||||
$needUpdate = true;
|
||||
}
|
||||
if ($needUpdate) {
|
||||
$goodsSkuNum = 0;
|
||||
foreach ($queryOrder['sub_order_list'] as $item) {
|
||||
|
||||
@ -121,6 +121,7 @@ class GoodSkuService
|
||||
->select("external_sku_id", DB::raw("SUM(goods_number) - SUM(already_cancel_number) as number"))
|
||||
->whereIn("external_sku_id", $externalSkuIds)
|
||||
->where("b.shipping_status", "=", BusinessOrderShippingStatus::UNSHIP)
|
||||
->where("b.after_sales_status", "!=", 2)
|
||||
->where("business_order_items.created_at", ">=", $startTime)->where("business_order_items.cancel_status", "=", 0)
|
||||
->groupBy('external_sku_id')->get()->toArray();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user