refactor(mes):优化BOM和物料同步失败处理逻辑
This commit is contained in:
parent
5f12a542a5
commit
5150a55404
|
|
@ -23,10 +23,7 @@ import nc.vo.fi.pub.SqlUtils;
|
||||||
import nc.vo.org.OrgVO;
|
import nc.vo.org.OrgVO;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BOM-艾普MES-定时重推失败的数据
|
* BOM-艾普MES-定时重推失败的数据
|
||||||
|
|
@ -181,11 +178,20 @@ public class BomToEpicMesPlugin implements IBackgroundWorkPlugin {
|
||||||
String cbomid = hvo.getCbomid();
|
String cbomid = hvo.getCbomid();
|
||||||
ids.add(cbomid);
|
ids.add(cbomid);
|
||||||
}
|
}
|
||||||
|
// 定义每批次处理的最大数量
|
||||||
|
int batchSize = 500;
|
||||||
try {
|
try {
|
||||||
String inSql = SqlUtils.getInStr("cbomid", ids.toArray(new String[0]), Boolean.TRUE);
|
List<String> idList = new ArrayList<>(ids);
|
||||||
String updateSql = "update bd_bom set hvdef19 = '[errorCode]' where " + inSql;
|
for (int i = 0; i < idList.size(); i += batchSize) {
|
||||||
updateSql = updateSql.replace("[errorCode]", errorCode);
|
// 取出当前批次的ID
|
||||||
int updatedRows = getDao().executeUpdate(updateSql);
|
List<String> batchIds = idList.subList(i, Math.min(i + batchSize, idList.size()));
|
||||||
|
String inSql = SqlUtils.getInStr("cbomid", batchIds.toArray(new String[0]), Boolean.TRUE);
|
||||||
|
String updateSql = "update bd_bom set hvdef19 = '[errorCode]' where " + inSql;
|
||||||
|
updateSql = updateSql.replace("[errorCode]", errorCode);
|
||||||
|
// NCCForUAPLogger.debug("EpicMes-handleSyncBomExp-updateSql = " + updateSql);
|
||||||
|
int updatedRows = getDao().executeUpdate(updateSql);
|
||||||
|
// NCCForUAPLogger.debug("EpicMes-BOM-handleSyncBomExp-updateRows = " + updatedRows);
|
||||||
|
}
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logDl.error("EpicMes-BOM-updateErrorInfo = " + e.getMessage(), e);
|
logDl.error("EpicMes-BOM-updateErrorInfo = " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,11 +198,22 @@ public class MaterialToEpicMesPlugin implements IBackgroundWorkPlugin {
|
||||||
String pkMaterial = vo.getPk_material();
|
String pkMaterial = vo.getPk_material();
|
||||||
ids.add(pkMaterial);
|
ids.add(pkMaterial);
|
||||||
}
|
}
|
||||||
|
// 定义每批次处理的最大数量
|
||||||
|
int batchSize = 500;
|
||||||
try {
|
try {
|
||||||
String inSql = SqlUtils.getInStr("pk_material", ids.toArray(new String[0]), Boolean.TRUE);
|
List<String> idList = new ArrayList<>(ids);
|
||||||
String updateSql = "update bd_material set def30 = '[errorCode]' where " + inSql;
|
for (int i = 0; i < idList.size(); i += batchSize) {
|
||||||
updateSql = updateSql.replace("[errorCode]", errorCode);
|
// 取出当前批次的ID
|
||||||
int updatedRows = getDao().executeUpdate(updateSql);
|
List<String> batchIds = idList.subList(i, Math.min(i + batchSize, idList.size()));
|
||||||
|
|
||||||
|
// 构造并执行SQL
|
||||||
|
String inSql = SqlUtils.getInStr("pk_material", batchIds.toArray(new String[0]), Boolean.TRUE);
|
||||||
|
String updateSql = "update bd_material set def30 = '[errorCode]' where " + inSql;
|
||||||
|
updateSql = updateSql.replace("[errorCode]", errorCode);
|
||||||
|
// NCCForUAPLogger.debug("EpicMes-handleSyncMaterialExp-updateSql = " + updateSql);
|
||||||
|
int updatedRows = getDao().executeUpdate(updateSql);
|
||||||
|
// NCCForUAPLogger.debug("EpicMes-Material-handleSyncMaterialExp-updateRows = " + updatedRows);
|
||||||
|
}
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logDl.error("EpicMes-Material-handleSyncMaterialExp = " + e.getMessage(), e);
|
logDl.error("EpicMes-Material-handleSyncMaterialExp = " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import java.util.stream.Stream;
|
||||||
* @date 2025/09/11
|
* @date 2025/09/11
|
||||||
*/
|
*/
|
||||||
public class MaterialToGyMesListener implements IBusinessListener {
|
public class MaterialToGyMesListener implements IBusinessListener {
|
||||||
private static final String LOG_INFO_NAME = "gyMesLog";
|
private static final String LOG_INFO_NAME = "gymeslog";
|
||||||
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
||||||
private static final String addUrl = "/bip/order/materialAdd";
|
private static final String addUrl = "/bip/order/materialAdd";
|
||||||
private static final String updateUrl = "/bip/order/materialUpdate";
|
private static final String updateUrl = "/bip/order/materialUpdate";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue