| | |
| | | ManualTechnologyMapper manualTechnologyMapper; |
| | | |
| | | @Resource |
| | | ProductService productService; |
| | | ManualProductService manualProductService; |
| | | |
| | | @Resource |
| | | InspectionItemService inspectionItemService; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addProcessInspectionSheet(String userId, FinishedInspectVo finishedInspectVo) { |
| | | //根据生产订单id查询编制工序的最后一道工艺 |
| | | List<ManualTechnology> manualTechnologyList = manualTechnologyMapper.selAllByMoId(finishedInspectVo.getId()); |
| | | //获取编制工艺最后一道工艺的id |
| | | Integer mtId = manualTechnologyList.get(0).getId(); |
| | | /*新增成品检验单*/ |
| | | FinishedInspect finishedInspect = new FinishedInspect(); |
| | | finishedInspect.setUserId(Integer.parseInt(userId)); |
| | |
| | | finishedInspect.setSpecificationsModel(finishedInspectVo.getSpecificationsModel()); |
| | | finishedInspect.setMaterial(finishedInspectVo.getMaterial()); |
| | | finishedInspect.setMaterialCode(finishedInspectVo.getMcode()); |
| | | //finishedInspect.setTechId(technologyId); |
| | | finishedInspectMapper.insert(finishedInspect); |
| | | /*批量新增成品检验项目单*/ |
| | | //获取型号id |
| | | //Integer specificationId = getSpecificationId(finishedInspectVo.getMaterial(), finishedInspectVo.getMcode(), finishedInspectVo.getSpecificationsModel()); |
| | | //根据生产订单id查询编制工序的最后一道工艺 |
| | | List<ManualTechnology> manualTechnologyList = manualTechnologyMapper.selAllByMoId(finishedInspectVo.getId()); |
| | | //获取最后一道工艺关联的工艺路线id |
| | | Integer technologyId = manualTechnologyList.get(0).getTechnologyId(); |
| | | /*//查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本*/ |
| | | List<Product> productList = productService.selProByVerSpe(technologyId); |
| | | List<InspectionItem> inspectionItemList = productList.stream().map(product -> { |
| | | List<ManualProduct> manualProductList = manualProductService.selByMtid(mtId); |
| | | List<InspectionItem> inspectionItemList = manualProductList.stream().map(manualProduct -> { |
| | | InspectionItem inspectionItem = new InspectionItem(); |
| | | BeanUtils.copyProperties(product, inspectionItem); |
| | | BeanUtils.copyProperties(manualProductList, inspectionItem); |
| | | inspectionItem.setId(null); |
| | | inspectionItem.setCreateTime(new Date()); |
| | | inspectionItem.setUpdateTime(new Date()); |
| | |
| | | return finishedInspect.getId(); |
| | | } |
| | | |
| | | |
| | | //上报(更新检验状态) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String updateFinishInspectsById(String username,Integer id) { |
| | | public String updateFinishInspectsById(String username, Integer id,Integer number) { |
| | | /*更新检验单里面的检验结论*/ |
| | | //先判断检验结果 |
| | | List<Integer> results = inspectionItemMapper.getResult(id,1); |
| | | List<Integer> results = inspectionItemMapper.getResult(id, 2); |
| | | int count = 0; |
| | | for (Integer result : results) { |
| | | if (result != null && result == 1) { |
| | |
| | | } else return "项目未检验完!"; |
| | | /*如果检验结论为不合格,则需要新增不合格检验单*/ |
| | | if (finishedInspect.getResult() == 0) { |
| | | //查询该检验单哪些检验项目不合格 |
| | | List<InspectionItem> inspectionItemList = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query() |
| | | .eq("inspect_id", id) |
| | | .eq("result", 0) |
| | | .eq("type", 2)); |
| | | String msg = ""; |
| | | for (InspectionItem inspectionItem : inspectionItemList) { |
| | | msg =msg+ inspectionItem.getName()+"-"; |
| | | } |
| | | InspectUnaccepted finishUnaccepted = InspectUnaccepted.builder() |
| | | .reason(finishedInspect.getMaterial() + "不合格") //暂且定义为产品名称不合格 |
| | | .reason(msg + "不合格") //暂且定义为项目+不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(1) //类型为成品检验 |
| | | .build(); |
| | |
| | | .eq(Repertory::getUnit, finishedInspect.getUnit()) |
| | | .eq(Repertory::getType, 1); |
| | | Repertory rep = repertoryMapper.selectOne(queryWrapper); |
| | | if (rep != null ) { |
| | | if (rep != null) { |
| | | rep.setNumber(rep.getNumber() + finishedInspect.getQuantity()); |
| | | rep.setUserName(username); |
| | | repertoryMapper.updateById(rep); |
| | |
| | | //分页查询成品检验单列表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectFinishedInspectPage(Page<Object> page, Integer result, String material) { |
| | | return finishedInspectMapper.selectFinishedInspectPage(page, result,material); |
| | | return finishedInspectMapper.selectFinishedInspectPage(page, result, material); |
| | | } |
| | | |
| | | //根据检验单id查询成品检验单详情 |