Commit a02c4bd7 by wuwenlong

产副品制造成本核算;

parent 6f824da4
package com.baosight.hggp.hg.cb.service;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cb.domain.HGCB001;
import com.baosight.hggp.hg.cb.domain.HGCB002;
import com.baosight.hggp.hg.cb.domain.HGCB005;
import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cw.domain.HGCW001;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Map;
import java.util.Objects;
public class ServiceHGCB005 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.initLoad(inInfo, EiConstant.resultBlock, new HGCB005());
EiInfoUtils.addBlock(inInfo,"company_code_block_id", UserSessionUtils.getRoleCompany(), Company.class);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try{
inInfo = super.query(inInfo, HGCB005.QUERY, new HGCB005());
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
public EiInfo synchData(EiInfo inInfo) {
Map params= EiInfoUtils.getFirstRow(inInfo);
HGUtils.setCondition(params);
HGCB001 hgcw001Today = HGCBTools.HgCb001.select(params);
if (hgcw001Today != null && hgcw001Today.getAccountPeriodStatus() == 0) {
throw new PlatException(String.format("公司[%s]会计期[%s]状态为关账状态,数据同步失败!", hgcw001Today.getCompanyCode(), hgcw001Today.getAccountPeriod()));
}
HGCB001 hgcw001Last = HGCBTools.HgCb001.selectLast(params);
if (hgcw001Last != null && hgcw001Last.getAccountPeriodStatus() == 1) {
throw new PlatException(String.format("公司[%s]上月会计期[%s]为开账状态,数据同步失败!", hgcw001Last.getCompanyCode(), hgcw001Last.getAccountPeriod()));
}
HGCW001 hgcw001 = HGCWTools.HgCw001.getByCondition(params);
AssertUtils.isNull(hgcw001,String.format("公司[%s]会计期[%s]会计账期数据异常,数据同步失败!", hgcw001Today.getCompanyCode(), hgcw001Today.getAccountPeriod()));
HGCBTools.THGCB005.synchData(hgcw001);
return inInfo;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment