46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
package com.tenwa.customer.handler.finance;
|
|
|
|
import jbo.app.tenwa.calc.LC_CLOSE_ACCOUNT;
|
|
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.jbo.JBOTransaction;
|
|
import com.amarsoft.awe.dw.handler.impl.CommonHandler;
|
|
import com.tenwa.reckon.util.DateUtil;
|
|
|
|
public class CustomerCloseHander extends CommonHandler{
|
|
|
|
|
|
@Override
|
|
protected boolean validityCheck(BizObject bo, boolean isInsert) {
|
|
try {
|
|
if(isInsert){
|
|
BizObject bx=JBOFactory.createBizObjectQuery(LC_CLOSE_ACCOUNT.CLASS_NAME,"cyear='"+bo.getAttribute("cyear")+"' and cmonth='"+bo.getAttribute("cmonth")+"'").getSingleResult(false);
|
|
if(bx!=null){
|
|
this.errors="该月已有关账记录";
|
|
return false;
|
|
}
|
|
}else{
|
|
BizObject bx=JBOFactory.createBizObjectQuery(LC_CLOSE_ACCOUNT.CLASS_NAME,"cyear='"+bo.getAttribute("cyear")+"' and cmonth='"+bo.getAttribute("cmonth")+"' and id<>'"+bo.getAttribute("id")+"'").getSingleResult(false);
|
|
if(bx!=null){
|
|
this.errors="该月已有关账记录";
|
|
return false;
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
// TODO: handle exception
|
|
}
|
|
return super.validityCheck(bo, isInsert);
|
|
}
|
|
|
|
@Override
|
|
protected void beforeInsert(JBOTransaction tx, BizObject bo)
|
|
throws Exception {
|
|
bo.setAttributeValue("inputtime", DateUtil.getSystemTimeByFormat("yyyy/MM/dd"));
|
|
super.beforeInsert(tx, bo);
|
|
}
|
|
|
|
|
|
|
|
}
|