高压IMS-生产报告同步-调整为独立事务
This commit is contained in:
parent
3b996941f7
commit
ab0a8975be
|
|
@ -6,7 +6,6 @@ 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;
|
||||
|
|
@ -16,7 +15,6 @@ import nc.util.mmf.busi.service.PFPubService;
|
|||
import nc.util.mmf.framework.base.MMStringUtil;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.util.mmpac.wr.WrItemKeyToQualityItemKeyUtil;
|
||||
import nc.vo.fi.pub.SqlUtils;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.wr.entity.AggWrVO;
|
||||
import nc.vo.mmpac.wr.entity.WrItemVO;
|
||||
|
|
@ -33,7 +31,9 @@ import nc.vo.scmpub.res.billtype.MMBillType;
|
|||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时同步高压加工车间IMS的生产报告
|
||||
|
|
@ -66,9 +66,6 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
|||
@Override
|
||||
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'";
|
||||
|
|
@ -76,9 +73,9 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
|||
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();
|
||||
try {
|
||||
String pkWrSql = "select * from BIPReportDetailTab where pk_wr = '" + pkWr + "'";
|
||||
List<Map<String, Object>> detailList = (List<Map<String, Object>>) getImsDao().executeQuery(pkWrSql, new MapListProcessor());
|
||||
Map<String, Map<String, Object>> detailIdMap = new HashMap<>();
|
||||
|
|
@ -159,38 +156,26 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
AggWrVO[] resultvos = null;
|
||||
try {
|
||||
resultvos = wrService.insert(vos);
|
||||
// 用_RequiresNew方法单独启事务
|
||||
AggWrVO[] wrVOS = wrService.insert_RequiresNew(vos);
|
||||
String updateSql;
|
||||
if (wrVOS != null && wrVOS.length > 0) {
|
||||
updateSql = "update BIPReportMainTab set status = '2',err_msg = null where pk_wr = '[pkWr]'";
|
||||
} else {
|
||||
updateSql = "update BIPReportMainTab set err_msg = '[err_msg]' where pk_wr = '[pkWr]'";
|
||||
updateSql = updateSql.replace("[err_msg]", "新增返回空");
|
||||
}
|
||||
updateSql = updateSql.replace("[pkWr]", pkWr);
|
||||
getImsDao().executeUpdate(updateSql);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("ProductReportGyImsPlugin Error: ", e);
|
||||
// NCCForUAPLogger.debug("ProductReportGyImsPlugin Error: " + e.getMessage());
|
||||
String updateSql = "update BIPReportMainTab set err_msg = '[err_msg]' where pk_wr = '[pkWr]'";
|
||||
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
||||
updateSql = updateSql.replace("[pkWr]", pkWr);
|
||||
// NCCForUAPLogger.debug("ProductReportGyImsPlugin-updateSql = " + updateSql);
|
||||
ImsDaoUtil.executeUpdate(updateSql, pkWr);
|
||||
}
|
||||
if (MMValueCheck.isEmpty(resultvos)) {
|
||||
continue;
|
||||
}
|
||||
pkWrSet.add(pkWr);
|
||||
}
|
||||
if (!pkWrSet.isEmpty()) {
|
||||
// 修改状态为 完成
|
||||
String inSql = SqlUtils.getInStr("pk_wr", pkWrSet.toArray(new String[0]), Boolean.TRUE);
|
||||
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.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());
|
||||
}
|
||||
logger.error("---end----任务结束运行--");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue