| | |
| | | if (!Cools.isEmpty(order1)){ |
| | | return FAIL.setMsg("请等待...订单执行档案正在转历史档案!!!"); |
| | | } |
| | | List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(order.getPakinPakoutStatus$(), order.getId()); |
| | | if (!Cools.isEmpty(orderDetls) || !orderDetls.isEmpty()) { |
| | | return FAIL.setMsg("请等待...订单执行明细档案正在转历史档案!!!"); |
| | | } |
| | | // List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(order.getPakinPakoutStatus$(), order.getId()); |
| | | // if (!Cools.isEmpty(orderDetls) || !orderDetls.isEmpty()) { |
| | | // return FAIL.setMsg("请等待...订单执行明细档案正在转历史档案!!!"); |
| | | // } |
| | | |
| | | // 单据明细档 |
| | | List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId()); |
| | |
| | | if (detail.getAnfme().equals(0D)){ |
| | | continue; |
| | | } |
| | | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(),detail.getBrand(),detail.getStandby1(),detail.getStandby2(),detail.getStandby3(), |
| | | DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(),detail.getBrand(),detail.getStandby1(),detail.getStandby2(),detail.getStandby3(),detail.getLineNumber(), |
| | | detail.getBoxType1(),detail.getBoxType2(),detail.getBoxType3(), detail.getAnfme()); |
| | | if (DetlDto.has(list, dto)) { |
| | | DetlDto detlDto = DetlDto.find(list, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getStandby1(),dto.getStandby2(),dto.getStandby3(),dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3()); |
| | | assert detlDto != null; |
| | | detlDto.setAnfme(detlDto.getAnfme() + detail.getAnfme()); |
| | | detlDto.setErpAnfme(detlDto.getErpAnfme() + detail.getErpAnfme()); |
| | | |
| | | OrderDetl orderDetl = OrderDetl.find(orderDetlList, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getStandby1(),dto.getStandby2(),dto.getStandby3(),dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3()); |
| | | assert orderDetl != null; |
| | | orderDetl.setAnfme(orderDetl.getAnfme() + detail.getAnfme()); |
| | | } else { |
| | | dto.setErpAnfme(detail.getErpAnfme()); |
| | | list.add(dto); |
| | | orderDetlList.add(detail); |
| | | } |
| | |
| | | String serial = Cools.isEmpty(orderDetl.getBatch()) ? "" : orderDetl.getBatch(); |
| | | pakinParam.getList().add(new MesPakinParam.Detl(orderDetl.getMatnr() + (Cools.isEmpty(serial) ? "" : "-" + serial), orderDetl.getQty())); |
| | | } |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | // |
| | | // String response = ""; |
| | | // boolean success = false; |
| | | try { |
| | | if (pakinParam.getList().size()==0){ |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | // 修改订单状态 8新增提交审核完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } else { |
| | | // response = new HttpHandler.Builder() |
| | | // .setUri(MesConstant.URL) |
| | | // .setPath(MesConstant.PAKIN_URL) |
| | | // .setJson(JSON.toJSONString(pakinParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | if (true) { |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (order.getSettle() == 8L) { |
| | | // 修改订单状态 8新增提交审核完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(pakinParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | log.error("8转6失败请查看流程中是否存在异常"); |
| | | throw new CoolException("8转6失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "成品库入库上报", |
| | | MesConstant.URL + MesConstant.PAKIN_URL, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(pakinParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | } |
| | | // 出库完成上报 |
| | |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "成品库出库上报", |
| | | "出库上报", |
| | | MesConstant.URL + MesConstant.PAKOUT_URL, |
| | | null, |
| | | "127.0.0.1", |