From ff7ca076121e21f4ebd5038625c42776dcd4e9fb Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Sat, 19 Oct 2024 18:39:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=8D=E5=90=88=E6=A0=BC?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/AddUnPassDhjydMasterVOAction.java | 13 +- .../config/action/4004012H9_action.xml | 5 + .../config/authorize/4004012H9_authorize.xml | 1 + .../dhjydmaster/DhjydMasterVOServiceImpl.java | 131 ++++++++++++++---- .../dhjydmaster/IDhjydMasterVOService.java | 2 +- 5 files changed, 114 insertions(+), 38 deletions(-) diff --git a/pu/src/client/nccloud/web/pu/dhjyd/dhjydmaster/action/AddUnPassDhjydMasterVOAction.java b/pu/src/client/nccloud/web/pu/dhjyd/dhjydmaster/action/AddUnPassDhjydMasterVOAction.java index 5c0d50e..151fdcf 100644 --- a/pu/src/client/nccloud/web/pu/dhjyd/dhjydmaster/action/AddUnPassDhjydMasterVOAction.java +++ b/pu/src/client/nccloud/web/pu/dhjyd/dhjydmaster/action/AddUnPassDhjydMasterVOAction.java @@ -16,21 +16,18 @@ public class AddUnPassDhjydMasterVOAction extends BaseAction { @Override public Object doAction(IRequest request, RequstParamWapper paramWapper) throws Throwable { - // json数据转换 + // json数据转换 RequestDTO param = VOTransform.toVO(paramWapper.requestString, RequestDTO.class); // 获取参数 String pk = param.getPk(); IDhjydMasterVOService service = ServiceLocator.find(IDhjydMasterVOService.class); - AggDhjydMasterVO vo = service.addUnPassDhjydMasterVO(pk); + AggDhjydMasterVO[] vos = service.addUnPassDhjydMasterVO(pk); - if (vo == null) { - return null; + if (vos == null) { + return false; } - Map externalData = new HashMap<>(); - BillCodeContext context = service.getBillCodeContext("pudhjyd"); - externalData.put("billCodeContext", context); - return buildResult(param, true, externalData, vo); + return true; } } \ No newline at end of file diff --git a/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/action/4004012H9_action.xml b/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/action/4004012H9_action.xml index b7f2f80..196218a 100644 --- a/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/action/4004012H9_action.xml +++ b/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/action/4004012H9_action.xml @@ -50,4 +50,9 @@ nccloud.web.pu.dhjyd.dhjydmaster.action.AddDhjydMasterVOAction + + pu.dhjyd.AddUnPassDhjydMasterVOAction + + nccloud.web.pu.dhjyd.dhjydmaster.action.AddUnPassDhjydMasterVOAction + \ No newline at end of file diff --git a/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/authorize/4004012H9_authorize.xml b/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/authorize/4004012H9_authorize.xml index adc7d97..49e4730 100644 --- a/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/authorize/4004012H9_authorize.xml +++ b/pu/src/client/yyconfig/modules/pu/dhjyd/dhjydmaster/config/authorize/4004012H9_authorize.xml @@ -12,6 +12,7 @@ pu.dhjyd.DeleteDhjydMasterVOAction pu.dhjyd.PFlowDhjydMasterVOAction pu.dhjyd.AddDhjydMasterVOAction + pu.dhjyd.AddUnPassDhjydMasterVOAction diff --git a/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/DhjydMasterVOServiceImpl.java b/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/DhjydMasterVOServiceImpl.java index 6b40578..a5315b2 100644 --- a/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/DhjydMasterVOServiceImpl.java +++ b/pu/src/private/nc/impl/pu/dhjyd/dhjydmaster/DhjydMasterVOServiceImpl.java @@ -2,6 +2,8 @@ package nc.impl.pu.dhjyd.dhjydmaster; import java.util.Map; import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.ArrayList; 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.UFDouble; import nc.uap.utils.InSQLCreator; +import nc.uif.pub.exception.UifException; + import org.apache.commons.lang3.ArrayUtils; 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.BusinessRuntimeException; +import nc.vo.pub.ISuperVO; import nc.vo.pub.SuperVO; import nc.vo.pub.VOStatus; import nc.codeplatform.framework.service.ServiceSupport; @@ -33,10 +38,13 @@ import nc.vo.pu.dhjyd.DhjydSlave0VO; import nc.vo.pu.dhjyd.AggDhjydMasterVO; import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; 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.pubapp.pattern.pub.MathTool; import nc.bs.dao.BaseDAO; import nc.bs.framework.common.InvocationInfoProxy; +import nc.bs.trade.business.HYPubBO; import nccloud.framework.core.exception.ExceptionUtils; public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMasterVOService { @@ -562,18 +570,21 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa } @Override - public AggDhjydMasterVO addUnPassDhjydMasterVO(String pk) throws BusinessException { + public AggDhjydMasterVO[] addUnPassDhjydMasterVO(String pk) throws BusinessException { 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); - getMainVO(vo).setStatus(VOStatus.NEW); + mainVO.setAttributeValue("srcbilltype", null); + // 来源单据主键改成当前传递的检验单的主键 + mainVO.setAttributeValue("srcbillid", pk); + mainVO.setAttributeValue("vsourcecode", mainVO.getCode()); - getMainVO(vo).setAttributeValue("srcbilltype", null); - getMainVO(vo).setAttributeValue("srcbillid", null); - - getMainVO(vo).setAttributeValue("code", null); - getMainVO(vo).setAttributeValue("", null); + mainVO.setAttributeValue("code", null); + // mainVO.setAttributeValue("", null); // 编码规则生成vo的编码 BillCodeContext billCodeContext = getBillCodeContext("pudhjyd"); if (billCodeContext == null) { @@ -582,32 +593,94 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa if (billCodeContext.isPrecode()) { String pk_group = InvocationInfoProxy.getInstance().getGroupId(); 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()); - getMainVO(vo).setAttributeValue("billmaker", InvocationInfoProxy.getInstance().getUserId()); - getMainVO(vo).setAttributeValue("approver", null); - getMainVO(vo).setAttributeValue("approvenote", null); - getMainVO(vo).setAttributeValue("approvedate", null); + mainVO.setAttributeValue("approvestatus", BillStatusEnum.FREE.toIntValue()); + mainVO.setAttributeValue("billmaker", InvocationInfoProxy.getInstance().getUserId()); + mainVO.setAttributeValue("approver", null); + mainVO.setAttributeValue("approvenote", null); + mainVO.setAttributeValue("approvedate", null); // 设置审计信息为空 - getMainVO(vo).setAttributeValue("creator", null); - getMainVO(vo).setAttributeValue("creationtime", null); - getMainVO(vo).setAttributeValue("modifier", null); - getMainVO(vo).setAttributeValue("modifiedtime", null); - getMainVO(vo).setAttributeValue("maketime", new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime())); - + mainVO.setAttributeValue("creator", null); + mainVO.setAttributeValue("creationtime", null); + mainVO.setAttributeValue("modifier", null); + mainVO.setAttributeValue("modifiedtime", null); + 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[] newVOs = new DhjydSlave0VO[3]; if (dhjydSlave0VOs != null && dhjydSlave0VOs.length > 0) { - Arrays.stream(dhjydSlave0VOs).forEach(subvo -> { - subvo.setPrimaryKey(null); - subvo.setStatus(VOStatus.NEW); - subvo.setAttributeValue("srcbilltype", null); - subvo.setAttributeValue("srcbillid", null); - subvo.setAttributeValue("rowno", null); - subvo.setAttributeValue("srcrowno", null); - }); + DhjydSlave0VO subvo = dhjydSlave0VOs[0]; + // 检查结果 合格、回用、不合格 + String def1 = subvo.getDef1(); + Object def1Code = null; + try { + def1Code = new HYPubBO().findColValue("bd_defdoc", "code", " dr = 0 and pk_defdoc='" + def1 + "' "); + } 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> testResList = (List>) getBaseDAO().executeQuery(getTestResSql, + new MapListProcessor()); + Map testResMap = new HashMap<>(); + for (Map 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 diff --git a/pu/src/public/nc/itf/pu/dhjyd/dhjydmaster/IDhjydMasterVOService.java b/pu/src/public/nc/itf/pu/dhjyd/dhjydmaster/IDhjydMasterVOService.java index 7ed7803..d4e31ef 100644 --- a/pu/src/public/nc/itf/pu/dhjyd/dhjydmaster/IDhjydMasterVOService.java +++ b/pu/src/public/nc/itf/pu/dhjyd/dhjydmaster/IDhjydMasterVOService.java @@ -287,6 +287,6 @@ public interface IDhjydMasterVOService { * 生成不合格审批单 * */ - AggDhjydMasterVO addUnPassDhjydMasterVO(String pk) throws BusinessException; + public AggDhjydMasterVO[] addUnPassDhjydMasterVO(String pk) throws BusinessException; } \ No newline at end of file