feat(ic): 精密-启源领料-单据日期赋值优化
This commit is contained in:
		
							parent
							
								
									8180857112
								
							
						
					
					
						commit
						40e8461237
					
				|  | @ -1,8 +1,10 @@ | ||||||
| package nc.bs.ic.general.rule.before; | package nc.bs.ic.general.rule.before; | ||||||
| 
 | 
 | ||||||
| import nc.bs.ic.pub.base.ICRule; | import nc.bs.ic.pub.base.ICRule; | ||||||
|  | import nc.bs.logging.Log; | ||||||
| import nc.bs.uapbd.util.MyHelper; | import nc.bs.uapbd.util.MyHelper; | ||||||
| import nc.util.mmf.framework.base.MMValueCheck; | import nc.util.mmf.framework.base.MMValueCheck; | ||||||
|  | import nc.vo.ic.general.define.ICBillBodyVO; | ||||||
| import nc.vo.ic.general.define.ICBillHeadVO; | import nc.vo.ic.general.define.ICBillHeadVO; | ||||||
| import nc.vo.ic.general.define.ICBillVO; | import nc.vo.ic.general.define.ICBillVO; | ||||||
| import nc.vo.ic.m4d.entity.MaterialOutVO; | import nc.vo.ic.m4d.entity.MaterialOutVO; | ||||||
|  | @ -11,6 +13,8 @@ import nc.vo.pub.BusinessException; | ||||||
| import nc.vo.pub.lang.UFDate; | import nc.vo.pub.lang.UFDate; | ||||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||||
| 
 | 
 | ||||||
|  | import java.util.Map; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * 精密-材料出库新增-单据日期赋值-启源领料 |  * 精密-材料出库新增-单据日期赋值-启源领料 | ||||||
|  * |  * | ||||||
|  | @ -18,40 +22,56 @@ import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||||
|  * @date 2025/10/26 |  * @date 2025/10/26 | ||||||
|  */ |  */ | ||||||
| public class MaterialOutBillDateRule<E extends ICBillVO> extends ICRule<E> { | public class MaterialOutBillDateRule<E extends ICBillVO> extends ICRule<E> { | ||||||
|  |     private static final String LOG_INFO_NAME = "jmqylog"; | ||||||
|  |     private static final Log logger = Log.getInstance(LOG_INFO_NAME); | ||||||
|  |     private Map<String, String> configParams; | ||||||
|  | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void process(E[] vos) { |     public void process(E[] vos) { | ||||||
|         if (MMValueCheck.isEmpty(vos)) { |         if (MMValueCheck.isEmpty(vos)) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         try { |         try { | ||||||
|  |             configParams = MyHelper.getConfigParams("jm-config", null); | ||||||
|  |             if (configParams.isEmpty()) { | ||||||
|  |                 throw new BusinessException("精密的启源接口缺少配置"); | ||||||
|  |             } | ||||||
|  |             String outBillDate = configParams.get("outBillDate"); | ||||||
|             for (ICBillVO vo : vos) { |             for (ICBillVO vo : vos) { | ||||||
|                 if (vo instanceof MaterialOutVO) { |                 if (vo instanceof MaterialOutVO) { | ||||||
|                     ICBillHeadVO headVO = vo.getParentVO(); |                     ICBillHeadVO headVO = vo.getParentVO(); | ||||||
|  |                     ICBillBodyVO[] bodys = vo.getBodys(); | ||||||
|                     String pk_org = (String) headVO.getAttributeValue("pk_org"); |                     String pk_org = (String) headVO.getAttributeValue("pk_org"); | ||||||
|                     String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); |                     String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); | ||||||
|                     // 启源领料id |                     // 启源领料id | ||||||
|                     String vdef9 = headVO.getVdef9(); |                     String vdef9 = headVO.getVdef9(); | ||||||
|                     if ("C038".equals(orgCode) && MMValueCheck.isNotEmpty(vdef9)) { |                     if ("C038".equals(orgCode)) { | ||||||
|                         // 启源传入的单据,单据日期增加校验 |                         if (MMValueCheck.isNotEmpty(vdef9)) { | ||||||
|                         UFDate dbilldate = headVO.getDbilldate(); |                             if (MMValueCheck.isEmpty(outBillDate) || "N".equals(outBillDate)) { | ||||||
|                         // 设置单据日期, 如果单据日期小于2025-11-02,则单据日期设置为2025-11-02 |                                 continue; | ||||||
|                         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(); |                             UFDate dbilldate = headVO.getDbilldate(); | ||||||
|                             int i = nowDate.compareTo(ufDate); |                             // 设置单据日期, 如果单据日期小于2025-11-02,则单据日期设置为2025-11-02 | ||||||
|                             if (i < 0) { |                             UFDate ufDate = new UFDate(outBillDate); | ||||||
|                                 headVO.setDbilldate(ufDate); |                             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) { |         } catch (BusinessException e) { | ||||||
|  |             logger.error("MaterialOutBillDateRule-exp:" + e.getMessage(), e); | ||||||
|             ExceptionUtils.wrappException(e); |             ExceptionUtils.wrappException(e); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue