高压IMS-定时同步数据调整
This commit is contained in:
parent
120c0b4929
commit
9c725d2c9a
|
|
@ -5,23 +5,22 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import nc.bs.dao.BaseDAO;
|
import nc.bs.dao.BaseDAO;
|
||||||
import nc.bs.framework.common.NCLocator;
|
import nc.bs.framework.common.NCLocator;
|
||||||
import nc.bs.logging.Log;
|
import nc.bs.logging.Log;
|
||||||
import nc.bs.logging.Logger;
|
|
||||||
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.bs.uapbd.util.MyHelper;
|
import nc.bs.uapbd.util.MyHelper;
|
||||||
import nc.jdbc.framework.processor.MapListProcessor;
|
import nc.jdbc.framework.processor.MapListProcessor;
|
||||||
import nc.jdbc.framework.processor.MapProcessor;
|
import nc.jdbc.framework.processor.MapProcessor;
|
||||||
import nc.vo.fi.pub.SqlUtils;
|
|
||||||
import nc.vo.ic.m45.entity.PurchaseInVO;
|
import nc.vo.ic.m45.entity.PurchaseInVO;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
import nccloud.api.ic.m45.IAPIPurchaseInMaitain;
|
import nccloud.api.ic.m45.IAPIPurchaseInMaitain;
|
||||||
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高压加工车间-IMS-定时获取采购入库数据
|
* 高压加工车间-IMS-定时获取采购入库数据
|
||||||
|
|
@ -57,13 +56,12 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
if (remain == null || remain.isEmpty()) {
|
if (remain == null || remain.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Set<String> imsIdSet = new HashSet<>();
|
|
||||||
try {
|
|
||||||
List<Map<String, Object>> paramList = new ArrayList<>();
|
|
||||||
for (Map<String, Object> map : remain) {
|
for (Map<String, Object> map : remain) {
|
||||||
|
List<Map<String, Object>> paramList = new ArrayList<>();
|
||||||
String cgeneralhid = (String) map.get("cgeneralhid");
|
String cgeneralhid = (String) map.get("cgeneralhid");
|
||||||
// 状态标识 IMS:C-创建;U-修改 BIP:2-BIP单据接收完成
|
// 状态标识 IMS:C-创建;U-修改 BIP:2-BIP单据接收完成
|
||||||
String status = map.get("status") + "";
|
String status = map.get("status") + "";
|
||||||
|
try {
|
||||||
String bodySql = " SELECT *" + " from BIPInputDetailTab a " + " where a.cgeneralhid ='" + cgeneralhid + "'";
|
String bodySql = " SELECT *" + " from BIPInputDetailTab a " + " where a.cgeneralhid ='" + cgeneralhid + "'";
|
||||||
List<Map<String, Object>> bodyList = (List<Map<String, Object>>) getImsDao().executeQuery(bodySql, new MapListProcessor());
|
List<Map<String, Object>> bodyList = (List<Map<String, Object>>) getImsDao().executeQuery(bodySql, new MapListProcessor());
|
||||||
if (bodyList == null || bodyList.isEmpty()) {
|
if (bodyList == null || bodyList.isEmpty()) {
|
||||||
|
|
@ -149,27 +147,26 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
param.put("ic_purchasein_b", bodyJsonArr);
|
param.put("ic_purchasein_b", bodyJsonArr);
|
||||||
// 添加到集合
|
// 添加到集合
|
||||||
paramList.add(param);
|
paramList.add(param);
|
||||||
imsIdSet.add(cgeneralhid);
|
|
||||||
}
|
|
||||||
// String jsonString = JSONArray.toJSONString(paramList);
|
// String jsonString = JSONArray.toJSONString(paramList);
|
||||||
// NCCForUAPLogger.debug("jsonString = " + jsonString);
|
// NCCForUAPLogger.debug("jsonString = " + jsonString);
|
||||||
IAPIPurchaseInMaitain purchaseInMaitain = NCLocator.getInstance().lookup(IAPIPurchaseInMaitain.class);
|
IAPIPurchaseInMaitain purchaseInMaitain = NCLocator.getInstance().lookup(IAPIPurchaseInMaitain.class);
|
||||||
PurchaseInVO[] resultvos = purchaseInMaitain.save(paramList);
|
PurchaseInVO[] resultvos = purchaseInMaitain.save_RequiresNew(paramList);
|
||||||
if (!imsIdSet.isEmpty() && resultvos != null) {
|
String updateSql;
|
||||||
// ÐÞ¸Ä״̬Ϊ Íê³É
|
if (resultvos != null && resultvos.length > 0) {
|
||||||
String inSql = SqlUtils.getInStr("cgeneralhid", imsIdSet.toArray(new String[0]), Boolean.TRUE);
|
updateSql = "update BIPInputMainTab set status = '2',err_msg = null where cgeneralhid = '[cgeneralhid]'";
|
||||||
String updateSql = "update BIPInputMainTab set status = '2',err_msg = null where " + inSql;
|
} else {
|
||||||
getImsDao().executeUpdate(updateSql);
|
updateSql = "update BIPInputMainTab set err_msg = '[err_msg]' where cgeneralhid = '[cgeneralhid]'";
|
||||||
|
updateSql = updateSql.replace("[err_msg]", "ÐÂÔö·µ»Ø¿Õ");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
updateSql = updateSql.replace("[cgeneralhid]", cgeneralhid);
|
||||||
logger.error("ErpIaI2billFromGyImsPlugin Error: ", e);
|
getImsDao().executeUpdate(updateSql);
|
||||||
// NCCForUAPLogger.debug("ErpIaI2billFromGyImsPlugin Error: " + e.getMessage());
|
} catch (BusinessException e) {
|
||||||
String inSql = SqlUtils.getInStr("cgeneralhid", imsIdSet.toArray(new String[0]), Boolean.TRUE);
|
logger.error("ErpIaI2billFromGyImsPlugin Error: " + e.getMessage(), e);
|
||||||
String updateSql = "update BIPInputMainTab set err_msg = '[err_msg]' where " + inSql;
|
String updateSql = "update BIPInputMainTab set err_msg = '[err_msg]' where cgeneralhid = '[cgeneralhid]'";
|
||||||
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
||||||
// NCCForUAPLogger.debug("ErpIaI2billFromGyImsPlugin-updateSql = " + updateSql);
|
updateSql = updateSql.replace("[cgeneralhid]", cgeneralhid);
|
||||||
int rows = ImsDaoUtil.executeUpdate(updateSql, imsIdSet.toString());
|
int rows = getImsDao().executeUpdate(updateSql);
|
||||||
// NCCForUAPLogger.debug("ErpIaI2billFromGyImsPlugin-rows = " + rows);
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,11 @@ public class MaterialOutGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
||||||
logger.error("---start----任务开始运行--");
|
logger.error("---start----高压IMS-材料出库-任务开始运行--");
|
||||||
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单据接收完成
|
||||||
String selSql = "select * from BIPOutMainTab where status = 'C'";
|
String selSql = "select * from BIPOutMainTab 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> 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") + "";
|
||||||
// 同步状态:IMS:C-创建;U-修改; 4-BIP审核出库MES接收确认 BIP:2-BIP审核出库
|
// 同步状态:IMS:C-创建;U-修改; 4-BIP审核出库MES接收确认 BIP:2-BIP审核出库
|
||||||
|
|
@ -174,7 +173,7 @@ public class MaterialOutGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
getImsDao().executeUpdate(updateSql);
|
getImsDao().executeUpdate(updateSql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.error("---end----任务结束运行--");
|
logger.error("---end----高压IMS-材料出库-任务结束运行--");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
public PreAlertObject executeTask(BgWorkingContext arg0) throws BusinessException {
|
||||||
logger.error("---start----任务开始运行--");
|
logger.error("---start----高压IMS-生产报告-任务开始运行--");
|
||||||
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'";
|
||||||
|
|
@ -169,14 +169,14 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
|
||||||
updateSql = updateSql.replace("[pkWr]", pkWr);
|
updateSql = updateSql.replace("[pkWr]", pkWr);
|
||||||
getImsDao().executeUpdate(updateSql);
|
getImsDao().executeUpdate(updateSql);
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logger.error("ProductReportGyImsPlugin Error: ", e);
|
logger.error("ProductReportGyImsPlugin Error: " + e.getMessage(), e);
|
||||||
String updateSql = "update BIPReportMainTab set err_msg = '[err_msg]' where pk_wr = '[pkWr]'";
|
String updateSql = "update BIPReportMainTab set err_msg = '[err_msg]' where pk_wr = '[pkWr]'";
|
||||||
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
updateSql = updateSql.replace("[err_msg]", e.getMessage());
|
||||||
updateSql = updateSql.replace("[pkWr]", pkWr);
|
updateSql = updateSql.replace("[pkWr]", pkWr);
|
||||||
getImsDao().executeUpdate(updateSql);
|
getImsDao().executeUpdate(updateSql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.error("---end----任务结束运行--");
|
logger.error("---end----高压IMS-生产报告-任务结束运行--");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue