|
|
@@ -10,6 +10,7 @@ use App\OracleActAllocationDetails;
|
|
|
use App\Order;
|
|
|
use App\OrderCommodity;
|
|
|
use App\Owner;
|
|
|
+use App\Station;
|
|
|
use Exception;
|
|
|
use Illuminate\Support\Collection;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
@@ -74,6 +75,7 @@ class BatchService
|
|
|
$this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
|
|
|
|
|
|
$stationTaskBatches=null;
|
|
|
+ $stationTasks=null;
|
|
|
$batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
|
|
|
if($batches_shouldProcess->isEmpty()) return;
|
|
|
$stationTaskMaterialBoxes_occupied = $this->stationTaskMaterialBoxService->getOccupied_byBatches($batches_shouldProcess); //按规则过滤需要的波次
|
|
|
@@ -85,14 +87,21 @@ class BatchService
|
|
|
->delay(now()->addMinutes(1)); //因为料箱被占用了,所以将任务推迟1分钟后尝试
|
|
|
return;
|
|
|
}
|
|
|
- DB::transaction(function ()use($batches,&$stationTaskBatches,&$batches_shouldProcess){
|
|
|
+ DB::transaction(function ()use($batches,&$stationTaskBatches,&$batches_shouldProcess,&$stationTasks){
|
|
|
$stationTasks = $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
|
|
|
$stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_shouldProcess,$stationTasks); //注册波次任务
|
|
|
$stationTaskMaterialBoxes=$this->stationTaskMaterialBoxService->createByBatches($batches_shouldProcess,$stationTasks); //注册料箱任务
|
|
|
$stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
|
|
|
});
|
|
|
|
|
|
-// broadcast(new BroadcastToStation(BroadcastToStation::ALL_STATION, $json));
|
|
|
+ $stationTasks->loadMissing([
|
|
|
+ "stationTaskCommodities.commodity.barcodes",
|
|
|
+ "stationTaskCommodities.materialBox",
|
|
|
+ "stationTaskBatches.batch.owner",
|
|
|
+ "stationTaskMaterialBoxes.materialBox",
|
|
|
+ ]);
|
|
|
+ $jsonStationTasks=json_encode($stationTasks);
|
|
|
+ broadcast(new BroadcastToStation(BroadcastToStation::ALL_STATION, $jsonStationTasks));
|
|
|
// $ran=$this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
|
|
|
}catch(Exception $e){
|
|
|
$batchesJson='';
|