|
|
@@ -10,6 +10,7 @@ use App\OrderCommodity;
|
|
|
use App\Owner;
|
|
|
use Exception;
|
|
|
use Illuminate\Support\Collection;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
use App\Traits\ServiceAppAop;
|
|
|
|
|
|
@@ -70,18 +71,20 @@ class BatchService
|
|
|
$this->instant($this->stationTaskCommodityService,'StationTaskCommodityService');
|
|
|
$this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
|
|
|
|
|
|
- $batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
|
|
|
- if($batches_shouldProcess->isEmpty()) return;
|
|
|
- LogService::log(__METHOD__,'assignTasks','波次任务分配2:'.json_encode($batches));
|
|
|
+ DB::transaction(function ()use($batches){
|
|
|
+ $batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
|
|
|
+ if($batches_shouldProcess->isEmpty()) return;
|
|
|
+ LogService::log(__METHOD__,'assignTasks','波次任务分配2:'.json_encode($batches));
|
|
|
|
|
|
- $stationTasks = $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
|
|
|
- LogService::log(__METHOD__,'assignTasks','波次任务分配3:'.json_encode($batches));
|
|
|
- $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_shouldProcess,$stationTasks); //注册波次任务
|
|
|
- LogService::log(__METHOD__,'assignTasks','波次任务分配4:'.json_encode($batches));
|
|
|
- $stationTaskMaterialBoxes=$this->stationTaskMaterialBoxService->createByBatches($batches_shouldProcess,$stationTasks); //注册料箱任务
|
|
|
- LogService::log(__METHOD__,'assignTasks','波次任务分配5:'.json_encode($stationTaskMaterialBoxes).json_encode($batches));
|
|
|
- $stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
|
|
|
- LogService::log(__METHOD__,'assignTasks','波次任务分配6:'.json_encode($batches));
|
|
|
+ $stationTasks = $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
|
|
|
+ LogService::log(__METHOD__,'assignTasks','波次任务分配3:'.json_encode($batches));
|
|
|
+ $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_shouldProcess,$stationTasks); //注册波次任务
|
|
|
+ LogService::log(__METHOD__,'assignTasks','波次任务分配4:'.json_encode($batches));
|
|
|
+ $stationTaskMaterialBoxes=$this->stationTaskMaterialBoxService->createByBatches($batches_shouldProcess,$stationTasks); //注册料箱任务
|
|
|
+ LogService::log(__METHOD__,'assignTasks','波次任务分配5:'.json_encode($stationTaskMaterialBoxes).json_encode($batches));
|
|
|
+ $stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
|
|
|
+ LogService::log(__METHOD__,'assignTasks','波次任务分配6:'.json_encode($batches));
|
|
|
+ });
|
|
|
|
|
|
$ran=$this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
|
|
|
LogService::log(__METHOD__,'assignTasks','波次任务分配7:'.json_encode($batches));
|