Merge branch 'master' of http://121.37.179.211:3000/yonyou/ic
This commit is contained in:
		
						commit
						0fa0c1288b
					
				|  | @ -1,33 +1,29 @@ | ||||||
| package nccloud.web.pu.dhjyd.dhjydmaster.action; | package nccloud.web.pu.dhjyd.dhjydmaster.action; | ||||||
| 
 | 
 | ||||||
| import java.util.HashMap; | import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; | ||||||
| import java.util.Map; | import nc.vo.pu.dhjyd.AggDhjydMasterVO; | ||||||
| import nc.pub.billcode.vo.BillCodeContext; |  | ||||||
| import nccloud.web.codeplatform.framework.action.base.BaseAction; |  | ||||||
| import nccloud.web.codeplatform.framework.action.base.RequstParamWapper; |  | ||||||
| import nccloud.web.codeplatform.framework.action.base.RequestDTO; |  | ||||||
| import nccloud.web.codeplatform.framework.action.base.VOTransform; |  | ||||||
| import nccloud.framework.service.ServiceLocator; | import nccloud.framework.service.ServiceLocator; | ||||||
| import nccloud.framework.web.container.IRequest; | import nccloud.framework.web.container.IRequest; | ||||||
| import nc.vo.pu.dhjyd.AggDhjydMasterVO; | import nccloud.web.codeplatform.framework.action.base.BaseAction; | ||||||
| import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; | import nccloud.web.codeplatform.framework.action.base.RequestDTO; | ||||||
|  | import nccloud.web.codeplatform.framework.action.base.RequstParamWapper; | ||||||
|  | import nccloud.web.codeplatform.framework.action.base.VOTransform; | ||||||
| 
 | 
 | ||||||
