feat(ic): 精密-启源领料-单据日期赋值优化
This commit is contained in:
parent
8180857112
commit
40e8461237
|
|
@ -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<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)) {
|
||||
// 启源传入的单据,单据日期增加校验
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue