| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aspose.words.License; |
| | | import com.aspose.words.SaveFormat; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.basic.pojo.StandardTemplate; |
| | | import com.ruoyi.basic.service.StandardTemplateService; |
| | | import com.ruoyi.basic.vo.IfsInventoryQuantityVO; |
| | | import com.ruoyi.common.constant.DictDataConstants; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.constant.MenuJumpPathConstants; |
| | |
| | | public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | // todo: 仅看自己或者实验室 |
| | | //获取当前人所属实验室id |
| | | |
| | | String laboratory = null; |
| | | |
| | | String userName = null; |
| | | Integer userId = null; |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | |
| | | Integer isCheck = insOrderPlanDTO.getIsCheck(); |
| | | insOrderPlanDTO.setIsCheck(null); |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | Integer typeSource = insOrderPlanDTO.getTypeSource(); |
| | | QueryWrapper<InsOrderPlanDTO> queryWrapper = new QueryWrapper<>(); |
| | | if(ObjectUtils.isNotEmpty(typeSource)){ |
| | | insOrderPlanDTO.setTypeSource(null); |
| | | queryWrapper = QueryWrappers.queryWrappers(insOrderPlanDTO) |
| | | .eq(!Objects.equals(-1,typeSource),"type_source",typeSource) |
| | | .isNotNull(!Objects.equals(-1,typeSource),"ifs_inventory_id") |
| | | .isNull(Objects.equals(-1,typeSource),"ifs_inventory_id");//委托试验查询非ifs报检订单 |
| | | } |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, |
| | | QueryWrappers.queryWrappers(insOrderPlanDTO), |
| | | queryWrapper, |
| | | userName, |
| | | userId, |
| | | sonLaboratory, |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<String> checkSubmitPlan(Integer orderId, String laboratory) { |
| | | public Map<String,Object> checkSubmitPlan(Integer orderId, String laboratory) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<String> collect = new ArrayList<>(); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId)); |
| | | List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList()); |
| | |
| | | return insProduct.getInspectionItem() + "-" + insProduct.getInspectionItemSubclass(); |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | return collect; |
| | | //查询ifs拆分订单是否有已下单但是未检完的单子 |
| | | long count = 0L; |
| | | InsOrder insOrder = insOrderMapper.selectById(orderId); |
| | | if(Objects.nonNull(insOrder.getIfsInventoryId())){ |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | //过滤出不合格或未提交的单子 |
| | | count = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(),one.getLineNo(),one.getReleaseNo(),one.getReceiptNo(),one.getOrderNo()) |
| | | .stream() |
| | | .filter(f->(Objects.nonNull(f.getInsOrderId()) && !Objects.equals(f.getInsOrderId(),orderId)) && (Objects.isNull(f.getInsResult()) || 0==f.getInsResult())).count(); |
| | | } |
| | | map.put("errorMsg",collect); |
| | | map.put("unInsOrderCount",count); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode) { |
| | | public int submitPlan(Integer orderId, String laboratory, Integer verifyUser, String entrustCode,Boolean registerInsResults) { |
| | | InsOrder order = insOrderMapper.selectById(orderId); |
| | | // 1. 判断是否有重复编号, 有重复编号做提醒 |
| | | Long codeCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | |
| | | // 14.ifs移库(原材料需要进行移库操作) --> 最后执行,因为失败无法回滚 |
| | | if (ifsInventoryQuantity != null) { |
| | | // 登记检验结果 |
| | | // 判断是否有不合格, 有不合格不能移库 |
| | | // todo: ifs移库 |
| | | insReportService.isRawMaterial(order); |
| | | insReportService.isRawMaterial(order,registerInsResults,false); |
| | | |
| | | // 15 判断当前样品是否为原材料, 原材料需要进行数据分析, 判断之前10条数据同一个供应商, 同一个检验项的偏差是否超过10% |
| | | // 查询ifs信息获取获取前10个供应商一样的, 检验项一样信息 |
| | |
| | | // 添加分析数据 |
| | | addAnalysis(productList, ifsInventoryQuantity, order, sendUserAccount); |
| | | }); |
| | | |
| | | |
| | | } else { |
| | | // 修改成品状态 |
| | | // 判断是否有不合格 |
| | |
| | | .set(InsOrder::getInsResult, 0)); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |