质检报告审核增加校验
This commit is contained in:
		
							parent
							
								
									fb999d54b5
								
							
						
					
					
						commit
						2c040f55fe
					
				|  | @ -0,0 +1,109 @@ | ||||||
|  | package nc.impl.qc.c003.approve.action; | ||||||
|  | 
 | ||||||
|  | import com.yonyou.cloud.ncc.plugin.entity.OperationInfo; | ||||||
|  | import java.io.Serializable; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.Map; | ||||||
|  | import nc.bs.pub.compiler.AbstractCompiler2; | ||||||
|  | import nc.bs.qc.c003.maintain.rule.ApproveEventAfterRule; | ||||||
|  | import nc.bs.qc.c003.maintain.rule.ApproveEventBeforeRule; | ||||||
|  | import nc.bs.qc.c003.maintain.rule.ReportSendMessageWithPlatTemplateRule; | ||||||
|  | import nc.bs.qc.c003.maintain.rule.ReportSendNCCMessageRule; | ||||||
|  | import nc.bs.qc.c003.maintain.rule.UpdateSnDocRule; | ||||||
|  | import nc.bs.qc.c003.plugin.ReportBPPlugInPoint; | ||||||
|  | import nc.bs.scmpub.pf.PfParameterUtil; | ||||||
|  | import nc.bs.scmpub.rule.VOSagaFrozenValidateRule; | ||||||
|  | import nc.impl.pubapp.pattern.data.bill.BillUpdate; | ||||||
|  | import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser; | ||||||
|  | import nc.impl.qc.c003.approve.action.rule.*; | ||||||
|  | import nc.itf.qc.c003.compensate.IReportSagasCompensate; | ||||||
|  | import nc.vo.ml.NCLangRes4VoTransl; | ||||||
|  | import nc.vo.pub.lang.UFBoolean; | ||||||
|  | import nc.vo.pubapp.AppContext; | ||||||
|  | import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||||
|  | import nc.vo.qc.c003.entity.ReportVO; | ||||||
|  | import nc.vo.qc.c003.rule.Write23WhenAuditRule; | ||||||
|  | import nc.vo.qc.c003.rule.Write4331WhenAuditRule; | ||||||
|  | import nc.vo.qc.c003.rule.Write4ZRuleWhenAuditRule; | ||||||
|  | import nc.vo.qc.c003.rule.WriteMMWhenAuditRule; | ||||||
|  | import nc.vo.qc.pub.enumeration.QCBillStatusEnum; | ||||||
|  | import nc.vo.qc.pub.util.QCSagasUtils; | ||||||
|  | import nc.vo.scmpub.res.billtype.QCBillType; | ||||||
|  | 
 | ||||||
