Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagRigaDocumento.java

69 lines
2.8 KiB
Java

import it.acxent.contab.Documento;
import it.acxent.contab.RigaDocumento;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import it.acxent.db.ResParm;
import it.acxent.util.DbConsole;
import it.acxent.util.Vectumerator;
import java.sql.Timestamp;
import java.util.Calendar;
public class AggiornaMagRigaDocumento extends DbConsole {
public static void main(String[] args) {
AggiornaMagRigaDocumento bean = new AggiornaMagRigaDocumento();
bean.doImport();
System.exit(0);
}
public void doImport() {
int i = 0, j = 0;
int se1 = 10;
int se2 = 100;
String hostname = "localhost";
String db = "ravinale";
boolean step1 = true, 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) {
i = 0;
System.out.println("Import All Movimento");
RigaDocumento rd = new RigaDocumento(apTarget);
Vectumerator<RigaDocumento> vec = rd.findByDocumento(51L, -1L, "", 0, 0, 0);
Documento documento = new Documento(apTarget);
documento.findByPrimaryKey(51L);
System.out.println("tot record: " + vec.getTotNumberOfRecords());
while (vec.hasMoreElements()) {
rd = (RigaDocumento)vec.nextElement();
System.out.println(rd.getArticoloVariante().getCodiceVariante() + " " + rd.getArticoloVariante().getCodiceVariante() + " " + rd.getArticoloVariante().getQuantitaEffettivaAv());
if (rd.getArticoloVariante().getQuantitaEffettivaAv() == 0.0D) {
rp = Documento.addRigaDocumento(documento, rd);
if (rd.getArticoloVariante().getQuantitaEffettivaAv() == 0.0D)
System.out.println("" +
rd.getArticoloVariante().getQuantitaEffettivaAv() + " " + rd.getArticoloVariante().getQuantitaEffettivaAv());
}
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println(i);
}
}
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
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();
}
}
}