| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | |
| | | @Override |
| | | public void checkComplete(String orderNo, Integer pltType) { |
| | | Order order = this.selectByNo(orderNo); |
| | | if (order.getDocType() == 38) { |
| | | return; |
| | | } |
| | | if (Cools.isEmpty(order)) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | // 如果 作业数量等于单据总数量 && 工作明细档中无该单据的数据 && AGV工作明细档中无该单据的数据 |
| | | int count = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("order_no", orderNo)); |
| | | //int count = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("order_no", orderNo)); |
| | | boolean wrkDeltExist = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().like("order_no", orderNo)) < 1; |
| | | boolean agvWrkDetlExist = agvWrkDetlService.selectCount(new EntityWrapper<AgvWrkDetl>().like("order_no", orderNo)) < 1; |
| | | boolean waitPakinExist = agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>().like("order_no", orderNo)) < 1; |
| | |
| | | boolean manPakoutExist = Cools.isEmpty(manPakOut) || (manPakOut.getPayment() != null && manPakOut.getPayment() == 1); |
| | | if (complete && wrkDeltExist && agvWrkDetlExist && waitPakinExist && manPakoutExist) { |
| | | if (pltType == null) { |
| | | if (!this.updateSettle(order.getId(), 4L, 9528L)) { |
| | | if (!this.updateSettle(order.getId(), 6L, 9528L)) { |
| | | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); |
| | | } |
| | | } else if (!this.updateSettle2(order.getId(), 4L, pltType, DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F))) { |
| | | } else if (!this.updateSettle2(order.getId(), 6L, pltType, DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F))) { |
| | | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); |
| | | } |
| | | } else { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(isolation= Isolation.READ_COMMITTED) |
| | | @Transactional |
| | | public void checkComplete2(String orderNo) { |
| | | Order order = this.selectByNo(orderNo); |
| | | if (Cools.isEmpty(order)) { |
| | |
| | | List<OrderDetl> orderDetls = orderDetlMapper.selectList(new EntityWrapper<OrderDetl>().eq("order_id", order.getId())); |
| | | // 作业数量是否等于数量 |
| | | boolean complete = true; |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (orderDetl.getAnfme() > orderDetl.getQty()) { |
| | | complete = false; |
| | |
| | | } |
| | | |
| | | // 如果 作业数量等于单据总数量 && 工作明细档中无该单据的数据 && AGV工作明细档中无该单据的数据 |
| | | int count = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("order_no", orderNo)); |
| | | //int count = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("order_no", orderNo)); |
| | | boolean wrkDeltExist = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().like("order_no", orderNo)) < 1; |
| | | boolean agvWrkDetlExist = agvWrkDetlService.selectCount(new EntityWrapper<AgvWrkDetl>().like("order_no", orderNo)) < 1; |
| | | boolean waitPakinExist = agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>().like("order_no", orderNo)) < 1; |
| | |
| | | |
| | | boolean manPakoutExist = Cools.isEmpty(manPakOut) || (manPakOut.getPayment() != null && manPakOut.getPayment() == 1); |
| | | if (complete && wrkDeltExist && agvWrkDetlExist && waitPakinExist && manPakoutExist) { |
| | | if (!this.updateSettle(order.getId(), 4L, 9528L)) { |
| | | if (!this.updateSettle(order.getId(), 6L, 9528L)) { |
| | | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); |
| | | } |
| | | } |