|
|
@@ -33,10 +33,10 @@ class OrderTrackingService
|
|
|
$ownerids = explode(",", $params['owner_id']);
|
|
|
$owner_ids = array_intersect($owner_ids, $ownerids);
|
|
|
}
|
|
|
- $query = OrderTracking::query()->with(['owner','uploadFile', 'commodities' => function ($query) {
|
|
|
+ $query = OrderTracking::query()->with(['logistic','owner','uploadFile', 'commodities' => function ($query) {
|
|
|
$query->with(['commodity'=>function($query){
|
|
|
$query->with('barcodes');
|
|
|
- }, 'package.order.logistic']);
|
|
|
+ }, 'package.order']);
|
|
|
},])->whereHas('owner', function ($query) use ($owner_ids) {
|
|
|
$query->whereIn('id', $owner_ids); //货主
|
|
|
});
|
|
|
@@ -68,17 +68,14 @@ class OrderTrackingService
|
|
|
if($params['client_code'] ?? false){
|
|
|
$query->where('client_code','like', $params['client_code']);
|
|
|
}
|
|
|
- if(isset($params['logistic_id']) ){
|
|
|
- $query->where('logistic_id',$params['logistic_id']);
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- if ($params['client'] ?? false) // 客户
|
|
|
- $query->where('client', 'like', $params['client']);
|
|
|
+ if(isset($params['logistic_id']))$query->where('logistic_id',$params['logistic_id']); // 快递
|
|
|
+
|
|
|
+ if ($params['client'] ?? false) $query->where('client', 'like', $params['client']); // 客户
|
|
|
|
|
|
- if(!empty($params['web_order_number']))
|
|
|
- $query->where('web_order_number', 'like', $params['web_order_number'].'%');
|
|
|
+ if(!empty($params['web_order_number'])) $query->where('web_order_number', 'like', $params['web_order_number'].'%'); // web+订单好
|
|
|
|
|
|
if ($params['sku'] ?? false) {
|
|
|
$query->whereHas('commodities.commodity', function ($query) use ($params) {
|
|
|
@@ -166,7 +163,7 @@ class OrderTrackingService
|
|
|
$orderService = app(OrderService::class);
|
|
|
/** @var Collection $orderHeaders */
|
|
|
$orderHeaders = app(OracleDOCOrderHeaderService::class)->getWmsOrderOnStartDateCreate($startData);
|
|
|
- $this->customizedOperation($orderHeaders);
|
|
|
+ // $this->customizedOperation($orderHeaders);
|
|
|
$orderService->createByWmsOrder($orderHeaders);
|
|
|
$this->createByWmsOrderHeader($orderHeaders);
|
|
|
}
|
|
|
@@ -176,7 +173,7 @@ class OrderTrackingService
|
|
|
$orderService = app(OrderService::class);
|
|
|
/** @var Collection $orderHeaders */
|
|
|
$orderHeaders = app(OracleDOCOrderHeaderService::class)->getWmsOrderOnStartDateEdit($startData);
|
|
|
- $this->customizedOperation($orderHeaders);
|
|
|
+ // $this->customizedOperation($orderHeaders);
|
|
|
$orderService->updateByWmsOrders($orderHeaders);
|
|
|
$this->updateByWmsOrderHeaders($orderHeaders);
|
|
|
}
|
|
|
@@ -438,6 +435,8 @@ class OrderTrackingService
|
|
|
*/
|
|
|
public function getParamsByOrderHeaderAndOrder($orderHeader,$order)
|
|
|
{
|
|
|
+ /** @var LogisticService $logisticService */
|
|
|
+ $logisticService = app('LogisticService');
|
|
|
$client = $orderHeader['issuepartyname'] ?? '';
|
|
|
$order_remark = $orderHeader['notes'] ?? '';
|
|
|
$web_order_number = null;
|
|
|
@@ -446,11 +445,13 @@ class OrderTrackingService
|
|
|
}
|
|
|
$pick_up_at = $orderHeader->lastshipmenttime;
|
|
|
$planning_sent_at = null;
|
|
|
+
|
|
|
+ // 快递方式
|
|
|
+ $logistic = $logisticService->getLogisticByCode($orderHeader['userdefine1']);
|
|
|
+ if($orderHeader['userdefine1'] =='自提') $logistic = $logisticService->getLogisticByCode('XJWL'); // 自提转新杰物流
|
|
|
if(isset($pick_up_at)){
|
|
|
- $logisticTiming = app(LogisticTimingService::class)->findByParams($orderHeader['c_city']??'',$orderHeader['c_province']??'',$order->logistic_id);
|
|
|
- if($logisticTiming){
|
|
|
- $planning_sent_at = Carbon::parse((string)$pick_up_at)->addDays($logisticTiming->days_at_working);
|
|
|
- }
|
|
|
+ $logisticTiming = app(LogisticTimingService::class)->findByParams($orderHeader['c_city']??'',$orderHeader['c_province']??'',$logistic['id']);
|
|
|
+ if($logisticTiming)$planning_sent_at = Carbon::parse((string)$pick_up_at)->addDays($logisticTiming->days_at_working); // 预期到货时间
|
|
|
}
|
|
|
if(stristr($order_remark,'[')){
|
|
|
$items = [];
|
|
|
@@ -458,10 +459,11 @@ class OrderTrackingService
|
|
|
$client = $items[1][0];
|
|
|
$order_remark = $items[3][0];
|
|
|
}
|
|
|
- if(stristr($client,'天猫'))$client='天猫';
|
|
|
- if(stristr($client,'京东'))$client='京东';
|
|
|
+ if(mb_strpos($client,'天猫')!=false)$client='天猫';
|
|
|
+ if(mb_strpos($client,'京东')!=false)$client='京东';
|
|
|
return [
|
|
|
'owner_id' => $order->owner_id,
|
|
|
+ 'logistic_id' => $logistic['id'],
|
|
|
'client' => $client,
|
|
|
'sale' => $orderHeader['issuepartyname'] ?? '',
|
|
|
'created_at' => $order->created_at,
|