| | |
| | | @Value("${u8.orderReportPath}") |
| | | private String orderReportPath; |
| | | |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(Order order) { |
| | | List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单")); |
| | |
| | | if (!report) { |
| | | return; |
| | | } |
| | | |
| | | if (order == null) { |
| | | return; |
| | | } |
| | | //List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单")); |
| | | //List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单", "银座委外材料出库单", "银座生产材料出库单")); |
| | | |
| | | |
| | | //if (docNames.contains(docType.getDocName())) { |
| | | List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId()); |
| | | List<OrderDetl> report = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetlList) { |
| | | if (orderDetl.getQty() > 0 && orderDetl.getQty() > (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty())) { |
| | | report.add(orderDetl); |
| | | List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId()); |
| | | List<OrderDetl> report = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetlList) { |
| | | if (orderDetl.getQty() > 0 && orderDetl.getQty() > (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty())) { |
| | | report.add(orderDetl); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(order.getPltType())) { |
| | | List<AgvWrkDetlLog> agvWrkDetlLogs = agvWrkDetlLogService.selectList(new EntityWrapper<AgvWrkDetlLog>().eq("order_no", order.getOrderNo()).orderBy("appe_time", false)); |
| | | if (!Cools.isEmpty(agvWrkDetlLogs)) { |
| | | AgvWrkDetlLog agvWrkDetlLog = agvWrkDetlLogs.get(0); |
| | | List<AgvWrkMastLog> agvWrkMastLogs = agvWrkMastLogService.selectList(new EntityWrapper<AgvWrkMastLog>().eq("wrk_no", agvWrkDetlLog.getWrkNo()).eq("io_type", 1).orderBy("appe_time", false)); |
| | | if (!Cools.isEmpty(agvWrkMastLogs)) { |
| | | AgvLocMast agvLocMast = agvLocMastService.selectById(agvWrkMastLogs.get(0).getLocNo()); |
| | | if (agvLocMast != null) { |
| | | log.info("补充逻辑生效:{}", order.getOrderNo()); |
| | | order.setPltType(agvLocMast.getPltType()); |
| | | } |
| | | } |
| | | } |
| | | if (Cools.isEmpty(order.getPltType())) { |
| | | List<AgvWrkDetlLog> agvWrkDetlLogs = agvWrkDetlLogService.selectList(new EntityWrapper<AgvWrkDetlLog>().eq("order_no", order.getOrderNo()).orderBy("appe_time", false)); |
| | | if (!Cools.isEmpty(agvWrkDetlLogs)) { |
| | | AgvWrkDetlLog agvWrkDetlLog = agvWrkDetlLogs.get(0); |
| | | List<AgvWrkMastLog> agvWrkMastLogs = agvWrkMastLogService.selectList(new EntityWrapper<AgvWrkMastLog>().eq("wrk_no", agvWrkDetlLog.getWrkNo()).eq("io_type", 1).orderBy("appe_time", false)); |
| | | if (!Cools.isEmpty(agvWrkMastLogs)) { |
| | | AgvLocMast agvLocMast = agvLocMastService.selectById(agvWrkMastLogs.get(0).getLocNo()); |
| | | if (agvLocMast != null) { |
| | | log.info("补充逻辑生效:{}", order.getOrderNo()); |
| | | order.setPltType(agvLocMast.getPltType()); |
| | | } |
| | | } |
| | | } |
| | | if (Cools.isEmpty(order.getPltType())) { |
| | | return; |
| | | return; |
| | | } |
| | | } |
| | | if (Cools.isEmpty(order.getInTime())) { |
| | | order.setInTime(DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F)); |
| | | } |
| | | if (!Cools.isEmpty(report)) { |
| | | ReportErpParam param = new ReportErpParam(); |
| | | mappingParam(order, param); |
| | | mappingParamChildren(report, param); |
| | | log.info(JSON.toJSONString(param)); |
| | | int code = doHttpRequest(param, "单据审核", url, orderReportPath, null, "127.0.0.1"); |
| | | if (code == 0) { |
| | | Date date = new Date(); |
| | | order.setInTime(DateUtils.convert(date, DateUtils.yyyyMMddHHmmsssss_F)); |
| | | orderService.updateById(order); |
| | | for (OrderDetl orderDetl : report) { |
| | | log.info("{}单据审核上报了:{}", order.getOrderNo(), orderDetl.getQty() - (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty())); |
| | | orderDetl.setReportQty(orderDetl.getQty()); |
| | | orderDetl.setUpdateTime(date); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(order.getInTime())) { |
| | | order.setInTime(DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F)); |
| | | } |
| | | if (!Cools.isEmpty(report)) { |
| | | ReportErpParam param = new ReportErpParam(); |
| | | mappingParam(order, param); |
| | | mappingParamChildren(report, param); |
| | | log.info(JSON.toJSONString(param)); |
| | | int code = doHttpRequest(param, "单据审核", url, orderReportPath, null, "127.0.0.1"); |
| | | if (code == 0) { |
| | | Date date = new Date(); |
| | | order.setInTime(DateUtils.convert(date, DateUtils.yyyyMMddHHmmsssss_F)); |
| | | orderService.updateById(order); |
| | | for (OrderDetl orderDetl : report) { |
| | | log.info("{}单据审核上报了:{}", order.getOrderNo(), orderDetl.getQty() - (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty())); |
| | | orderDetl.setReportQty(orderDetl.getQty()); |
| | | orderDetl.setUpdateTime(date); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | } |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | } |