LD 4 anni fa
parent
commit
6feee9614d
1 ha cambiato i file con 44 aggiunte e 44 eliminazioni
  1. 44 44
      app/Http/Controllers/TestController.php

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

@@ -130,50 +130,50 @@ class TestController extends Controller
         return call_user_func([$this, $method], $request);
     }
 
-    public function test()
-    {
-        ini_set('max_execution_time', 2500);
-        $model = MaterialBoxModel::query()->create([
-            "code" => "common"
-        StationTask::destroy([1278, 1279, 1280, 1282, 1283]);
-        StationTaskMaterialBox::destroy([18405, 18406, 18407, 18409, 18410]);
-        dd("OK");
-        $s = Station::query()->select("id")->where("parent_id", 6)->whereNotIn("code", [
-            "HAIB1-01-01", "HAIB1-03-01", "HAIB1-03-03"
-        ]);
-        $sql = <<<sql
-    select * from INV_LOT_LOC_ID where traceid = '*' and locationid like 'IDE%'
-sql;
-        foreach (DB::connection("oracle")->select(DB::raw($sql)) as $inv){
-            $materialBox = MaterialBox::query()->firstOrCreate(["code"=>$inv->locationid],[
-                "code" => $inv->locationid,
-                "material_box_model_id"=>$model
-            ]);
-            $owner = Owner::query()->firstOrCreate([
-                "code" => $inv->customerid
-            ],[
-                "code" => $inv->customerid,
-                "name" => $inv->customerid,
-            ]);
-            $commodity = Commodity::query()->where("owner_id",$owner->id)->where("sku",$inv->sku)->first();
-            if (!$commodity){
-                dump($inv->customerid." | ".$inv->sku);
-                continue;
-            }
-            \App\Storage::query()->create([
-                "material_box_id" => $materialBox->id,
-                "commodity_id" => $commodity->id,
-                "amount" => $inv->qty,
-            ]);
-        }
-        dd($s->get());
-        $t = StationTask::query()->select("id")->where("status", '待处理')
-            ->whereIn("station_id", $s);
-        StationTask::query()->where("status", '待处理')
-            ->whereIn("station_id", $s)->update(["status" => "完成"]);
-        StationTaskMaterialBox::query()->whereIn("station_task_id", $t)->update(["status" => "完成"]);
-        dd("OK");
-    }
+//    public function test()
+//    {
+//        ini_set('max_execution_time', 2500);
+//        $model = MaterialBoxModel::query()->create([
+//            "code" => "common"
+//        StationTask::destroy([1278, 1279, 1280, 1282, 1283]);
+//        StationTaskMaterialBox::destroy([18405, 18406, 18407, 18409, 18410]);
+//        dd("OK");
+//        $s = Station::query()->select("id")->where("parent_id", 6)->whereNotIn("code", [
+//            "HAIB1-01-01", "HAIB1-03-01", "HAIB1-03-03"
+//        ]);
+//        $sql = <<<sql
+//    select * from INV_LOT_LOC_ID where traceid = '*' and locationid like 'IDE%'
+//sql;
+//        foreach (DB::connection("oracle")->select(DB::raw($sql)) as $inv){
+//            $materialBox = MaterialBox::query()->firstOrCreate(["code"=>$inv->locationid],[
+//                "code" => $inv->locationid,
+//                "material_box_model_id"=>$model
+//            ]);
+//            $owner = Owner::query()->firstOrCreate([
+//                "code" => $inv->customerid
+//            ],[
+//                "code" => $inv->customerid,
+//                "name" => $inv->customerid,
+//            ]);
+//            $commodity = Commodity::query()->where("owner_id",$owner->id)->where("sku",$inv->sku)->first();
+//            if (!$commodity){
+//                dump($inv->customerid." | ".$inv->sku);
+//                continue;
+//            }
+//            \App\Storage::query()->create([
+//                "material_box_id" => $materialBox->id,
+//                "commodity_id" => $commodity->id,
+//                "amount" => $inv->qty,
+//            ]);
+//        }
+//        dd($s->get());
+//        $t = StationTask::query()->select("id")->where("status", '待处理')
+//            ->whereIn("station_id", $s);
+//        StationTask::query()->where("status", '待处理')
+//            ->whereIn("station_id", $s)->update(["status" => "完成"]);
+//        StationTaskMaterialBox::query()->whereIn("station_task_id", $t)->update(["status" => "完成"]);
+//        dd("OK");
+//    }
 
     public function orderCreateBill()
     {