不合格检验单删除的同时也删除生成的批次号档案
This commit is contained in:
		
							parent
							
								
									0a78053868
								
							
						
					
					
						commit
						4a16562e90
					
				|  | @ -18,7 +18,6 @@ import nc.bs.framework.common.NCLocator; | |||
| import nc.bs.pub.common.PfServiceScmUtil; | ||||
| import nc.bs.trade.business.HYPubBO; | ||||
| import nc.codeplatform.framework.service.ServiceSupport; | ||||
| import nc.itf.ic.batch.IBatchGenerateForPU; | ||||
| import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService; | ||||
| import nc.itf.scmf.ic.mbatchcode.IBatchcodeMaintainService; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
|  | @ -29,7 +28,6 @@ import nc.vo.bd.meta.BatchOperateVO; | |||
| import nc.vo.pu.dhjyd.AggDhjydMasterVO; | ||||
| import nc.vo.pu.dhjyd.DhjydMasterVO; | ||||
| import nc.vo.pu.dhjyd.DhjydSlave0VO; | ||||
| import nc.vo.pu.m23.rule.BatchCodeFieldMap; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.ISuperVO; | ||||
| import nc.vo.pub.SuperVO; | ||||
|  | @ -357,6 +355,8 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | |||
| 			} | ||||
| 		}); | ||||
| 		dao.delete(vos, true); | ||||
| 		// 不合格检验单删除的同时也删除生成的批次号档案 | ||||
| 		this.delBatchcodes(vos); | ||||
| 		return vos; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -913,6 +913,50 @@ public class DhjydMasterVOServiceImpl extends ServiceSupport implements IDhjydMa | |||
| 		return super.getBillCodeContext(coderuleid, pkgroup, pkorg); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * 不合格检验单删除的同时也删除生成的批次号档案 | ||||
| 	 */ | ||||
| 	private void delBatchcodes(AggDhjydMasterVO[] vos) throws BusinessException { | ||||
| 		for (AggDhjydMasterVO vo : vos) { | ||||
| 			// 不合格检验单删除的同时也删除生成的批次号档案 | ||||
| 			DhjydMasterVO mainVo = vo.getParentVO(); | ||||
| 			String transtype = mainVo.getTranstype(); | ||||
| 			if ("DHJY-Cxx-02".equals(transtype)) { | ||||
| 				DhjydSlave0VO[] detailVOs = (DhjydSlave0VO[]) vo.getChildren(DhjydSlave0VO.class); | ||||
| 				for (DhjydSlave0VO detailVo : detailVOs) { | ||||
| 					String vbatch = detailVo.getVbatch(); | ||||
| 					if (vbatch == null || "".equals(vbatch)) { | ||||
| 						continue; | ||||
| 					} | ||||
| 					if (!vbatch.contains("回用") && !vbatch.contains("不合格")) { | ||||
| 						continue; | ||||
| 					} | ||||
| 					// 删除对应的批次号 | ||||
| 					// 根据批次号编码查询 | ||||
| 					IBatchcodeMaintainService batchcodeMaintainService = (IBatchcodeMaintainService) NCLocator | ||||
| 							.getInstance().lookup(IBatchcodeMaintainService.class); | ||||
| 					String whereSql = " vbatchcode = '[vbatchcode]' "; | ||||
| 					whereSql = whereSql.replace("[vbatchcode]", vbatch); | ||||
| 					// 获取批次号的实体 | ||||
| 					BatchcodeVO[] batchcodes = (BatchcodeVO[]) batchcodeMaintainService.selectByWhereSql(whereSql, | ||||
| 							BatchcodeVO.class); | ||||
| 					// 设置批次号为删除状态 | ||||
| 					for (BatchcodeVO batchcodeVO : batchcodes) { | ||||
| 						batchcodeVO.setStatus(VOStatus.DELETED); | ||||
| 					} | ||||
| 					// 删除批次号 | ||||
| 					if ((batchcodes != null) && (batchcodes.length > 0)) { | ||||
| 						IBatchcodeMaintainService maintainService = NCLocator.getInstance() | ||||
| 								.lookup(IBatchcodeMaintainService.class); | ||||
| 						BatchOperateVO operateVO = new BatchOperateVO(); | ||||
| 						operateVO.setDelObjs(batchcodes); | ||||
| 						maintainService.batchSave(operateVO); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private BaseDAO getBaseDAO() { | ||||
| 		if (this.baseDAO == null) { | ||||
| 			this.baseDAO = new BaseDAO(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue