到货检验单删除前校验审核状态和是否存在下游的不合格检验单
This commit is contained in:
parent
adfef3a109
commit
75864f8c5f
|
@ -36,6 +36,7 @@ import nc.vo.pub.lang.UFDateTime;
|
||||||
import nc.vo.pub.lang.UFDouble;
|
import nc.vo.pub.lang.UFDouble;
|
||||||
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.vo.pubapp.pattern.pub.SqlBuilder;
|
||||||
import nc.vo.scmf.ic.mbatchcode.BatchcodeVO;
|
import nc.vo.scmf.ic.mbatchcode.BatchcodeVO;
|
||||||
import nccloud.framework.core.exception.ExceptionUtils;
|
import nccloud.framework.core.exception.ExceptionUtils;
|
||||||
|
|
||||||
|
@ -345,6 +346,7 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
|
||||||
public AggDhjydMasterVO[] deleteAggDhjydMasterVOs(Map<String, String> tsMap) throws BusinessException {
|
public AggDhjydMasterVO[] deleteAggDhjydMasterVOs(Map<String, String> tsMap) throws BusinessException {
|
||||||
AggDhjydMasterVO[] vos = dao.listByPk(AggDhjydMasterVO.class, tsMap.keySet().toArray(new String[0]));
|
AggDhjydMasterVO[] vos = dao.listByPk(AggDhjydMasterVO.class, tsMap.keySet().toArray(new String[0]));
|
||||||
validate(vos, tsMap);
|
validate(vos, tsMap);
|
||||||
|
validateStatusBeforeDel(vos);
|
||||||
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
||||||
Arrays.stream(vos).forEach(vo -> {
|
Arrays.stream(vos).forEach(vo -> {
|
||||||
String code = (String) getMainVO(vo).getAttributeValue("code");
|
String code = (String) getMainVO(vo).getAttributeValue("code");
|
||||||
|
@ -389,6 +391,49 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 到货检验单删除前校验审核状态和是否存在下游的不合格检验单
|
||||||
|
private void validateStatusBeforeDel(AggDhjydMasterVO[] vos) throws BusinessException {
|
||||||
|
String error = ""; // 错误信息
|
||||||
|
for (int i = 0; i < vos.length; i++) {
|
||||||
|
AggDhjydMasterVO vo = vos[i];
|
||||||
|
DhjydMasterVO mainVo = vo.getParentVO();
|
||||||
|
String transtype = mainVo.getTranstype();
|
||||||
|
String srcbillid = mainVo.getSrcbillid();// 到货单主键
|
||||||
|
if (srcbillid == null || "".equals(srcbillid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String pk_chekbill_h = mainVo.getPk_chekbill_h();
|
||||||
|
// 类型是到货检验单的判断
|
||||||
|
if ("DHJY-Cxx-01".equals(transtype)) {
|
||||||
|
// 判断是否存在相同来源的检验单已审核,不包含自身
|
||||||
|
SqlBuilder countSql = new SqlBuilder();
|
||||||
|
countSql.append("select count(1) from hfdl_chekbill_h ");
|
||||||
|
countSql.append("where nvl(dr, 0) = 0");
|
||||||
|
countSql.append(" and approvestatus = 1");
|
||||||
|
countSql.append(" and srcbillid = '" + srcbillid + "'");
|
||||||
|
countSql.append(" and pk_chekbill_h != '" + pk_chekbill_h + "'");
|
||||||
|
Integer statusNum = (Integer) getBaseDAO().executeQuery(countSql.toString(), new ColumnProcessor());
|
||||||
|
if (statusNum > 0) {
|
||||||
|
error += "存在相同来源的到货检验单已审批,不能删除!\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
countSql.reset();
|
||||||
|
countSql.append("select count(1) from hfdl_chekbill_h ");
|
||||||
|
countSql.append("where nvl(dr, 0) = 0");
|
||||||
|
countSql.append(" and transtype = 'DHJY-Cxx-02'");
|
||||||
|
countSql.append(" and srcbillid = '" + pk_chekbill_h + "'");
|
||||||
|
Integer billNum = (Integer) getBaseDAO().executeQuery(countSql.toString(), new ColumnProcessor());
|
||||||
|
if (billNum > 0) {
|
||||||
|
error += "存在关联的不合格检验单,不能删除!\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!"".equals(error)) {
|
||||||
|
throw new BusinessException(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T[] loadTreeData(Class<T> clazz, Map<String, Object> userJson) throws BusinessException {
|
public <T> T[] loadTreeData(Class<T> clazz, Map<String, Object> userJson) throws BusinessException {
|
||||||
String condition = "dr = 0 ";
|
String condition = "dr = 0 ";
|
||||||
|
|
Loading…
Reference in New Issue