LD 4 éve
szülő
commit
efd1d9d3f2

+ 5 - 4
app/Http/Controllers/StorageController.php

@@ -125,8 +125,6 @@ class StorageController extends Controller
             $data .= "存在任务待处理,无法调取";
             $boxes = array_values($boxes);
         }
-        //清理原有任务
-        app("StorageService")->clearTask($boxes);//TODO 改为机器人防置时触发 但需要阿君修改任务参数为指定格口而非整个缓存架
         //重新调取料箱
         $result = app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->whereIn("code",$boxes)->get());
         if ($result===null)$this->error("任务下发错误,检查日志");
@@ -157,9 +155,9 @@ class StorageController extends Controller
                     ->where("status",0)->where(DB::raw("{$model->maximum}-amount"),">=",request("amount"))->get()->each(function ($box)use(&$boxId){
                         if (app("MaterialBoxService")->checkUsableBox($box->id)){
                             $boxId = $box->id;
-                            return true;
+                            return false;
                         }
-                        return false;
+                        return true;
                     });
                 if ($boxId)break;
             }
@@ -176,7 +174,9 @@ class StorageController extends Controller
             if (!$box)$this->error("无可用料箱");
             $boxId = $box->id;
         }
+        if (!$boxId)$this->error("无可用料箱");
         //发起取箱任务
+        DB::beginTransaction();
         $collection = new Collection();
         $task = StationTask::query()->create([
             'status' => "待处理",
@@ -202,6 +202,7 @@ class StorageController extends Controller
             "user_id" => Auth::id(),
             "mark" => 1
         ]);
+        DB::commit();
         //亮灯
         app("CacheShelfService")->stationLightUp($station->code,null,'2');
         $this->success();

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 46 - 48
app/Http/Controllers/TestController.php


+ 5 - 3
app/Services/StorageService.php

@@ -67,6 +67,9 @@ class StorageService
                 "station_id" => $stationTaskMaterialBox->station_id,
                 "material_box_id" => $stationTaskMaterialBox->material_box_id,
             ]);
+            $stationTaskMaterialBox->loadMissing("station");
+            //清理原有任务
+            app("StorageService")->clearTask([$stationTaskMaterialBox->station->code]);
             DB::commit();
         }catch (\Exception $e){
             DB::rollBack();
@@ -87,8 +90,6 @@ class StorageService
         if ($storage->status == 1)$update["status"] = 0;
         if ($storage->station_id)$update["station_id"] = null;
         if ($update)$storage->update($update);
-        //一号缓存架操作完下达补充料箱
-        if ($stationTaskMaterialBox->station->parent_id == 6)app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->where("code",$stationTaskMaterialBox->station_id)->get());
     }
 
     /**
@@ -133,7 +134,6 @@ class StorageService
                         DB::connection("oracle")->rollBack();
                         return false;
                     };
-                    DB::connection("oracle")->commit();
                 }catch(\Exception $e){
                     DB::connection("oracle")->rollBack();
                     return false;
@@ -148,9 +148,11 @@ class StorageService
                 $collection = new Collection([$taskMaterialBox]);
                 app("ForeignHaiRoboticsService")->fetchGroup($station->code,$collection,'','缓存架入立架'); //呼叫机器人入库
                 DB::commit();
+                DB::connection("oracle")->commit();
                 return true;
             }catch(\Exception $e){
                 DB::rollBack();
+                DB::connection("oracle")->rollBack();
                 return false;
             }
         }

+ 9 - 9
resources/views/store/inStorage/cacheRackStorage.blade.php

@@ -50,27 +50,27 @@
                     <div class="mt-2 h-75">
                         <table class="table table-sm table-bordered border-dark w-100 h-100 text-center" style="cursor: pointer">
                             <tr>
-                                <th :class="[shelfOccupy['HAIB1-03-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-03'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-03-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-03'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-03-03')">HAIB1-03-03</th>
-                                <th :class="[shelfOccupy['HAIB1-02-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-03'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-02-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-03'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-02-03')">HAIB1-02-03</th>
-                                <th :class="[shelfOccupy['HAIB1-01-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-03'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-01-03'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-03'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-01-03')">HAIB1-01-03</th>
                             </tr>
                             <tr>
-                                <th :class="[shelfOccupy['HAIB1-03-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-02'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-03-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-02'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-03-02')">HAIB1-03-02</th>
-                                <th :class="[shelfOccupy['HAIB1-02-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-02'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-02-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-02'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-02-02')">HAIB1-02-02</th>
-                                <th :class="[shelfOccupy['HAIB1-01-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-02'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-01-02'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-02'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-01-02')">HAIB1-01-02</th>
                             </tr>
                             <tr>
-                                <th :class="[shelfOccupy['HAIB1-03-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-01'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-03-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-03-01'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-03-01')">HAIB1-03-01</th>
-                                <th :class="[shelfOccupy['HAIB1-02-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-01'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-02-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-02-01'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-02-01')">HAIB1-02-01</th>
-                                <th :class="[shelfOccupy['HAIB1-01-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-01'] ? 'box-shadow-dark' : '']"
+                                <th class="d-block" :class="[shelfOccupy['HAIB1-01-01'] ? 'bg-danger' : 'bg-success',selectedBox['HAIB1-01-01'] ? 'box-shadow-dark' : '']"
                                     @click="fillingBox('HAIB1-01-01')">HAIB1-01-01</th>
                             </tr>
                         </table>

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott