生成不合格审批单
This commit is contained in:
parent
766ea47576
commit
ff7ca07612
|
@ -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<String, Object> externalData = new HashMap<>();
|
||||
BillCodeContext context = service.getBillCodeContext("pudhjyd");
|
||||
externalData.put("billCodeContext", context);
|
||||
return buildResult(param, true, externalData, vo);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -50,4 +50,9 @@
|
|||
<label>新增动作</label>
|
||||
<clazz>nccloud.web.pu.dhjyd.dhjydmaster.action.AddDhjydMasterVOAction</clazz>
|
||||
</action>
|
||||
<action>
|
||||
<name>pu.dhjyd.AddUnPassDhjydMasterVOAction</name>
|
||||
<label>生成不合格审批单</label>
|
||||
<clazz>nccloud.web.pu.dhjyd.dhjydmaster.action.AddUnPassDhjydMasterVOAction</clazz>
|
||||
</action>
|
||||
</actions>
|
|
@ -12,6 +12,7 @@
|
|||
<action>pu.dhjyd.DeleteDhjydMasterVOAction</action>
|
||||
<action>pu.dhjyd.PFlowDhjydMasterVOAction</action>
|
||||
<action>pu.dhjyd.AddDhjydMasterVOAction</action>
|
||||
<action>pu.dhjyd.AddUnPassDhjydMasterVOAction</action>
|
||||
</actions>
|
||||
</authorize>
|
||||
<authorize>
|
||||
|
|
|
@ -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<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
|
||||
|
|
|
@ -287,6 +287,6 @@ public interface IDhjydMasterVOService {
|
|||
* 生成不合格审批单
|
||||
*
|
||||
*/
|
||||
AggDhjydMasterVO addUnPassDhjydMasterVO(String pk) throws BusinessException;
|
||||
public AggDhjydMasterVO[] addUnPassDhjydMasterVO(String pk) throws BusinessException;
|
||||
|
||||
}
|
Loading…
Reference in New Issue