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

+ 9 - 1
app/Authority.php

@@ -15,7 +15,15 @@ class Authority extends Model
     use ModelLogChanging;
     use SoftDeletes;
     use ModelTimeFormat;
-    protected $fillable = ['name','parent_id','alias_name','permission'];
+    protected $fillable = ['name','parent_id','alias_name','permission',"route","method"];
+
+    const METHOD = [
+        0 => "GET",
+        1 => "POST",
+        2 => "PUT",
+        3 => "DELETE",
+    ];
+
     function roles(){
         return $this->belongsToMany('App\Role','authority_role','id_authority','id_role');
     }

+ 1 - 1
app/Http/Controllers/OwnerController.php

@@ -211,7 +211,7 @@ class OwnerController extends Controller
         $id = $request->input('id');
         $owner = Owner::query()->whereNotNull('deleted_at')->where('id', $id)->first();
         $owner->update(["deleted_at" => null]);
-        app("OwnerService")->createAuthority($owner);
+        //app("OwnerService")->createAuthority($owner);
         app('LogService')->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
         return ['success' => 'true', 'owner' => $owner];
     }

+ 13 - 5
app/Http/Controllers/ProcessController.php

@@ -1065,11 +1065,19 @@ class ProcessController extends Controller
                     $query->where('code',$str)->orWhere('name',$str);
                 })->first();
                 if (!$owner){
-                    $owner = Owner::query()->create([
-                        'code' => $str,
-                        'name' => $str
-                    ]);
-                    app('LogService')->log(__METHOD__,"二次加工单录入导入商品数据时添加货主".__FUNCTION__,json_encode($owner),Auth::user()['id']);
+                    $owner=Owner::query()->whereNotNull("deleted_at")->where(function ($query)use($str){
+                        $query->where('code',$str)->orWhere('name',$str);
+                    })->first();
+                    if (!$owner){
+                        $owner = Owner::query()->create([
+                            'code' => $str,
+                            'name' => $str
+                        ]);
+                        Log::info("二次加工录入货主",["owner"=>$owner->toJson(),"user"=>Auth::id()]);
+                    }else{
+                        $owner->update(["deleted_at"=>null]);
+                        Log::info("二次加工恢复货主",["owner"=>$owner->toJson(),"user"=>Auth::id()]);
+                    }
                 }
             }
             $goods = Commodity::query()->with('barcodes')->where('owner_id',$owner->id)//->whereNull('owner_id')  保留,暂时不知为何限定货主为空

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

@@ -158,10 +158,10 @@ sql;
         //清理任务
         $data = '';
         //剔除准备执行任务但没有真正开始执行的待定库位
-        $occupy = Station::query()->select("id")->whereIn("code",$boxes)->where("status",1)->get();
+        $occupy = Station::query()->select("id","code")->whereIn("code",$boxes)->where("status",1)->get();
         foreach ($occupy as $item){
-            unset($boxes[array_search($item->code,$boxes)]);
             $data .= '“'.$item->code.'”,';
+            unset($boxes[array_search($item->code,$boxes)]);
         }
         if ($occupy->count()>0){
             $data .= "存在任务待处理,无法调取  ";

+ 0 - 1
app/Notifications/RoutineNotification.php

@@ -46,7 +46,6 @@ class RoutineNotification extends Notification implements ShouldQueue
 
     public function toBroadcast($notifiable):BroadcastMessage
     {
-        Log::debug("notifiable",["开始分发通知"]);
         return new BroadcastMessage($this->seeLog);
     }
 }

+ 34 - 0
database/migrations/2021_09_23_170820_change_authorities_table_add_column_route.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeAuthoritiesTableAddColumnRoute extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table("authorities",function (Blueprint $table){
+            $table->string("route")->nullable()->comment("路由");
+            $table->bigInteger("method")->nullable()->comment("请求方式");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table("authorities",function (Blueprint $table){
+            $table->dropColumn("route");
+            $table->dropColumn("method");
+        });
+    }
+}