| | |
| | | private InsOrderMapper insOrderMapper; |
| | | |
| | | private InsSampleMapper insSampleMapper; |
| | | private WarehouseHistoryMapper warehouseHistoryMapper; |
| | | |
| | | private InsProductMapper insProductMapper; |
| | | private InsProductService insProductService; |
| | |
| | | return map; |
| | | } |
| | | |
| | | //分配站点 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) { |
| | |
| | | code2 = one.getCode2(); |
| | | } |
| | | insOrder.setEntrustCode(giveCode.giveCode2("JCZX/" + code + "-" + code2 + "-", insOrder.getCompanyId(), insOrder.getLaboratory(), "ins_order", "", "yyMM")); |
| | | /*审核通过之后还需要判断该样品是否在库*/ |
| | | //如果在库,系统查询站点任务分布情况,将检验任务下发至最少的站台 |
| | | //系统查询站点任务分布情况,将检验任务下发至最少的站台 |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, insOrder.getId()).select(InsSample::getId)); |
| | | List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getState, 1) |
| | | .in(InsProduct::getInsSampleId, ids)); |
| | | .eq(InsProduct::getState, 1) |
| | | .in(InsProduct::getInsSampleId, ids)); |
| | | List<String> collect = insProducts.stream().map(InsProduct::getSonLaboratory).distinct().collect(Collectors.toList()); |
| | | //要判断剩余试验室中哪个最空闲就安排给哪个 |
| | | Map<String, Long> dataCounts = new HashMap<>(); |
| | |
| | | } |
| | | } |
| | | int day = insProductService.selectOrderManDay(insOrder.getId());//预计完成时间 |
| | | upInsOrder(insOrder.getId(),null,LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null,minElement); |
| | | //如果不在库,暂不下发 |
| | | upInsOrder(insOrder.getId(), null, LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), null, minElement); |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | |
| | | if (order.getCheckState1() == 1 && order.getCheckState2() == 1 && order.getCheckState3() == 1) { |
| | | order.setState(1); |
| | | upInsOrderOfState(order); |
| | | } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2 || order.getCheckState3() == 2){ |
| | | } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2 || order.getCheckState3() == 2) { |
| | | order.setState(2); |
| | | upInsOrderOfState(order); |
| | | } |
| | | } else if (order.getOrderType().equals("B")) { |
| | | //如果是B类,1和2审核通过后这个单子就审核通过 |
| | | if (order.getCheckState1() == 1 && order.getCheckState2() == 1 ) { |
| | | if (order.getCheckState1() == 1 && order.getCheckState2() == 1) { |
| | | order.setState(1); |
| | | upInsOrderOfState(order); |
| | | } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2 ){ |
| | | } else if (order.getCheckState1() == 2 || order.getCheckState2() == 2) { |
| | | order.setState(2); |
| | | upInsOrderOfState(order); |
| | | } |