解决工艺路线修改后制单人缺失的问题
This commit is contained in:
parent
f2cec0c84b
commit
79d782329a
|
@ -0,0 +1,419 @@
|
||||||
|
package nccloud.api.impl.mmbd.routing.rule;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.impl.pubapp.pattern.data.vo.VOQuery;
|
||||||
|
import nc.itf.bd.rt.rt0008.IRtQuery;
|
||||||
|
import nc.itf.bd.rt.rt0008.service.ProxyService;
|
||||||
|
import nc.itf.mmf.busi.measure.IMeasesureService;
|
||||||
|
import nc.mmbd.adapter.uap.UAPAdapter;
|
||||||
|
import nc.pubitf.bd.bdactivity.pub.IBDActivityPubQuery;
|
||||||
|
import nc.util.mmf.busi.measure.MeasureVO;
|
||||||
|
import nc.util.mmf.busi.service.MaterialPubService;
|
||||||
|
import nc.util.mmf.busi.service.OrgUnitPubService;
|
||||||
|
import nc.util.mmf.framework.base.MMValueCheck;
|
||||||
|
import nc.util.mmf.framework.db.MMSqlBuilder;
|
||||||
|
import nc.vo.bd.bdactivity.entity.BDActivityVO;
|
||||||
|
import nc.vo.bd.bom.bom0202.enumeration.ItemSourceEnum;
|
||||||
|
import nc.vo.bd.material.MaterialVO;
|
||||||
|
import nc.vo.bd.rt.rt0004.entity.RcVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.AggRtVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.AssOrgVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtActivityVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtHeadVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtItemVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtOpacVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.enumeration.FcontrolEnum;
|
||||||
|
import nc.vo.bd.rt.rt0008.enumeration.FprocessMoveTypeEnum;
|
||||||
|
import nc.vo.bd.rt.rt0008.enumeration.FsupplymodeEnum;
|
||||||
|
import nc.vo.ml.MultiLangUtil;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.lang.UFBoolean;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
|
import nc.vo.pubapp.AppContext;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
|
||||||
|
public class ChangeAboutFieldValue {
|
||||||
|
public void process(AggRtVO[] vos) {
|
||||||
|
for (AggRtVO vo : vos) {
|
||||||
|
this.fillHeadValue(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillHeadValue(AggRtVO vo) {
|
||||||
|
RtHeadVO hvo = (RtHeadVO) vo.getParentVO();
|
||||||
|
AggRtVO[] aggvos = null;
|
||||||
|
if(MMValueCheck.isNotEmpty(hvo.getPrimaryKey())) {
|
||||||
|
IRtQuery rtquery = (IRtQuery) NCLocator.getInstance().lookup(IRtQuery.class);
|
||||||
|
try {
|
||||||
|
aggvos = rtquery.queryByIds(new String[] {hvo.getPrimaryKey()});
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.wrappException(e);
|
||||||
|
}
|
||||||
|
RtHeadVO oldHead = (RtHeadVO) aggvos[0].getParentVO();
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getCreator())) {
|
||||||
|
hvo.setCreator(oldHead.getCreator());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getBillmaker())) {
|
||||||
|
hvo.setBillmaker(oldHead.getBillmaker());
|
||||||
|
}
|
||||||
|
if (hvo.getCreationtime()==null) {
|
||||||
|
hvo.setCreationtime(oldHead.getCreationtime());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 工厂关联工厂版本
|
||||||
|
if (MMValueCheck.isNotEmpty(hvo.getPk_org()) && MMValueCheck.isEmpty(hvo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(hvo.getPk_org());
|
||||||
|
hvo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(hvo.getPk_org_v()) && MMValueCheck.isEmpty(hvo.getPk_org())) {
|
||||||
|
String oid = OrgUnitPubService.getOrgIDByVID(hvo.getPk_org());
|
||||||
|
hvo.setPk_org(oid);
|
||||||
|
}
|
||||||
|
// 物料编码关联相关字段
|
||||||
|
if (MMValueCheck.isNotEmpty(hvo.getCmaterialid()) && MMValueCheck.isEmpty(hvo.getCmaterialvid())) {
|
||||||
|
String materialvid = hvo.getCmaterialid();
|
||||||
|
materialvid = MaterialPubService.queryMaterialLatestVidByOid(new String[] { materialvid }).get(materialvid);
|
||||||
|
hvo.setCmaterialvid(materialvid);
|
||||||
|
this.setMaterialField(vo, hvo.getCmaterialid());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getCmaterialid()) && MMValueCheck.isNotEmpty(hvo.getCmaterialvid())) {
|
||||||
|
String materialoid = hvo.getCmaterialid();
|
||||||
|
materialoid = MaterialPubService.queryOidMaterialByLatestVid(new String[] { hvo.getCmaterialvid() })
|
||||||
|
.get(hvo.getCmaterialvid());
|
||||||
|
hvo.setCmaterialvid(materialoid);
|
||||||
|
this.setMaterialField(vo, materialoid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getHbcustomized())) {
|
||||||
|
hvo.setHbcustomized(UFBoolean.FALSE);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.fillBodyValue(vo);
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
ExceptionUtils.wrappException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillBodyValue(AggRtVO vo) throws BusinessException {
|
||||||
|
RtHeadVO hvo = (RtHeadVO) vo.getParentVO();
|
||||||
|
AssOrgVO[] avos = (AssOrgVO[]) vo.getChildren(AssOrgVO.class);
|
||||||
|
AssOrgVO[] avoss = null;
|
||||||
|
if (MMValueCheck.isNotEmpty(avos)) {
|
||||||
|
if (MMValueCheck.isEmpty(avos[0].getPk_useorg()) && MMValueCheck.isEmpty(avos[0].getPk_org())
|
||||||
|
&& MMValueCheck.isEmpty(avos[0].getPk_org_v()) && MMValueCheck.isEmpty(avos[0].getPk_useorg_v())) {
|
||||||
|
avos[0].setPk_useorg(hvo.getPk_org());
|
||||||
|
avos[0].setPk_org(hvo.getPk_org());
|
||||||
|
avos[0].setPk_useorg_v(hvo.getPk_org_v());
|
||||||
|
avos[0].setPk_org_v(hvo.getPk_org_v());
|
||||||
|
vo.setChildren(AssOrgVO.class, avos);
|
||||||
|
} else {
|
||||||
|
List<String> oidList = new ArrayList<String>();
|
||||||
|
List<String> vidList = new ArrayList<String>();
|
||||||
|
for (AssOrgVO avo : avos) {
|
||||||
|
if (MMValueCheck.isNotEmpty(avo.getPk_useorg())) {
|
||||||
|
oidList.add(avo.getPk_useorg());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(avo.getPk_useorg_v())) {
|
||||||
|
vidList.add(avo.getPk_useorg_v());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 根据vid获取oid
|
||||||
|
Map<String, String> oidmap = OrgUnitPubService.getOrgIDSByVIDS(vidList.toArray(new String[0]));
|
||||||
|
// 根据oid获取vid
|
||||||
|
Map<String, String> vidmap = OrgUnitPubService.getNewVIDSByOrgIDS(oidList.toArray(new String[0]));
|
||||||
|
UFBoolean flag = UFBoolean.FALSE;
|
||||||
|
for (AssOrgVO avo : avos) {
|
||||||
|
if (MMValueCheck.isEmpty(avo.getPk_org()) && MMValueCheck.isNotEmpty(avo.getPk_useorg())) {
|
||||||
|
avo.setPk_org(avo.getPk_useorg());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(avo.getPk_org_v()) && MMValueCheck.isNotEmpty(avo.getPk_useorg_v())) {
|
||||||
|
avo.setPk_org_v(avo.getPk_useorg_v());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(avo.getPk_org_v()) && MMValueCheck.isNotEmpty(avo.getPk_org())) {
|
||||||
|
avo.setPk_org_v(vidmap.get(avo.getPk_org()));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(avo.getPk_org()) && MMValueCheck.isNotEmpty(avo.getPk_org_v())) {
|
||||||
|
avo.setPk_org(oidmap.get(avo.getPk_org_v()));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(avo.getPk_useorg()) && MMValueCheck.isNotEmpty(avo.getPk_useorg_v())) {
|
||||||
|
avo.setPk_useorg(vidmap.get(avo.getPk_useorg_v()));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(avo.getPk_useorg_v()) && MMValueCheck.isNotEmpty(avo.getPk_useorg())) {
|
||||||
|
avo.setPk_useorg_v(vidmap.get(avo.getPk_useorg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (AssOrgVO avo : avos) {
|
||||||
|
if (hvo.getPk_org().equals(avo.getPk_org())) {
|
||||||
|
flag = UFBoolean.TRUE;
|
||||||
|
}
|
||||||
|
if (hvo.getPk_org_v().equals(avo.getPk_org_v())) {
|
||||||
|
flag = UFBoolean.TRUE;
|
||||||
|
}
|
||||||
|
if (hvo.getPk_org().equals(avo.getPk_useorg())) {
|
||||||
|
flag = UFBoolean.TRUE;
|
||||||
|
}
|
||||||
|
if (hvo.getPk_org_v().equals(avo.getPk_useorg_v())) {
|
||||||
|
flag = UFBoolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag.equals(UFBoolean.FALSE)) {
|
||||||
|
avoss = new AssOrgVO[avos.length + 1];
|
||||||
|
for (int i = 0; i < avos.length; i++) {
|
||||||
|
avoss[i] = avos[i];
|
||||||
|
}
|
||||||
|
avoss[avos.length] = new AssOrgVO();
|
||||||
|
avoss[avos.length].setPk_useorg(hvo.getPk_org());
|
||||||
|
avoss[avos.length].setPk_org(hvo.getPk_org());
|
||||||
|
avoss[avos.length].setPk_useorg_v(hvo.getPk_org_v());
|
||||||
|
avoss[avos.length].setPk_org_v(hvo.getPk_org_v());
|
||||||
|
vo.setChildren(AssOrgVO.class, avoss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
avos = new AssOrgVO[1];
|
||||||
|
avos[0] = new AssOrgVO();
|
||||||
|
// 设置使用组织的默认值
|
||||||
|
avos[0].setPk_useorg(hvo.getPk_org());
|
||||||
|
avos[0].setPk_org(hvo.getPk_org());
|
||||||
|
avos[0].setPk_useorg_v(hvo.getPk_org_v());
|
||||||
|
avos[0].setPk_org_v(hvo.getPk_org_v());
|
||||||
|
vo.setChildren(AssOrgVO.class, avos);
|
||||||
|
}
|
||||||
|
|
||||||
|
RtItemVO[] itemVos = (RtItemVO[]) vo.getChildren(RtItemVO.class);
|
||||||
|
for (RtItemVO itemvo : itemVos) {
|
||||||
|
if (MMValueCheck.isEmpty(itemvo.getPk_org()) && MMValueCheck.isEmpty(itemvo.getPk_org_v())) {
|
||||||
|
itemvo.setPk_org(hvo.getPk_org());
|
||||||
|
}
|
||||||
|
RtOpacVO[] rtVos = itemvo.getRtopacitems();
|
||||||
|
RtActivityVO[] rtActVos = itemvo.getRtactitems();
|
||||||
|
if (MMValueCheck.isEmpty(itemvo.getPk_group())) {
|
||||||
|
String pk_group = AppContext.getInstance().getPkGroup();
|
||||||
|
itemvo.setPk_group(pk_group);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(itemvo.getPk_org()) && MMValueCheck.isEmpty(itemvo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(itemvo.getPk_org());
|
||||||
|
itemvo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(itemvo.getPk_org()) && MMValueCheck.isNotEmpty(itemvo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(itemvo.getPk_org());
|
||||||
|
itemvo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(itemvo.getCrcid())) {
|
||||||
|
String pk_group = itemvo.getPk_group();
|
||||||
|
MMSqlBuilder sql = new MMSqlBuilder();
|
||||||
|
sql.and();
|
||||||
|
sql.append(RcVO.PK_GROUP, pk_group);
|
||||||
|
VOQuery<RcVO> query = new VOQuery<RcVO>(RcVO.class);
|
||||||
|
// 查询标准工序
|
||||||
|
RcVO[] rcVOs = query.query(sql.toString(), null);
|
||||||
|
for (int i = 0; i < rcVOs.length; i++) {
|
||||||
|
if (rcVOs[i].getPk_group().equals(rcVOs[i].getPk_org())) {
|
||||||
|
itemvo.setCrcid(rcVOs[i].getCrcid());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 查询工序VO
|
||||||
|
// if (!MMValueCheck.isEmpty(itemVos[0].getCrcid())) {
|
||||||
|
// AggRcVO[] crcvos = new BillQuery<AggRcVO>(AggRcVO.class).query(new String[] {itemVos[0].getCrcid()});
|
||||||
|
// RcVO rcvo = (RcVO) crcvos[0].getParentVO();
|
||||||
|
// String vrcname = rcvo.getVrcname();
|
||||||
|
// }
|
||||||
|
itemvo.setBcountpoint(UFBoolean.TRUE);
|
||||||
|
itemvo.setBcheckpoint(UFBoolean.FALSE);
|
||||||
|
itemvo.setProcessmovetype(FprocessMoveTypeEnum.NOMOVE.toIntValue());
|
||||||
|
if (MMValueCheck.isEmpty(itemvo.getNworktime())) {
|
||||||
|
itemvo.setNworktime(UFDouble.ONE_DBL);
|
||||||
|
}
|
||||||
|
// 孙表设值
|
||||||
|
if (MMValueCheck.isNotEmpty(rtVos)) {
|
||||||
|
for (RtOpacVO rtvo : rtVos) {
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getVprocessno())) {
|
||||||
|
rtvo.setVprocessno("10");
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getPk_group())) {
|
||||||
|
String pk_group = AppContext.getInstance().getPkGroup();
|
||||||
|
rtvo.setPk_group(pk_group);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getPk_org()) && MMValueCheck.isEmpty(rtvo.getPk_org_v())) {
|
||||||
|
if (MMValueCheck.isNotEmpty(itemvo.getPk_org())) {
|
||||||
|
rtvo.setPk_org(itemvo.getPk_org());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtvo.getPk_org()) && MMValueCheck.isEmpty(rtvo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(rtvo.getPk_org());
|
||||||
|
rtvo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getPk_org()) && MMValueCheck.isNotEmpty(rtvo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(rtvo.getPk_org());
|
||||||
|
rtvo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
// 补全工序耗料物料
|
||||||
|
// if (MMValueCheck.isEmpty(rtvo.getCmaterialid()) && MMValueCheck.isEmpty(rtvo.getCmaterialvid())) {
|
||||||
|
// String pk_group = rtvo.getPk_group();
|
||||||
|
// MMSqlBuilder sql = new MMSqlBuilder();
|
||||||
|
// sql.and();
|
||||||
|
// sql.append(MaterialVO.PK_GROUP, pk_group);
|
||||||
|
// VOQuery<MaterialVO> query = new VOQuery<MaterialVO>(MaterialVO.class);
|
||||||
|
// //查询标准工序
|
||||||
|
// MaterialVO[] materialVos = query.query(sql.toString(), null);
|
||||||
|
// for (MaterialVO materialvo : materialVos) {
|
||||||
|
// if (MMValueCheck.isNotEmpty(hvo.getCmaterialid()) && !hvo.getCmaterialid().equals(materialvo.getPk_material())) {
|
||||||
|
// rtvo.setCmaterialid(materialvo.getPk_material());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (MMValueCheck.isNotEmpty(rtvo.getCmaterialid()) && MMValueCheck.isEmpty(rtvo.getCmaterialvid())) {
|
||||||
|
String materialvid = rtvo.getCmaterialid();
|
||||||
|
materialvid = MaterialPubService.queryMaterialLatestVidByOid(new String[] { materialvid })
|
||||||
|
.get(rtvo.getCmaterialid());
|
||||||
|
rtvo.setCmaterialvid(materialvid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getCmaterialid()) && MMValueCheck.isNotEmpty(rtvo.getCmaterialvid())) {
|
||||||
|
String materialoid = rtvo.getCmaterialid();
|
||||||
|
materialoid = MaterialPubService.queryOidMaterialByLatestVid(new String[] { rtvo.getCmaterialvid() })
|
||||||
|
.get(rtvo.getCmaterialvid());
|
||||||
|
rtvo.setCmaterialvid(materialoid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtvo.getCmaterialid())) {
|
||||||
|
IMeasesureService mservice = NCLocator.getInstance().lookup(IMeasesureService.class);
|
||||||
|
Map<String, MeasureVO> measurevoMap;
|
||||||
|
try {
|
||||||
|
measurevoMap = mservice.getMeasureInfoMap(new String[] { rtvo.getCmaterialid() });
|
||||||
|
MeasureVO mvo = measurevoMap.get(rtvo.getCmaterialid());
|
||||||
|
String cassmeasureid = mvo.getCassMeasures();
|
||||||
|
String cmeasureid = mvo.getCmeasureid();
|
||||||
|
String vchangerate = mvo.getVchangeRate();
|
||||||
|
rtvo.setCassmeasureid(cassmeasureid);
|
||||||
|
rtvo.setCmeasureid(cmeasureid);
|
||||||
|
rtvo.setVchangerate(vchangerate);
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
ExceptionUtils.wrappException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getNastnum()) && MMValueCheck.isEmpty(rtvo.getNnumber())) {
|
||||||
|
rtvo.setNastnum(UFDouble.ONE_DBL);
|
||||||
|
rtvo.setNnumber(UFDouble.ONE_DBL);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getBacknumber())) {
|
||||||
|
rtvo.setBacknumber(Integer.valueOf(1));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getFsupplymode())) {
|
||||||
|
rtvo.setFsupplymode(FsupplymodeEnum.NORMAL.toIntValue());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getFpicksource())) {
|
||||||
|
rtvo.setFpicksource(ItemSourceEnum.FROM_STORE.toIntValue());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(rtvo.getFcontrol())) {
|
||||||
|
rtvo.setFcontrol(FcontrolEnum.UNCONTROLABLE.toIntValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtActVos)) {
|
||||||
|
for (RtActivityVO ravo : rtActVos) {
|
||||||
|
if (MMValueCheck.isEmpty(ravo.getPk_group())) {
|
||||||
|
String pk_group = AppContext.getInstance().getPkGroup();
|
||||||
|
ravo.setPk_group(pk_group);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(ravo.getPk_org()) && MMValueCheck.isEmpty(ravo.getPk_org_v())) {
|
||||||
|
if (MMValueCheck.isNotEmpty(itemvo.getPk_org())) {
|
||||||
|
ravo.setPk_org(itemvo.getPk_org());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(ravo.getPk_org()) && MMValueCheck.isEmpty(ravo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(ravo.getPk_org());
|
||||||
|
ravo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(ravo.getPk_org()) && MMValueCheck.isNotEmpty(ravo.getPk_org_v())) {
|
||||||
|
String vid = OrgUnitPubService.getNewVIDByOrgID(ravo.getPk_org());
|
||||||
|
ravo.setPk_org_v(vid);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(ravo.getCactivityid())) {
|
||||||
|
List<String> actids = new ArrayList<String>();
|
||||||
|
actids.add(ravo.getCactivityid());
|
||||||
|
IBDActivityPubQuery qry = NCLocator.getInstance().lookup(IBDActivityPubQuery.class);
|
||||||
|
BDActivityVO[] acts = qry.queryBDActivityVOByPKs(actids);
|
||||||
|
ravo.setCmeasureid(acts[0].getCmeasureid());
|
||||||
|
ravo.setBilltime(acts[0].getBilltime());
|
||||||
|
ravo.setBillbase(acts[0].getBillbase());
|
||||||
|
ravo.setCaculateway(acts[0].getCaculateway());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(ravo.getNstandardwknum())) {
|
||||||
|
ravo.setNstandardwknum(UFDouble.ONE_DBL);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(itemvo.getDeffectdate())) {
|
||||||
|
ravo.setDeffectdate(itemvo.getDeffectdate());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(itemvo.getDinvaliddate())) {
|
||||||
|
ravo.setDinvaliddate(itemvo.getDinvaliddate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMaterialField(AggRtVO vo, String materialvid) {
|
||||||
|
RtHeadVO hvo = (RtHeadVO) vo.getParentVO();
|
||||||
|
RtItemVO[] itemVos = (RtItemVO[]) vo.getChildren(RtItemVO.class);
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getNastnum()) && MMValueCheck.isEmpty(hvo.getNnumber())) {
|
||||||
|
hvo.setNastnum(UFDouble.ONE_DBL);
|
||||||
|
hvo.setNnumber(UFDouble.ONE_DBL);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getNastnum()) && MMValueCheck.isNotEmpty(hvo.getNnumber())) {
|
||||||
|
hvo.setNastnum(hvo.getNnumber());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(hvo.getNastnum()) && MMValueCheck.isEmpty(hvo.getNnumber())) {
|
||||||
|
hvo.setNnumber(hvo.getNastnum());
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getBdefault())) {
|
||||||
|
hvo.setBdefault(UFBoolean.TRUE);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(materialvid)) {
|
||||||
|
try {
|
||||||
|
Map<String, MaterialVO> materialMap = UAPAdapter.queryMaterialBaseInfo(new String[] { materialvid });
|
||||||
|
String materialname = MultiLangUtil.getSuperVONameOfCurrentLang(materialMap.get(materialvid), MaterialVO.NAME,
|
||||||
|
null);
|
||||||
|
IMeasesureService mservice = NCLocator.getInstance().lookup(IMeasesureService.class);
|
||||||
|
Map<String, MeasureVO> measurevoMap;
|
||||||
|
measurevoMap = mservice.getMeasureInfoMap(new String[] { materialvid });
|
||||||
|
MeasureVO mvo = measurevoMap.get(materialvid);
|
||||||
|
String cassmeasureid = mvo.getCassMeasures();
|
||||||
|
String cmeasureid = mvo.getCmeasureid();
|
||||||
|
String vchangerate = mvo.getVchangeRate();
|
||||||
|
hvo.setCassmeasureid(cassmeasureid);
|
||||||
|
hvo.setCmeasureid(cmeasureid);
|
||||||
|
hvo.setVchangerate(vchangerate);
|
||||||
|
for (RtItemVO itemVo : itemVos) {
|
||||||
|
itemVo.setCbpriceassmeasureid(cassmeasureid);
|
||||||
|
itemVo.setCbpricemeasureid(cmeasureid);
|
||||||
|
itemVo.setVbpricechangerate(vchangerate);
|
||||||
|
}
|
||||||
|
hvo.setCmaterialname(materialname);
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
ExceptionUtils.wrappException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String pk_group = AppContext.getInstance().getPkGroup();
|
||||||
|
if (hvo.getPk_group() == null) {
|
||||||
|
hvo.setPk_group(pk_group);
|
||||||
|
}
|
||||||
|
String newVersion = null;
|
||||||
|
try {
|
||||||
|
if (MMValueCheck.isNotEmpty(pk_group) && MMValueCheck.isNotEmpty(hvo.getPk_org())
|
||||||
|
&& MMValueCheck.isNotEmpty(hvo.getCmaterialid()) && MMValueCheck.isNotEmpty(hvo.getCmaterialvid())) {
|
||||||
|
newVersion = ProxyService.getIRtQueryService().getRtNewVersionByConWithCustParam(pk_group, hvo.getPk_org(),
|
||||||
|
hvo.getCmaterialid(), hvo.getCmaterialvid(), false);
|
||||||
|
}
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
ExceptionUtils.wrappException(e);
|
||||||
|
}
|
||||||
|
if (newVersion != null) {
|
||||||
|
hvo.setNewbomversion(newVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,529 @@
|
||||||
|
package nccloud.openapi.mmbd.routing;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
|
||||||
|
import nc.bs.framework.common.InvocationInfoProxy;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.itf.bd.rt.rt0008.IRtQuery;
|
||||||
|
import nc.util.bd.bom.openapi.BillFieldsCodeToPkUtil;
|
||||||
|
import nc.util.mmf.framework.base.MMValueCheck;
|
||||||
|
import nc.util.mmf.framework.db.MMSqlBuilder;
|
||||||
|
import nc.util.mmpub.dpub.base.ValueCheckUtil;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.AggRtVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.AssOrgVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtActivityVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtHeadVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtItemVO;
|
||||||
|
import nc.vo.bd.rt.rt0008.entity.RtOpacVO;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.ISuperVO;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
||||||
|
import nccloud.api.mmbd.routing.IAPIRoutingBusinessService;
|
||||||
|
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||||
|
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
||||||
|
import org.json.JSONString;
|
||||||
|
|
||||||
|
@Path("mmbd/routing")
|
||||||
|
public class RoutingResource extends AbstractNCCRestResource {
|
||||||
|
private static String PD_RT = "pd_rt";
|
||||||
|
|
||||||
|
private static String PD_RT_B = "pd_rt_b";
|
||||||
|
|
||||||
|
private static String PD_RT_ASSORG = "pd_rt_assorg";
|
||||||
|
|
||||||
|
private static String AGG = "agg";
|
||||||
|
|
||||||
|
private static String MARKWORD = "markword";
|
||||||
|
|
||||||
|
private static String RTO = "pd_rt_opac";
|
||||||
|
|
||||||
|
private static String RTA = "pd_rt_activity";
|
||||||
|
|
||||||
|
private static String CRTID = "crtid";
|
||||||
|
|
||||||
|
public String getModule() {
|
||||||
|
return "mmbd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("operation/save")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
public JSONString saveRouting(JSONObject para) {
|
||||||
|
List<Map<String, Object>> paramList = (List) para.get("data");
|
||||||
|
AggRtVO[] retVos = null;
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息",
|
||||||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
||||||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
||||||
|
String exception = markword.substring(0, markword.length() - 2);
|
||||||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
||||||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
||||||
|
.lookup(IAPIRoutingBusinessService.class);
|
||||||
|
try {
|
||||||
|
retVos = service.save(aggVos);
|
||||||
|
return ResultMessageUtil.toJSON(retVos, "工艺路线保存成功");
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("save")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
public JSONString saveRouting(List<Map<String, Object>> paramList) {
|
||||||
|
AggRtVO[] retVos = null;
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息",
|
||||||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
||||||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
||||||
|
String exception = markword.substring(0, markword.length() - 2);
|
||||||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
||||||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
||||||
|
.lookup(IAPIRoutingBusinessService.class);
|
||||||
|
try {
|
||||||
|
retVos = service.save(aggVos);
|
||||||
|
return ResultMessageUtil.toJSON(retVos, "工艺路线保存成功");
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("operation/update")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
public JSONString updateRouting(JSONObject para) {
|
||||||
|
List<Map<String, Object>> paramList = (List) para.get("data");
|
||||||
|
AggRtVO[] retVos = null;
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT_ASSORG)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息",
|
||||||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
||||||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
||||||
|
String exception = markword.substring(0, markword.length() - 2);
|
||||||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
||||||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
||||||
|
.lookup(IAPIRoutingBusinessService.class);
|
||||||
|
try {
|
||||||
|
retVos = service.update(aggVos);
|
||||||
|
return ResultMessageUtil.toJSON(retVos, "工艺路线修改成功");
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("update")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
public JSONString updateRouting(List<Map<String, Object>> paramList) {
|
||||||
|
AggRtVO[] retVos = null;
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
if (!map.containsKey(PD_RT_B) || !map.containsKey(PD_RT_ASSORG)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息",
|
||||||
|
APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String markword = (String) getAggRtVO(paramList).get(MARKWORD);
|
||||||
|
if (MMValueCheck.isNotEmpty(markword)) {
|
||||||
|
String exception = markword.substring(0, markword.length() - 2);
|
||||||
|
return ResultMessageUtil.exceptionToJSON(exception, APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
AggRtVO[] aggVos = (AggRtVO[]) getAggRtVO(paramList).get(AGG);
|
||||||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
||||||
|
.lookup(IAPIRoutingBusinessService.class);
|
||||||
|
try {
|
||||||
|
retVos = service.update(aggVos);
|
||||||
|
return ResultMessageUtil.toJSON(retVos, "工艺路线修改成功");
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("query")
|
||||||
|
@Consumes({ "application/json" })
|
||||||
|
@Produces({ "application/json" })
|
||||||
|
public JSONString queryRouting(Map<String, Object> paramMap) {
|
||||||
|
AggRtVO[] retVos = null;
|
||||||
|
IAPIRoutingBusinessService service = (IAPIRoutingBusinessService) NCLocator.getInstance()
|
||||||
|
.lookup(IAPIRoutingBusinessService.class);
|
||||||
|
try {
|
||||||
|
retVos = service.query(paramMap);
|
||||||
|
RtHeadVO[] hvos = null;
|
||||||
|
if (!ValueCheckUtil.isNullORZeroLength(retVos)) {
|
||||||
|
hvos = getHVO(retVos);
|
||||||
|
}
|
||||||
|
String usercode = InvocationInfoProxy.getInstance().getUserCode();
|
||||||
|
if ("plm".equals(usercode) || "gaoning".equals(usercode)) {
|
||||||
|
return ResultMessageUtil.toJSONUnTranslate(retVos, "工艺路线查询成功");
|
||||||
|
}
|
||||||
|
return ResultMessageUtil.toJSON(hvos, "工艺路线查询成功");
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(new BusinessException(e.getMessage(), e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RtHeadVO[] getHVO(AggRtVO[] vos) {
|
||||||
|
RtHeadVO[] hvos = new RtHeadVO[vos.length];
|
||||||
|
if (MMValueCheck.isNotEmpty(vos)) {
|
||||||
|
for (int i = 0; i < hvos.length; i++) {
|
||||||
|
hvos[i] = (RtHeadVO) vos[i].getParentVO();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hvos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> getAggRtVO(List<Map<String, Object>> paramList) {
|
||||||
|
List<AggRtVO> aggVoList = new ArrayList<AggRtVO>();
|
||||||
|
Map<String, AggRtVO> pkmap = new HashMap<String, AggRtVO>();
|
||||||
|
List<String> pklist = new ArrayList<String>();
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
|
||||||
|
Map<String, Object> head = (Map) map.get(PD_RT);
|
||||||
|
if (MMValueCheck.isNotEmpty(head.get(CRTID))) {
|
||||||
|
pklist.add((String) head.get(CRTID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] pks = (String[]) pklist.toArray(new String[0]);
|
||||||
|
AggRtVO[] newaggvos = null;
|
||||||
|
if (!ValueCheckUtil.isEmpty(pks)) {
|
||||||
|
newaggvos = queryVOByIDs(pks);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(newaggvos)) {
|
||||||
|
for (int i = 0; i < newaggvos.length; i++) {
|
||||||
|
if (MMValueCheck.isNotEmpty(newaggvos[i].getPrimaryKey())) {
|
||||||
|
pkmap.put(newaggvos[i].getPrimaryKey(), newaggvos[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
|
||||||
|
Map<String, Set<String>> tableid = new HashMap<String, Set<String>>();
|
||||||
|
|
||||||
|
Map<String, Object> idvo = new HashMap<String, Object>();
|
||||||
|
AggRtVO aggvo = new AggRtVO();
|
||||||
|
|
||||||
|
Map<String, Object> head = (Map) map.get(PD_RT);
|
||||||
|
|
||||||
|
List<Map<String, Object>> body_b = (List) map.get(PD_RT_B);
|
||||||
|
|
||||||
|
List<Map<String, String>> body_s = (List) map.get(PD_RT_ASSORG);
|
||||||
|
RtHeadVO hvo = new RtHeadVO();
|
||||||
|
for (String headkey : head.keySet()) {
|
||||||
|
hvo.setAttributeValue(headkey, head.get(headkey));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isEmpty(hvo.getPrimaryKey())) {
|
||||||
|
hvo.setStatus(2);
|
||||||
|
} else {
|
||||||
|
hvo.setStatus(1);
|
||||||
|
}
|
||||||
|
aggvo.setParent(hvo);
|
||||||
|
AggRtVO newRtvo = null;
|
||||||
|
for (String pk : pkmap.keySet()) {
|
||||||
|
if (pk.equals(hvo.getPrimaryKey())) {
|
||||||
|
newRtvo = (AggRtVO) pkmap.get(pk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(newRtvo)) {
|
||||||
|
Set<String> sethvo = new HashSet<String>();
|
||||||
|
RtHeadVO newhvo = (RtHeadVO) newRtvo.getParentVO();
|
||||||
|
sethvo.add(newhvo.getPrimaryKey());
|
||||||
|
tableid.put(PD_RT, sethvo);
|
||||||
|
Set<String> setitemvo = new HashSet<String>();
|
||||||
|
RtItemVO[] newitemvos = (RtItemVO[]) newRtvo.getChildren(RtItemVO.class);
|
||||||
|
if (MMValueCheck.isNotEmpty(newitemvos)) {
|
||||||
|
for (RtItemVO itemvo : newitemvos) {
|
||||||
|
setitemvo.add(itemvo.getPrimaryKey());
|
||||||
|
idvo.put(itemvo.getPrimaryKey(), itemvo);
|
||||||
|
Set<String> setrtovo = new HashSet<String>();
|
||||||
|
RtOpacVO[] newrtovos = itemvo.getRtopacitems();
|
||||||
|
if (MMValueCheck.isNotEmpty(newrtovos)) {
|
||||||
|
for (RtOpacVO newrtavo : newrtovos) {
|
||||||
|
setrtovo.add(newrtavo.getPrimaryKey());
|
||||||
|
idvo.put(newrtavo.getPrimaryKey(), newrtavo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tableid.put(RTO, setrtovo);
|
||||||
|
Set<String> setrtavo = new HashSet<String>();
|
||||||
|
RtActivityVO[] newrtavos = itemvo.getRtactitems();
|
||||||
|
if (MMValueCheck.isNotEmpty(newrtavos)) {
|
||||||
|
for (RtActivityVO newrtovo : newrtavos) {
|
||||||
|
setrtavo.add(newrtovo.getPrimaryKey());
|
||||||
|
idvo.put(newrtovo.getPrimaryKey(), newrtovo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tableid.put(RTA, setrtavo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tableid.put(PD_RT_B, setitemvo);
|
||||||
|
AssOrgVO[] newassvos = (AssOrgVO[]) newRtvo.getChildren(AssOrgVO.class);
|
||||||
|
Set<String> setassvo = new HashSet<String>();
|
||||||
|
if (MMValueCheck.isNotEmpty(newassvos)) {
|
||||||
|
for (AssOrgVO assvo : newassvos) {
|
||||||
|
setassvo.add(assvo.getPrimaryKey());
|
||||||
|
idvo.put(assvo.getPrimaryKey(), assvo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tableid.put(PD_RT_ASSORG, setassvo);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RtItemVO> rtItemVoList = new ArrayList<RtItemVO>();
|
||||||
|
Set<String> body_b_set = (Set) tableid.get(PD_RT_B);
|
||||||
|
if (MMValueCheck.isNotEmpty(body_b)) {
|
||||||
|
for (Map<String, Object> body_b_map : body_b) {
|
||||||
|
RtItemVO itemVo = new RtItemVO();
|
||||||
|
for (String body_b_key : body_b_map.keySet()) {
|
||||||
|
itemVo.setAttributeValue(body_b_key, body_b_map.get(body_b_key));
|
||||||
|
if (RTO.equals(body_b_key)) {
|
||||||
|
List<RtOpacVO> rtoVoList = new ArrayList<RtOpacVO>();
|
||||||
|
|
||||||
|
List<Map<String, Object>> rto = (List) body_b_map.get(body_b_key);
|
||||||
|
Set<String> rto_set = (Set) tableid.get(RTO);
|
||||||
|
if (MMValueCheck.isNotEmpty(rto)) {
|
||||||
|
for (Map<String, Object> rtomap : rto) {
|
||||||
|
RtOpacVO rtoVo = new RtOpacVO();
|
||||||
|
if (MMValueCheck.isNotEmpty(rtomap)) {
|
||||||
|
for (String rtomapkey : rtomap.keySet()) {
|
||||||
|
rtoVo.setAttributeValue(rtomapkey, rtomap.get(rtomapkey));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtoVo.getPrimaryKey())) {
|
||||||
|
rtoVo.setStatus(1);
|
||||||
|
} else {
|
||||||
|
rtoVo.setStatus(2);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtoVo.getPrimaryKey())) {
|
||||||
|
rto_set.remove(rtoVo.getPrimaryKey());
|
||||||
|
}
|
||||||
|
rtoVoList.add(rtoVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rto_set)) {
|
||||||
|
for (String rto_set_pk : rto_set) {
|
||||||
|
RtOpacVO setrtovo = (RtOpacVO) idvo.get(rto_set_pk);
|
||||||
|
setrtovo.setStatus(3);
|
||||||
|
rtoVoList.add(setrtovo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (MMValueCheck.isNotEmpty(rto_set)) {
|
||||||
|
for (String rto_set_pk : rto_set) {
|
||||||
|
RtOpacVO setrtovo = (RtOpacVO) idvo.get(rto_set_pk);
|
||||||
|
setrtovo.setStatus(3);
|
||||||
|
rtoVoList.add(setrtovo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
itemVo.setRtopacitems((RtOpacVO[]) rtoVoList.toArray(new RtOpacVO[0]));
|
||||||
|
}
|
||||||
|
if (RTA.equals(body_b_key)) {
|
||||||
|
List<RtActivityVO> rtaVoList = new ArrayList<RtActivityVO>();
|
||||||
|
|
||||||
|
List<Map<String, Object>> rta = (List) body_b_map.get(body_b_key);
|
||||||
|
Set<String> rta_set = (Set) tableid.get(RTA);
|
||||||
|
if (MMValueCheck.isNotEmpty(rta)) {
|
||||||
|
for (Map<String, Object> rtamap : rta) {
|
||||||
|
RtActivityVO rtoVa = new RtActivityVO();
|
||||||
|
for (String rtomapkey : rtamap.keySet()) {
|
||||||
|
rtoVa.setAttributeValue(rtomapkey, rtamap.get(rtomapkey));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtoVa.getPrimaryKey())) {
|
||||||
|
rtoVa.setStatus(1);
|
||||||
|
} else {
|
||||||
|
rtoVa.setStatus(2);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rtoVa.getPrimaryKey())) {
|
||||||
|
rta_set.remove(rtoVa.getPrimaryKey());
|
||||||
|
}
|
||||||
|
rtaVoList.add(rtoVa);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(rta_set)) {
|
||||||
|
for (String rta_set_pk : rta_set) {
|
||||||
|
RtActivityVO setrtavo = (RtActivityVO) idvo.get(rta_set_pk);
|
||||||
|
setrtavo.setStatus(3);
|
||||||
|
rtaVoList.add(setrtavo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (MMValueCheck.isNotEmpty(rta_set)) {
|
||||||
|
for (String rta_set_pk : rta_set) {
|
||||||
|
RtActivityVO setrtavo = (RtActivityVO) idvo.get(rta_set_pk);
|
||||||
|
setrtavo.setStatus(3);
|
||||||
|
rtaVoList.add(setrtavo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
itemVo.setRtactitems((RtActivityVO[]) rtaVoList.toArray(new RtActivityVO[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(itemVo.getPrimaryKey())) {
|
||||||
|
itemVo.setStatus(1);
|
||||||
|
} else {
|
||||||
|
itemVo.setStatus(2);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(itemVo.getPrimaryKey())) {
|
||||||
|
body_b_set.remove(itemVo.getPrimaryKey());
|
||||||
|
}
|
||||||
|
rtItemVoList.add(itemVo);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(body_b_set)) {
|
||||||
|
for (String body_b_setpk : body_b_set) {
|
||||||
|
RtItemVO setitemVo = (RtItemVO) idvo.get(body_b_setpk);
|
||||||
|
setitemVo.setStatus(3);
|
||||||
|
rtItemVoList.add(setitemVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (MMValueCheck.isNotEmpty(body_b_set)) {
|
||||||
|
for (String body_b_setpk : body_b_set) {
|
||||||
|
RtItemVO setitemVo = (RtItemVO) idvo.get(body_b_setpk);
|
||||||
|
setitemVo.setStatus(3);
|
||||||
|
rtItemVoList.add(setitemVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aggvo.setChildren(RtItemVO.class, (ISuperVO[]) rtItemVoList.toArray(new RtItemVO[0]));
|
||||||
|
|
||||||
|
List<AssOrgVO> assOrgVoList = new ArrayList<AssOrgVO>();
|
||||||
|
Set<String> body_s_set = (Set) tableid.get(PD_RT_ASSORG);
|
||||||
|
if (MMValueCheck.isNotEmpty(body_s)) {
|
||||||
|
for (Map<String, String> body_s_map : body_s) {
|
||||||
|
AssOrgVO orgVo = new AssOrgVO();
|
||||||
|
for (String body_s_key : body_s_map.keySet()) {
|
||||||
|
orgVo.setAttributeValue(body_s_key, body_s_map.get(body_s_key));
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(orgVo.getPrimaryKey())) {
|
||||||
|
orgVo.setStatus(1);
|
||||||
|
} else {
|
||||||
|
orgVo.setStatus(2);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(orgVo.getPrimaryKey())) {
|
||||||
|
body_s_set.remove(orgVo.getPrimaryKey());
|
||||||
|
}
|
||||||
|
assOrgVoList.add(orgVo);
|
||||||
|
}
|
||||||
|
if (MMValueCheck.isNotEmpty(body_s_set)) {
|
||||||
|
for (String body_s_setpk : body_s_set) {
|
||||||
|
AssOrgVO setorgVo = (AssOrgVO) idvo.get(body_s_setpk);
|
||||||
|
setorgVo.setStatus(3);
|
||||||
|
assOrgVoList.add(setorgVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (MMValueCheck.isNotEmpty(body_s_set)) {
|
||||||
|
for (String body_s_setpk : body_s_set) {
|
||||||
|
AssOrgVO setorgVo = (AssOrgVO) idvo.get(body_s_setpk);
|
||||||
|
setorgVo.setStatus(3);
|
||||||
|
assOrgVoList.add(setorgVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aggvo.setChildren(AssOrgVO.class, (ISuperVO[]) assOrgVoList.toArray(new AssOrgVO[0]));
|
||||||
|
aggVoList.add(aggvo);
|
||||||
|
}
|
||||||
|
AggRtVO[] aggVos = (AggRtVO[]) aggVoList.toArray(new AggRtVO[0]);
|
||||||
|
RtHeadVO[] hvos = new RtHeadVO[aggVos.length];
|
||||||
|
String markword = null;
|
||||||
|
for (int i = 0; i < aggVos.length; i++) {
|
||||||
|
hvos[i] = (RtHeadVO) aggVos[i].getParent();
|
||||||
|
RtItemVO[] itemvos = (RtItemVO[]) aggVos[i].getChildren(RtItemVO.class);
|
||||||
|
String exceptionMessage = getHeadInputField(hvos) + getHeadInputField(hvos);
|
||||||
|
if (MMValueCheck.isNotEmpty(exceptionMessage)) {
|
||||||
|
markword = "您有必输项未输," + exceptionMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVos);
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
map.put(AGG, aggVos);
|
||||||
|
map.put(MARKWORD, markword);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getHeadInputField(RtHeadVO[] hvos) {
|
||||||
|
String retstr = "";
|
||||||
|
for (RtHeadVO hvo : hvos) {
|
||||||
|
if (hvo.getPk_org() == null || MMValueCheck.isEmpty(hvo.getPk_org())) {
|
||||||
|
retstr = retstr + "pk_org,";
|
||||||
|
}
|
||||||
|
if (hvo.getCmaterialid() == null || MMValueCheck.isEmpty(hvo.getCmaterialid())) {
|
||||||
|
retstr = retstr + "cmaterialid,";
|
||||||
|
}
|
||||||
|
if (hvo.getNastnum() == null || MMValueCheck.isEmpty(hvo.getNastnum())) {
|
||||||
|
retstr = retstr + "nastnum,";
|
||||||
|
}
|
||||||
|
if (hvo.getVersion() == null || MMValueCheck.isEmpty(hvo.getVersion())) {
|
||||||
|
retstr = retstr + "version,";
|
||||||
|
}
|
||||||
|
if (hvo.getFversiontype() == null || MMValueCheck.isEmpty(hvo.getFversiontype())) {
|
||||||
|
retstr = retstr + "fversiontype,";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBodyInputField(RtItemVO[] bvos) {
|
||||||
|
String retstr = "";
|
||||||
|
for (RtItemVO bvo : bvos) {
|
||||||
|
if (bvo.getVprocessno() == null || MMValueCheck.isEmpty(bvo.getVprocessno())) {
|
||||||
|
retstr = retstr + "vprocessno,";
|
||||||
|
}
|
||||||
|
if (bvo.getProcessmovetype() == null || MMValueCheck.isEmpty(bvo.getProcessmovetype())) {
|
||||||
|
retstr = retstr + "processmovetype,";
|
||||||
|
}
|
||||||
|
if (bvo.getDeffectdate() == null || MMValueCheck.isEmpty(bvo.getDeffectdate())) {
|
||||||
|
retstr = retstr + "deffectdate,";
|
||||||
|
}
|
||||||
|
if (bvo.getDinvaliddate() == null || MMValueCheck.isEmpty(bvo.getDinvaliddate())) {
|
||||||
|
retstr = retstr + "dinvaliddate,";
|
||||||
|
}
|
||||||
|
if (bvo.getBmainprocess() == null || MMValueCheck.isEmpty(bvo.getBmainprocess())) {
|
||||||
|
retstr = retstr + "bmainprocess,";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AggRtVO[] queryVOByIDs(String[] pks) {
|
||||||
|
AggRtVO[] aggvos = null;
|
||||||
|
IRtQuery rtquery = (IRtQuery) NCLocator.getInstance().lookup(IRtQuery.class);
|
||||||
|
MMSqlBuilder sql = new MMSqlBuilder();
|
||||||
|
sql.append(" crtid ", pks);
|
||||||
|
try {
|
||||||
|
aggvos = rtquery.queryRtByWhereSql(sql.toString());
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
ExceptionUtils.wrappException(e);
|
||||||
|
}
|
||||||
|
return aggvos;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue