service = app('OrderPackageService'); $this->orderService = app('OrderService'); $this->orderHeaderService = app('OracleDocOrderHeaderService'); } /** * @test */ public function getInnerParamsTest() { $orderHeader = OracleDOCOrderHeader::query() ->with('actAllocationDetails') ->where('sostatus',99) ->orderByDesc('AddTime')->first(); Logistic::query()->firstOrCreate(['code'=>$orderHeader->userdefine1,'name'=>'']); $owner = Owner::query()->firstOrCreate(['code'=>$orderHeader->customerid,'name'=>'']); Shop::query()->firstOrCreate(['name'=>$orderHeader->issuepartyname ?? '','owner_id'=>$owner->id]); app('WarehouseService')->firstOrCreate(["code"=>$orderHeader->warehouseid],["code"=>$orderHeader->warehouseid,"name"=>$orderHeader->warehouseid]); $orderHeaders = collect(); $orderHeaders = $orderHeaders->push($orderHeader); $this->orderService->syncOrder($orderHeaders); $order = Order::query()->where('code',$orderHeader->orderno)->first(); $inner_params = $this->service->getInnerParams($orderHeader,$order,['mapkey'=>['logistic_number']]); $this->assertNotEmpty($inner_params); $actAllocationDetails = $orderHeader->actAllocationDetails; foreach ($inner_params as $inner_param) { $detail = $actAllocationDetails->where('picktotraceid',$inner_param['logistic_number'])->first(); $this->assertNotEmpty($detail); $this->assertEquals($inner_param['order_id'],$order->id); $this->assertEquals($inner_param['logistic_number'],$detail->picktotraceid); $this->assertNotEmpty($inner_param['created_at']); $this->assertNotEmpty($inner_param['updated_at']); } } }