不合格检验单回写检验单调整
This commit is contained in:
		
							parent
							
								
									c303560cb6
								
							
						
					
					
						commit
						9ec6b4d52d
					
				|  | @ -437,19 +437,19 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | |||
| 		for (AggDhjydMasterVO vo : vos) { | ||||
| 			DhjydMasterVO jydMasterVO = vo.getParentVO(); | ||||
| 			String code = jydMasterVO.getAttributeValue("code") + ""; | ||||
| 			// 如果不合格检验数量>0,则给出提示 | ||||
| 			UFDouble brecheck = (UFDouble) jydMasterVO.getAttributeValue("brecheck"); | ||||
| 			// System.out.println("brecheck = " + brecheck); | ||||
| 			if (MathTool.compareTo(brecheck, UFDouble.ZERO_DBL) > 0) { | ||||
| 				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 ("DHJY-Cxx-01".equals(jydMasterVO.getTranstype())) { | ||||
| 				// 如果不合格检验数量>0,则给出提示 | ||||
| 				UFDouble brecheck = (UFDouble) jydMasterVO.getAttributeValue("brecheck"); | ||||
| 				// System.out.println("brecheck = " + brecheck); | ||||
| 				if (MathTool.compareTo(brecheck, UFDouble.ZERO_DBL) > 0) { | ||||
| 					errors += "单据号:[" + code + "]提交失败,失败原因:含有不合格数量,请检查。\n"; | ||||
| 				} | ||||
| 				// 存在下游的不合格检验单,不能提交审核 | ||||
| 				Object unPasscode = new HYPubBO().findColValue("hfdl_chekbill_h", "code", | ||||
| 						" srcbillid='" + jydMasterVO.getPk_chekbill_h() + "' "); | ||||
| 				if (unPasscode != null && !"".equals(unPasscode)) { | ||||
| 					errors += "单据号:[" + code + "]提交失败,失败原因:存在关联的不合格检验单,请检查。\n"; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		if (!"".equals(errors)) { | ||||
|  | @ -745,17 +745,44 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | |||
| 		for (int i = 0; i < vos.length; i++) { | ||||
| 			AggDhjydMasterVO vo = vos[i]; | ||||
| 			ISuperVO mainVo = vo.getParent(); | ||||
| 			// 判断是否为不合格检验单,不是则直接跳过 | ||||
| 			if (!"DHJY-Cxx-02".equals(mainVo.getAttributeValue("transtype"))) { | ||||
| 				continue; | ||||
| 			} | ||||
| 			DhjydSlave0VO[] unPassVOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class); | ||||
| 			Object srcbillid = mainVo.getAttributeValue("srcbillid"); | ||||
| 			if (srcbillid != null && "".equals(srcbillid)) { | ||||
| 				String[] pks = { srcbillid + "" }; | ||||
| 				AggDhjydMasterVO[] listByPk = dao.listByPk(AggDhjydMasterVO.class, pks); | ||||
| 				if(listByPk != null) { | ||||
| 					 | ||||
| 				AggDhjydMasterVO[] listCheckV0 = dao.listByPk(AggDhjydMasterVO.class, pks); | ||||
| 				if (listCheckV0 != null && listCheckV0.length > 0) { | ||||
| 					// 上游的到货检验单的实体 | ||||
| 					AggDhjydMasterVO masterVO = listCheckV0[0]; | ||||
| 					// 到货检验单的表头 | ||||
| 					ISuperVO mainCheckVo = masterVO.getParent(); | ||||
| 					mainCheckVo.setStatus(VOStatus.UPDATED); | ||||
| 					// 到货检验单的表体 | ||||
| 					DhjydSlave0VO[] dhjydSlave0VOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class); | ||||
| 					// 不合格检验单审核通过后同步修改上游的到货检验单的表体 | ||||
| 					DhjydSlave0VO[] newVOs = new DhjydSlave0VO[dhjydSlave0VOs.length + unPassVOs.length]; | ||||
| 					// 删掉原来的 | ||||
| 					for (int j = 0; j < dhjydSlave0VOs.length; j++) { | ||||
| 						DhjydSlave0VO dhjydSlave0VO = dhjydSlave0VOs[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; | ||||
| 					} | ||||
| 					masterVO.setChildren(DhjydSlave0VO.class, newVOs); | ||||
| 					AggDhjydMasterVO[] saveVOs = dao.update(masterVO); | ||||
| 					// 不合格检验单审核通过后触发上游的到货检验单审核通过 | ||||
| 					PfServiceScmUtil.processBatch("APPROVE", "DHJY", saveVOs, null, null); | ||||
| 				} | ||||
| 				// 不合格检验单审核通过后同步修改上游的到货检验单的表体 | ||||
| 
 | ||||
| 				// 不合格检验单审核通过后触发上游的到货检验单审核通过 | ||||
| 				PfServiceScmUtil.processBatch("APPROVE", "DHJY", vos, null, null); | ||||
| 			} | ||||
| 
 | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue