|
|
@@ -523,17 +523,24 @@ class OrderService
|
|
|
public function getParamsByOrderHeader($orderHeaders_map,$owners_code_map,$logistics_code_map,$shop_name_map)
|
|
|
{
|
|
|
$params = [];
|
|
|
+ // 自提 转 新杰物流
|
|
|
$orders = Order::query()->whereIn('code',data_get($orderHeaders_map,'*.orderno'))->get();
|
|
|
$order_code_map = [];
|
|
|
foreach ($orders as $order) {
|
|
|
$order_code_map[$order->code]= $order;
|
|
|
}
|
|
|
+ $logistic_XJWL = Logistic::query()->where('code' ,'XJWL')->first();
|
|
|
foreach ($orderHeaders_map as $orderHeader) {
|
|
|
if($order_code_map[$orderHeader->orderno] ?? false)continue;
|
|
|
$owner = $owners_code_map[$orderHeader->customerid] ?? null;
|
|
|
$logistic = $logistics_code_map[$orderHeader->userdefine1] ?? null;
|
|
|
$key = ' owner_code='.$orderHeader->customerid.' name='.$orderHeader->issuepartyname ?? '';
|
|
|
$shop = $shop_name_map[$key] ?? '';
|
|
|
+
|
|
|
+ // 自提 转 新杰物流
|
|
|
+ if($logistic!= null && $logistic->name == '自提'){
|
|
|
+ $logistic = $logistic_XJWL;
|
|
|
+ }
|
|
|
$params[] = [
|
|
|
'code' => $orderHeader->orderno,
|
|
|
'owner_id' => $owner->id ?? null,
|
|
|
@@ -589,11 +596,16 @@ class OrderService
|
|
|
'id','owner_id','wms_status','logistic_id','shop_id','consignee_name','consignee_phone','province','city','district','address','client_code','updated_at','wms_edittime'
|
|
|
]];
|
|
|
$updated_at = Carbon::now()->toDateTimeString();
|
|
|
-
|
|
|
+ // 新杰物流
|
|
|
+ $logistic_XJWL = Logistic::query()->where('code','XJWL')->first();
|
|
|
foreach ($orderHeaders as $orderHeader) {
|
|
|
$order =$dataHandlerService->getKeyValue(['code'=>$orderHeader->orderno],$orders_code_map);
|
|
|
if(!$order){continue;}
|
|
|
$logistic = $dataHandlerService->getKeyValue(['code'=>$orderHeader->userdefine1] ,$logistics_code_map);
|
|
|
+ // 自提 转 新杰物流
|
|
|
+ if($logistic != '' && $logistic->name == '自提'){
|
|
|
+ $logistic = $logistic_XJWL;
|
|
|
+ }
|
|
|
$owner = $dataHandlerService->getKeyValue(['code'=>$orderHeader->customerid] ,$owner_code_map);
|
|
|
$shop = $dataHandlerService->getKeyValue(['owner_id'=>$owner->id ?? '','name'=> $orderHeader->issuepartyname] ,$shops_map);
|
|
|
$shop_id = $shop->id ?? null;
|
|
|
@@ -669,8 +681,12 @@ class OrderService
|
|
|
|
|
|
public function getParamByOrderHeader($orderHeader)
|
|
|
{
|
|
|
+ if($orderHeader->userdefine1 == 'ZT'){
|
|
|
+ $logistic = Logistic::query()->where('code','XJWL')->first();
|
|
|
|
|
|
- $logistic = Logistic::query()->where('code',$orderHeader->userdefine1)->first();
|
|
|
+ }else{
|
|
|
+ $logistic = Logistic::query()->where('code',$orderHeader->userdefine1)->first();
|
|
|
+ }
|
|
|
$owner = Owner::query()->where('code',$orderHeader->customerid ?? '')->first();
|
|
|
$shop = Shop::query()->where('name',$orderHeader->issuepartyname)->where('owner_id',$owner->id)->first();
|
|
|
return [
|
|
|
@@ -704,6 +720,7 @@ class OrderService
|
|
|
return ;
|
|
|
}
|
|
|
$params = $this->getParamByOrderHeader($orderHeader);
|
|
|
+
|
|
|
$data = [
|
|
|
'code'=>$order->code ?? $params['code'],
|
|
|
'owner_id'=>$order->code ?? $params['owner_id'],
|