| | |
| | | import com.yuanchu.mom.dto.InsOrderPlanDTO; |
| | | import com.yuanchu.mom.dto.InsProductDto; |
| | | import com.yuanchu.mom.pojo.InsOrderFile; |
| | | import com.yuanchu.mom.pojo.InsOrderState; |
| | | import com.yuanchu.mom.service.InsOrderFileService; |
| | | import com.yuanchu.mom.service.InsOrderPlanService; |
| | | import com.yuanchu.mom.service.InsOrderStateService; |
| | | import com.yuanchu.mom.service.InsProductService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | |
| | | private InsOrderFileService insOrderFileService; |
| | | |
| | | private InsProductService insProductService; |
| | | private InsOrderStateService insOrderStateService; |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "获取检验任务列表") |
| | |
| | | public Result<?> temCycle(Integer sampleId, String inspectionItem, String inspectionItemSubclass) { |
| | | return Result.success(insOrderPlanService.temCycle(sampleId, inspectionItem, inspectionItemSubclass)); |
| | | } |
| | | |
| | | @ValueClassify("检验任务") |
| | | @ApiOperation(value = "插队操作") |
| | | @PostMapping("/jumpTeam") |
| | | public Result<?> jumpTeam(Integer orderStateId,Integer sort) { |
| | | InsOrderState orderState = new InsOrderState(); |
| | | orderState.setId(orderStateId); |
| | | orderState.setSort(sort); |
| | | return Result.success(insOrderStateService.updateById(orderState)); |
| | | } |
| | | } |
| | |
| | | private Integer isLeave; |
| | | |
| | | /** |
| | | * 1:检验处理 0:待审核 2:退回 3:撤销 |
| | | * 1:检验处理 0:待审核 2:退回 3:撤销4:已检验 |
| | | */ |
| | | @ApiModelProperty("状态") |
| | | private Integer state; |
| | |
| | | |
| | | @ApiModelProperty("复核理由") |
| | | private String verifyTell; |
| | | |
| | | @ApiModelProperty("插队操作的排序") |
| | | private Integer sort; |
| | | } |
| | |
| | | private ShiftTimeMapper shiftTimeMapper; |
| | | @Resource |
| | | private PerformanceShiftMapper performanceShiftMapper; |
| | | @Resource |
| | | private WarehouseHistoryMapper warehouseHistoryMapper; |
| | | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | |
| | | public boolean claimInsOrderPlan(InsOrderPlanDTO entity) { |
| | | if (Objects.isNull(entity)) { |
| | | return false; |
| | | } |
| | | /*认领需要判断该样品是否在库*/ |
| | | //查询样品id |
| | | List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery() |
| | | .eq(InsSample::getInsOrderId, entity.getInsSampleId())).stream().map(InsSample::getId).collect(Collectors.toList()); |
| | | for (Integer samId : sampleIds) { |
| | | //入库次数 |
| | | Long inCount = warehouseHistoryMapper.selectCount(Wrappers.<WarehouseHistory>lambdaQuery() |
| | | .eq(WarehouseHistory::getState, 1) |
| | | .eq(WarehouseHistory::getInsSampleId, samId)); |
| | | //出库次数 |
| | | Long outCount = warehouseHistoryMapper.selectCount(Wrappers.<WarehouseHistory>lambdaQuery() |
| | | .eq(WarehouseHistory::getState, 2) |
| | | .eq(WarehouseHistory::getInsSampleId, samId)); |
| | | if (inCount > 0 && inCount > outCount) { |
| | | //入库 |
| | | } else { |
| | | throw new ErrorException("所选的样品库存不足,请检查入库和出库记录!"); |
| | | } |
| | | } |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); |
| | | Integer userId = map1.get("userId"); |
| | |
| | | //这里的insSamples是订单下的所有样品包括("/") |
| | | List<InsSample> samples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)); |
| | | for (InsSample insSample : samples) { |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, insSample.getId()).eq(InsProduct::getState, 1)); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .eq(InsProduct::getSonLaboratory, laboratory) |
| | | .eq(InsProduct::getState, 1)); |
| | | List<Integer> results = insProducts.stream().map(InsProduct::getInsResult).filter(str -> str != null).collect(Collectors.toList()); |
| | | if (results.contains(0)) { |
| | | insSample.setInsResult(0); |
| | |
| | | /*type=0 再次试验; type=1 继续试验 ; type=2 结束试验*/ |
| | | switch (type) { |
| | | case 0: |
| | | /*再次试验:系统自动在此站台再次创建一次检验任务;*/ |
| | | /*再次试验:该单子退回到检验状态(排序改成当前的最后);*/ |
| | | //更新原来的检验任务 |
| | | // 查询根据 id 倒序排列的第一条记录 |
| | | InsOrderState record = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery() |
| | |
| | | .set(InsOrderState::getInsTime, now) |
| | | .set(InsOrderState::getInsState, 4) |
| | | .set(InsOrderState::getVerifyTell, tell) |
| | | .set(InsOrderState::getVerifyUser, userId)); |
| | | .set(InsOrderState::getVerifyUser, userId) |
| | | .set(InsOrderState::getCreateTime, LocalDateTime.now())); |
| | | } |
| | | //新建检验任务 |
| | | /* InsOrderState orderState = new InsOrderState(); |
| | | orderState.setInsOrderId(orderId); |
| | | orderState.setLaboratory(laboratory); |
| | | orderState.setInsState(0); |
| | | insOrderStateMapper.insert(orderState);*/ |
| | | break; |
| | | case 1: |
| | | //继续试验:则继续将检验任务转接至下一站点; |
| | |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getState, 1)); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(4);list.add(5);list.add(6); |
| | | list.add(4); |
| | | list.add(5); |
| | | list.add(6); |
| | | List<InsOrderState> insOrderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery() |
| | | .eq(InsOrderState::getInsOrderId, orderId) |
| | | .in(InsOrderState::getInsState, list)); |
| | |
| | | cells.add(cellRenderData); |
| | | } else { |
| | | //第七列 |
| | | if (a.getInsProduct().get(i - 2).getInsResult() == 0) { |
| | | textRenderData.setText("×"); |
| | | if (ObjectUtils.isEmpty(a.getInsProduct().get(i - 2).getInsResult())) { |
| | | textRenderData.setText("-"); |
| | | } else if (a.getInsProduct().get(i - 2).getInsResult() == 1) { |
| | | textRenderData.setText("√"); |
| | | } else if (a.getInsProduct().get(i - 2).getInsResult() == 0) { |
| | | textRenderData.setText("×"); |
| | | } else { |
| | | textRenderData.setText("-"); |
| | | } |
| | |
| | | if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) { |
| | | throw new ErrorException("找不到检验人的签名"); |
| | | } |
| | | //Custom custom = customMapper.selectById(user.get("company")); |
| | | Custom custom = customMapper.selectById(insOrder.getCompanyId()); |
| | | if (!resultCh.get().equals("")) { |
| | | resultCh.set("依据委托要求," + resultCh.get().replaceFirst("、", "") + "等所检项目不符合要求,其余所检项目均符合要求。"); |
| | |
| | | insSampleUser.setState(1); |
| | | insSampleUser.setSonLaboratory(laboratory); |
| | | insSampleUserMapper.insert(insSampleUser); |
| | | /*如果是C类订单且是下发到质量部,则直接复核通过*/ |
| | | /*如果是C类订单且是下发到质量部,则直接复核通过(结束试验)*/ |
| | | InsOrder insOrder = insOrderMapper.selectById(orderId); |
| | | if (insOrder.getOrderType().equals("C") && insOrder.getDepartmentLims().equals("质量部")) { |
| | | verifyPlan(orderId, laboratory, 1, null); |
| | | verifyPlan(orderId, laboratory, 2, null); |
| | | } |
| | | /*校验一下result表*/ |
| | | CompletableFuture.supplyAsync(() -> { |
| | |
| | | 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()); |
| | |
| | | } |
| | | int day = insProductService.selectOrderManDay(insOrder.getId());//预计完成时间 |
| | | upInsOrder(insOrder.getId(),null,LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null,minElement); |
| | | //如果不在库,暂不下发 |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |
| | |
| | | </select> |
| | | <select id="selectCostStatistics" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> |
| | | select * from ( |
| | | <!--SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | | isa.sample, |
| | | isa.model, |
| | | c.price, |
| | | c.cost, |
| | | c.inspection_item, |
| | | cus.company, |
| | | u.`name`, |
| | | i.create_user, |
| | | c.ins_sample_id |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | left join custom cus on cus.id = u.company |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2 |
| | | SEPARATOR ',') |
| | | inspection_item from (select *,GROUP_CONCAT(inspection_item |
| | | SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) |
| | | ) a--> |
| | | SELECT A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | |
| | | SEPARATOR ',') |
| | | inspection_item from (select * , |
| | | GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from |
| | | ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | ins_product where state = 1 and ins_result is not null and ins_result!=2 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | where (<!--i.state = 1 or i.state = 3 or -->i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | GROUP BY |
| | | A.id, |
| | | A.entrust_code, |
| | |
| | | |
| | | <select id="selectCostStatistics2" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> |
| | | select * from ( |
| | | <!--SELECT |
| | | i.id, |
| | | i.entrust_code, |
| | | i.create_time, |
| | | isa.sample, |
| | | isa.model, |
| | | c.price, |
| | | c.cost, |
| | | c.inspection_item, |
| | | u.company, |
| | | u.`name`, |
| | | i.create_user, |
| | | c.ins_sample_id |
| | | FROM |
| | | ins_order i |
| | | LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id |
| | | LEFT JOIN `user` u ON u.id = i.user_id |
| | | LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2 |
| | | SEPARATOR ',') |
| | | inspection_item from (select *,GROUP_CONCAT(inspection_item |
| | | SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) |
| | | ) a--> |
| | | SELECT A.id, |
| | | A.entrust_code, |
| | | A.create_time, |
| | |
| | | SEPARATOR ',') |
| | | inspection_item from (select * , |
| | | GROUP_CONCAT(CONCAT(inspection_item,'@',inspection_item_subclass) SEPARATOR ',')inspection_item2 from |
| | | ins_product where state = 1 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | ins_product where state = 1 and ins_result is not null and ins_result!=2 and template_id IS NOT NULL GROUP BY ins_sample_id,man_hour_group) b GROUP |
| | | BY b.ins_sample_id) c ON c.ins_sample_id = isa.id |
| | | where (i.state = 1 or i.state = 3 or i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | where (<!--i.state = 1 or i.state = 3 or -->i.state = 4) and c.ins_sample_id IS not NULL)A |
| | | GROUP BY |
| | | A.id, |
| | | A.entrust_code, |
| | |
| | | select ip.id, |
| | | ip.inspection_item, |
| | | ip.inspection_item_subclass, |
| | | ip.laboratory, |
| | | ip.son_laboratory, |
| | | ip.unit, |
| | | ipr.equip_name equipValue, |
| | | io.entrust_code, |
| | | ipr.update_time, |
| | | ip.`last_value`, |
| | | ip.ins_result, |
| | | u.name updateUserName |
| | | from ins_product ip |
| | |
| | | <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> |
| | | select * from(select * from( |
| | | SELECT |
| | | a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id orderStateId |
| | | a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id orderStateId,ios.create_time,ios.sort |
| | | FROM |
| | | ( |
| | | SELECT |
| | |
| | | ) a |
| | | LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory |
| | | ORDER BY |
| | | ios.sort, |
| | | a.type DESC, |
| | | a.id |
| | | ios.create_time |
| | | ) b |
| | | where ins_state is not null |
| | | and son_laboratory=#{sonLaboratory} |
| | |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | String b=null; |
| | | BigDecimal decimal1 = new BigDecimal("20"); |
| | | BigDecimal decimal2 = new BigDecimal(b == null ?"0":b); |
| | | BigDecimal decimal3 = new BigDecimal("10"); |
| | | if (decimal1.compareTo(decimal2)>0 && decimal1.compareTo(decimal3)>0){ |
| | | System.out.println("√"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |