77 lines
2.8 KiB
Java
77 lines
2.8 KiB
Java
import com.ablia.contab.RigaDocumento;
|
|
import com.ablia.contab.RigaDocumentoCR;
|
|
import com.ablia.contab.RigaDocumentoP;
|
|
import com.ablia.db.ApplParm;
|
|
import com.ablia.db.ApplParmFull;
|
|
import com.ablia.db.ResParm;
|
|
import com.ablia.util.DbConsole;
|
|
import com.ablia.util.Vectumerator;
|
|
import java.sql.Timestamp;
|
|
import java.util.Calendar;
|
|
|
|
public class AggiornaRDMOV extends DbConsole {
|
|
public static void main(String[] args) {
|
|
AggiornaRDMOV bean = new AggiornaRDMOV();
|
|
bean.doImport();
|
|
System.exit(0);
|
|
}
|
|
|
|
public void doImport() {
|
|
int i = 0, j = 0;
|
|
int se1 = 10;
|
|
int se2 = 100;
|
|
String hostname = "localhost";
|
|
String db = "guidoreni14";
|
|
boolean step1 = false, step2 = true, step3 = true, step4 = true, step5 = true;
|
|
System.out.println("Db: " + db);
|
|
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60));
|
|
apTarget.setDebug(false);
|
|
StringBuffer msg = new StringBuffer();
|
|
try {
|
|
long l_id_articolo = 0L;
|
|
ResParm rp = new ResParm(true);
|
|
int pagerow = 1000;
|
|
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
|
System.out.println("START: " + start.toString());
|
|
if (step1) {
|
|
System.out.println("CICLO RIGA DOCUMENTO");
|
|
i = 0;
|
|
RigaDocumento rd = new RigaDocumento(apTarget);
|
|
RigaDocumentoCR CR = new RigaDocumentoCR(apTarget);
|
|
int nrighe = 100000;
|
|
int recordCancellati = 0;
|
|
int npag = 1;
|
|
Vectumerator<RigaDocumento> vec;
|
|
while ((vec = rd.findByCR(CR, npag, nrighe)).hasMoreElements()) {
|
|
npag++;
|
|
while (vec.hasMoreElements()) {
|
|
RigaDocumento row = (RigaDocumento)vec.nextElement();
|
|
rp = row.saveMagSuRIgaDocumento();
|
|
if (!rp.getStatus())
|
|
System.out.println(rp.getMsg());
|
|
i++;
|
|
if (se1 > 0 && i % se1 == 0)
|
|
System.out.print(".");
|
|
if (se2 > 0 && i % se2 == 0)
|
|
System.out.println(String.valueOf(i) + " PAG. " + npag + " / " + nrighe);
|
|
}
|
|
}
|
|
}
|
|
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
|
System.out.println("STOP: " + start.toString());
|
|
System.out.println("DURATA: " + ((double)(stop.getTime() - start.getTime()) / 60000.0D) + " minuti");
|
|
start = stop;
|
|
if (step2) {
|
|
RigaDocumentoP rdp = new RigaDocumentoP(apTarget);
|
|
rdp.aggiustaOrdiniSuRD();
|
|
}
|
|
stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
|
System.out.println("STOP: " + start.toString());
|
|
System.out.println("DURATA: " + ((double)(stop.getTime() - start.getTime()) / 60000.0D) + " minuti");
|
|
System.out.println("Fine");
|
|
System.out.println(rp.getMsg());
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|