ajustes de 7 para 10 etapas
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/config/color_palette.dart';
|
||||
import 'package:rkm/config/routes.dart';
|
||||
|
||||
class PostHttpOverrides extends HttpOverrides{
|
||||
@override
|
||||
HttpClient createHttpClient( context){
|
||||
return super.createHttpClient(context)
|
||||
..badCertificateCallback = (X509Certificate cert, String host, int port)=> true;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
HttpOverrides.global = new PostHttpOverrides();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
List list = value;
|
||||
if(list.length !=0){
|
||||
setState(() {
|
||||
messageSteps = "Etapa 1 de 7 - Gravando as Unidades no Aplicativo";
|
||||
messageSteps = "Etapa 1 de 10 - Gravando as Unidades no Aplicativo";
|
||||
});
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveUnidadesDB(value,i).then((value)async{
|
||||
@@ -70,7 +70,7 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
}
|
||||
await ApiDataLoad().loadProcedimentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
setState(() {
|
||||
messageSteps = "Etapa 2 de 7 - Gravando os Procedimentos no Aplicativo";
|
||||
messageSteps = "Etapa 2 de 10 - Gravando os Procedimentos no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
@@ -82,94 +82,122 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
}
|
||||
print('finalizou save Procedures');
|
||||
await ApiDataLoad().loadProcedimentosRegistros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
await DbSqliteLoad().saveProceduresRegisterDB(value).then((value)async{
|
||||
print('finalizou saveProceduresRegisterDB');
|
||||
await ApiDataLoad().loadCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCID');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 3 de 10 - Gravando os Procedimentos Registros no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveProceduresRegisterDB(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveProceduresRegisterDB');
|
||||
await ApiDataLoad().loadCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCID');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 4 de 10 - Gravando os CIDs no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCID(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCID');
|
||||
await ApiDataLoad().loadProcedimentosCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCID');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 3 de 7 - Gravando os CIDs no Aplicativo";
|
||||
messageSteps = "Etapa 5 de 10 - Gravando os Procedimentos CIDs no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCID(value,i).then((value)async{
|
||||
await DbSqliteLoad().saveProceduresCID(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCID');
|
||||
await ApiDataLoad().loadProcedimentosCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCID');
|
||||
await DbSqliteLoad().saveProceduresCID(value).then((value)async{
|
||||
print('finalizou saveProceduresCID');
|
||||
await ApiDataLoad().loadCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCBO');
|
||||
print('finalizou saveProceduresCID');
|
||||
await ApiDataLoad().loadCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCBO');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 6 de 10 - Gravando os CBOs no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCBO(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCBO');
|
||||
await ApiDataLoad().loadProcedimentosCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCBO');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 7 de 10 - Gravando os Procedimentos CBO no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveProceduresCBO(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
print('finalizou saveProceduresCBO');
|
||||
await ApiDataLoad().loadCIAP(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCIAP');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 4 de 7 - Gravando os CBOs no Aplicativo";
|
||||
messageSteps = "Etapa 8 de 10 - Gravando os CIAPs no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCBO(value,i).then((value)async{
|
||||
await DbSqliteLoad().saveCIAP(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCBO');
|
||||
await ApiDataLoad().loadProcedimentosCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCBO');
|
||||
await DbSqliteLoad().saveProceduresCBO(value).then((value)async{
|
||||
print('finalizou saveProceduresCBO');
|
||||
await ApiDataLoad().loadCIAP(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCIAP');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 5 de 7 - Gravando os CIAPs no Aplicativo";
|
||||
print('finalizou saveCIAP');
|
||||
await ApiDataLoad().loadMunicipios(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadMunicipios');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 9 de 10 - Gravando os Municípios no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCity(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataLoad().loadEquipes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipes');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 10 de 10 - Gravando as Equipes no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveTeam(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCIAP(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCIAP');
|
||||
await ApiDataLoad().loadMunicipios(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadMunicipios');
|
||||
}
|
||||
print('finalizou saveTeam');
|
||||
await ApiDataLoad().loadEquipeComponentes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipeComponentes');
|
||||
await DbSqliteLoad().saveTeamComponents(value).then((value)async{
|
||||
print('finalizou saveTeamComponents');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 6 de 7 - Gravando os Municípios no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCity(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataLoad().loadEquipes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipes');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 7 de 7 - Gravando as Equipes no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveTeam(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveTeam');
|
||||
await ApiDataLoad().loadEquipeComponentes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipeComponentes');
|
||||
await DbSqliteLoad().saveTeamComponents(value).then((value)async{
|
||||
print('finalizou saveTeamComponents');
|
||||
setState(() {
|
||||
finish = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
finish = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -269,7 +297,7 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
maxLines: 3,
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
TextDefault(text: countProg>0.94?'100 % finalizando etapa atual':(countProg*100).toStringAsFixed(0) + '%',color: Colors.black,textAlign: TextAlign.center,fontWeigth: FontWeight.bold,fontSize: 20),
|
||||
TextDefault(text: countProg>0.99?'100 % finalizando etapa atual':(countProg*100).toStringAsFixed(0) + '%',color: Colors.black,textAlign: TextAlign.center,fontWeigth: FontWeight.bold,fontSize: 20),
|
||||
SizedBox(height: 10),
|
||||
LinearProgressIndicator(value: countProg,minHeight: 15,color: ColorPalette.appBar,backgroundColor: ColorPalette.titleContainer,)
|
||||
],
|
||||
|
||||
@@ -174,19 +174,18 @@ class DbSqliteLoad{
|
||||
// print(await db.query('PROCEDIMENTOS_SIGTAP'));
|
||||
return db;
|
||||
}
|
||||
Future saveProceduresRegisterDB(var value)async{
|
||||
Future saveProceduresRegisterDB(var value, int i)async{
|
||||
Database db = await intialDB();
|
||||
// "INSERT OR REPLACE INTO PROCEDIMENTOS_SIGTAP_REGISTRO (COD_PROC_SIGTAP, CODIGO_REGISTRO) VALUES (?,?)";
|
||||
// {"codProcedimento":"0101010010","codRegistro":"01"}
|
||||
for(int i=0;value.length > i;i++){
|
||||
Map<String, dynamic> row = {
|
||||
'COD_PROC_SIGTAP' : value[i]['codProcedimento'],
|
||||
'CODIGO_REGISTRO' : value[i]['codRegistro'],
|
||||
};
|
||||
int id = await db.insert('PROCEDIMENTOS_SIGTAP_REGISTRO', row);
|
||||
// print('id increment $id PROCEDIMENTOS_SIGTAP_REGISTRO');
|
||||
// print(await db.query('PROCEDIMENTOS_SIGTAP_REGISTRO'));
|
||||
}
|
||||
|
||||
Map<String, dynamic> row = {
|
||||
'COD_PROC_SIGTAP' : value[i]['codProcedimento'],
|
||||
'CODIGO_REGISTRO' : value[i]['codRegistro'],
|
||||
};
|
||||
int id = await db.insert('PROCEDIMENTOS_SIGTAP_REGISTRO', row);
|
||||
// print('id increment $id PROCEDIMENTOS_SIGTAP_REGISTRO');
|
||||
// print(await db.query('PROCEDIMENTOS_SIGTAP_REGISTRO'));
|
||||
return db;
|
||||
}
|
||||
Future saveCID(var value,int i)async{
|
||||
@@ -203,18 +202,18 @@ class DbSqliteLoad{
|
||||
// print(await db.query('CIDS'));
|
||||
return db;
|
||||
}
|
||||
Future saveProceduresCID(var value)async{
|
||||
Future saveProceduresCID(var value, int i)async{
|
||||
Database db = await intialDB();
|
||||
// "INSERT OR REPLACE INTO PROCEDIMENTOS_SIGTAP_CID (COD_PROC_SIGTAP, CODIGO_CID) VALUES (?,?)"
|
||||
// {"codProcedimento":"0201010046","codCID":"C211"}
|
||||
for(int i=0;value.length > i;i++){
|
||||
Map<String, dynamic> row = {
|
||||
'COD_PROC_SIGTAP' : value[i]['codProcedimento'],
|
||||
'CODIGO_CID' : value[i]['codCID'],
|
||||
};
|
||||
int id = await db.insert('PROCEDIMENTOS_SIGTAP_CID', row);
|
||||
// print('id increment $id PROCEDIMENTOS_SIGTAP_REGISTRO');
|
||||
}
|
||||
|
||||
Map<String, dynamic> row = {
|
||||
'COD_PROC_SIGTAP' : value[i]['codProcedimento'],
|
||||
'CODIGO_CID' : value[i]['codCID'],
|
||||
};
|
||||
int id = await db.insert('PROCEDIMENTOS_SIGTAP_CID', row);
|
||||
// print('id increment $id PROCEDIMENTOS_SIGTAP_REGISTRO');
|
||||
|
||||
// print(await db.query('PROCEDIMENTOS_SIGTAP_CID'));
|
||||
return db;
|
||||
}
|
||||
@@ -231,18 +230,18 @@ class DbSqliteLoad{
|
||||
// print(await db.query('CBOS'));
|
||||
return db;
|
||||
}
|
||||
Future saveProceduresCBO(var value)async{
|
||||
Future saveProceduresCBO(var value,int i)async{
|
||||
Database db = await intialDB();
|
||||
// "INSERT OR REPLACE INTO PROCEDIMENTOS_SIGTAP_CBO (COD_PROC_SIGTAP, CODIGO_CBO) VALUES (?,?)";
|
||||
// "codProcedimento":"0101010010","codCBO":"223208"
|
||||
for(int i=0;value.length > i;i++){
|
||||
Map<String, dynamic> row = {
|
||||
'COD_PROC_SIGTAP' : value[i]['codProcedimento'],
|
||||
'CODIGO_CBO' : value[i]['codCBO'],
|
||||
};
|
||||
int id = await db.insert('PROCEDIMENTOS_SIGTAP_CBO', row);
|
||||
// print('id increment $id PROCEDIMENTOS_SIGTAP_REGISTRO');
|
||||
}
|
||||
|
||||
Map<String, dynamic> row = {
|
||||
'COD_PROC_SIGTAP' : value[i]['codProcedimento'],
|
||||
'CODIGO_CBO' : value[i]['codCBO'],
|
||||
};
|
||||
int id = await db.insert('PROCEDIMENTOS_SIGTAP_CBO', row);
|
||||
// print('id increment $id PROCEDIMENTOS_SIGTAP_REGISTRO');
|
||||
|
||||
// print(await db.query('PROCEDIMENTOS_SIGTAP_CBO'));
|
||||
return db;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user