refactor(task): 优化同步高压IMS同步-材料出库+生产报告
This commit is contained in:
parent
bbfe66edb6
commit
2afff0cd1f
|
|
@ -65,8 +65,9 @@ public class MaterialOutGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PreAlertObject executeTask(BgWorkingContext arg0) {
|
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
||||||
logger.error("---start----任务开始运行--");
|
logger.error("---start----任务开始运行--");
|
||||||
|
Set<String> imsIdFailSet = new HashSet<>();
|
||||||
try {
|
try {
|
||||||
IPickmQueryService queryService = NCLocator.getInstance().lookup(IPickmQueryService.class);
|
IPickmQueryService queryService = NCLocator.getInstance().lookup(IPickmQueryService.class);
|
||||||
// IMS 同步状态:BIP:C-创建;U-修改D-删除 IMS:2-MES单据接收完成
|
// IMS 同步状态:BIP:C-创建;U-修改D-删除 IMS:2-MES单据接收完成
|
||||||
|
|
@ -75,6 +76,7 @@ public class MaterialOutGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
Set<String> imsIdSet = new HashSet<>();
|
Set<String> imsIdSet = new HashSet<>();
|
||||||
for (Map<String, Object> mainMap : mainList) {
|
for (Map<String, Object> mainMap : mainList) {
|
||||||
String cgeneralhid = mainMap.get("cgeneralhid") + "";
|
String cgeneralhid = mainMap.get("cgeneralhid") + "";
|
||||||
|
imsIdFailSet.add(cgeneralhid);
|
||||||
// 同步状态:IMS:C-创建;U-修改; 4-BIP审核出库MES接收确认 BIP:2-BIP审核出库
|
// 同步状态:IMS:C-创建;U-修改; 4-BIP审核出库MES接收确认 BIP:2-BIP审核出库
|
||||||
String status = mainMap.get("status") + "";
|
String status = mainMap.get("status") + "";
|
||||||
try {
|
try {
|
||||||
|
|
@ -186,7 +188,10 @@ public class MaterialOutGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
logger.error("---end----任务结束运行--");
|
logger.error("---end----任务结束运行--");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("MaterialOutGyImsPlugin Error: ", e);
|
logger.error("MaterialOutGyImsPlugin Error: ", e);
|
||||||
NCCForUAPLogger.debug("MaterialOutGyImsPlugin Error: " + e.getMessage());
|
String inSql = SqlUtils.getInStr("cgeneralhid", imsIdFailSet.toArray(new String[0]), Boolean.TRUE);
|
||||||
|
String updateSql = "update BIPOutMainTab set err_msg = '[err_msg]' where " + inSql;
|
||||||
|
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
||||||
|
int rows = ImsDaoUtil.executeUpdate(updateSql, imsIdFailSet.toString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import nc.bs.logging.Log;
|
||||||
import nc.bs.pub.pa.PreAlertObject;
|
import nc.bs.pub.pa.PreAlertObject;
|
||||||
import nc.bs.pub.taskcenter.BgWorkingContext;
|
import nc.bs.pub.taskcenter.BgWorkingContext;
|
||||||
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
|
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
|
||||||
|
import nc.bs.uapbd.util.ImsDaoUtil;
|
||||||
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
|
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
|
||||||
import nc.itf.mmpac.wr.IWrMaintainService;
|
import nc.itf.mmpac.wr.IWrMaintainService;
|
||||||
import nc.itf.uap.pf.busiflow.PfButtonClickContext;
|
import nc.itf.uap.pf.busiflow.PfButtonClickContext;
|
||||||
|
|
@ -63,17 +64,19 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PreAlertObject executeTask(BgWorkingContext arg0) {
|
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
||||||
logger.error("---start----任务开始运行--");
|
logger.error("---start----任务开始运行--");
|
||||||
|
Set<String> pkWrFailSet = new HashSet<>();
|
||||||
try {
|
try {
|
||||||
|
Set<String> pkWrSet = new HashSet<>();
|
||||||
IPMOQueryService pmoQueryService = NCLocator.getInstance().lookup(IPMOQueryService.class);
|
IPMOQueryService pmoQueryService = NCLocator.getInstance().lookup(IPMOQueryService.class);
|
||||||
IWrMaintainService wrService = NCLocator.getInstance().lookup(IWrMaintainService.class);
|
IWrMaintainService wrService = NCLocator.getInstance().lookup(IWrMaintainService.class);
|
||||||
String selSql = "select * from BIPReportMainTab where status = 'C'";
|
String selSql = "select * from BIPReportMainTab where status = 'C'";
|
||||||
List<Map<String, Object>> mainList = (List<Map<String, Object>>) getImsDao().executeQuery(selSql, new MapListProcessor());
|
List<Map<String, Object>> mainList = (List<Map<String, Object>>) getImsDao().executeQuery(selSql, new MapListProcessor());
|
||||||
Set<String> pkWrSet = new HashSet<>();
|
|
||||||
for (Map<String, Object> mainMap : mainList) {
|
for (Map<String, Object> mainMap : mainList) {
|
||||||
// IMS生产报告的主键
|
// IMS生产报告的主键
|
||||||
String pkWr = mainMap.get("pk_wr").toString();
|
String pkWr = mainMap.get("pk_wr").toString();
|
||||||
|
pkWrFailSet.add(pkWr);
|
||||||
// 同步标识 IMS:C-创建;U-修改 BIP:2-BIP单据接收完成
|
// 同步标识 IMS:C-创建;U-修改 BIP:2-BIP单据接收完成
|
||||||
String status = mainMap.get("status").toString();
|
String status = mainMap.get("status").toString();
|
||||||
String pkWrSql = "select * from BIPReportDetailTab where pk_wr = '" + pkWr + "'";
|
String pkWrSql = "select * from BIPReportDetailTab where pk_wr = '" + pkWr + "'";
|
||||||
|
|
@ -105,7 +108,7 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
hvo.setFbillstatus(2);
|
hvo.setFbillstatus(2);
|
||||||
String dmakedateStr = "";
|
String dmakedateStr = "";
|
||||||
if (mainMap.get("dmakedate") != null && mainMap.get("dmakedate") instanceof Timestamp dmakedate1) {
|
if (mainMap.get("dmakedate") != null && mainMap.get("dmakedate") instanceof Timestamp dmakedate1) {
|
||||||
dmakedateStr = DATETIME_FORMATTER.format(dmakedate1);
|
dmakedateStr = DATE_FORMATTER.format(dmakedate1);
|
||||||
UFDate dmakedate = new UFDate(dmakedateStr);
|
UFDate dmakedate = new UFDate(dmakedateStr);
|
||||||
hvo.setDmakedate(dmakedate);
|
hvo.setDmakedate(dmakedate);
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +169,7 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
||||||
updateSql = updateSql.replace("[pkWr]", pkWr);
|
updateSql = updateSql.replace("[pkWr]", pkWr);
|
||||||
// NCCForUAPLogger.debug("ProductReportGyImsPlugin-updateSql = " + updateSql);
|
// NCCForUAPLogger.debug("ProductReportGyImsPlugin-updateSql = " + updateSql);
|
||||||
getImsDao().executeUpdate(updateSql);
|
ImsDaoUtil.executeUpdate(updateSql, pkWr);
|
||||||
}
|
}
|
||||||
if (MMValueCheck.isEmpty(resultvos)) {
|
if (MMValueCheck.isEmpty(resultvos)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -176,13 +179,17 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
if (!pkWrSet.isEmpty()) {
|
if (!pkWrSet.isEmpty()) {
|
||||||
// 修改状态为 完成
|
// 修改状态为 完成
|
||||||
String inSql = SqlUtils.getInStr("pk_wr", pkWrSet.toArray(new String[0]), Boolean.TRUE);
|
String inSql = SqlUtils.getInStr("pk_wr", pkWrSet.toArray(new String[0]), Boolean.TRUE);
|
||||||
String updateSql = "update BIPReportMainTab set status = '2' where " + inSql;
|
String updateSql = "update BIPReportMainTab set status = '2',err_msg = null where " + inSql;
|
||||||
getImsDao().executeUpdate(updateSql);
|
getImsDao().executeUpdate(updateSql);
|
||||||
}
|
}
|
||||||
logger.error("---end----任务结束运行--");
|
logger.error("---end----任务结束运行--");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("ProductReportGyImsPlugin Error: ", e);
|
logger.error("ProductReportGyImsPlugin Error: " + e.getMessage(), e);
|
||||||
// NCCForUAPLogger.debug("ProductReportGyImsPlugin Error: " + e.getMessage());
|
// NCCForUAPLogger.debug("ProductReportGyImsPlugin Error: " + e.getMessage());
|
||||||
|
String inSql = SqlUtils.getInStr("pk_wr", pkWrFailSet.toArray(new String[0]), Boolean.TRUE);
|
||||||
|
String updateSql = "update BIPReportMainTab set err_msg = '[err_msg]' where " + inSql;
|
||||||
|
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
||||||
|
int rows = ImsDaoUtil.executeUpdate(updateSql, pkWrFailSet.toString());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue