소스 검색

临时提交

zengjun 3 년 전
부모
커밋
8f23d8aeab
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      app/Services/OrderCommodityService.php

+ 7 - 1
app/Services/OrderCommodityService.php

@@ -3,10 +3,12 @@
 namespace App\Services;
 namespace App\Services;
 
 
 use App\Batch;
 use App\Batch;
+use App\Log;
 use App\OracleActAllocationDetails;
 use App\OracleActAllocationDetails;
 use App\Order;
 use App\Order;
 use App\OrderCommodity;
 use App\OrderCommodity;
 use App\OrderPackage;
 use App\OrderPackage;
+use App\Owner;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
 use App\Services\common\DataHandlerService;
 use Carbon\Carbon;
 use Carbon\Carbon;
@@ -23,7 +25,8 @@ class OrderCommodityService
         if(!$innerParams)return false;
         if(!$innerParams)return false;
         if(count($innerParams)==0)return false;
         if(count($innerParams)==0)return false;
         try {
         try {
-            return OrderCommodity::query()->insert($innerParams);
+            $bool = OrderCommodity::query()->insert($innerParams);
+            return $bool;
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             return false;
             return false;
         }
         }
@@ -202,6 +205,9 @@ class OrderCommodityService
             $order = $orderCommodity->order;
             $order = $orderCommodity->order;
             $owner  = $dataHandlerService->getKeyValue(['id'=>$order->owner_id ?? ''],$owner_id_maps);
             $owner  = $dataHandlerService->getKeyValue(['id'=>$order->owner_id ?? ''],$owner_id_maps);
             $sku =  $orderCommodity->commodity->sku ?? '';
             $sku =  $orderCommodity->commodity->sku ?? '';
+            if($owner == null){
+                $owner = App(OwnerService::class)->first(['id'=>$order->owner_id]);
+            }
             $key = "order_{$order->code}_owner_code_{$owner['code']}_sku_{ $sku}_location_{$orderCommodity->location}_amount_{$orderCommodity->amount}";
             $key = "order_{$order->code}_owner_code_{$owner['code']}_sku_{ $sku}_location_{$orderCommodity->location}_amount_{$orderCommodity->amount}";
             if(empty($map[$key]))$map[$key]=[];
             if(empty($map[$key]))$map[$key]=[];
             $map[$key][]  =[
             $map[$key][]  =[