精密-启源领料-单据日期赋值-代码调整,需要在开关账检查之前赋值
This commit is contained in:
		
							parent
							
								
									79177e6f96
								
							
						
					
					
						commit
						15790ede83
					
				|  | @ -8,7 +8,6 @@ import nc.bs.ic.general.insert.rule.before.InsertBeforeEventRule; | |||
| import nc.bs.ic.general.rule.after.AfterInsertRuleForRewriteSpecial; | ||||
| import nc.bs.ic.general.rule.after.AtpAfterUpdate; | ||||
| import nc.bs.ic.general.rule.before.CtplcustomeridCheck; | ||||
| import nc.bs.ic.m45.insert.rule.PurchaseInProjectRule; | ||||
| import nc.bs.ic.m4d.base.BPPlugInPoint; | ||||
| import nc.bs.ic.m4d.base.MaterialOutCheckRule; | ||||
| import nc.bs.ic.m4d.base.MaterialOutValueProcRule; | ||||
|  | @ -109,7 +108,7 @@ public class InsertBP implements IInsertBP<MaterialOutVO>, | |||
| 
 | ||||
|         //2025年6月13日09点38分 -- 物料档案基本页签启用项目辅助属性+库存组织未启用项目,采购入库单保存时(包含接口导入)清除行项目,材料出库单保存时(包含接口导入)清除行项目 | ||||
|         processor.addBeforeRule(new MaterialOutProjectRule()); | ||||
|         processor.addBeforeRule(new MaterialOutBillDateRule()); | ||||
|         // processor.addBeforeRule(new MaterialOutBillDateRule()); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  |  | |||
|  | @ -1,57 +0,0 @@ | |||
| package nc.bs.ic.m4d.insert.rule; | ||||
| 
 | ||||
| import nc.bs.ic.pub.base.ICRule; | ||||
| import nc.bs.uapbd.util.MyHelper; | ||||
| import nc.util.mmf.framework.base.MMValueCheck; | ||||
| import nc.vo.ic.general.define.ICBillHeadVO; | ||||
| import nc.vo.ic.general.define.ICBillVO; | ||||
| import nc.vo.ic.m4d.entity.MaterialOutVO; | ||||
| import nc.vo.org.StockOrgVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDate; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| 
 | ||||
| /** | ||||
|  * 精密-材料出库新增-单据日期赋值-启源领料 | ||||
|  * | ||||
|  * @author mzr | ||||
|  * @date 2025/10/26 | ||||
|  */ | ||||
| public class MaterialOutBillDateRule extends ICRule<MaterialOutVO> { | ||||
|     @Override | ||||
|     public void process(MaterialOutVO[] vos) { | ||||
|         if (MMValueCheck.isEmpty(vos)) { | ||||
|             return; | ||||
|         } | ||||
|         try { | ||||
|             for (ICBillVO vo : vos) { | ||||
|                 ICBillHeadVO headVO = vo.getParentVO(); | ||||
|                 String pk_org = (String) headVO.getAttributeValue("pk_org"); | ||||
|                 String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); | ||||
|                 // 启源领料id | ||||
|                 String vdef9 = headVO.getVdef9(); | ||||
|                 if ("C038".equals(orgCode) && MMValueCheck.isNotEmpty(vdef9)) { | ||||
|                     // 启源传入的单据,单据日期增加校验 | ||||
|                     UFDate dbilldate = headVO.getDbilldate(); | ||||
|                     // 设置单据日期, 如果单据日期小于2025-11-02,则单据日期设置为2025-11-02 | ||||
|                     UFDate ufDate = new UFDate("2025-11-02"); | ||||
|                     if (dbilldate != null) { | ||||
|                         int i = dbilldate.compareTo(ufDate); | ||||
|                         if (i < 0) { | ||||
|                             headVO.setDbilldate(ufDate); | ||||
|                         } | ||||
|                     } else { | ||||
|                         UFDate nowDate = new UFDate(); | ||||
|                         int i = nowDate.compareTo(ufDate); | ||||
|                         if (i < 0) { | ||||
|                             headVO.setDbilldate(ufDate); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } catch (BusinessException e) { | ||||
|             ExceptionUtils.wrappException(e); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -133,7 +133,7 @@ public class InsertBPTemplate<T extends ICBillVO> extends | |||
|         //组织停用检查 | ||||
|         processor.addBeforeRule(new ICStockOrgEnableCheckRule<T>()); | ||||
|         // 精密-单据日期检查 | ||||
|         // processor.addBeforeRule(new MaterialOutBillDateRule<T>()); | ||||
|         processor.addBeforeRule(new MaterialOutBillDateRule<T>()); | ||||
|         // 开关账检查 | ||||
|         processor.addBeforeRule(new BaseAccountStatusCheck<T>()); | ||||
|         // 总数量,体积计算 | ||||
|  |  | |||
|  | @ -0,0 +1,59 @@ | |||
| package nc.bs.ic.general.rule.before; | ||||
| 
 | ||||
| import nc.bs.ic.pub.base.ICRule; | ||||
| import nc.bs.uapbd.util.MyHelper; | ||||
| import nc.util.mmf.framework.base.MMValueCheck; | ||||
| import nc.vo.ic.general.define.ICBillHeadVO; | ||||
| import nc.vo.ic.general.define.ICBillVO; | ||||
| import nc.vo.ic.m4d.entity.MaterialOutVO; | ||||
| import nc.vo.org.StockOrgVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDate; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| 
 | ||||
| /** | ||||
|  * 精密-材料出库新增-单据日期赋值-启源领料 | ||||
|  * | ||||
|  * @author mzr | ||||
|  * @date 2025/10/26 | ||||
|  */ | ||||
| public class MaterialOutBillDateRule<E extends ICBillVO> extends ICRule<E> { | ||||
|     @Override | ||||
|     public void process(E[] vos) { | ||||
|         if (MMValueCheck.isEmpty(vos)) { | ||||
|             return; | ||||
|         } | ||||
|         try { | ||||
|             for (ICBillVO vo : vos) { | ||||
|                 if (vo instanceof MaterialOutVO) { | ||||
|                     ICBillHeadVO headVO = vo.getParentVO(); | ||||
|                     String pk_org = (String) headVO.getAttributeValue("pk_org"); | ||||
|                     String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); | ||||
|                     // 启源领料id | ||||
|                     String vdef9 = headVO.getVdef9(); | ||||
|                     if ("C038".equals(orgCode) && MMValueCheck.isNotEmpty(vdef9)) { | ||||
|                         // 启源传入的单据,单据日期增加校验 | ||||
|                         UFDate dbilldate = headVO.getDbilldate(); | ||||
|                         // 设置单据日期, 如果单据日期小于2025-11-02,则单据日期设置为2025-11-02 | ||||
|                         UFDate ufDate = new UFDate("2025-11-02"); | ||||
|                         if (dbilldate != null) { | ||||
|                             int i = dbilldate.compareTo(ufDate); | ||||
|                             if (i < 0) { | ||||
|                                 headVO.setDbilldate(ufDate); | ||||
|                             } | ||||
|                         } else { | ||||
|                             UFDate nowDate = new UFDate(); | ||||
|                             int i = nowDate.compareTo(ufDate); | ||||
|                             if (i < 0) { | ||||
|                                 headVO.setDbilldate(ufDate); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } catch (BusinessException e) { | ||||
|             ExceptionUtils.wrappException(e); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue