|
|
@@ -3,7 +3,10 @@
|
|
|
namespace App\Jobs;
|
|
|
|
|
|
use App\Batch;
|
|
|
+use App\Exceptions\ErrorException;
|
|
|
+use App\Log;
|
|
|
use App\Services\ForeignZhenCangService;
|
|
|
+use App\Services\LogService;
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
@@ -35,12 +38,19 @@ class BroadcastBatchToZhengCangJob implements ShouldQueue
|
|
|
{
|
|
|
/** @var ForeignZhenCangService $foreignZhenCangService */
|
|
|
$foreignZhenCangService=app('ForeignZhenCangService');
|
|
|
- //TODO 限定指定货主波次
|
|
|
- foreach ($this->batches as &$batch){
|
|
|
- $batch->loadMissing([
|
|
|
- 'orders.orderCommodities.commodity.barcodes'
|
|
|
- ]);
|
|
|
- $foreignZhenCangService->broadcastBatch($batch);
|
|
|
+ if(!$this->batches){throw new ErrorException('波次任务中波次不存在!');}
|
|
|
+ $batchCollect=collect($this->batches);
|
|
|
+ //暂时直接指定 375 妍柯货主
|
|
|
+ $batches=Batch::query()->where('owner_id',375)->whereIn('id',data_get($batchCollect,'*.id'))->get();
|
|
|
+ try {
|
|
|
+ foreach ($batches as &$batch) {
|
|
|
+ $batch->loadMissing([
|
|
|
+ 'orders.orderCommodities.commodity.barcodes'
|
|
|
+ ]);
|
|
|
+ $foreignZhenCangService->broadcastBatch($batch);
|
|
|
+ }
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ LogService::log(__METHOD__,'BroadcastBatchToZhengCangJob','波次任务推送祯仓失败'.json_encode($e->getMessage()));
|
|
|
}
|
|
|
}
|
|
|
}
|