|
@@ -30,15 +30,22 @@ class TestController extends Controller
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
public function test(){
|
|
public function test(){
|
|
|
- $arr = DB::connection("oracle")->select(DB::raw("SELECT LOCATIONID FROM INV_LOT_LOC_ID
|
|
|
|
|
-where LOCATIONID like 'IDE%' and CUSTOMERID in ('PUHE')
|
|
|
|
|
-group by CUSTOMERID,LOCATIONID order by CUSTOMERID"));
|
|
|
|
|
- $str = "";
|
|
|
|
|
|
|
+ $sql = <<<SQL
|
|
|
|
|
+select * from equipment where id in (
|
|
|
|
|
+ select parent_id from equipment where parent_id in (select id from equipment where info like '%"id":2%' and code like 'H%')
|
|
|
|
|
+ group by parent_id having (count(*)<5)
|
|
|
|
|
+);
|
|
|
|
|
+SQL;
|
|
|
|
|
+
|
|
|
|
|
+ $arr = DB::connection("aliyunMysql")->select(DB::raw($sql));
|
|
|
|
|
+ $insert = <<<SQL
|
|
|
|
|
+insert into equipment(repository_id, code, parent_id, info, depth, width, height, containers, location_tab, created_at, updated_at, tandem)
|
|
|
|
|
+values (?,?,?,null,?,?,1.8,null,'0-0','2022-01-13 16:08:00','2022-01-13 16:08:00',null)
|
|
|
|
|
+SQL;
|
|
|
|
|
|
|
|
foreach ($arr as $item){
|
|
foreach ($arr as $item){
|
|
|
- $str .= '"'.$item->locationid.'",';
|
|
|
|
|
|
|
+ DB::connection("aliyunMysql")->insert($insert, [$item->repository_id,$item->code."-1",$item->id,$item->depth,$item->width]);
|
|
|
}
|
|
}
|
|
|
- dd($str);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|