|
@@ -605,7 +605,7 @@ class OrderService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function pushQueue($orderHeaders){
|
|
public function pushQueue($orderHeaders){
|
|
|
- $orders = Order::query()->with(["logistic","packages.commodities.commodity"])->where('wms_status','订单完成')->whereIn('code',data_get($orderHeaders,'*.code'))->get();
|
|
|
|
|
|
|
+ $orders = Order::query()->with(["logistic","packages.commodities.commodity"])->where('wms_status','订单完成')->whereIn('code',data_get($orderHeaders,'*.orderno'))->get();
|
|
|
$orders->each(function($order){
|
|
$orders->each(function($order){
|
|
|
dispatch(new OrderCreateInstantBill($order));
|
|
dispatch(new OrderCreateInstantBill($order));
|
|
|
});
|
|
});
|
|
@@ -658,7 +658,7 @@ class OrderService
|
|
|
// 转换插入 3s
|
|
// 转换插入 3s
|
|
|
$this->pushOrderCreatedCountCache($created_params);
|
|
$this->pushOrderCreatedCountCache($created_params);
|
|
|
if(count($created_params) > 0){
|
|
if(count($created_params) > 0){
|
|
|
- collect($created_params)->chunk(3000)->each(function($inner_params){
|
|
|
|
|
|
|
+ collect($created_params)->chunk(1000)->each(function($inner_params){
|
|
|
$arr = $inner_params->toArray();
|
|
$arr = $inner_params->toArray();
|
|
|
$this->insert($arr);
|
|
$this->insert($arr);
|
|
|
dispatch(new OrderFreeze($arr));
|
|
dispatch(new OrderFreeze($arr));
|
|
@@ -1083,62 +1083,43 @@ class OrderService
|
|
|
|
|
|
|
|
public function pushOrderUpdatedCountCache($orders,$update_params)
|
|
public function pushOrderUpdatedCountCache($orders,$update_params)
|
|
|
{
|
|
{
|
|
|
- /**
|
|
|
|
|
- * @var DataHandlerService $dataHandlerService
|
|
|
|
|
- * @var OwnerService $ownerService
|
|
|
|
|
- */
|
|
|
|
|
- if(!$orders||!$update_params)return;
|
|
|
|
|
- $dataHandlerService = app('DataHandlerService');
|
|
|
|
|
|
|
+ /** @var DataHandlerService $dataHandlerService */
|
|
|
|
|
+ $dataHandlerService = app(DataHandlerService::class);
|
|
|
$order_map = $dataHandlerService->dataHeader(['code'],$orders);
|
|
$order_map = $dataHandlerService->dataHeader(['code'],$orders);
|
|
|
$owner_map = [];
|
|
$owner_map = [];
|
|
|
- $month_begin = Carbon::parse(date(date('Y-m-01 00:00:00')));
|
|
|
|
|
- foreach ($update_params as $key=>$params) {
|
|
|
|
|
- if(!($params['code'] ?? false))continue;
|
|
|
|
|
- if($params['wms_status'] !== '订单完成')continue;
|
|
|
|
|
- $order = $dataHandlerService->getKeyValue(['code' => $params['code']],$order_map);
|
|
|
|
|
- if(!$order || $order['wms_status'] === '订单完成')continue;
|
|
|
|
|
- if($month_begin->isAfter(Carbon::parse($order['wms_edittime'])))continue;
|
|
|
|
|
- $owner_id = $params['owner_id'];
|
|
|
|
|
- if(!array_key_exists($owner_id,$owner_map))$owner_map[$owner_id] = 0;
|
|
|
|
|
- $owner_map[$owner_id]+=1;
|
|
|
|
|
- }
|
|
|
|
|
- $cancelCount = [];
|
|
|
|
|
- foreach ($update_params as $key=>$params) {
|
|
|
|
|
- if($key==1||!($params['code'] ?? false))continue;
|
|
|
|
|
- if($params['wms_status'] == '订单完成' || $params['wms_status'] !== '订单取消')continue;
|
|
|
|
|
- $order = $dataHandlerService->getKeyValue(['code' => $params['code']],$order_map);
|
|
|
|
|
- if($month_begin->isAfter(Carbon::parse($order['wms_edittime'])))continue;
|
|
|
|
|
- if(!$order || $order['wms_status'] == '订单完成') continue;
|
|
|
|
|
- $owner_id = $params['owner_id'];
|
|
|
|
|
- if(!array_key_exists($owner_id,$cancelCount))$cancelCount[$owner_id] = 0;
|
|
|
|
|
- $cancelCount[$owner_id]+=1;
|
|
|
|
|
|
|
+ $month_begin =date('Y-m-01 00:00:00');
|
|
|
|
|
+ foreach ($update_params as $update_param) {
|
|
|
|
|
+ if(!($update_param['wms_status'] ?? false) || $update_param['wms_status']!='订单完成')continue;
|
|
|
|
|
+ $wms_EditTime = \Illuminate\Support\Carbon::parse($update_param['wms_edittime']);
|
|
|
|
|
+ if($wms_EditTime->isBefore($month_begin))continue;
|
|
|
|
|
+ $owner_id = $update_param['owner_id'] ?? false;
|
|
|
|
|
+ if(!$owner_id)continue;
|
|
|
|
|
+ $order = $dataHandlerService->getKeyValue(['code'=>$update_param['code']],$order_map);
|
|
|
|
|
+ if(!$order)continue;
|
|
|
|
|
+ if($order['wms_status'] ==='订单完成')continue;
|
|
|
|
|
+ if(!array_key_exists($owner_id,$owner_map))$owner_map[$owner_id]=1;
|
|
|
|
|
+ else $owner_map[$owner_id]+=1;
|
|
|
}
|
|
}
|
|
|
- foreach ($owner_map as $key => $value) {
|
|
|
|
|
- if($value==0)continue;
|
|
|
|
|
- $cancelCount = $cancelCount[$key] ?? 0;
|
|
|
|
|
- $this->setCurrentFinishedOrders_byOwnerId($key,$value,$cancelCount);
|
|
|
|
|
|
|
+ foreach ($owner_map as $owner_id=>$count) {
|
|
|
|
|
+ $this->setCurrentFinishedOrders_byOwnerId($owner_id,$count);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function pushOrderCreatedCountCache($created_params)
|
|
public function pushOrderCreatedCountCache($created_params)
|
|
|
{
|
|
{
|
|
|
- /**
|
|
|
|
|
- * @var OwnerService $ownerService
|
|
|
|
|
- */
|
|
|
|
|
- if(!$created_params)return;
|
|
|
|
|
- $owner_map = [];
|
|
|
|
|
- $month_begin = Carbon::parse(date(date('Y-m-01 00:00:00')));
|
|
|
|
|
- foreach ($created_params as $params) {
|
|
|
|
|
- if($params['wms_status'] != '订单完成')continue;
|
|
|
|
|
- if($month_begin->isAfter(Carbon::parse($params['created_at'])))continue;
|
|
|
|
|
- $owner_id = $params['owner_id'] ?? false;
|
|
|
|
|
|
|
+ $owner_map=[];
|
|
|
|
|
+ $month_begin =date('Y-m-01 00:00:00');
|
|
|
|
|
+ foreach ($created_params as $created_param) {
|
|
|
|
|
+ $owner_id = $created_param['owner_id'] ?? false;
|
|
|
|
|
+ $wms_EditTime = \Illuminate\Support\Carbon::parse($created_param['wms_edittime']);
|
|
|
|
|
+ if($wms_EditTime->isBefore($month_begin))continue;
|
|
|
if(!$owner_id)continue;
|
|
if(!$owner_id)continue;
|
|
|
- if(!array_key_exists($owner_id,$owner_map))$owner_map[$owner_id] = 0;
|
|
|
|
|
- $owner_map[$owner_id]=$owner_map[$owner_id]+1;
|
|
|
|
|
|
|
+ if($created_param['wms_status']!=='订单完成')continue;
|
|
|
|
|
+ if(!array_key_exists($owner_id,$owner_map)) $owner_map[$owner_id]=1;
|
|
|
|
|
+ else $owner_map[$owner_id]+=1;
|
|
|
}
|
|
}
|
|
|
- foreach ($owner_map as $key => $value) {
|
|
|
|
|
- if($value==0)continue;
|
|
|
|
|
- $this->setCurrentFinishedOrders_byOwnerId($key,$value);
|
|
|
|
|
|
|
+ foreach ($owner_map as $owner_id=>$count) {
|
|
|
|
|
+ $this->setCurrentFinishedOrders_byOwnerId($owner_id,$count);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|