Zhouzhendong 4 лет назад
Родитель
Сommit
b14bd2b567

+ 2 - 0
app/Http/Controllers/StorageController.php

@@ -133,6 +133,8 @@ class StorageController extends Controller
         //获取目标库位
         $station = app("StationService")->getMirrorMappingLocation(request("station"));
         if (!$station)$this->error("未知库位");
+        $occupyTask = StationTaskMaterialBox::query()->where("station_id",$station->id)->whereNotIn("status",["完成","取消"])->first();
+        if ($occupyTask)$this->error("库位存在任务未处理完成");
         //获取料箱
         if ($boxId && !app("MaterialBoxService")->checkUsableBox($boxId)){
             $blacklist = [$boxId];

+ 6 - 6
app/Http/Controllers/TestController.php

@@ -143,13 +143,13 @@ class TestController extends Controller
     }
     public function test()
     {
+        dd();
         ini_set('max_execution_time', 0);
-        foreach (Order::query()->whereBetween("wms_edittime",["2021-06-01 00:00:00","2021-06-30 23:59:59"])
-                     ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")
-                         ->whereBetween("worked_at",["2021-06-01 00:00:00","2021-06-30 23:59:59"])
-                         ->where("outer_table_name","orders"))->get() as $order){
-            dispatch(new OrderCreateInstantBill($order));
-        }
+        $orders = Order::query()->whereBetween("wms_edittime",["2021-06-01 00:00:00","2021-06-30 23:59:59"])
+            ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")
+                ->whereBetween("worked_at",["2021-06-01 00:00:00","2021-06-30 23:59:59"])
+                ->where("outer_table_name","orders"))->get();
+        foreach ($orders->chunk(50) as $or)dispatch(new OrderCreateInstantBill($or));
     }
     public function orderCreateBill()
     {

+ 1 - 1
app/Services/StationService.php

@@ -101,7 +101,7 @@ class StationService
     public function getMirrorMappingLocation($mirrorLocation)
     {
         if (!$mirrorLocation)return null;
-        return Station::query()->where("code","M-".$mirrorLocation)->first();
+        return Station::query()->where("code",substr($mirrorLocation,2))->first();
     }
 
 }

+ 12 - 5
app/Services/StorageService.php

@@ -71,7 +71,16 @@ class StorageService
             ]);
             $stationTaskMaterialBox->loadMissing("station");
             //清理原有任务
-            $this->clearTask([$stationTaskMaterialBox->station->code]);
+            if ($stationTaskMaterialBox->station){
+                switch ($stationTaskMaterialBox->station->parent_id){
+                    case 6:
+                        $this->clearTask([$stationTaskMaterialBox->station->code]);
+                        break;
+                    case 7:
+                        app("CacheShelfService")->_stationCacheLightOn($stationTaskMaterialBox->station->code);
+                        break;
+                }
+            }
             DB::commit();
         }catch (\Exception $e){
             DB::rollBack();
@@ -105,7 +114,7 @@ class StorageService
             ->where("status",0)->first();
         if (!$task)return;
         //蓝灯闪烁
-        if ($task->type == '入库' && $task->mark == 1)app("CacheShelfService")->stationLightUp($stationTaskMaterialBox->station->code,null,'2','2');
+        if ($task->type == '入库' && $task->mark == 1)app("CacheShelfService")->stationLightUp($stationTaskMaterialBox->station->code,null,'2','2',"可放置商品数量“".$task->amount."”");
     }
 
     /**
@@ -145,10 +154,8 @@ class StorageService
                 $task->update([
                     "task_id" => $taskMaterialBox->id,
                     "status" => 1,
-                    "user_id" => Auth::id(),
                 ]);//标记事务完成
-                $collection = new Collection([$taskMaterialBox]);
-                app("ForeignHaiRoboticsService")->fetchGroup($station->code,$collection,'','缓存架入立架'); //呼叫机器人入库
+                app("ForeignHaiRoboticsService")->putBinToStore_fromCacheShelf($taskMaterialBox,$station->code); //呼叫机器人入库
                 DB::commit();
                 DB::connection("oracle")->commit();
                 return true;

+ 2 - 1
resources/views/store/inStorage/halfChestStorage.blade.php

@@ -166,11 +166,12 @@
                 checkMaximum(){
                     if (!this.info.asn || !this.info.barCode || this.checkSign)return;
                     window.tempTip.postBasicRequest("{{url('store/inStorage/checkMaximum')}}",this.info,res=>{
-                        this.info.maximum = res.need;
+                        this.info.maximum = res.maximum;
                         this.info.material_box_id = res.material_box_id;
                         this.info.material_box_model_id = res.material_box_model_id;
                         this.info.commodity_id = res.commodity_id;
                         this.checkSign = true;
+                        return "该库位最大可上数为"+res.maximum;
                     });
                 },
             },