| public class AddUnPassDhjydMasterVOAction extends BaseAction { | public class AddUnPassDhjydMasterVOAction extends BaseAction { | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public Object doAction(IRequest request, RequstParamWapper paramWapper) throws Throwable { | 	public Object doAction(IRequest request, RequstParamWapper paramWapper) throws Throwable { | ||||||
| 		// jsonÊý¾Ýת»»  | 		// jsonÊý¾Ýת»» | ||||||
| 		RequestDTO param = VOTransform.toVO(paramWapper.requestString, RequestDTO.class); | 		RequestDTO param = VOTransform.toVO(paramWapper.requestString, RequestDTO.class); | ||||||
| 		// »ñÈ¡²ÎÊý | 		// »ñÈ¡²ÎÊý | ||||||
| 		String pk = param.getPk(); | 		String pk = param.getPk(); | ||||||
| 
 | 
 | ||||||
| 		IDhjydMasterVOService service = ServiceLocator.find(IDhjydMasterVOService.class); | 		IDhjydMasterVOService service = ServiceLocator.find(IDhjydMasterVOService.class); | ||||||
| 
 | 
 | ||||||
| 		AggDhjydMasterVO[] vos = service.addUnPassDhjydMasterVO(pk); | 		AggDhjydMasterVO aggDhjydMasterVO = service.addUnPassDhjydMasterVO(pk); | ||||||
| 
 | 		if (aggDhjydMasterVO == null) { | ||||||
| 		if (vos == null) { | 			return null; | ||||||
| 			return false; |  | ||||||
| 		} | 		} | ||||||
| 		return true; | 		return buildResult(param, true, null, aggDhjydMasterVO); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -1,50 +1,38 @@ | ||||||
| package nc.impl.pu.dhjyd.dhjydmaster; | package nc.impl.pu.dhjyd.dhjydmaster; | ||||||
| 
 | 
 | ||||||
| import java.util.Map; | import java.util.ArrayList; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.Iterator; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.ArrayList; | import java.util.Map; | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
| import java.util.UUID; |  | ||||||
| import java.lang.String; |  | ||||||
| import java.util.stream.Stream; | 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.ArrayUtils; | ||||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||||
| 
 | 
 | ||||||
| import com.informix.util.stringUtil; | import cn.hutool.core.bean.BeanUtil; | ||||||
| 
 | import nc.bs.dao.BaseDAO; | ||||||
| import cn.hutool.core.util.NumberUtil; | import nc.bs.framework.common.InvocationInfoProxy; | ||||||
| 
 | import nc.bs.pub.common.PfServiceScmUtil; | ||||||
| import org.apache.commons.beanutils.PropertyUtils; | import nc.bs.trade.business.HYPubBO; | ||||||
| 
 |  | ||||||
| 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; | import nc.codeplatform.framework.service.ServiceSupport; | ||||||
| 
 |  | ||||||
| import nc.pub.billcode.vo.BillCodeContext; |  | ||||||
| 
 |  | ||||||
| import nc.vo.pu.dhjyd.DhjydMasterVO; |  | ||||||
| import nc.vo.pu.dhjyd.DhjydSlave0VO; |  | ||||||
| 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.MapListProcessor; | ||||||
| import nc.jdbc.framework.processor.MapProcessor; | import nc.jdbc.framework.processor.MapProcessor; | ||||||
|  | import nc.pub.billcode.vo.BillCodeContext; | ||||||
|  | import nc.vo.pu.dhjyd.AggDhjydMasterVO; | ||||||
|  | import nc.vo.pu.dhjyd.DhjydMasterVO; | ||||||
|  | import nc.vo.pu.dhjyd.DhjydSlave0VO; | ||||||
|  | import nc.vo.pub.BusinessException; | ||||||
|  | import nc.vo.pub.ISuperVO; | ||||||
|  | import nc.vo.pub.SuperVO; | ||||||
|  | import nc.vo.pub.VOStatus; | ||||||
|  | import nc.vo.pub.lang.UFDateTime; | ||||||
|  | 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.bs.dao.BaseDAO; |  | ||||||
| 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 { | ||||||
|  | @ -448,11 +436,20 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | ||||||
| 		String errors = ""; | 		String errors = ""; | ||||||
| 		for (AggDhjydMasterVO vo : vos) { | 		for (AggDhjydMasterVO vo : vos) { | ||||||
| 			DhjydMasterVO jydMasterVO = vo.getParentVO(); | 			DhjydMasterVO jydMasterVO = vo.getParentVO(); | ||||||
|  | 			String code = jydMasterVO.getAttributeValue("code") + ""; | ||||||
| 			// 如果不合格检验数量>0,则给出提示 | 			// 如果不合格检验数量>0,则给出提示 | ||||||
| 			UFDouble brecheck = (UFDouble) jydMasterVO.getAttributeValue("brecheck"); | 			UFDouble brecheck = (UFDouble) jydMasterVO.getAttributeValue("brecheck"); | ||||||
| 			// System.out.println("brecheck = " + brecheck); | 			// System.out.println("brecheck = " + brecheck); | ||||||
| 			if (MathTool.compareTo(brecheck, UFDouble.ZERO_DBL) > 0) { | 			if (MathTool.compareTo(brecheck, UFDouble.ZERO_DBL) > 0) { | ||||||
| 				errors += "单据号:[" + jydMasterVO.getAttributeValue("code") + "]提交失败,失败原因:含有不合格数量,请检查。\n"; | 				errors += "单据号:[" + code + "]提交失败,失败原因:含有不合格数量,请检查。\n"; | ||||||
|  | 			} | ||||||
|  | 			// 存在下游的不合格检验单,不能审核 | ||||||
|  | 			String getBillSql = "select code from hfdl_chekbill_h where srcbillid = '[otherId]'"; | ||||||
|  | 			getBillSql = getBillSql.replace("[otherId]", jydMasterVO.getPk_chekbill_h()); | ||||||
|  | 			HashMap<String, String> headMap = (HashMap<String, String>) getBaseDAO().executeQuery(getBillSql, | ||||||
|  | 					new MapProcessor()); | ||||||
|  | 			if (!headMap.isEmpty() && !StringUtils.isEmpty(headMap.get("code"))) { | ||||||
|  | 				errors += "单据号:[" + code + "]提交失败,失败原因:存在关联的不合格检验单,请检查。\n"; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (!"".equals(errors)) { | 		if (!"".equals(errors)) { | ||||||
|  | @ -507,12 +504,26 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | ||||||
| 			if ("".equals(otherId) || "null".equals(otherId)) { | 			if ("".equals(otherId) || "null".equals(otherId)) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			// 查询采购入库单是否存在该id | 			String transtype = jydMasterVO.getTranstype(); | ||||||
| 			String countSql = "select count(1) from IC_PURCHASEIN_B where csourcebillhid = '[otherId]';"; | 			if ("DHJY-Cxx-02".equals(transtype)) { | ||||||
| 			countSql = countSql.replace("[otherId]", otherId); | 				// 不合格检验单的校验 如果上游的检验单已经审核通过则不能弃审 | ||||||
| 			Integer num = (Integer) getBaseDAO().executeQuery(countSql, new ColumnProcessor()); | 				String getBillSql = "select approvestatus from hfdl_chekbill_h where pk_chekbill_h = '[otherId]'"; | ||||||
| 			if (num > 0) { | 				getBillSql = getBillSql.replace("[otherId]", otherId); | ||||||
| 				errors += "单据号:[" + jydMasterVO.getAttributeValue("code") + "]收回失败,失败原因:到货单已入库,请勿收回。\n"; | 				HashMap<String, Integer> headMap = (HashMap<String, Integer>) getBaseDAO().executeQuery(getBillSql, | ||||||
|  | 						new MapProcessor()); | ||||||
|  | 				Integer status = headMap.getOrDefault("approvestatus", BillStatusEnum.FREE.toIntValue()); | ||||||
|  | 				if (status == BillStatusEnum.APPROVED.toIntValue()) { | ||||||
|  | 					errors += "单据号:[" + jydMasterVO.getAttributeValue("code") + "]收回失败,失败原因:到货检验单已审核通过,请勿收回。\n"; | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				// 到货检验单的校验 | ||||||
|  | 				// 查询采购入库单是否存在该id | ||||||
|  | 				String countSql = "select count(1) from IC_PURCHASEIN_B where csourcebillhid = '[otherId]';"; | ||||||
|  | 				countSql = countSql.replace("[otherId]", otherId); | ||||||
|  | 				Integer num = (Integer) getBaseDAO().executeQuery(countSql, new ColumnProcessor()); | ||||||
|  | 				if (num > 0) { | ||||||
|  | 					errors += "单据号:[" + jydMasterVO.getAttributeValue("code") + "]收回失败,失败原因:到货单已入库,请勿收回。\n"; | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (!"".equals(errors)) { | 		if (!"".equals(errors)) { | ||||||
|  | @ -570,18 +581,26 @@ 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 = null; | ||||||
| 		AggDhjydMasterVO vo = dao.findByPk(AggDhjydMasterVO.class, pk, false); | 		String whereSql = "srcbillid = 'pk'"; | ||||||
|  | 		whereSql.replace("pk", pk); | ||||||
|  | 		AggDhjydMasterVO[] unPassVOs = dao.listByCondition(AggDhjydMasterVO.class, whereSql); | ||||||
|  | 		if (unPassVOs != null && unPassVOs.length > 0) { | ||||||
|  | 			return unPassVOs[0]; | ||||||
|  | 		} else { | ||||||
|  | 			vo = dao.findByPk(AggDhjydMasterVO.class, pk, false); | ||||||
|  | 		} | ||||||
| 		DhjydMasterVO mainVO = vo.getParentVO(); | 		DhjydMasterVO mainVO = vo.getParentVO(); | ||||||
| 		// SuperVO mainVO = getMainVO(vo); | 		// SuperVO mainVO = getMainVO(vo); | ||||||
|  | 		String oldCode = mainVO.getCode(); | ||||||
| 		mainVO.setPrimaryKey(null); | 		mainVO.setPrimaryKey(null); | ||||||
| 		mainVO.setStatus(VOStatus.NEW); | 		mainVO.setStatus(VOStatus.NEW); | ||||||
| 
 | 
 | ||||||
| 		mainVO.setAttributeValue("srcbilltype", null); | 		mainVO.setAttributeValue("srcbilltype", null); | ||||||
| 		// 来源单据主键改成当前传递的检验单的主键 | 		// 来源单据主键改成当前传递的检验单的主键 | ||||||
| 		mainVO.setAttributeValue("srcbillid", pk); | 		mainVO.setAttributeValue("srcbillid", pk); | ||||||
| 		mainVO.setAttributeValue("vsourcecode", mainVO.getCode()); | 		mainVO.setAttributeValue("vsourcecode", oldCode); | ||||||
| 
 | 
 | ||||||
| 		mainVO.setAttributeValue("code", null); | 		mainVO.setAttributeValue("code", null); | ||||||
| 		// mainVO.setAttributeValue("", null); | 		// mainVO.setAttributeValue("", null); | ||||||
|  | @ -612,29 +631,31 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | ||||||
| 				"pk_billtypecode = 'DHJY-Cxx-02' "); | 				"pk_billtypecode = 'DHJY-Cxx-02' "); | ||||||
| 		mainVO.setAttributeValue("transtypepk", billtypeid); | 		mainVO.setAttributeValue("transtypepk", billtypeid); | ||||||
| 		mainVO.setAttributeValue("transtype", "DHJY-Cxx-02"); | 		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]; | 		DhjydSlave0VO[] newVOs = new DhjydSlave0VO[3]; | ||||||
| 		if (dhjydSlave0VOs != null && dhjydSlave0VOs.length > 0) { | 		if (dhjydSlave0VOs != null && dhjydSlave0VOs.length > 0) { | ||||||
| 			DhjydSlave0VO subvo = dhjydSlave0VOs[0]; | 			DhjydSlave0VO oldVo = dhjydSlave0VOs[0]; | ||||||
| 			// 检查结果 合格、回用、不合格 | 			// 检查结果 合格、回用、不合格 | ||||||
| 			String def1 = subvo.getDef1(); | 			String def1 = oldVo.getDef1(); | ||||||
| 			Object def1Code = null; | 			String getTestResCodeSql = "SELECT a.code,a.pk_defdoc " | ||||||
| 			try { | 					+ "FROM bd_defdoc a LEFT JOIN bd_defdoclist b ON a.pk_defdoclist = b.pk_defdoclist " | ||||||
| 				def1Code = new HYPubBO().findColValue("bd_defdoc", "code", " dr = 0 and pk_defdoc='" + def1 + "' "); | 					+ "WHERE a.dr = 0 AND a.pk_defdoc = '[def1]' AND b.code = 'checkresult'"; | ||||||
| 			} catch (UifException e) { | 			getTestResCodeSql = getTestResCodeSql.replace("[def1]", def1); | ||||||
| 				e.printStackTrace(); | 			HashMap<String, String> headMap = (HashMap<String, String>) getBaseDAO().executeQuery(getTestResCodeSql, | ||||||
| 			} | 					new MapProcessor()); | ||||||
| 			subvo.setPrimaryKey(null); | 			String def1Code = headMap.getOrDefault("code", ""); | ||||||
| 			subvo.setStatus(VOStatus.NEW); | 			oldVo.setPrimaryKey(null); | ||||||
| 			subvo.setAttributeValue("pk_chekbill_b", null); | 			oldVo.setStatus(VOStatus.NEW); | ||||||
| 			subvo.setAttributeValue("srcbilltype", null); | 			oldVo.setAttributeValue("pk_chekbill_b", null); | ||||||
| 			subvo.setAttributeValue("srcbillid", null); | 			oldVo.setAttributeValue("srcbilltype", null); | ||||||
| 			subvo.setAttributeValue("rowno", null); | 			oldVo.setAttributeValue("srcbillid", null); | ||||||
| 			subvo.setAttributeValue("srcrowno", null); | 			oldVo.setAttributeValue("rowno", null); | ||||||
|  | 			oldVo.setAttributeValue("srcrowno", null); | ||||||
| 			// 根据自定义档案的编码查询对应的主键 | 			// 根据自定义档案的编码查询对应的主键 | ||||||
| 			String getTestResSql = "select code,pk_defdoc from bd_defdoc where dr = 0 and code in ('01','02','03')"; | 			String getTestResSql = "SELECT a.code,a.pk_defdoc " | ||||||
|  | 					+ "FROM bd_defdoc a LEFT JOIN bd_defdoclist b ON a.pk_defdoclist = b.pk_defdoclist " | ||||||
|  | 					+ "WHERE a.dr = 0 AND a.code IN ('01','02','03') AND b.code = 'checkresult'"; | ||||||
| 			List<Map<String, Object>> testResList = (List<Map<String, Object>>) getBaseDAO().executeQuery(getTestResSql, | 			List<Map<String, Object>> testResList = (List<Map<String, Object>>) getBaseDAO().executeQuery(getTestResSql, | ||||||
| 					new MapListProcessor()); | 					new MapListProcessor()); | ||||||
| 			Map<String, String> testResMap = new HashMap<>(); | 			Map<String, String> testResMap = new HashMap<>(); | ||||||
|  | @ -643,44 +664,101 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | ||||||
| 					testResMap.put(map.getOrDefault("code", "") + "", map.getOrDefault("pk_defdoc", "") + ""); | 					testResMap.put(map.getOrDefault("code", "") + "", map.getOrDefault("pk_defdoc", "") + ""); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | 			// UFDouble qualifiednum = oldVo.getQualifiednum(); | ||||||
|  | 			// UFDouble nunqualifiednum = oldVo.getNunqualifiednum(); | ||||||
|  | 			String vbatch = (oldVo.getVbatch() != null) ? oldVo.getVbatch() : "";// 批次号 | ||||||
|  | 			// oldVo.setQualifiednum(UFDouble.ZERO_DBL); | ||||||
|  | 			// oldVo.setNunqualifiednum(UFDouble.ZERO_DBL); | ||||||
|  | 			DhjydSlave0VO vo0 = new DhjydSlave0VO(); | ||||||
|  | 			DhjydSlave0VO vo1 = new DhjydSlave0VO(); | ||||||
|  | 			DhjydSlave0VO vo2 = new DhjydSlave0VO(); | ||||||
|  | 			BeanUtil.copyProperties(oldVo, vo0); | ||||||
|  | 			BeanUtil.copyProperties(oldVo, vo1); | ||||||
|  | 			BeanUtil.copyProperties(oldVo, vo2); | ||||||
|  | 			String[] vbatchStr = { "-合格", "-回用", "-不合格" }; | ||||||
| 			// 第1行 合格 第2行 回用 第3行 不合格 | 			// 第1行 合格 第2行 回用 第3行 不合格 | ||||||
| 			if ("01".equals(def1Code)) { | 			if ("01".equals(def1Code)) { | ||||||
| 				// 合格 | 				// 合格 | ||||||
| 				newVOs[0] = subvo; | 				// vo0.setQualifiednum(qualifiednum); | ||||||
| 				// 不合格 | 				vo0.setVbatch(vbatch + vbatchStr[0]); | ||||||
| 				DhjydSlave0VO vo2 = new DhjydSlave0VO(); | 				newVOs[0] = vo0; | ||||||
| 				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; | 				vo1.setAttributeValue("def1", testResMap.get("02")); | ||||||
| 				subvo.setAttributeValue("def1", testResMap.get("01")); | 				vo1.setVbatch(vbatch + vbatchStr[1]); | ||||||
| 				newVOs[2] = subvo; | 				newVOs[1] = vo1; | ||||||
| 				subvo.setAttributeValue("def1", testResMap.get("03")); | 
 | ||||||
| 			} else if ("03".equals(def1Code)) { |  | ||||||
| 				// 不合格 | 				// 不合格 | ||||||
| 				newVOs[2] = subvo; | 				// 设置检验结果的值 | ||||||
|  | 				vo2.setAttributeValue("def1", testResMap.get("03")); | ||||||
|  | 				vo2.setVbatch(vbatch + vbatchStr[2]); | ||||||
|  | 				newVOs[2] = vo2; | ||||||
|  | 				// mainVO.setNnum(qualifiednum); | ||||||
|  | 			} else if ("02".equals(def1Code)) { | ||||||
|  | 				// 合格 | ||||||
|  | 				vo0.setAttributeValue("def1", testResMap.get("01")); | ||||||
|  | 				vo0.setVbatch(vbatch + vbatchStr[0]); | ||||||
|  | 				newVOs[0] = vo0; | ||||||
|  | 
 | ||||||
|  | 				// 回用 | ||||||
|  | 				// vo1.setQualifiednum(qualifiednum); | ||||||
|  | 				vo1.setVbatch(vbatch + vbatchStr[1]); | ||||||
|  | 				newVOs[1] = vo1; | ||||||
|  | 
 | ||||||
|  | 				// 不合格 | ||||||
|  | 				vo2.setAttributeValue("def1", testResMap.get("03")); | ||||||
|  | 				vo2.setVbatch(vbatch + vbatchStr[2]); | ||||||
|  | 				newVOs[2] = vo2; | ||||||
|  | 				// mainVO.setNnum(qualifiednum); | ||||||
|  | 			} else if ("03".equals(def1Code)) { | ||||||
| 				// 合格 | 				// 合格 | ||||||
| 				DhjydSlave0VO vo0 = new DhjydSlave0VO(); |  | ||||||
| 				vo0 = subvo; |  | ||||||
| 				vo0.setQualifiednum(UFDouble.ZERO_DBL); |  | ||||||
| 				// 设置检验结果的值 | 				// 设置检验结果的值 | ||||||
| 				vo0.setAttributeValue("def1", testResMap.get("01")); | 				vo0.setAttributeValue("def1", testResMap.get("01")); | ||||||
|  | 				vo0.setVbatch(vbatch + vbatchStr[0]); | ||||||
| 				newVOs[0] = vo0; | 				newVOs[0] = vo0; | ||||||
| 				vo0.setAttributeValue("def1", testResMap.get("02")); | 
 | ||||||
| 				newVOs[1] = vo0; | 				// 回用 | ||||||
|  | 				// 设置检验结果的值 | ||||||
|  | 				vo1.setAttributeValue("def1", testResMap.get("02")); | ||||||
|  | 				vo1.setVbatch(vbatch + vbatchStr[1]); | ||||||
|  | 				newVOs[1] = vo1; | ||||||
|  | 
 | ||||||
|  | 				// 不合格 | ||||||
|  | 				// vo2.setNunqualifiednum(nunqualifiednum); | ||||||
|  | 				vo2.setVbatch(vbatch + vbatchStr[2]); | ||||||
|  | 				newVOs[2] = vo2; | ||||||
|  | 				// mainVO.setNnum(nunqualifiednum); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 		} | 		} | ||||||
| 		vo.setChildren(DhjydSlave0VO.class, newVOs); | 		vo.setChildren(DhjydSlave0VO.class, newVOs); | ||||||
| 		AggDhjydMasterVO[] saveAggDhjydMasterVO = this.saveAggDhjydMasterVO(vo); | 		// AggDhjydMasterVO[] saveAggDhjydMasterVO = this.saveAggDhjydMasterVO(vo); | ||||||
| 		return saveAggDhjydMasterVO; | 		return vo; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	@Override | ||||||
|  | 	public void afterAuditUnPass(AggDhjydMasterVO[] vos) throws BusinessException { | ||||||
|  | 		if (ArrayUtils.isEmpty(vos)) { | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		for (int i = 0; i < vos.length; i++) { | ||||||
|  | 			AggDhjydMasterVO vo = vos[i]; | ||||||
|  | 			ISuperVO mainVo = vo.getParent(); | ||||||
|  | 			Object srcbillid = mainVo.getAttributeValue("srcbillid"); | ||||||
|  | 			if (srcbillid != null && "".equals(srcbillid)) { | ||||||
|  | 				String[] pks = { srcbillid + "" }; | ||||||
|  | 				AggDhjydMasterVO[] listByPk = dao.listByPk(AggDhjydMasterVO.class, pks); | ||||||
|  | 				if(listByPk != null) { | ||||||
|  | 					 | ||||||
|  | 				} | ||||||
|  | 				// 不合格检验单审核通过后同步修改上游的到货检验单的表体 | ||||||
|  | 
 | ||||||
|  | 				// 不合格检验单审核通过后触发上游的到货检验单审核通过 | ||||||
|  | 				PfServiceScmUtil.processBatch("APPROVE", "DHJY", vos, null, null); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
|  |  | ||||||
|  | @ -4,57 +4,58 @@ import java.util.Arrays; | ||||||
| 
 | 
 | ||||||
| import nc.bs.framework.common.NCLocator; | import nc.bs.framework.common.NCLocator; | ||||||
| import nc.bs.pub.compiler.IWorkFlowRet; | import nc.bs.pub.compiler.IWorkFlowRet; | ||||||
| import nc.vo.pub.BusinessException; |  | ||||||
| import nc.vo.pub.compiler.PfParameterVO; |  | ||||||
| import nc.vo.pub.VOStatus; |  | ||||||
| import nc.vo.uap.pf.PFBusinessException; |  | ||||||
| import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill; |  | ||||||
| import nc.vo.pubapp.pattern.model.meta.entity.bill.IBillMeta; |  | ||||||
| import nc.vo.pub.CircularlyAccessibleValueObject; |  | ||||||
| import nccloud.commons.lang.StringUtils; |  | ||||||
| import nc.codeplatform.framework.service.AbstractPfScriptAction; | import nc.codeplatform.framework.service.AbstractPfScriptAction; | ||||||
| import nc.vo.pu.dhjyd.AggDhjydMasterVO; |  | ||||||
| import nc.itf.pu.dhjyd.dhjydmaster.IArriveToDhjyd; | import nc.itf.pu.dhjyd.dhjydmaster.IArriveToDhjyd; | ||||||
| import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; | import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; | ||||||
|  | import nc.vo.pu.dhjyd.AggDhjydMasterVO; | ||||||
|  | import nc.vo.pub.BusinessException; | ||||||
|  | import nc.vo.pub.VOStatus; | ||||||
|  | import nc.vo.pub.compiler.PfParameterVO; | ||||||
|  | import nc.vo.uap.pf.PFBusinessException; | ||||||
|  | import nccloud.commons.lang.StringUtils; | ||||||
| 
 | 
 | ||||||
| public class N_DHJY_APPROVE extends AbstractPfScriptAction<AggDhjydMasterVO>{ | public class N_DHJY_APPROVE extends AbstractPfScriptAction<AggDhjydMasterVO> { | ||||||
| 	 | 
 | ||||||
| 	public N_DHJY_APPROVE(){ | 	public N_DHJY_APPROVE() { | ||||||
| 		super(); | 		super(); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	protected Object process(PfParameterVO paraVO) throws BusinessException { | 	protected Object process(PfParameterVO paraVO) throws BusinessException { | ||||||
| 		try { | 		try { | ||||||
| 			IDhjydMasterVOService service = NCLocator.getInstance().lookup(IDhjydMasterVOService.class); | 			IDhjydMasterVOService service = NCLocator.getInstance().lookup(IDhjydMasterVOService.class); | ||||||
| 			AggDhjydMasterVO[] vos = (AggDhjydMasterVO[])this.getVos(); | 			AggDhjydMasterVO[] vos = (AggDhjydMasterVO[]) this.getVos(); | ||||||
| 			Arrays.stream(vos).forEach(v-> v.getParent().setStatus(VOStatus.UPDATED)); | 			Arrays.stream(vos).forEach(v -> v.getParent().setStatus(VOStatus.UPDATED)); | ||||||
| 			 | 
 | ||||||
| 			IWorkFlowRet  workFlowRet = (IWorkFlowRet)this.procActionFlow(paraVO); | 			IWorkFlowRet workFlowRet = (IWorkFlowRet) this.procActionFlow(paraVO); | ||||||
| 			 | 
 | ||||||
| 			vos = service.callbackAPPROVE(vos); | 			vos = service.callbackAPPROVE(vos); | ||||||
| 			 | 
 | ||||||
| 			return workFlowRet==null?vos:workFlowRet; | 			return workFlowRet == null ? vos : workFlowRet; | ||||||
| 		}catch(Exception ex) { | 		} catch (Exception ex) { | ||||||
| 			if (ex instanceof BusinessException) { | 			if (ex instanceof BusinessException) { | ||||||
| 		        throw (BusinessException) ex; | 				throw (BusinessException) ex; | ||||||
| 		      } | 			} | ||||||
| 	        throw new PFBusinessException(ex.getMessage(), ex); | 			throw new PFBusinessException(ex.getMessage(), ex); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	protected void before(PfParameterVO paraVO)  throws BusinessException{ | 	protected void before(PfParameterVO paraVO) throws BusinessException { | ||||||
| 		AggDhjydMasterVO vo = (AggDhjydMasterVO)this.getVo(); | 		AggDhjydMasterVO vo = (AggDhjydMasterVO) this.getVo(); | ||||||
| 		if(StringUtils.isEmpty(vo.getPrimaryKey())){ | 		if (StringUtils.isEmpty(vo.getPrimaryKey())) { | ||||||
| 			throw new BusinessException("当前单据未执行保存动作脚本,如果配置了业务流程定义,请检查动作驱动配置!"); | 			throw new BusinessException("当前单据未执行保存动作脚本,如果配置了业务流程定义,请检查动作驱动配置!"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	protected void after(PfParameterVO paraVO) throws BusinessException { | 	protected void after(PfParameterVO paraVO) throws BusinessException { | ||||||
| 		AggDhjydMasterVO[] vos = (AggDhjydMasterVO[])this.getVos(); | 		AggDhjydMasterVO[] vos = (AggDhjydMasterVO[]) this.getVos(); | ||||||
| 		IArriveToDhjyd service = NCLocator.getInstance().lookup(IArriveToDhjyd.class); | 		IArriveToDhjyd service = NCLocator.getInstance().lookup(IArriveToDhjyd.class); | ||||||
| 		for(int i = 0; i < vos.length; i++) { | 		for (int i = 0; i < vos.length; i++) { | ||||||
| 			service.writeBackQc(vos[i]); | 			service.writeBackQc(vos[i]); | ||||||
| 		} | 		} | ||||||
|  | 		// IDhjydMasterVOService dhjydMasterVOService = | ||||||
|  | 		// NCLocator.getInstance().lookup(IDhjydMasterVOService.class); | ||||||
|  | 		// dhjydMasterVOService.afterAuditUnPass(vos); | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | @ -287,6 +287,12 @@ public interface IDhjydMasterVOService { | ||||||
| 	 * 生成不合格审批单 | 	 * 生成不合格审批单 | ||||||
| 	 *  | 	 *  | ||||||
| 	 */ | 	 */ | ||||||
| 	public AggDhjydMasterVO[] addUnPassDhjydMasterVO(String pk) throws BusinessException; | 	public AggDhjydMasterVO addUnPassDhjydMasterVO(String pk) throws BusinessException; | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * 不合格检验单审批通过之后同步调整关联的到货检验单 | ||||||
|  | 	 *  | ||||||
|  | 	 */ | ||||||
|  | 	public void afterAuditUnPass(AggDhjydMasterVO[] vos) throws BusinessException; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue