不合格检验单回写检验单调整

This commit is contained in:
mzr 2024-10-23 11:18:57 +08:00
parent 25fcff74c7
commit 6f03c68383
1 changed files with 13 additions and 11 deletions

View File

@ -584,7 +584,7 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
public AggDhjydMasterVO addUnPassDhjydMasterVO(String pk) throws BusinessException {
AggDhjydMasterVO vo = null;
String whereSql = "srcbillid = 'pk'";
whereSql.replace("pk", pk);
whereSql = whereSql.replace("pk", pk);
AggDhjydMasterVO[] unPassVOs = dao.listByCondition(AggDhjydMasterVO.class, whereSql);
if (unPassVOs != null && unPassVOs.length > 0) {
return unPassVOs[0];
@ -751,7 +751,7 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
}
DhjydSlave0VO[] unPassVOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class);
Object srcbillid = mainVo.getAttributeValue("srcbillid");
if (srcbillid != null && "".equals(srcbillid)) {
if (srcbillid != null && !"".equals(srcbillid)) {
String[] pks = { srcbillid + "" };
AggDhjydMasterVO[] listCheckV0 = dao.listByPk(AggDhjydMasterVO.class, pks);
if (listCheckV0 != null && listCheckV0.length > 0) {
@ -761,22 +761,24 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
ISuperVO mainCheckVo = masterVO.getParent();
mainCheckVo.setStatus(VOStatus.UPDATED);
// 到货检验单的表体
DhjydSlave0VO[] dhjydSlave0VOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class);
DhjydSlave0VO[] checkDetailVOs = (DhjydSlave0VO[]) masterVO.getChildren(DhjydSlave0VO.class);
// 不合格检验单审核通过后同步修改上游的到货检验单的表体
DhjydSlave0VO[] newVOs = new DhjydSlave0VO[dhjydSlave0VOs.length + unPassVOs.length];
DhjydSlave0VO[] newVOs = new DhjydSlave0VO[checkDetailVOs.length + unPassVOs.length];
// 删掉原来的
for (int j = 0; j < dhjydSlave0VOs.length; j++) {
DhjydSlave0VO dhjydSlave0VO = dhjydSlave0VOs[j];
for (int j = 0; j < checkDetailVOs.length; j++) {
DhjydSlave0VO dhjydSlave0VO = checkDetailVOs[j];
dhjydSlave0VO.setStatus(VOStatus.DELETED);
newVOs[0] = dhjydSlave0VO;
}
// 添加新的
for (int j = 0; j < unPassVOs.length; j++) {
DhjydSlave0VO dhjydSlave0VO = newVOs[j];
dhjydSlave0VO.setStatus(VOStatus.NEW);
dhjydSlave0VO.setPrimaryKey(null);
dhjydSlave0VO.setAttributeValue("pk_chekbill_b", null);
newVOs[j + 1] = dhjydSlave0VO;
DhjydSlave0VO vo0 = new DhjydSlave0VO();
DhjydSlave0VO dhjydSlave0VO = unPassVOs[j];
BeanUtil.copyProperties(dhjydSlave0VO, vo0);
vo0.setStatus(VOStatus.NEW);
vo0.setPrimaryKey(null);
vo0.setAttributeValue("pk_chekbill_b", null);
newVOs[j + 1] = vo0;
}
masterVO.setChildren(DhjydSlave0VO.class, newVOs);
AggDhjydMasterVO[] saveVOs = dao.update(masterVO);