Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
6a77360408
|
|
@ -108,6 +108,7 @@ public class InsertBP implements IInsertBP<MaterialOutVO>,
|
|||
|
||||
//2025年6月13日09点38分 -- 物料档案基本页签启用项目辅助属性+库存组织未启用项目,采购入库单保存时(包含接口导入)清除行项目,材料出库单保存时(包含接口导入)清除行项目
|
||||
processor.addBeforeRule(new MaterialOutProjectRule());
|
||||
processor.addBeforeRule(new MaterialOutBatchCodeRule());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
package nc.bs.ic.m4d.insert.rule;
|
||||
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.ic.pub.base.ICRule;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.trade.business.HYPubBO;
|
||||
import nc.bs.uapbd.util.MyHelper;
|
||||
import nc.itf.mmpac.pickm.IPickmQueryService;
|
||||
import nc.itf.uap.IUAPQueryBS;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
|
||||
import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
|
||||
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||
import nc.vo.mmpac.pickm.entity.PickmHeadVO;
|
||||
import nc.vo.org.StockOrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||
import nc.vo.scmf.ic.mbatchcode.BatchcodeVO;
|
||||
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 精密-材料出库新增--批次号赋值
|
||||
*
|
||||
* @author mzr
|
||||
* @date 2025/10/26
|
||||
*/
|
||||
public class MaterialOutBatchCodeRule extends ICRule<MaterialOutVO> {
|
||||
private static final String LOG_INFO_NAME = "jmqylog";
|
||||
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
||||
private Map<String, String> configParams;
|
||||
private IUAPQueryBS queryBS = null;
|
||||
|
||||
public final IUAPQueryBS getQueryBS() {
|
||||
if (null == queryBS) {
|
||||
queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
}
|
||||
return queryBS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(MaterialOutVO[] vos) {
|
||||
if (MMValueCheck.isEmpty(vos)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
configParams = MyHelper.getConfigParams("jm-config", null);
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("精密的启源接口缺少配置");
|
||||
}
|
||||
String configMaterialCode = configParams.get("noItemCode");
|
||||
if (configMaterialCode == null || configMaterialCode.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
HYPubBO hyPub = new HYPubBO();
|
||||
for (MaterialOutVO vo : vos) {
|
||||
MaterialOutHeadVO headVO = vo.getHead();
|
||||
MaterialOutBodyVO[] bodys = vo.getBodys();
|
||||
String pk_org = (String) headVO.getAttributeValue("pk_org");
|
||||
String vtrantypecode = headVO.getVtrantypecode();
|
||||
String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org);
|
||||
if ("C038".equals(orgCode)) {
|
||||
if ("4D-Cxx-58".equals(vtrantypecode)) {
|
||||
IPickmQueryService service = NCLocator.getInstance().lookup(IPickmQueryService.class);
|
||||
// 批次号赋值
|
||||
for (MaterialOutBodyVO body : bodys) {
|
||||
// 备料计划表头主键
|
||||
String cpickmhid = body.getCpickmhid();
|
||||
String cmaterialvid = body.getCmaterialvid();
|
||||
String condition = "pk_material = '" + cmaterialvid + "'";
|
||||
String materialCode = hyPub.findColValue(MaterialVO.getDefaultTableName(), MaterialVO.CODE, condition) + "";
|
||||
if (!configMaterialCode.equals(materialCode)) {
|
||||
continue;
|
||||
}
|
||||
if (MMValueCheck.isNotEmpty(cpickmhid)) {
|
||||
AggPickmVO aggVO = service.querySingleBillByPk(cpickmhid);
|
||||
if (aggVO == null) {
|
||||
continue;
|
||||
}
|
||||
PickmHeadVO pickmHeadVO = aggVO.getParentVO();
|
||||
// 来源生产订单明细
|
||||
String vsourcemorowid = pickmHeadVO.getVsourcemorowid();
|
||||
NCCForUAPLogger.debug("来源生产订单明细:" + vsourcemorowid);
|
||||
if (vsourcemorowid != null && !vsourcemorowid.isEmpty()) {
|
||||
body.setVbatchcode(vsourcemorowid);// 批次号
|
||||
Map<String, String> batchMap = getBatchCodeVO(cmaterialvid, vsourcemorowid);
|
||||
String pkBatchcode = batchMap.get(vsourcemorowid);
|
||||
body.setPk_batchcode(pkBatchcode);// 批次档案id
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
logger.error("MaterialOutBatchCodeRule-exp:" + e.getMessage(), e);
|
||||
ExceptionUtils.wrappException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getBatchCodeVO(String cbmaterialvid, String vbatchcode)
|
||||
throws BusinessException {
|
||||
Map<String, String> resMap = new HashMap<>();
|
||||
SqlBuilder sb = new SqlBuilder();
|
||||
sb.append("pk_group", InvocationInfoProxy.getInstance().getGroupId());
|
||||
sb.append(" and ");
|
||||
sb.append("nvl(dr,0)", 0);
|
||||
sb.append(" and ");
|
||||
sb.append("cmaterialvid", cbmaterialvid);
|
||||
sb.append(" and ");
|
||||
sb.append("vbatchcode", vbatchcode);
|
||||
Collection<BatchcodeVO> vos = this.getQueryBS().retrieveByClause(BatchcodeVO.class, sb.toString());
|
||||
for (BatchcodeVO vo : vos) {
|
||||
String pk_batchcode = vo.getPk_batchcode();
|
||||
String vbatchcode1 = vo.getVbatchcode();
|
||||
resMap.put(vbatchcode1, pk_batchcode);
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -495,8 +495,11 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
|
|||
for (AggPickmVO newPickmVO : newPickmVOS) {
|
||||
PickmItemVO[] pickmItemVOS = (PickmItemVO[]) newPickmVO.getChildren(PickmItemVO.class);
|
||||
for (PickmItemVO pickmItemVO : pickmItemVOS) {
|
||||
Double nbsetpartsnum = pickmItemVO.getNbsetpartsnum().toDouble();
|
||||
sum += nbsetpartsnum;
|
||||
UFDouble nbsetpartsnum1 = pickmItemVO.getNbsetpartsnum();
|
||||
if (nbsetpartsnum1 != null) {
|
||||
Double nbsetpartsnum = nbsetpartsnum1.toDouble();
|
||||
sum += nbsetpartsnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package nccloud.wmssync.ml.m4a;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.ic.general.businessevent.ICGeneralCommonEvent;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.vo.ic.m4a.entity.GeneralInHeadVO;
|
||||
import nc.vo.ic.m4a.entity.GeneralInVO;
|
||||
import nc.vo.org.StockOrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.uapbd.wms.utils.IWmsSyncUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 其他入库单删除后同步WMS
|
||||
* 支持的交易类型:
|
||||
* - 4A-Cxx-14: 形态转换入库 -> XTRK
|
||||
* - 4A-Cxx-13: 其他入库 -> QTRK
|
||||
* - 4A-Cxx-12: 盘盈入库 -> ADJ
|
||||
*/
|
||||
public class WmsSyncAfterDeleteGeneralInListener implements IBusinessListener {
|
||||
|
||||
/**
|
||||
* 支持取消同步的交易类型编码映射
|
||||
* key: ERP交易类型编码, value: WMS交易类型
|
||||
*/
|
||||
private static final Map<String, String> SUPPORTED_TRAN_TYPES = new HashMap<>();
|
||||
|
||||
static {
|
||||
SUPPORTED_TRAN_TYPES.put("4A-06", "XTRK"); // 形态转换入库
|
||||
SUPPORTED_TRAN_TYPES.put("4A-01", "QTRK"); // 其他入库
|
||||
SUPPORTED_TRAN_TYPES.put("4A-03", "ADJ"); // 盘盈入库
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package nccloud.resources.ic.ic.materialout;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.uapbd.wms.utils.WmsSyncUtils;
|
||||
|
||||
// 取消材料出库单据同步到FLUX WMS
|
||||
public class CancelMaterialOutWmsPlugin implements IBusinessListener {
|
||||
|
||||
private static final Log log = Log.getInstance("wmslog");
|
||||
private final WmsSyncUtils wmsSyncUtils = new WmsSyncUtils();
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
log.error("CancelMaterialOutWmsPlugin - 处理异常: " + e.getMessage(), e);
|
||||
throw new BusinessException("取消材料出库单同步时报错,报错信息:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,25 @@
|
|||
package nccloud.openapi.mmpac.wr;
|
||||
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.uif2.validation.ValidationFailure;
|
||||
import nc.itf.mmpac.wr.IWrBusinessService;
|
||||
import nc.jdbc.framework.SQLParameter;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.util.mmf.framework.base.MMCollectionUtil;
|
||||
import nc.util.mmf.framework.base.MMNumberUtil;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.bd.bom.bom0202.enumeration.OutputTypeEnum;
|
||||
import nc.vo.mmpac.wr.consts.WrptLangConst;
|
||||
import nc.vo.mmpac.wr.entity.*;
|
||||
import nc.vo.mmpac.wr.enumeration.WrBillStatusEnum;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.VOStatus;
|
||||
import nc.vo.pub.billtype.BilltypeVO;
|
||||
import nc.vo.pub.lang.UFBoolean;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
import nc.vo.pubapp.AppContext;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
|
|
@ -24,6 +27,7 @@ import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
|||
import nccloud.api.mmpac.wr.IAPIWrMaintain;
|
||||
import nccloud.api.rest.utils.NCCRestUtils;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.service.ServiceLocator;
|
||||
import nccloud.openapi.scmpub.pub.TransferCodeToPKTool;
|
||||
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
||||
import org.json.JSONString;
|
||||
|
|
@ -379,7 +383,50 @@ public class WrResource extends AbstractNCCRestResource {
|
|||
aggWrVO.getParentVO().setVtrantypeid(collection.get(0).getPk_billtypeid());
|
||||
aggWrVO.getParentVO().setDbilldate(new UFDate());
|
||||
}
|
||||
AggWrVO[] aggvos = server.newsave(voList.toArray(new AggWrVO[0]));
|
||||
|
||||
/*
|
||||
* edit by xc 2025-10-22
|
||||
* 齐套检查前置 从产品入库 前置 完工报告
|
||||
* 考虑标品接口扩展性 表头增加校验参数 isdonecheck:Y/N
|
||||
*/
|
||||
AggWrVO[] wrVOS = voList.toArray(new AggWrVO[0]);
|
||||
if (headInfo.containsKey("isdonecheck") && "Y".equals(headInfo.get("isdonecheck").toString())) {
|
||||
IWrBusinessService service = (IWrBusinessService) ServiceLocator.find(IWrBusinessService.class);
|
||||
AggWrVO[] resultvos = service.setCheck(wrVOS);
|
||||
if (!MMValueCheck.isEmpty(resultvos)) {
|
||||
StringBuilder errorMessagesSB = new StringBuilder();
|
||||
|
||||
for (AggWrVO aggWrVO : resultvos) {
|
||||
if (!WrBillStatusEnum.FREEDOM.equalsValue(aggWrVO.getParentVO().getFbillstatus())) {
|
||||
StringBuilder notThroughSB = new StringBuilder();
|
||||
String billCode = aggWrVO.getParentVO().getVbillcode();
|
||||
WrItemVO[] itemVOs = (WrItemVO[]) aggWrVO.getChildren(WrItemVO.class);
|
||||
if (!MMValueCheck.isEmpty(itemVOs)) {
|
||||
for (WrItemVO itemVO : itemVOs) {
|
||||
if (!MMValueCheck.isEmpty(itemVO.getCbmoid()) && OutputTypeEnum.MAIN_PRODUCT.equalsValue(itemVO.getFbproducttype()) && !UFBoolean.TRUE.equals(itemVO.getBbsetmark())) {
|
||||
notThroughSB.append(itemVO.getVbrowno());
|
||||
notThroughSB.append(",");
|
||||
}
|
||||
}
|
||||
if (!MMValueCheck.isEmpty(notThroughSB)) {
|
||||
notThroughSB.setLength(notThroughSB.length() - 1);
|
||||
String message = WrptLangConst.getSetCheckError_Msg(new String[]{billCode, notThroughSB.toString()});
|
||||
errorMessagesSB.append(message);
|
||||
errorMessagesSB.append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!MMValueCheck.isEmpty(errorMessagesSB)) {
|
||||
ExceptionUtils.wrappBusinessException(errorMessagesSB.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* end 齐套检查
|
||||
* edit by xc 2025-10-22
|
||||
*/
|
||||
AggWrVO[] aggvos = server.newsave(wrVOS);
|
||||
boolean successFlag = true;
|
||||
StringBuilder errMsg = new StringBuilder();
|
||||
if (MMArrayUtil.isNotEmpty(aggvos)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package nccloud.wmssync.ml.c003;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
||||
public class WmsSyncQcReportListener implements IBusinessListener {
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -182,6 +182,19 @@ public class MaterialToEpicMesPlugin implements IBackgroundWorkPlugin {
|
|||
if (num > 0) {
|
||||
mesType = "1";
|
||||
}
|
||||
// 判断物料是否是虚拟件,只要有一个组织是就赋值0
|
||||
String countSql1 = "SELECT count(1)" +
|
||||
" FROM bd_materialplan a" +
|
||||
" LEFT JOIN org_orgs b ON a.pk_org = b.pk_org" +
|
||||
" WHERE a.dr = 0 AND a.isvirtual = 'Y' " +
|
||||
" AND a.pk_material = '[pkMaterial]'" +
|
||||
" AND b.isbusinessunit = 'Y'" +
|
||||
" AND " + inStr;
|
||||
countSql1 = countSql1.replace("[pkMaterial]", pkMaterial);
|
||||
Integer num1 = (Integer) new BaseDAO().executeQuery(countSql1, new ColumnProcessor());
|
||||
if (num1 > 0) {
|
||||
mesType = "0";
|
||||
}
|
||||
return mesType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import nc.jdbc.framework.processor.ColumnProcessor;
|
|||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.bd.material.plan.MaterialPlanVO;
|
||||
import nc.vo.bd.material.prod.MaterialProdVO;
|
||||
import nc.vo.bd.material.stock.MaterialStockVO;
|
||||
import nc.vo.fi.pub.SqlUtils;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
|
@ -55,12 +58,34 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
try {
|
||||
if ("1002".equals(eventType) || "1004".equals(eventType) || "1061".equals(eventType) ||
|
||||
"1071".equals(eventType) || "1069".equals(eventType)) {
|
||||
useVOs = ArrayClassConvertUtil.convert(objs, MaterialVO.class);
|
||||
configParams = MyHelper.getConfigParams("Dldz-config", null);
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("电力电子的艾普MES接口缺少配置");
|
||||
}
|
||||
buildSyncData(useVOs, eventType);
|
||||
List<MaterialVO> list = new ArrayList<>();
|
||||
if (objs instanceof MaterialVO[]) {
|
||||
// 基本信息修改后/停用启用
|
||||
useVOs = ArrayClassConvertUtil.convert(objs, MaterialVO.class);
|
||||
for (MaterialVO materialVO : useVOs) {
|
||||
String pkMaterial = materialVO.getPk_material();
|
||||
// 如果修改基本信息,判断物料所属组织中是否存在电力电子,不存在则跳过
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "dldzOrg");
|
||||
if (num <= 0) {
|
||||
continue;
|
||||
}
|
||||
list.add(materialVO);
|
||||
}
|
||||
} else if (objs instanceof MaterialStockVO[]) {
|
||||
// 库存信息修改
|
||||
processMaterialChange(objs, list);
|
||||
} else if (objs instanceof MaterialPlanVO[]) {
|
||||
// 计划信息修改
|
||||
processMaterialChange(objs, list);
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
useVOs = list.toArray(new MaterialVO[0]);
|
||||
buildSyncData(useVOs, eventType);
|
||||
}
|
||||
} else if ("1009".equals(eventType)) {
|
||||
// 物料可见性范围-分配后 1009
|
||||
configParams = MyHelper.getConfigParams("Dldz-config", null);
|
||||
|
|
@ -110,10 +135,10 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
// 判断物料的业务单元是否是电力电子公司,不是则跳过
|
||||
String pkOrg = vo.getPk_org();
|
||||
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "dldzOrg");
|
||||
/*Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "dldzOrg");
|
||||
if (!"1009".equals(eventType) && (num <= 0)) {
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
// 字段值翻译
|
||||
// String pk_marbasclass = vo.getPk_marbasclass();
|
||||
// String mrlTypeCOde = MyHelper.transferField(MarBasClassVO.getDefaultTableName(), MarBasClassVO.CODE, MarBasClassVO.PK_MARBASCLASS, pk_marbasclass);
|
||||
|
|
@ -169,6 +194,55 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理物料VO的通用方法
|
||||
*/
|
||||
private void processMaterialChange(Object[] objs, List<MaterialVO> list) throws BusinessException {
|
||||
HYPubBO hyPub = new HYPubBO();
|
||||
for (Object newVO : objs) {
|
||||
String pk_material = getPkMaterialFromVO(newVO);
|
||||
if (MMValueCheck.isEmpty(pk_material)) {
|
||||
continue;
|
||||
}
|
||||
String pkOrg = getPkOrgFromVO(newVO);
|
||||
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||
// 判断各个页签修改信息是否属于电力电子
|
||||
if (MMValueCheck.isNotEmpty(pkOrg) && MyHelper.checkIfDldzOrg(orgCode, configParams)) {
|
||||
continue;
|
||||
}
|
||||
MaterialVO materialVO = (MaterialVO) hyPub.queryByPrimaryKey(MaterialVO.class, pk_material);
|
||||
list.add(materialVO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从不同类型的VO中获取pk_material
|
||||
*/
|
||||
private String getPkMaterialFromVO(Object vo) {
|
||||
if (vo instanceof MaterialStockVO newVo) {
|
||||
return newVo.getPk_material();
|
||||
} else if (vo instanceof MaterialPlanVO newVo) {
|
||||
return newVo.getPk_material();
|
||||
} else if (vo instanceof MaterialProdVO) {
|
||||
return ((MaterialProdVO) vo).getPk_material();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从不同类型的VO中获取pk_org
|
||||
*/
|
||||
private String getPkOrgFromVO(Object vo) {
|
||||
if (vo instanceof MaterialStockVO) {
|
||||
return ((MaterialStockVO) vo).getPk_org();
|
||||
} else if (vo instanceof MaterialPlanVO) {
|
||||
return ((MaterialPlanVO) vo).getPk_org();
|
||||
} else if (vo instanceof MaterialProdVO) {
|
||||
return ((MaterialProdVO) vo).getPk_org();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getType(String eventType) {
|
||||
// 类型(I:新增 U:修改 D:删除)
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
|
@ -212,6 +286,19 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
if (num > 0) {
|
||||
mesType = "1";
|
||||
}
|
||||
// 判断物料是否是虚拟件,只要有一个组织是就赋值0
|
||||
String countSql1 = "SELECT count(1)" +
|
||||
" FROM bd_materialplan a" +
|
||||
" LEFT JOIN org_orgs b ON a.pk_org = b.pk_org" +
|
||||
" WHERE a.dr = 0 AND a.isvirtual = 'Y' " +
|
||||
" AND a.pk_material = '[pkMaterial]'" +
|
||||
" AND b.isbusinessunit = 'Y'" +
|
||||
" AND " + inStr;
|
||||
countSql1 = countSql1.replace("[pkMaterial]", pkMaterial);
|
||||
Integer num1 = (Integer) new BaseDAO().executeQuery(countSql1, new ColumnProcessor());
|
||||
if (num1 > 0) {
|
||||
mesType = "0";
|
||||
}
|
||||
return mesType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package nccloud.resources.ic.ic.materialin;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.uapbd.wms.utils.WmsSyncUtils;
|
||||
|
||||
/**
|
||||
* Éú²úÍËÁϵ¥É¾³ýºóͬ²½WMS
|
||||
*/
|
||||
public class MaterialInAfterDeleteWmsPlugin implements IBusinessListener {
|
||||
|
||||
private static final Log log = Log.getInstance("wmslog");
|
||||
private final WmsSyncUtils wmsSyncUtils = new WmsSyncUtils();
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package nccloud.resources.ic.ic.materialin;
|
||||
|
||||
import nc.bs.businessevent.BdUpdateEvent;
|
||||
import nc.bs.businessevent.BusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.ic.general.businessevent.ICGeneralCommonEvent;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.uapbd.wms.utils.WmsSyncUtils;
|
||||
|
||||
// 材料入库保存后同步到FLUX WMS
|
||||
public class MaterialInAfterSaveWmsPlugin implements IBusinessListener {
|
||||
|
||||
private static final Log log = Log.getInstance("wmslog");
|
||||
private final WmsSyncUtils wmsSyncUtils = new WmsSyncUtils();
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
try {
|
||||
log.info("MaterialInAfterSaveWmsPlugin - 开始处理生产退料入库WMS同步");
|
||||
// 获取单据数据
|
||||
MaterialOutVO[] materialOutVOs = getMaterialOutVOs(iBusinessEvent);
|
||||
} catch (Exception e) {
|
||||
log.error("MaterialInAfterSaveWmsPlugin - 处理异常: " + e.getMessage(), e);
|
||||
throw new BusinessException("材料入库单同步时报错,报错信息:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从业务事件中获取生产退料入库数据
|
||||
*/
|
||||
private MaterialOutVO[] getMaterialOutVOs(IBusinessEvent event) throws BusinessException {
|
||||
Object object = null;
|
||||
|
||||
// 根据不同的事件类型获取单据数据
|
||||
if (event instanceof BusinessEvent businessEvent) {
|
||||
object = businessEvent.getObject();
|
||||
} else if (event instanceof BdUpdateEvent updateEvent) {
|
||||
object = updateEvent.getNewObject();
|
||||
} else if (event instanceof ICGeneralCommonEvent commonEvent) {
|
||||
object = commonEvent.getOldObjs();
|
||||
} else {
|
||||
log.warn("MaterialInAfterSaveWmsPlugin - 未支持的事件类型: " + event.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 转换为MaterialOutVO数组
|
||||
if (object.getClass().isArray()) {
|
||||
return (MaterialOutVO[]) object;
|
||||
} else {
|
||||
return new MaterialOutVO[]{(MaterialOutVO) object};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package nccloud.resources.ic.ic.materialout;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.uapbd.wms.utils.WmsSyncUtils;
|
||||
|
||||
// ²ÄÁϳö¿â±£´æºóͬ²½µ½FLUX WMS
|
||||
public class MaterialOutAfterSaveWmsPlugin implements IBusinessListener {
|
||||
|
||||
private static final Log log = Log.getInstance("wmslog");
|
||||
private final WmsSyncUtils wmsSyncUtils = new WmsSyncUtils();
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package nccloud.wmssync.ml;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
||||
/**
|
||||
* 膠죕谿꼍말잇WMS
|
||||
*/
|
||||
public class WmsSyncMaterialListener implements IBusinessListener {
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue