diff --git a/ic/src/public/nc/bs/ic/general/rule/before/MaterialOutBillDateRule.java b/ic/src/public/nc/bs/ic/general/rule/before/MaterialOutBillDateRule.java index 33cf221c..2f191c6f 100644 --- a/ic/src/public/nc/bs/ic/general/rule/before/MaterialOutBillDateRule.java +++ b/ic/src/public/nc/bs/ic/general/rule/before/MaterialOutBillDateRule.java @@ -1,8 +1,10 @@ package nc.bs.ic.general.rule.before; import nc.bs.ic.pub.base.ICRule; +import nc.bs.logging.Log; import nc.bs.uapbd.util.MyHelper; 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.ICBillVO; 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.pubapp.pattern.exception.ExceptionUtils; +import java.util.Map; + /** * 精密-材料出库新增-单据日期赋值-启源领料 * @@ -18,40 +22,56 @@ import nc.vo.pubapp.pattern.exception.ExceptionUtils; * @date 2025/10/26 */ public class MaterialOutBillDateRule extends ICRule { + private static final String LOG_INFO_NAME = "jmqylog"; + private static final Log logger = Log.getInstance(LOG_INFO_NAME); + private Map configParams; + @Override public void process(E[] vos) { if (MMValueCheck.isEmpty(vos)) { return; } try { + configParams = MyHelper.getConfigParams("jm-config", null); + if (configParams.isEmpty()) { + throw new BusinessException("精密的启源接口缺少配置"); + } + String outBillDate = configParams.get("outBillDate"); for (ICBillVO vo : vos) { if (vo instanceof MaterialOutVO) { ICBillHeadVO headVO = vo.getParentVO(); + ICBillBodyVO[] bodys = vo.getBodys(); 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); + if ("C038".equals(orgCode)) { + if (MMValueCheck.isNotEmpty(vdef9)) { + if (MMValueCheck.isEmpty(outBillDate) || "N".equals(outBillDate)) { + continue; } - } else { - UFDate nowDate = new UFDate(); - int i = nowDate.compareTo(ufDate); - if (i < 0) { - headVO.setDbilldate(ufDate); + // 启源传入的单据,单据日期增加校验 + UFDate dbilldate = headVO.getDbilldate(); + // 设置单据日期, 如果单据日期小于2025-11-02,则单据日期设置为2025-11-02 + UFDate ufDate = new UFDate(outBillDate); + 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) { + logger.error("MaterialOutBillDateRule-exp:" + e.getMessage(), e); ExceptionUtils.wrappException(e); } }