|
|
@ -2,6 +2,8 @@ package nc.impl.pu.dhjyd.dhjydmaster;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -11,6 +13,8 @@ import java.util.stream.Stream;
|
|
|
|
import nc.vo.pub.lang.UFDateTime;
|
|
|
|
import nc.vo.pub.lang.UFDateTime;
|
|
|
|
import nc.vo.pub.lang.UFDouble;
|
|
|
|
import nc.vo.pub.lang.UFDouble;
|
|
|
|
import nc.uap.utils.InSQLCreator;
|
|
|
|
import nc.uap.utils.InSQLCreator;
|
|
|
|
|
|
|
|
import nc.uif.pub.exception.UifException;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
@ -22,6 +26,7 @@ import org.apache.commons.beanutils.PropertyUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import nc.vo.pub.BusinessException;
|
|
|
|
import nc.vo.pub.BusinessException;
|
|
|
|
import nc.vo.pub.BusinessRuntimeException;
|
|
|
|
import nc.vo.pub.BusinessRuntimeException;
|
|
|
|
|
|
|
|
import nc.vo.pub.ISuperVO;
|
|
|
|
import nc.vo.pub.SuperVO;
|
|
|
|
import nc.vo.pub.SuperVO;
|
|
|
|
import nc.vo.pub.VOStatus;
|
|
|
|
import nc.vo.pub.VOStatus;
|
|
|
|
import nc.codeplatform.framework.service.ServiceSupport;
|
|
|
|
import nc.codeplatform.framework.service.ServiceSupport;
|
|
|
@ -33,10 +38,13 @@ import nc.vo.pu.dhjyd.DhjydSlave0VO;
|
|
|
|
import nc.vo.pu.dhjyd.AggDhjydMasterVO;
|
|
|
|
import nc.vo.pu.dhjyd.AggDhjydMasterVO;
|
|
|
|
import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService;
|
|
|
|
import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService;
|
|
|
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
|
|
|
|
|
import nc.jdbc.framework.processor.MapListProcessor;
|
|
|
|
|
|
|
|
import nc.jdbc.framework.processor.MapProcessor;
|
|
|
|
import nc.vo.pub.pf.BillStatusEnum;
|
|
|
|
import nc.vo.pub.pf.BillStatusEnum;
|
|
|
|
import nc.vo.pubapp.pattern.pub.MathTool;
|
|
|
|
import nc.vo.pubapp.pattern.pub.MathTool;
|
|
|
|
import nc.bs.dao.BaseDAO;
|
|
|
|
import nc.bs.dao.BaseDAO;
|
|
|
|
import nc.bs.framework.common.InvocationInfoProxy;
|
|
|
|
import nc.bs.framework.common.InvocationInfoProxy;
|
|
|
|
|
|
|
|
import nc.bs.trade.business.HYPubBO;
|
|
|
|
import nccloud.framework.core.exception.ExceptionUtils;
|
|
|
|
import nccloud.framework.core.exception.ExceptionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMasterVOService {
|
|
|
|
public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMasterVOService {
|
|
|
@ -562,18 +570,21 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public AggDhjydMasterVO addUnPassDhjydMasterVO(String pk) throws BusinessException {
|
|
|
|
public AggDhjydMasterVO[] addUnPassDhjydMasterVO(String pk) throws BusinessException {
|
|
|
|
|
|
|
|
|
|
|
|
AggDhjydMasterVO vo = dao.findByPk(AggDhjydMasterVO.class, pk, false);
|
|
|
|
AggDhjydMasterVO vo = dao.findByPk(AggDhjydMasterVO.class, pk, false);
|
|
|
|
|
|
|
|
DhjydMasterVO mainVO = vo.getParentVO();
|
|
|
|
|
|
|
|
// SuperVO mainVO = getMainVO(vo);
|
|
|
|
|
|
|
|
mainVO.setPrimaryKey(null);
|
|
|
|
|
|
|
|
mainVO.setStatus(VOStatus.NEW);
|
|
|
|
|
|
|
|
|
|
|
|
getMainVO(vo).setPrimaryKey(null);
|
|
|
|
mainVO.setAttributeValue("srcbilltype", null);
|
|
|
|
getMainVO(vo).setStatus(VOStatus.NEW);
|
|
|
|
// 来源单据主键改成当前传递的检验单的主键
|
|
|
|
|
|
|
|
mainVO.setAttributeValue("srcbillid", pk);
|
|
|
|
|
|
|
|
mainVO.setAttributeValue("vsourcecode", mainVO.getCode());
|
|
|
|
|
|
|
|
|
|
|
|
getMainVO(vo).setAttributeValue("srcbilltype", null);
|
|
|
|
mainVO.setAttributeValue("code", null);
|
|
|
|
getMainVO(vo).setAttributeValue("srcbillid", null);
|
|
|
|
// mainVO.setAttributeValue("", null);
|
|
|
|
|
|
|
|
|
|
|
|
getMainVO(vo).setAttributeValue("code", null);
|
|
|
|
|
|
|
|
getMainVO(vo).setAttributeValue("", null);
|
|
|
|
|
|
|
|
// 编码规则生成vo的编码
|
|
|
|
// 编码规则生成vo的编码
|
|
|
|
BillCodeContext billCodeContext = getBillCodeContext("pudhjyd");
|
|
|
|
BillCodeContext billCodeContext = getBillCodeContext("pudhjyd");
|
|
|
|
if (billCodeContext == null) {
|
|
|
|
if (billCodeContext == null) {
|
|
|
@ -582,32 +593,94 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
|
|
|
|
if (billCodeContext.isPrecode()) {
|
|
|
|
if (billCodeContext.isPrecode()) {
|
|
|
|
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
|
|
|
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
|
|
|
String code = getBillcodeManage().getPreBillCode_RequiresNew("pudhjyd", pk_group, pk_group);
|
|
|
|
String code = getBillcodeManage().getPreBillCode_RequiresNew("pudhjyd", pk_group, pk_group);
|
|
|
|
getMainVO(vo).setAttributeValue("code", code);
|
|
|
|
mainVO.setAttributeValue("code", code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getMainVO(vo).setAttributeValue("approvestatus", BillStatusEnum.FREE.toIntValue());
|
|
|
|
mainVO.setAttributeValue("approvestatus", BillStatusEnum.FREE.toIntValue());
|
|
|
|
getMainVO(vo).setAttributeValue("billmaker", InvocationInfoProxy.getInstance().getUserId());
|
|
|
|
mainVO.setAttributeValue("billmaker", InvocationInfoProxy.getInstance().getUserId());
|
|
|
|
getMainVO(vo).setAttributeValue("approver", null);
|
|
|
|
mainVO.setAttributeValue("approver", null);
|
|
|
|
getMainVO(vo).setAttributeValue("approvenote", null);
|
|
|
|
mainVO.setAttributeValue("approvenote", null);
|
|
|
|
getMainVO(vo).setAttributeValue("approvedate", null);
|
|
|
|
mainVO.setAttributeValue("approvedate", null);
|
|
|
|
// 设置审计信息为空
|
|
|
|
// 设置审计信息为空
|
|
|
|
getMainVO(vo).setAttributeValue("creator", null);
|
|
|
|
mainVO.setAttributeValue("creator", null);
|
|
|
|
getMainVO(vo).setAttributeValue("creationtime", null);
|
|
|
|
mainVO.setAttributeValue("creationtime", null);
|
|
|
|
getMainVO(vo).setAttributeValue("modifier", null);
|
|
|
|
mainVO.setAttributeValue("modifier", null);
|
|
|
|
getMainVO(vo).setAttributeValue("modifiedtime", null);
|
|
|
|
mainVO.setAttributeValue("modifiedtime", null);
|
|
|
|
getMainVO(vo).setAttributeValue("maketime", new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime()));
|
|
|
|
mainVO.setAttributeValue("maketime", new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime()));
|
|
|
|
|
|
|
|
// 调整交易类型 transtype
|
|
|
|
|
|
|
|
// 根据编码查询[不合格检验单]类型的主键 transtypepk = '1001C110000000A9V8AQ'
|
|
|
|
|
|
|
|
Object billtypeid = new HYPubBO().findColValue("BD_BILLTYPE", "pk_billtypeid",
|
|
|
|
|
|
|
|
"pk_billtypecode = 'DHJY-Cxx-02' ");
|
|
|
|
|
|
|
|
mainVO.setAttributeValue("transtypepk", billtypeid);
|
|
|
|
|
|
|
|
mainVO.setAttributeValue("transtype", "DHJY-Cxx-02");
|
|
|
|
|
|
|
|
// mainVO.setAttributeValue("vmemo", "mzr");
|
|
|
|
|
|
|
|
// 获取子表的数据
|
|
|
|
DhjydSlave0VO[] dhjydSlave0VOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class);
|
|
|
|
DhjydSlave0VO[] dhjydSlave0VOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class);
|
|
|
|
|
|
|
|
DhjydSlave0VO[] newVOs = new DhjydSlave0VO[3];
|
|
|
|
if (dhjydSlave0VOs != null && dhjydSlave0VOs.length > 0) {
|
|
|
|
if (dhjydSlave0VOs != null && dhjydSlave0VOs.length > 0) {
|
|
|
|
Arrays.stream(dhjydSlave0VOs).forEach(subvo -> {
|
|
|
|
DhjydSlave0VO subvo = dhjydSlave0VOs[0];
|
|
|
|
subvo.setPrimaryKey(null);
|
|
|
|
// 检查结果 合格、回用、不合格
|
|
|
|
subvo.setStatus(VOStatus.NEW);
|
|
|
|
String def1 = subvo.getDef1();
|
|
|
|
subvo.setAttributeValue("srcbilltype", null);
|
|
|
|
Object def1Code = null;
|
|
|
|
subvo.setAttributeValue("srcbillid", null);
|
|
|
|
try {
|
|
|
|
subvo.setAttributeValue("rowno", null);
|
|
|
|
def1Code = new HYPubBO().findColValue("bd_defdoc", "code", " dr = 0 and pk_defdoc='" + def1 + "' ");
|
|
|
|
subvo.setAttributeValue("srcrowno", null);
|
|
|
|
} catch (UifException e) {
|
|
|
|
});
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
subvo.setPrimaryKey(null);
|
|
|
|
|
|
|
|
subvo.setStatus(VOStatus.NEW);
|
|
|
|
|
|
|
|
subvo.setAttributeValue("pk_chekbill_b", null);
|
|
|
|
|
|
|
|
subvo.setAttributeValue("srcbilltype", null);
|
|
|
|
|
|
|
|
subvo.setAttributeValue("srcbillid", null);
|
|
|
|
|
|
|
|
subvo.setAttributeValue("rowno", null);
|
|
|
|
|
|
|
|
subvo.setAttributeValue("srcrowno", null);
|
|
|
|
|
|
|
|
// 根据自定义档案的编码查询对应的主键
|
|
|
|
|
|
|
|
String getTestResSql = "select code,pk_defdoc from bd_defdoc where dr = 0 and code in ('01','02','03')";
|
|
|
|
|
|
|
|
List<Map<String, Object>> testResList = (List<Map<String, Object>>) getBaseDAO().executeQuery(getTestResSql,
|
|
|
|
|
|
|
|
new MapListProcessor());
|
|
|
|
|
|
|
|
Map<String, String> testResMap = new HashMap<>();
|
|
|
|
|
|
|
|
for (Map<String, Object> map : testResList) {
|
|
|
|
|
|
|
|
if (!map.isEmpty()) {
|
|
|
|
|
|
|
|
testResMap.put(map.getOrDefault("code", "") + "", map.getOrDefault("pk_defdoc", "") + "");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 第1行 合格 第2行 回用 第3行 不合格
|
|
|
|
|
|
|
|
if ("01".equals(def1Code)) {
|
|
|
|
|
|
|
|
// 合格
|
|
|
|
|
|
|
|
newVOs[0] = subvo;
|
|
|
|
|
|
|
|
// 不合格
|
|
|
|
|
|
|
|
DhjydSlave0VO vo2 = new DhjydSlave0VO();
|
|
|
|
|
|
|
|
vo2 = subvo;
|
|
|
|
|
|
|
|
vo2.setNunqualifiednum(UFDouble.ZERO_DBL);
|
|
|
|
|
|
|
|
// 设置检验结果的值
|
|
|
|
|
|
|
|
vo2.setAttributeValue("def1", testResMap.get("02"));
|
|
|
|
|
|
|
|
newVOs[1] = vo2;
|
|
|
|
|
|
|
|
vo2.setAttributeValue("def1", testResMap.get("03"));
|
|
|
|
|
|
|
|
newVOs[2] = vo2;
|
|
|
|
|
|
|
|
} else if ("02".equals(def1Code)) {
|
|
|
|
|
|
|
|
// 回用
|
|
|
|
|
|
|
|
newVOs[1] = subvo;
|
|
|
|
|
|
|
|
newVOs[0] = subvo;
|
|
|
|
|
|
|
|
subvo.setAttributeValue("def1", testResMap.get("01"));
|
|
|
|
|
|
|
|
newVOs[2] = subvo;
|
|
|
|
|
|
|
|
subvo.setAttributeValue("def1", testResMap.get("03"));
|
|
|
|
|
|
|
|
} else if ("03".equals(def1Code)) {
|
|
|
|
|
|
|
|
// 不合格
|
|
|
|
|
|
|
|
newVOs[2] = subvo;
|
|
|
|
|
|
|
|
// 合格
|
|
|
|
|
|
|
|
DhjydSlave0VO vo0 = new DhjydSlave0VO();
|
|
|
|
|
|
|
|
vo0 = subvo;
|
|
|
|
|
|
|
|
vo0.setQualifiednum(UFDouble.ZERO_DBL);
|
|
|
|
|
|
|
|
// 设置检验结果的值
|
|
|
|
|
|
|
|
vo0.setAttributeValue("def1", testResMap.get("01"));
|
|
|
|
|
|
|
|
newVOs[0] = vo0;
|
|
|
|
|
|
|
|
vo0.setAttributeValue("def1", testResMap.get("02"));
|
|
|
|
|
|
|
|
newVOs[1] = vo0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return vo;
|
|
|
|
vo.setChildren(DhjydSlave0VO.class, newVOs);
|
|
|
|
|
|
|
|
AggDhjydMasterVO[] saveAggDhjydMasterVO = this.saveAggDhjydMasterVO(vo);
|
|
|
|
|
|
|
|
return saveAggDhjydMasterVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|