| | |
| | | package com.zy.third.erp.task; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.common.service.erp.ErpSqlServer; |
| | | import com.zy.third.erp.entity.InDetTB; |
| | | import com.zy.third.erp.entity.InHedTB; |
| | |
| | | private ErpSqlServer erpSqlServer; |
| | | |
| | | |
| | | @Transactional(rollbackFor = Throwable.class) |
| | | //@Transactional(rollbackFor = Throwable.class) |
| | | @Scheduled(cron = "${erp.refreshtime}") |
| | | public void InHedTBScheduler() { |
| | | //log.info("InHedTBScheduler开始了"); |
| | |
| | | List<InHedTB> inHeds = erpSqlServer.select(sqlInHed, InHedTB.class); |
| | | if (!inHeds.isEmpty()) { |
| | | for (InHedTB inHed : inHeds) { |
| | | if (!Cools.isEmpty(inHed.getTemp3()) && inHed.getTemp3().equals("fault")) { |
| | | continue; |
| | | } |
| | | HashMap<String, String> condition = new HashMap<>(); |
| | | condition.put("BillNo", "'" + inHed.getBillNo() + "'"); |
| | | List<InDetTB> inDetTBS = erpSqlServer.selectList(InDetTB.class, condition); |
| | | HashMap<String, Object> hedAndDet = new HashMap<>(); |
| | | hedAndDet.put("hed", inHed); |
| | | hedAndDet.put("det", inDetTBS); |
| | | boolean result = inMS.createInOrder(inHed, inDetTBS); |
| | | if (result) { |
| | | log.info("入库单据成功,{}", inHed); |
| | | move(hedAndDet); |
| | | } else { |
| | | String sql = "UPDATE erp_InHedTB SET Temp3 = ‘fault’ WHERE BillNo = '" + inHed.getBillNo() + "'"; |
| | | try { |
| | | inMS.createInOrder(inHed, inDetTBS); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String sql = "UPDATE erp_InHedTB SET Temp3 = 'fault' WHERE BillNo = '" + inHed.getBillNo() + "'"; |
| | | erpSqlServer.update(sql); |
| | | } |
| | | log.info("入库单据成功,{}", inHed); |
| | | move(hedAndDet); |
| | | |
| | | } |
| | | } |
| | | } |