data["active_test"] = "active"; } public function method(Request $request, $method) { return call_user_func([$this, $method], $request); } private function valFormat($val):?string { if ($val!==null){ $ret = date("Y-m-d H:i:s",strtotime($val))===(string)$val; if ($ret)$val = "to_date('".$val."','yyyy-mm-dd hh24:mi:ss')"; else $val = "'".$val."'"; }else $val = "null"; return $val; } public function test1($task,$amount){ DB::connection("oracle")->beginTransaction(); try { $columns = ''; $values = ''; foreach ($task as $key => $val) { if (Str::upper($key) == 'TASKID_SEQUENCE') { $taskMax = DB::connection("oracle")->selectOne(DB::raw("select MAX(TASKID_SEQUENCE) maxseq from TSK_TASKLISTS where taskid = ?"), [$task->taskid]); $val = $taskMax->maxseq + 1; } if (Str::upper($key) == 'FMQTY' || Str::upper($key) == 'FMQTY_EACH' || Str::upper($key) == 'PLANTOQTY' || Str::upper($key) == 'PLANTOQTY_EACH') { $val -= $amount; $task->$key = $amount; } $columns .= $key . ","; $values .= $this->valFormat($val) . ","; } $columns = mb_substr($columns, 0, -1); $values = mb_substr($values, 0, -1); $sql = <<where("id",171829)->get(); $batchService->assignTasks($batches); dd();*/ /*TaskTransaction::query()->where("id",">=",277)->delete(); StationTaskMaterialBox::query()->whereIn("id",[89685,89686,89687])->delete(); app("CacheShelfService")->_stationCacheLightOff("HAIB1-01-01");//灭灯 app("CacheShelfService")->_stationCacheLightOff("HAIB1-02-01");//灭灯 dd(1);*/ Station::query()->find(16)->update(["status"=>1]); Cache::forget("CACHE_SHELF_AVAILABLE"); $station = ["HAIB1-01-01","HAIB1-02-01"]; $material = ["IDE0001954","IDE0004030","IDE0002012"]; Station::query()->whereIn("code",$station)->update(["status"=>0]); $stations = Station::query()->whereIn("code",$station)->get(); $materials = MaterialBox::query()->whereIn("code",$material)->get(); $dateTime = date("Y-m-d H:i:s"); $task1 = StationTaskMaterialBox::query()->create([ 'station_id'=>$stations[0]->id, 'material_box_id'=>$materials[0]->id, 'station_task_batch_id'=>1, 'status'=>'待处理' ]); $task2=StationTaskMaterialBox::query()->create([ 'station_id'=>$stations[1]->id, 'material_box_id'=>$materials[1]->id, 'station_task_batch_id'=>1, 'status'=>'待处理' ]); $task3=StationTaskMaterialBox::query()->create([ 'station_id'=>6, 'material_box_id'=>$materials[2]->id, 'station_task_batch_id'=>1, 'status'=>'待处理' ]); TaskTransaction::query()->insert([[ "doc_code" => "test", "bar_code" => "test", "to_station_id" => $stations[0]->id, "material_box_id" => $materials[0]->id, "task_id" => $task1->id, "commodity_id" => 505012,//XUNI03 "amount" => 1, "type" => "出库", "status" => 0, "mark" => 2, "bin_number"=>1, "created_at"=>$dateTime, "updated_at"=>$dateTime, ],[ "doc_code" => "test", "bar_code" => "test", "to_station_id" => $stations[1]->id, "material_box_id" => $materials[1]->id, "task_id" => $task2->id, "commodity_id" => 505012,//XUNI03 "amount" => 1, "type" => "出库", "status" => 0, "mark" => 2, "bin_number"=>1, "created_at"=>$dateTime, "updated_at"=>$dateTime, ],[ "doc_code" => "test", "bar_code" => "test", "to_station_id" => 6, "material_box_id" => $materials[2]->id, "task_id" => $task3->id, "commodity_id" => 505012,//XUNI03 "amount" => 1, "type" => "出库", "status" => 3, "mark" => 2, "bin_number"=>1, "created_at"=>$dateTime, "updated_at"=>$dateTime, ]]); $foreignHaiRoboticsService = new ForeignHaiRoboticsService(); $toLocation = collect($station); $taskMaterialBoxes = collect([$task1,$task2]); $foreignHaiRoboticsService-> fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, '', '立架出至缓存架',20,false); foreach ($toLocation as $value){ app("CacheShelfService")->lightUp($value,'3','0',["title"=>"机器人取箱中,禁止操作"]); Cache::forever("CACHE_SHELF_OCCUPANCY_11",true); } app("StationService")->locationOccupyMulti($toLocation->toArray()); } public function update_order_packages_is_manual_update() { $descriptions = Log::query() ->select('description') ->whereBetween('created_at', ['2021-08-31 10:30:00', '2021-08-31 10:35:00']) ->where('class', 'like', 'https://was.baoshi56.com/package/logistic/batchUpdate%')->pluck('description'); foreach ($descriptions as $description) { $description = substr($description, 9); $description = \Illuminate\Support\Str::before($description,"}"); $obj= json_decode($description.'}',true); OrderPackage::query() ->whereIn('logistic_number', $obj['logistic_numbers']) ->update([ 'status' => '无', 'is_manual_update' => false, ]); } } public function oci() { $conn = getOciConnect(); $sql_sp= 'begin SPSO_SingleSKU_Match(:IN_Warehouse,:IN_CustomerID,:IN_WaveNo,:IN_SKU,:IN_CheckModule,:IN_WorkStation,:IN_Language,:IN_UserID,:OUT_AllocationDetailsID,:OUT_TOID,:OUT_OrderNo,:OUT_Return_Code); end;'; $stmt = oci_parse($conn, $sql_sp); $warehouse_id = "WHO1"; $customer_id = 'WANLING'; $wave_no = '*'; $sku = 'TEST017'; $check_module = ''; $work_station = ''; $language = ''; $use_id = 'lizixu'; $allocation_details_id = ''; $to_id = ''; $order_no = ''; $return_code = ''; oci_bind_by_name($stmt,":IN_Warehouse",$warehouse_id); oci_bind_by_name($stmt,':IN_CustomerID',$customer_id ); oci_bind_by_name($stmt,':IN_WaveNo',$wave_no ); oci_bind_by_name($stmt,':IN_SKU', $sku ); oci_bind_by_name($stmt,':IN_CheckModule',$check_module ); oci_bind_by_name($stmt,':IN_WorkStation',$work_station ); oci_bind_by_name($stmt,':IN_Language',$language ); oci_bind_by_name($stmt,':IN_UserID', $use_id ); oci_bind_by_name($stmt,':OUT_AllocationDetailsID',$allocation_details_id ); oci_bind_by_name($stmt,':OUT_TOID',$to_id ); oci_bind_by_name($stmt,':OUT_OrderNo',$order_no ); oci_bind_by_name($stmt,':OUT_Return_Code',$return_code ); oci_execute($stmt); oci_close($conn); dd([$allocation_details_id, $to_id, $order_no, $return_code]); } }