/* * Created on 10 ��.�. 2549 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.csc.library.process; import com.csc.library.utilities.MyLog; import java.util.Vector; import com.csc.library.databean.Ttimetemp; import com.csc.library.session.DbInquiry; import com.csc.library.session.DbRecord; import com.csc.library.session.InitialInquiry; import com.csc.library.session.InitialRecord; import com.csc.library.utilities.CscCalendar; /** * @author SassyBoy100 * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ /* * class �����㹡�� move �����š��ŧ���� ŧ��� ����ѵԡ��ŧ���� * TTIMETEMP --> TTIMETEMP_HISTORY */ public class MoveTimeTempToHistory extends ProcessTimeBase { private DbInquiry inq = null; public Vector getProcessList() { Vector v = new Vector(); try { this.setParamData(); if (!this.getParamValue("filterProcess").equals("")) { DbInquiry inq = new InitialInquiry(this.upf).getDbInquiry(); inq.setParam(this.data); inq.setSchemaName(this.upf.getSchemaName()); inq.initMyTable("Memployee", this.getParamValue("filterProcess"), "employeeid"); inq.setColumn("employeeid, time0, runno, bossid, bu1, bu2, bu3, bu4, bu5, companyid, startdate, resigndate, status"); inq.setFatchAll(true); inq.refresh(); while (inq.next()) { v.addElement(inq.getCurrentDbRecord().getString("employeeid")); } } } catch (Exception e) { MyLog.error(this, e); } return v; } public void process() throws Exception { this.setParamData(); CscCalendar cs1 = new CscCalendar(this.getParamValue("startDate")); //cs1.decDate(); CscCalendar cs2 = new CscCalendar(this.getParamValue("endDate")); //cs2.incDate(); String filter=""; Vector vt = this.processList; for (int i=0;i<vt.size() && !this.isCancle();i++) { String id = (String) vt.elementAt(i); filter = "employeeid='" + (String) vt.elementAt(i) + "' and (swipedate between '"+cs1.getYYYYMMDD()+"' and '"+cs2.getYYYYMMDD()+"') "; this.moveHistory(filter); //�ӡ�� move data this.alive("Process EmployeeID : "+id+" ["+i+" of "+vt.size()+"]"); } this.setMessage("Successful of MoveTimeTempToHistory : "+vt.size()); this.setFullMessage("Successful of MoveTimeTempToHistory : "+vt.size()+"\n"); } /* * �ӡ�����¢����š��ŧ���Ҩҡ * TTIMETEMP --> TTIMETEMP_HISTORY */ private void moveHistory(String filter) { try { if (this.inq == null) { this.inq = new InitialInquiry(this.upf).getDbInquiry(); this.inq.setParam(this.data); this.inq.setSchemaName(this.upf.getSchemaName()); this.inq.initMyTable("Ttimetemp", "", ""); this.inq.setColumn("*"); } this.inq.setFilter(filter); this.inq.refresh(); while (this.inq.next()) { Ttimetemp rec = (Ttimetemp) this.inq.getCurrentDbRecord().cloneRecord(true); rec.setReferOn(true); rec.moveTimeHistory(); } } catch (Exception e) { MyLog.error(this, e); } } }