|
|
@@ -1572,4 +1572,35 @@ TEXT;
|
|
|
$service = app('OrderPackageExceptionTypeCountingRecordService');
|
|
|
$service->updateOrCreate(30);
|
|
|
}
|
|
|
+ public function testForeignZhenCang($batches)
|
|
|
+ {
|
|
|
+
|
|
|
+ $batches=Batch::query()
|
|
|
+ ->with(['orders.orderCommodities.commodity.barcodes'])
|
|
|
+ ->find(111953);
|
|
|
+ $body=[];
|
|
|
+ $body['id']=$batches->code;
|
|
|
+ $body['orders'] = [];
|
|
|
+ foreach ($batches->orders as $order){
|
|
|
+ $orderArr = [];
|
|
|
+ $orderArr['id']=$order->code??'';
|
|
|
+ $orderArr['createdAt']=Carbon::parse($order->created_at)->toDateTimeString()??'';
|
|
|
+ $orderArr['barcodes'] = [];
|
|
|
+ foreach ($order->orderCommodities as $orderCommodity){
|
|
|
+ $barcode=[];
|
|
|
+ $barcode['id']=$orderCommodity->id;
|
|
|
+ $barcode['barcode']=$orderCommodity->commodity ? ($orderCommodity->commodity->barcodes?$orderCommodity->commodity->barcodes->first()['code']:'') : '';
|
|
|
+ $barcode['name']=$orderCommodity->commodity->name??'';
|
|
|
+ $barcode['sku']=$orderCommodity->commodity->sku??'';
|
|
|
+ $barcode['amount']=$orderCommodity->amount??'';
|
|
|
+ $barcode['location']=$orderCommodity->location??'';
|
|
|
+ $orderArr['barcodes'][]=$barcode;
|
|
|
+ }
|
|
|
+ $body['orders'][] = $orderArr;
|
|
|
+ }
|
|
|
+ $response = Http::withHeaders([
|
|
|
+ 'Host' => 'zc-it.com',
|
|
|
+ ])->post('http://1.116.164.201:8080/api/createBatch',$body);
|
|
|
+ dd(json_decode($response->body()));
|
|
|
+ }
|
|
|
}
|