Explorar el Código

海柔队列修正,料箱状态4的修正,恢复事务

LD hace 5 años
padre
commit
637c1635c7

+ 6 - 6
app/Http/Controllers/api/thirdPart/haiq/LightController.php

@@ -31,12 +31,12 @@ class LightController
      */
     public function update(Request $request){// 拍灯以后的消息发至此处
 
-        if($request['PTLAction'] == 0){  // 拍灯 推送任务
-            /** @var CacheShelfService $cacheShelfService */
-            $cacheShelfService = app(CacheShelfService::class);
-            $result =   $cacheShelfService->lightOffTask($request['locCode'],$request['PTLAction']);
-            return ['location'=>$result['success'] ? 200 :0,'errMsg'=>$result['errMsg'] ?? null,'data'=>$request->all()];
-        }
+//        if($request['PTLAction'] == 0){  // 拍灯 推送任务
+//            /** @var CacheShelfService $cacheShelfService */
+//            $cacheShelfService = app(CacheShelfService::class);
+//            $result =   $cacheShelfService->lightOffTask($request['locCode'],$request['PTLAction']);
+//            return ['location'=>$result['success'] ? 200 :0,'errMsg'=>$result['errMsg'] ?? null,'data'=>$request->all()];
+//        }
         $success = $request->input('success');
         $location = $success?200:0;
         app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->all()));

+ 7 - 61
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -43,70 +43,22 @@ class StorageController
             "taskMode"      => 1,
             "bins"=>[
                 [
-                    "binCode"   => "IDE0000009",
+                    "binCode"   => "IDE0004954",
                     "taskCode"  =>'t1'.microtime(true),
                     "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "",
             ],
                 [
-                    "binCode"   => "IDE0000032",
+                    "binCode"   => "IDE0005262",
                     "taskCode"  =>'t2'.microtime(true),
                     "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "",
             ],
                 [
-                    "binCode"   => "IDE0000153",
+                    "binCode"   => "IDE0004968",
                     "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" => "",
             ],
                 ],
             "groupCode"     => 'g'.microtime(true),
@@ -119,25 +71,19 @@ class StorageController
 
                 [
                 "taskCode"  =>'t1'.microtime(true),
-                "binCode"   => "IDE0000009",
+                "binCode"   => "IDE0004954",
                 "fromLocCode" => "",
                 "toLocCode" => "BIN-OUT1",
             ],
                 [
                 "taskCode"  =>'t2'.microtime(true),
-                "binCode"   => "IDE0000032",
+                "binCode"   => "IDE0005262",
                 "fromLocCode" => "",
                 "toLocCode" => "BIN-OUT1",
             ],
                 [
-                "taskCode"  =>'t5'.microtime(true),
-                "binCode"   => "IDE0000153",
-                "fromLocCode" => "",
-                "toLocCode" => "BIN-OUT1",
-            ],
-                [
-                "taskCode"  =>'t8'.microtime(true),
-                "binCode"   => "IDE0005227",
+                "taskCode"  =>'t3'.microtime(true),
+                "binCode"   => "IDE0004968",
                 "fromLocCode" => "",
                 "toLocCode" => "BIN-OUT1",
             ],

+ 3 - 3
app/Services/BatchService.php

@@ -73,7 +73,7 @@ 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));
@@ -87,13 +87,13 @@ 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));
         }catch(Exception $e){
             foreach ($batches as $batch){
-                Cache::tags('波次防重叠'.[$batch['id']])->flush();
+                Cache::tags(['波次防重叠'.$batch['id']])->flush();
             }
             throw new ErrorException('注册任务失败: '.json_encode($batches). $e->getMessage());
         }

+ 1 - 2
app/Services/ForeignHaiRoboticsService.php

@@ -153,7 +153,7 @@ class ForeignHaiRoboticsService
             LogService::log('海柔请求','markBinProcessed1.6',
                 json_encode($stationTaskMaterialBox));
             if(!$stationTaskMaterialBox){
-                throw new ErrorException('该料箱没有安排在处理队列中');
+                throw new ErrorException('该料箱没有安排在处理队列中.');
             }
             $this->putBinToStore($stationTaskMaterialBox)
                 ?true
@@ -228,7 +228,6 @@ class ForeignHaiRoboticsService
             $this->stationTaskMaterialBoxService->set($stationTaskMaterialBox,[
                 'id' => $stationTaskMaterialBox['id'],
                 'status' => $stationTaskMaterialBox['status']='处理中',
-                'station_id' => 4,
             ]);
         }
         return $controlSuccess;

+ 2 - 2
app/Services/StationRuleBatchService.php

@@ -66,10 +66,10 @@ class StationRuleBatchService
         foreach ($batches as $batch){
             $stationRuleBatch=$this->getByBatch($batch);
             if(!$stationRuleBatch)continue;
-            if(Cache::tags('波次防重叠'.[$batch['id']])->get($batch['id']))
+            if(Cache::tags(['波次防重叠'.$batch['id']])->get($batch['id']))
                 continue;
             $batches_toProcess->push($batch);
-            Cache::tags('波次防重叠'.[ $batch['id']])->put($batch['id'],true,config('haiRou.波次防重叠时间_秒'));
+            Cache::tags([ '波次防重叠'.$batch['id']])->put($batch['id'],true,config('haiRou.波次防重叠时间_秒'));
         }
         LogService::log(__METHOD__,'shouldProcess','波次任务分配1.3:'.json_encode($batches_toProcess));
         return $batches_toProcess;