|
@@ -15,6 +15,7 @@ import org.apache.log4j.Logger;
|
|
|
|
|
|
import com.kingdee.bos.BOSException;
|
|
|
import com.kingdee.bos.Context;
|
|
|
+import com.kingdee.bos.dao.IObjectPK;
|
|
|
import com.kingdee.bos.util.BOSUuid;
|
|
|
import com.kingdee.eas.basedata.person.PersonCollection;
|
|
|
import com.kingdee.eas.basedata.person.PersonFactory;
|
|
@@ -241,7 +242,7 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
/**
|
|
|
* 工时计算
|
|
|
*/
|
|
|
- protected void _updateWorkHoursReport(Context ctx, String number, String star, String end, int day)
|
|
|
+ protected void _updateWorkHoursReport(Context ctx, String number, String star, String end, int day,String type)
|
|
|
throws BOSException, EASBizException {
|
|
|
//获取工时确认单生成工时单
|
|
|
String CFCLOCKTIME = null; //年月日-时分秒
|
|
@@ -286,13 +287,14 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
sb.append(" order by CFEMPLOYEEID,CFCLOCKTIME asc").append(" \n");//排序
|
|
|
//获取打卡数据-审核通过的数据
|
|
|
IRowSet rs = DbUtil.executeQuery(ctx, sb.toString());
|
|
|
+ System.out.println("sb:"+sb);
|
|
|
try {
|
|
|
while (rs.next()) {
|
|
|
CFCLOCKTIME = rs.getString("CFCLOCKTIME"); //年月日-时分秒
|
|
|
CFCLOCKDATE = rs.getString("CFCLOCKDATE"); //年月日
|
|
|
CFPROJECTID = rs.getString("CFPROJECTID"); //项目id
|
|
|
CFEMPLOYEEID = rs.getString("CFEMPLOYEEID"); //人员id
|
|
|
- CFCLOCKLOCATION = rs.getString("CFCLOCKLOCATION"); //位置
|
|
|
+ CFCLOCKLOCATION = "";//rs.getString("CFCLOCKLOCATION"); //位置
|
|
|
fid = rs.getString("fid"); //fid
|
|
|
map = new HashMap<String,String>();
|
|
|
map.put("CFCLOCKTIME", CFCLOCKTIME);
|
|
@@ -336,6 +338,7 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
String oldCFPROJECTID = null; //旧的项目
|
|
|
String oldCFCLOCKTIME = null; //旧的打卡时间
|
|
|
String oldfid = null; //旧的fid
|
|
|
+ String deleteWhere = " CFEMPLOYEEID='"+CFEMPLOYEEID+"' and to_char(CFDATA,'YYYY-MM-DD') = '"+CFCLOCKDATE+"'";
|
|
|
for (int j2 = 0; j2 < listMap.size(); j2++) {
|
|
|
map = listMap.get(j2);
|
|
|
CFCLOCKTIME = map.get("CFCLOCKTIME"); //年月日-时分秒
|
|
@@ -367,12 +370,9 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
long diffInHours = diffInMillies / (60 * 60 * 1000);
|
|
|
BigDecimal hours = new BigDecimal(diffInHours);
|
|
|
//组装数据
|
|
|
- info = initInfo(ctx,CFEMPLOYEEID, oldCFPROJECTID, date, null, CFCLOCKLOCATION, hours,oldfid+","+fid);
|
|
|
- if(!delist.contains(oldfid)) {
|
|
|
- delist.add(oldfid);
|
|
|
- }
|
|
|
- if(!delist.contains(fid)) {
|
|
|
- delist.add(fid);
|
|
|
+ info = initInfo(ctx,CFEMPLOYEEID, oldCFPROJECTID, date, sdf.format(sdf.parse(CFCLOCKTIME)), null, hours,oldfid+","+fid);
|
|
|
+ if(!delist.contains(deleteWhere)) {
|
|
|
+ delist.add(deleteWhere);
|
|
|
}
|
|
|
coll.add(info);
|
|
|
} catch (ParseException ee) {
|
|
@@ -401,12 +401,9 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
long diffInHours = diffInMillies / (60 * 60 * 1000);
|
|
|
BigDecimal hours = new BigDecimal(diffInHours);
|
|
|
//组装数据
|
|
|
- info = initInfo(ctx,CFEMPLOYEEID, oldCFPROJECTID, date, null, CFCLOCKLOCATION, hours,oldfid+","+fid);
|
|
|
- if(!delist.contains(oldfid)) {
|
|
|
- delist.add(oldfid);
|
|
|
- }
|
|
|
- if(!delist.contains(fid)) {
|
|
|
- delist.add(fid);
|
|
|
+ info = initInfo(ctx,CFEMPLOYEEID, oldCFPROJECTID, date, sdf.format(sdf.parse(CFCLOCKTIME)), null, hours,oldfid+","+fid);
|
|
|
+ if(!delist.contains(deleteWhere)) {
|
|
|
+ delist.add(deleteWhere);
|
|
|
}
|
|
|
coll.add(info);
|
|
|
} catch (ParseException ee) {
|
|
@@ -417,12 +414,24 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //保存
|
|
|
- biz.addnew(coll);
|
|
|
-
|
|
|
- if(delist != null && delist.size() > 0) {
|
|
|
-
|
|
|
- }
|
|
|
+ //删除情况下
|
|
|
+ if(type.equals("update") && delist.size() > 0) {
|
|
|
+ //删除当天
|
|
|
+ for (int i = 0; i < delist.size(); i++) {
|
|
|
+ DbUtil.execute(ctx, " delete from CT_PRO_WorkHoursReport where CFDATASOURCE = 'workHoursCal' and FBILLSTATE = '3' "
|
|
|
+ + "and CFFILLINGSTARTDATE = CFFILLINGENDDATE and fid in(select FParentID from CT_PRO_WorkHoursReportentry where "+delist.get(i)+") ");
|
|
|
+ DbUtil.execute(ctx, " delete from CT_PRO_WorkHoursReportentry where "+delist.get(i)+" ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存处理-审核通过
|
|
|
+ System.out.println("coll:"+coll.toString());
|
|
|
+ if(coll.size() > 0) {
|
|
|
+ for (int i = 0; i < coll.size(); i++) {
|
|
|
+ info = (WorkHoursReportInfo) coll.get(i);
|
|
|
+ IObjectPK pk = biz.addnew(info);
|
|
|
+ biz.setAudited(BOSUuid.read(pk.toString())); //-审核通过
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -456,9 +465,11 @@ public class WorkHoursFacadeControllerBean extends AbstractWorkHoursFacadeContro
|
|
|
info.setDataSource(dataSource.workHoursCal);
|
|
|
info.setAffiliatedProject(proinfo);
|
|
|
info.setBillState(HRBillStateEnum.AUDITED); //审核通过
|
|
|
+ info.setFillingStartDate(data); //默认当天
|
|
|
+ info.setFillingEndDate(data); //默认当天
|
|
|
info.setSourceBillId(ids);
|
|
|
einfo.setEmployee(pinfo);
|
|
|
- einfo.setClockLocation("");
|
|
|
+// einfo.setClockLocation("工时计算");
|
|
|
einfo.setClockTime(ClockTime); //打卡时间
|
|
|
einfo.setData(data); //日期
|
|
|
einfo.setWorkingHours(hours); //工时
|