|
|
@@ -34,39 +34,41 @@ public class WMSUploadTask {
|
|
|
//需要调用三次对接方法
|
|
|
String[] masterList = new String[]{"YUEJH", "AIFL", "YJH_HK"};
|
|
|
for (String master : masterList) {
|
|
|
- logger.info("uploadfxML-begin-master {}",master);
|
|
|
- String emCode = "ADMIN";
|
|
|
- SqlRowList toSendList = baseDao.queryForRowSet("select pi_id,pi_inoutno,pi_class,ds_table,nvl(pi_sendwmserr_count,0) pi_sendwmserr_count from "+master+".prodinout left join documentsetup on ds_name = pi_class " +
|
|
|
- "where pi_status ='未过账' and PI_WMSORDERTYPE is not null and nvl(PI_SENDWMSFLAG,0) = 0 and ds_inorout in ('-IN','OUT','IN','-OUT') and PI_SENDWMSERR IS NOT NULL AND NVL(PI_SENDWMSERR_COUNT,0)<5 " +
|
|
|
- "order by pi_id");
|
|
|
- if(toSendList.hasNext()){
|
|
|
- while (toSendList.next()){
|
|
|
- String id = String.valueOf(toSendList.getObject("pi_id"));
|
|
|
- String inoutno = String.valueOf(toSendList.getObject("pi_inoutno"));
|
|
|
- String caller = toSendList.getGeneralString("ds_table");
|
|
|
- Integer errCount = toSendList.getGeneralInt("pi_sendwmserr_count");
|
|
|
- logger.info("uploadfxML-Upload:caller {} id {} code {}",caller,id,inoutno);
|
|
|
- // 调用待测方法
|
|
|
- Map<String, Object> result = erpService.sendIO(master, id, emCode,caller);
|
|
|
+ if(!baseDao.isDBSetting("sys","stopWms")){
|
|
|
+ logger.info("uploadfxML-begin-master {}",master);
|
|
|
+ String emCode = "ADMIN";
|
|
|
+ SqlRowList toSendList = baseDao.queryForRowSet("select pi_id,pi_inoutno,pi_class,ds_table,nvl(pi_sendwmserr_count,0) pi_sendwmserr_count from "+master+".prodinout left join documentsetup on ds_name = pi_class " +
|
|
|
+ "where pi_status ='未过账' and PI_WMSORDERTYPE is not null and nvl(PI_SENDWMSFLAG,0) = 0 and ds_inorout in ('-IN','OUT','IN','-OUT') and PI_SENDWMSERR IS NOT NULL AND NVL(PI_SENDWMSERR_COUNT,0)<5 " +
|
|
|
+ "order by pi_id");
|
|
|
+ if(toSendList.hasNext()){
|
|
|
+ while (toSendList.next()){
|
|
|
+ String id = String.valueOf(toSendList.getObject("pi_id"));
|
|
|
+ String inoutno = String.valueOf(toSendList.getObject("pi_inoutno"));
|
|
|
+ String caller = toSendList.getGeneralString("ds_table");
|
|
|
+ Integer errCount = toSendList.getGeneralInt("pi_sendwmserr_count");
|
|
|
+ logger.info("uploadfxML-Upload:caller {} id {} code {}",caller,id,inoutno);
|
|
|
+ // 调用待测方法
|
|
|
+ Map<String, Object> result = erpService.sendIO(master, id, emCode,caller);
|
|
|
// System.out.println("result:"+result.toString());
|
|
|
- if (result.get("success") != null && "true".equals(result.get("success").toString())) {
|
|
|
- baseDao.execute("update "+master+".prodinout set "+(StringUtil.hasText(result.get("OrderId"))?"pi_wmsordercode='"+result.get("OrderId")+"',":"")+"pi_sendwmsstatus='同步成功' ,PI_SENDWMSERR_COUNT=0,pi_sendwmserr=null,pi_sendwmsflag=-1 where pi_id = "+id);
|
|
|
- }else{
|
|
|
- String message = result.get("message") == null ? "同步失败" : result.get("message").toString().replaceAll("'", "''");
|
|
|
- baseDao.execute("update "+master+".prodinout set pi_sendwmsstatus='同步失败',PI_SENDWMSERR_COUNT=NVL(PI_SENDWMSERR_COUNT,0)+1,pi_sendwmserr=('" + message + "') where pi_id = " + id);
|
|
|
- if(errCount == 4){
|
|
|
- StringBuffer msg = new StringBuffer();
|
|
|
- msg.append("账套:").append(master).append(",").append(toSendList.getGeneralString("pi_class"))
|
|
|
- .append("[").append(inoutno).append("]")
|
|
|
- .append("对接WMS失败已达5次,请确认失败原因。");
|
|
|
- docCommonService.sendErrToRobot("263a7170-3197-4ff5-8a29-be42b646a546",msg.toString());
|
|
|
+ if (result.get("success") != null && "true".equals(result.get("success").toString())) {
|
|
|
+ baseDao.execute("update "+master+".prodinout set "+(StringUtil.hasText(result.get("OrderId"))?"pi_wmsordercode='"+result.get("OrderId")+"',":"")+"pi_sendwmsstatus='同步成功' ,PI_SENDWMSERR_COUNT=0,pi_sendwmserr=null,pi_sendwmsflag=-1 where pi_id = "+id);
|
|
|
+ }else{
|
|
|
+ String message = result.get("message") == null ? "同步失败" : result.get("message").toString().replaceAll("'", "''");
|
|
|
+ baseDao.execute("update "+master+".prodinout set pi_sendwmsstatus='同步失败',PI_SENDWMSERR_COUNT=NVL(PI_SENDWMSERR_COUNT,0)+1,pi_sendwmserr=('" + message + "') where pi_id = " + id);
|
|
|
+ if(errCount == 4){
|
|
|
+ StringBuffer msg = new StringBuffer();
|
|
|
+ msg.append("账套:").append(master).append(",").append(toSendList.getGeneralString("pi_class"))
|
|
|
+ .append("[").append(inoutno).append("]")
|
|
|
+ .append("对接WMS失败已达5次,请确认失败原因。");
|
|
|
+ docCommonService.sendErrToRobot("263a7170-3197-4ff5-8a29-be42b646a546",msg.toString());
|
|
|
+ }
|
|
|
}
|
|
|
+ logger.info("uploadfxML-Upload:caller {} id {} Upload res {}",caller,id,result.toString());
|
|
|
}
|
|
|
- logger.info("uploadfxML-Upload:caller {} id {} Upload res {}",caller,id,result.toString());
|
|
|
- }
|
|
|
//
|
|
|
+ }
|
|
|
+ logger.info("uploadfxML-End-master {}",master);
|
|
|
}
|
|
|
- logger.info("uploadfxML-End-master {}",master);
|
|
|
}
|
|
|
logger.info("uploadfxML-End");
|
|
|
}
|