精密-物料计划信息保存前校验
This commit is contained in:
		
							parent
							
								
									845677c59e
								
							
						
					
					
						commit
						cd9816e280
					
				|  | @ -0,0 +1,57 @@ | |||
| package nc.impl.bd.material.plan; | ||||
| 
 | ||||
| import nc.bs.businessevent.IBusinessEvent; | ||||
| import nc.bs.businessevent.IBusinessListener; | ||||
| import nc.bs.businessevent.bd.BDCommonEvent; | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.logging.Log; | ||||
| import nc.bs.uapbd.util.MyHelper; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.util.mmf.framework.base.MMValueCheck; | ||||
| import nc.vo.bd.material.plan.MaterialPlanVO; | ||||
| import nc.vo.org.OrgVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 精密-物料计划信息保存前校验 | ||||
|  * | ||||
|  * @author mzr | ||||
|  * @date 2025/10/30 | ||||
|  */ | ||||
| public class MaterialSaveBeforeCheckJMListener implements IBusinessListener { | ||||
|     private static final String LOG_INFO_NAME = "jmqylog"; | ||||
|     private static final Log logger = Log.getInstance(LOG_INFO_NAME); | ||||
|     private BaseDAO baseDAO = new BaseDAO(); | ||||
| 
 | ||||
|     public void doAction(IBusinessEvent event) throws BusinessException { | ||||
|         BDCommonEvent e = (BDCommonEvent) event; | ||||
|         String eventType = event.getEventType(); | ||||
|         Object[] objs = e.getObjs(); | ||||
|         // 1003 修改前校验 | ||||
|         if ("1003".equals(eventType)) { | ||||
|             String orgId = MyHelper.getStrValByCondition(OrgVO.getDefaultTableName(), OrgVO.PK_ORG, OrgVO.CODE + " = 'C038' and ISBUSINESSUNIT = 'Y'"); | ||||
|             for (Object obj : objs) { | ||||
|                 if (obj instanceof MaterialPlanVO planVO) { | ||||
|                     String pkOrg = planVO.getPk_org(); | ||||
|                     // 组织判断,精密的才需校验 | ||||
|                     if (MMValueCheck.isNotEmpty(orgId) && orgId.equals(pkOrg)) { | ||||
|                         String def2 = planVO.getDef2();// 启源物料编码/原系统物料编码 | ||||
|                         if (MMValueCheck.isNotEmpty(def2)) { | ||||
|                             String countSql = "select count(1) from bd_materialplan where pk_org = '[pk_org]' and def2 = '[def2]'"; | ||||
|                             countSql = countSql.replace("[pk_org]", pkOrg).replace("[def2]", def2); | ||||
|                             Integer num = (Integer) baseDAO.executeQuery(countSql, new ColumnProcessor()); | ||||
|                             if (num > 0) { | ||||
|                                 throw new BusinessException("原系统物料编码重复,请检查!"); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue