feat(ic): 精密-启源领料-单据日期赋值优化

This commit is contained in:
mzr 2025-10-29 13:52:18 +08:00
parent 8180857112
commit 40e8461237
1 changed files with 34 additions and 14 deletions

View File

@ -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,24 +22,38 @@ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
* @date 2025/10/26
*/
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
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)) {
if ("C038".equals(orgCode)) {
if (MMValueCheck.isNotEmpty(vdef9)) {
if (MMValueCheck.isEmpty(outBillDate) || "N".equals(outBillDate)) {
continue;
}
// 启源传入的单据单据日期增加校验
UFDate dbilldate = headVO.getDbilldate();
// 设置单据日期, 如果单据日期小于2025-11-02则单据日期设置为2025-11-02
UFDate ufDate = new UFDate("2025-11-02");
UFDate ufDate = new UFDate(outBillDate);
if (dbilldate != null) {
int i = dbilldate.compareTo(ufDate);
if (i < 0) {
@ -51,7 +69,9 @@ public class MaterialOutBillDateRule<E extends ICBillVO> extends ICRule<E> {
}
}
}
}
} catch (BusinessException e) {
logger.error("MaterialOutBillDateRule-exp:" + e.getMessage(), e);
ExceptionUtils.wrappException(e);
}
}