备料重算后更新请购单 增加组织和项目专用料过滤
This commit is contained in:
parent
6a77360408
commit
23dfbb2e05
|
|
@ -2,11 +2,15 @@ package nc.bs.mmpac.pmo.pac0002.bp.rule;
|
|||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.uapbd.util.MyHelper;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.vo.bd.material.stock.MaterialStockVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -17,13 +21,28 @@ import java.util.Map;
|
|||
* ±¸ÁÏÖØËãºó¸üÐÂÇ빺µ¥
|
||||
*/
|
||||
public class AfterPickmRecalUpdateBuyingreqRule implements IRule<PMOAggVO> {
|
||||
private Map<String, String> configParams;
|
||||
|
||||
|
||||
@Override
|
||||
public void process(PMOAggVO[] pmoAggVOS) {
|
||||
BaseDAO dao = new BaseDAO();
|
||||
try {
|
||||
for (PMOAggVO pmoAggVO : pmoAggVOS) {
|
||||
for (PMOItemVO pmoItemVO:pmoAggVO.getChildrenVO()){
|
||||
configParams = MyHelper.getConfigParams("xb-config", null);
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("箱变的QMS接口缺少配置");
|
||||
}
|
||||
String pkOrg = pmoAggVO.getParentVO().getPk_org();
|
||||
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||
if (checkIfOrg(orgCode, configParams)) {
|
||||
continue;
|
||||
}
|
||||
String material= pmoItemVO.getCmaterialvid();
|
||||
if(!checkProdect(material,pkOrg)){
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
String pmoid=pmoItemVO.getCmoid();
|
||||
UFDouble nastnum=pmoItemVO.getNastnum();
|
||||
|
|
@ -80,5 +99,41 @@ public class AfterPickmRecalUpdateBuyingreqRule implements IRule<PMOAggVO> {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 根据物料查询物料库存信息页签-是否项目专用料进行判断
|
||||
*
|
||||
* @param cmaterialvid
|
||||
* @param pk_org
|
||||
* @return
|
||||
*/
|
||||
private Boolean checkProdect(String cmaterialvid, String pk_org) {
|
||||
String whereSql = " pk_material='" + cmaterialvid + "' and pk_org='" + pk_org + "' and nvl(dr,0)=0 ";
|
||||
List<MaterialStockVO> list = null;
|
||||
try {
|
||||
list = (List<MaterialStockVO>) new BaseDAO().retrieveByClause(MaterialStockVO.class, whereSql);
|
||||
} catch (DAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (list != null && list.size() > 0) {
|
||||
return list.get(0).getFixasst2()==null?false:list.get(0).getFixasst2().booleanValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
|
||||
String targetCode = configParams.get("xbOrg");
|
||||
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
||||
throw new BusinessException("未配置组织参数");
|
||||
}
|
||||
String[] orgItem = targetCode.split(",");
|
||||
for (String orgCode : orgItem) {
|
||||
if (!orgCode.isEmpty() && orgCode.equals(code)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue