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