|  | public class ReportApproveAction { | ||||||
|  |     public ReportApproveAction() { | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public ReportVO[] approveReport(ReportVO[] voArray, AbstractCompiler2 script) { | ||||||
|  |         PfParameterUtil<ReportVO> util = new PfParameterUtil(script == null ? null : script.getPfParameterVO(), voArray); | ||||||
|  |         ReportVO[] originBills = (ReportVO[])util.getOrginBills(); | ||||||
|  |         ReportVO[] clientBills = (ReportVO[])util.getClientFullInfoBill(); | ||||||
|  |         CompareAroundProcesser<ReportVO> processer = new CompareAroundProcesser(ReportBPPlugInPoint.ReportApprove); | ||||||
|  |         this.addBeforeRule(processer); | ||||||
|  |         processer.before(clientBills, null); | ||||||
|  |         if (null != script) { | ||||||
|  |             try { | ||||||
|  |                 script.procFlowBacth(script.getPfParameterVO()); | ||||||
|  |             } catch (Exception e) { | ||||||
|  |                 ExceptionUtils.wrappException(e); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (script != null && script.getPfParameterVO().m_preValueVos != null) { | ||||||
|  |             ReportVO[] appovedVos = (ReportVO[])script.getPfParameterVO().m_preValueVos; | ||||||
|  | 
 | ||||||
|  |             for(ReportVO vo : appovedVos) { | ||||||
|  |                 vo.getHVO().setApprover(AppContext.getInstance().getPkUser()); | ||||||
|  |                 vo.getHVO().setTaudittime(AppContext.getInstance().getBusiDate()); | ||||||
|  |                 vo.getParentVO().setStatus(1); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             BillUpdate<ReportVO> update = new BillUpdate(); | ||||||
|  |             clientBills = (ReportVO[])update.update(appovedVos, originBills); | ||||||
|  |             QCSagasUtils.frozenAndAddSaga(voArray, QCBillType.ReportBill.getCode(), "1", (OperationInfo)null); | ||||||
|  |             Map<String, Serializable> paramMap = new HashMap(); | ||||||
|  |             paramMap.put("actionname", "approve_C003_mmsfc"); | ||||||
|  |             paramMap.put("hid", originBills[0].getHVO().getPrimaryKey()); | ||||||
|  |             paramMap.put("reportapprover", originBills[0].getHVO().getApprover()); | ||||||
|  |             paramMap.put("reporttaudittime", originBills[0].getHVO().getTaudittime()); | ||||||
|  |             paramMap.put("reportfbillstatus", originBills[0].getHVO().getFbillstatus()); | ||||||
|  |             QCSagasUtils.compensate(paramMap, IReportSagasCompensate.class); | ||||||
|  |             this.addAfterRule(processer, clientBills); | ||||||
|  |             processer.after(clientBills, null); | ||||||
|  |             return clientBills; | ||||||
|  |         } else { | ||||||
|  |             String msg = NCLangRes4VoTransl.getNCLangRes().getStrByID("c010003_0", "0c010003-0062"); | ||||||
|  |             ExceptionUtils.wrappBusinessException(msg); | ||||||
|  |             return null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private void addAfterRule(CompareAroundProcesser<ReportVO> pc, ReportVO[] bills) { | ||||||
|  |         pc.addAfterRule(new WriteC001WhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |         Integer status = bills[0].getHVO().getFbillstatus(); | ||||||
|  |         if (QCBillStatusEnum.APPROVE.value().equals(status)) { | ||||||
|  |             pc.addAfterRule(new Write23WhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new Write4331WhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new Write4ZRuleWhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new WriteMMWhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new WriteC005WhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new WriteContinueBatchWhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new WriteICBatchDocWhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new Write55D2WhenAuditRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new ReportSendMessageWithPlatTemplateRule()); | ||||||
|  |             pc.addAfterRule(new ReportSendNCCMessageRule()); | ||||||
|  |             pc.addAfterRule(new UpdateSnDocRule(UFBoolean.TRUE)); | ||||||
|  |             pc.addAfterRule(new ApproveEventAfterRule()); | ||||||
|  |             pc.addAfterRule(new CreateStockStateChangeBill()); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private void addBeforeRule(CompareAroundProcesser<ReportVO> pc) { | ||||||
|  |         pc.addBeforeRule(new VOSagaFrozenValidateRule(true)); | ||||||
|  |         pc.addBeforeRule(new ChkCanApproveRule()); | ||||||
|  |         pc.addBeforeRule(new ApproveEventBeforeRule()); | ||||||
|  | 
 | ||||||
|  |         pc.addBeforeRule(new CheckQMSApproveRule()); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,48 @@ | ||||||
|  | package nc.impl.qc.c003.approve.action.rule; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import nc.bs.dao.BaseDAO; | ||||||
|  | import nc.bs.dao.DAOException; | ||||||
|  | import nc.impl.pubapp.pattern.rule.ICompareRule; | ||||||
|  | import nc.jdbc.framework.processor.ColumnProcessor; | ||||||
|  | import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||||
|  | import nc.vo.qc.c003.entity.ReportHeaderVO; | ||||||
|  | import nc.vo.qc.c003.entity.ReportItemVO; | ||||||
|  | import nc.vo.qc.c003.entity.ReportVO; | ||||||
|  | 
 | ||||||
|  | import java.util.Map; | ||||||
|  | 
 | ||||||
|  | public class CheckQMSApproveRule implements ICompareRule<ReportVO> { | ||||||
|  | 
 | ||||||
|  |     public CheckQMSApproveRule() { | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void process(ReportVO[] vos, ReportVO[] originVOs) { | ||||||
|  |         if (vos == null) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |         for (ReportVO vo : vos) { | ||||||
|  | 
 | ||||||
|  |             ReportHeaderVO hvo = vo.getHVO(); | ||||||
|  |             for (ReportItemVO itemVO : vo.getBVO()) { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                 try { | ||||||
|  |                     String countSql = "SELECT vbdef32 from po_arriveorder_b WHERE pk_arriveorder_b= '" + itemVO.getCfirstbid() + "'"; | ||||||
|  |                     String vbdef32 = (String) new BaseDAO().executeQuery(countSql, new ColumnProcessor()); | ||||||
|  |                     if (null !=vbdef32  && "Y".equals(vbdef32)) { | ||||||
|  |                         if (!"Y".equals(hvo.getVdef10())) { | ||||||
|  |                             ExceptionUtils.wrappBusinessException("QMSδ»Ø´«¼ìÑé½á¹ûÇëÎðÌá½»"); | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                 } catch (DAOException e) { | ||||||
|  |                     throw new RuntimeException(e); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue