فهرست منبع

暂时取消海柔执行事务

LD 5 سال پیش
والد
کامیت
e24be9847a

+ 82 - 13
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -43,21 +43,69 @@ class StorageController
             "taskMode"      => 1,
             "bins"=>[
                 [
-                "taskCode"  =>'t1'.microtime(true),
-                "binCode"   => "IDE0000032",
-                "fromLocCode" => "BIN-IN1",
+                    "binCode"   => "IDE0000009",
+                    "taskCode"  =>'t1'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "",
             ],
                 [
-                "taskCode"  =>'t2'.microtime(true),
-                "binCode"   => "IDE0004462",
-                "fromLocCode" => "BIN-IN1",
+                    "binCode"   => "IDE0000032",
+                    "taskCode"  =>'t2'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "",
             ],
                 [
-                "taskCode"  =>'t3'.microtime(true),
-                "binCode"   => "IDE0004463",
-                "fromLocCode" => "BIN-IN1",
+                    "binCode"   => "IDE0000153",
+                    "taskCode"  =>'t3'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005227",
+                    "taskCode"  =>'t4'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005659",
+                    "taskCode"  =>'t5'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005719",
+                    "taskCode"  =>'t7'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005132",
+                    "taskCode"  =>'t8'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005134",
+                    "taskCode"  =>'t9'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005133",
+                    "taskCode"  =>'t10'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005256",
+                    "taskCode"  =>'t11'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],
+                [
+                    "binCode"   => "IDE0005262",
+                    "taskCode"  =>'t12'.microtime(true),
+                    "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "",
             ],
                 ],
@@ -67,12 +115,33 @@ class StorageController
         ]];
         $this->post2 = [[
             "taskMode"      => 2,
-            "bins"=>[[
-                "taskCode"  =>'t'.microtime(true),
-                "binCode"   => "IDE0005714",
+            "bins"=>[
+
+                [
+                "taskCode"  =>'t1'.microtime(true),
+                "binCode"   => "IDE0000009",
                 "fromLocCode" => "",
                 "toLocCode" => "BIN-OUT1",
-            ],],
+            ],
+                [
+                "taskCode"  =>'t2'.microtime(true),
+                "binCode"   => "IDE0000032",
+                "fromLocCode" => "",
+                "toLocCode" => "BIN-OUT1",
+            ],
+                [
+                "taskCode"  =>'t5'.microtime(true),
+                "binCode"   => "IDE0000153",
+                "fromLocCode" => "",
+                "toLocCode" => "BIN-OUT1",
+            ],
+                [
+                "taskCode"  =>'t8'.microtime(true),
+                "binCode"   => "IDE0005227",
+                "fromLocCode" => "",
+                "toLocCode" => "BIN-OUT1",
+            ],
+                ],
             "groupCode"     => 'g'.microtime(true),
             "priority"      => 20,
             "sequenceFlag"  => 1,

+ 3 - 2
app/Services/BatchService.php

@@ -73,10 +73,11 @@ class BatchService
             $this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
 
             $stationTaskBatches=null;
-            DB::transaction(function ()use($batches,&$stationTaskBatches){
+//            DB::transaction(function ()use($batches,&$stationTaskBatches){
                 $batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
                 if($batches_shouldProcess->isEmpty()) return;
                 LogService::log(__METHOD__,'assignTasks','波次任务分配2:'.json_encode($batches));
+//                $batches_shouldProcess = $this->stationTaskMaterialBoxService->getInOccupied_byBatches($batches); //按规则过滤需要的波次
 
                 $stationTasks =  $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
                 LogService::log(__METHOD__,'assignTasks','波次任务分配3:'.json_encode($batches));
@@ -86,7 +87,7 @@ class BatchService
                 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));

+ 3 - 1
app/Services/ForeignHaiRoboticsService.php

@@ -170,7 +170,9 @@ class ForeignHaiRoboticsService
             if($stationTaskMaterialBox_next)
                 $this->stationTaskCommoditiesService
                     ->markProcessing($stationTaskMaterialBox_next['stationTaskCommodities']);//因为上边商品任务被标记完成了,所以这里要将队列中找出正在处理的料箱对应的标记为“处理中”
-            if(!$stationTaskMaterialBox_next){
+
+            $notFinishedBoxTasks = $this->stationTaskMaterialBoxService->getNotFinishedSiblings($stationTaskMaterialBox);
+            if($notFinishedBoxTasks->isEmpty()){
                 $this->instant($this->stationTaskService,'StationTaskService');
                 LogService::log('海柔请求','markBinProcessed1.81',
                     json_encode($stationTaskMaterialBox['stationTaskBatch']));

+ 1 - 1
app/Services/StationRuleBatchService.php

@@ -71,7 +71,7 @@ class StationRuleBatchService
             $batches_toProcess->push($batch);
             Cache::tags('波次防重叠'.[ $batch['id']])->put($batch['id'],true,config('haiRou.波次防重叠时间_秒'));
         }
-        LogService::log(__METHOD__,'shouldProcess','波次任务分配1.3:'.json_encode($batches_inTask));
+        LogService::log(__METHOD__,'shouldProcess','波次任务分配1.3:'.json_encode($batches_toProcess));
         return $batches_toProcess;
     }
 }

+ 9 - 1
app/Services/StationTaskMaterialBoxService.php

@@ -140,7 +140,9 @@ class StationTaskMaterialBoxService
                     $this->stationTaskBatchService->markProcessing_byIds($stationTaskMaterialBox['station_task_batch_id']);
                     $this->stationTaskCommodityService->markProcessing($stationTaskMaterialBox['stationTaskCommodities']);
                     $this->stationTaskService->markProcessing_byIds(data_get($stationTaskMaterialBox['stationTaskCommodities'],'*.station_task_id'));
-                    $this->stationService->broadcastBinMonitor($stationTaskMaterialBox['station_id'],$this->stationTaskService->getProcessing());
+                    /** @var StationTask $stationTask */
+                    $stationTask = $this->stationTaskService->getProcessing();
+                    $this->stationService->broadcastBinMonitor($stationTaskMaterialBox['station_id'], $stationTask);
                     break;
                 case '入立库':
                     $this->set($stationTaskMaterialBox,[
@@ -196,6 +198,12 @@ class StationTaskMaterialBoxService
         $stationTaskMaterialBox['station_id'] = 4;
         $stationTaskMaterialBox->update();
     }
+    function getNotFinishedSiblings($stationTaskMaterialBox){
+        return StationTaskMaterialBox::query()
+            ->whereNotIn('status',['完成'])
+            ->where('station_task_id',$stationTaskMaterialBox['station_task_id'])
+            ->get();
+    }
 
     /**
      * 每波次仅将最老的作务标为“处理中”,其他置入队列;

+ 4 - 2
app/Services/StationTaskService.php

@@ -81,9 +81,11 @@ class StationTaskService
         }
     }
 
-    function getProcessing($ids)
+    function getProcessing()
     {
-
+        return StationTask::query()
+            ->where(['status'=>'处理中'])
+            ->first();
     }
     function markProcessing_byIds($ids)
     {