Merge remote-tracking branch 'origin/master'
| | |
| | | @Autowired |
| | | private FinishedInspectService finishedInspectService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | Jwt jwt; |
| | |
| | | |
| | | @ApiOperation(value = "分页查询成品检验单列表") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "条数/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "result", value = "检验结果(为空=全部)", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "material", value = "产品名称", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/list_page") |
| | | public Result<?> list_page(Integer pageNo, Integer pageSize, Integer result, String material) { |
| | | IPage<Map<String, Object>> page = finishedInspectService.selectFinishedInspectPage(new Page<Object>(pageNo, pageSize), result, material); |
| | | public Result<?> list_page(Integer pageSize, Integer countSize, Integer result, String material) { |
| | | IPage<Map<String, Object>> page = finishedInspectService.selectFinishedInspectPage(new Page<Object>(pageSize, countSize), result, material); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", page.getTotal()); |
| | | map.put("row", page.getRecords()); |
| | |
| | | //获取该类型检验单id下的检验项目结果集 |
| | | List<Integer> getResult(Integer id, int type); |
| | | |
| | | List<InspectionItemDto> selectInspectionItem(Integer finishInspectId, Integer type); |
| | | List<InspectionItemDto> selectInspectionItem(Integer id, Integer type); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 新增按钮-->2、查询所有检验项目 |
| | | * @param finishInspectId |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<InspectionItemDto> selectInspectionItem(Integer finishInspectId, Integer type); |
| | | List<InspectionItemDto> selectInspectionItem(Integer id, Integer type); |
| | | |
| | | /** |
| | | * 新增按钮-->2、检验项目-->失去焦点发起该请求 |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | |
| | | @Resource |
| | | FinishedInspectMapper finishedInspectMapper; |
| | | |
| | | @Resource |
| | | MaterialMapper materialMapper; |
| | | |
| | | @Resource |
| | | StandardService standardService; |
| | | |
| | | @Resource |
| | | SpecificationsService specificationsService; |
| | | |
| | | @Resource |
| | | ManualTechnologyMapper manualTechnologyMapper; |
| | |
| | | finishedInspectMapper.insert(finishedInspect); |
| | | /*批量新增成品检验项目单*/ |
| | | //获取型号id |
| | | Integer specificationId = getSpecificationId(finishedInspectVo.getMaterial(), finishedInspectVo.getMcode(), finishedInspectVo.getSpecificationsModel()); |
| | | //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, ver); |
| | | /*//查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本*/ |
| | | List<Product> productList = productService.selProByVerSpe(technologyId); |
| | | List<InspectionItem> inspectionItemList = productList.stream().map(product -> { |
| | | InspectionItem inspectionItem = new InspectionItem(); |
| | | BeanUtils.copyProperties(product, inspectionItem); |
| | | inspectionItem.setCreateTime(new Date()); |
| | | inspectionItem.setUpdateTime(new Date()); |
| | | inspectionItem.setInspectId(finishedInspect.getId()); |
| | | inspectionItem.setType(2);//成品 |
| | | return inspectionItem; |
| | |
| | | return finishedInspectMapper.selectFinishInspectsListById(id); |
| | | } |
| | | |
| | | |
| | | /*根据样品名称,样品编号,型号规格获取型号id*/ |
| | | private Integer getSpecificationId(String name, String mcode, String specification) { |
| | | //获取物料id |
| | | Material material = materialMapper.selectOne(Wrappers.<Material>query() |
| | | .eq("name", name) |
| | | .eq("code", mcode)); |
| | | if (Objects.isNull(material)) { |
| | | return null; |
| | | } |
| | | //获取规格名称和型号名称 |
| | | String[] split = specification.split("-"); |
| | | String stName = split[0]; |
| | | String spName = split[1]; |
| | | //获取规格id |
| | | Standard standard = standardService.getOne(Wrappers.<Standard>query() |
| | | .eq("name", stName) |
| | | .eq("material_id", material.getId())); |
| | | //获取型号id |
| | | Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query() |
| | | .eq("name", spName) |
| | | .eq("standard_id", standard.getId())); |
| | | return specifications.getId(); |
| | | } |
| | | |
| | | /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); |
| | | |
| | | if (isStandardValueSatisfied && isControlValueSatisfied) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private boolean isValueSatisfied(String valueStr, String detectionValueStr) { |
| | | String substring = valueStr.substring(1, 2); |
| | | if (substring.equals("=")) { |
| | | String operator = valueStr.substring(0, 2); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(2)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">=": |
| | | return detectionValue >= standardValue; |
| | | case "<=": |
| | | return detectionValue <= standardValue; |
| | | default: |
| | | return false; |
| | | } |
| | | } else { |
| | | String operator = valueStr.substring(0, 1); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(1)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">": |
| | | return detectionValue > standardValue; |
| | | case "≥": |
| | | return detectionValue >= standardValue; |
| | | case "≤": |
| | | return detectionValue <= standardValue; |
| | | case "<": |
| | | return detectionValue < standardValue; |
| | | case "=": |
| | | return detectionValue.equals(standardValue); |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | //新增按钮-->2、查询所有检验项目 |
| | | @Override |
| | | public List<InspectionItemDto> selectInspectionItem(Integer finishInspectId, Integer type) { |
| | | return inspectionItemMapper.selectInspectionItem(finishInspectId,type); |
| | | public List<InspectionItemDto> selectInspectionItem(Integer id, Integer type) { |
| | | return inspectionItemMapper.selectInspectionItem(id,type); |
| | | } |
| | | |
| | | |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | |
| | | @Resource |
| | | ProcessInspectMapper processInspectMapper; |
| | | |
| | | @Resource |
| | | MaterialMapper materialMapper; |
| | | |
| | | @Resource |
| | | StandardService standardService; |
| | | |
| | | @Resource |
| | | SpecificationsService specificationsService; |
| | | |
| | | @Resource |
| | | ProductService productService; |
| | |
| | | BeanUtils.copyProperties(processInspectVo, processInspect); |
| | | processInspectMapper.insert(processInspect); |
| | | /*批量新增过程检验项目表*/ |
| | | //获取型号id |
| | | /*//获取型号id |
| | | Integer specificationId = getSpecificationId(processInspectVo.getMaterial(), processInspectVo.getMaterialCode(), processInspectVo.getSpecificationsModel()); |
| | | //查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本 |
| | | List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechnologyId(), ver); |
| | | Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本*/ |
| | | List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechnologyId()); |
| | | List<InspectionItem> inspectionItemList = productList.stream().map(product -> { |
| | | InspectionItem inspectionItem = new InspectionItem(); |
| | | BeanUtils.copyProperties(product, inspectionItem); |
| | | inspectionItem.setCreateTime(new Date()); |
| | | inspectionItem.setUpdateTime(new Date()); |
| | | inspectionItem.setInspectId(processInspect.getId()); |
| | | inspectionItem.setType(1); |
| | | return inspectionItem; |
| | |
| | | return processInspectMapper.selectProcessInspectsList(page,techfather,result,name); |
| | | } |
| | | |
| | | |
| | | /*根据样品名称,样品编号,型号规格获取型号id*/ |
| | | private Integer getSpecificationId(String name, String mcode, String specification) { |
| | | //获取物料id |
| | | Material material = materialMapper.selectOne(Wrappers.<Material>query() |
| | | .eq("name", name) |
| | | .eq("code", mcode)); |
| | | if (Objects.isNull(material)) { |
| | | return null; |
| | | } |
| | | //获取规格名称和型号名称 |
| | | String[] split = specification.split("-"); |
| | | String stName = split[0]; |
| | | String spName = split[1]; |
| | | //获取规格id |
| | | Standard standard = standardService.getOne(Wrappers.<Standard>query() |
| | | .eq("name", stName) |
| | | .eq("material_id", material.getId())); |
| | | //获取型号id |
| | | Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query() |
| | | .eq("name", spName) |
| | | .eq("standard_id", standard.getId())); |
| | | return specifications.getId(); |
| | | } |
| | | |
| | | /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); |
| | | |
| | | if (isStandardValueSatisfied && isControlValueSatisfied) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private boolean isValueSatisfied(String valueStr, String detectionValueStr) { |
| | | String substring = valueStr.substring(1, 2); |
| | | if (substring.equals("=")) { |
| | | String operator = valueStr.substring(0, 2); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(2)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">=": |
| | | return detectionValue >= standardValue; |
| | | case "<=": |
| | | return detectionValue <= standardValue; |
| | | default: |
| | | return false; |
| | | } |
| | | } else { |
| | | String operator = valueStr.substring(0, 1); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(1)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">": |
| | | return detectionValue > standardValue; |
| | | case "≥": |
| | | return detectionValue >= standardValue; |
| | | case "≤": |
| | | return detectionValue <= standardValue; |
| | | case "<": |
| | | return detectionValue < standardValue; |
| | | case "=": |
| | | return detectionValue.equals(standardValue); |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | <result property="qualityTraceability" column="quality_traceability"/> |
| | | <result property="specifications" column="specifications"/> |
| | | <result property="unit" column="unit"/> |
| | | <collection property="children" resultMap="threeMap" javaType="List"/> |
| | | </resultMap> |
| | | <select id="chooseMater" resultMap="oneMap"> |
| | | select s.proname prname, |
| | |
| | | <if test="techfather!=null and techfather!=''"> |
| | | and techfather like concat('%',#{techfather},'%') |
| | | </if> |
| | | <if test="material!=null and material!=''"> |
| | | <if test="name!=null and name!=''"> |
| | | and material like concat('%',#{name},'%') |
| | | </if> |
| | | <if test="result!=null "> |
| | |
| | | return Result.fail("没有该类型!"); |
| | | } |
| | | |
| | | @ApiOperation("添加同一个型号工艺路线,技术指标,物料清单,生产工艺的版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId ,Integer version) { |
| | | Integer version1 = materialService.addVersion(specificationsId,version); |
| | | return Result.success("添加型号"+specificationsId+"的版本"+version1+"成功"); |
| | | } |
| | | |
| | | } |
| | |
| | | return Result.fail("更新失败"); |
| | | } |
| | | |
| | | @ApiOperation("添加同一个型号物料清单的版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId ,Integer version) { |
| | | Integer version1 = mbomService.addVersion(specificationsId,version); |
| | | return Result.success("添加型号"+specificationsId+"的物料清单版本"+version1+"成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "物料清单id", dataTypeClass = Integer.class,required = true) |
| | |
| | | }) |
| | | @PostMapping("/write") |
| | | public Result<?> write(Integer id, String required, String internal) { |
| | | Integer write = productService.write(id, required, internal); |
| | | if (write >= 1){ |
| | | return Result.success("更新成功"); |
| | | } |
| | | return Result.fail("更新失败"); |
| | | } |
| | | |
| | | @ApiOperation("添加同一个型号技术指标的版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId ,Integer version) { |
| | | Integer version1 = productService.addVersion(specificationsId,version); |
| | | return Result.success("添加型号"+specificationsId+"的技术指标版本"+version1+"成功"); |
| | | return Result.success(productService.write(id, required, internal)); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "技术指标id", dataTypeClass = Integer.class,required = true) |
| | | @ApiImplicitParam(name = "id", value = "技术指标id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/delTechById") |
| | | public Result delProById(Integer id) { |
| | | productService.delProById(id); |
| | | return Result.success("删除"+id+"成功!"); |
| | | return Result.success("删除" + id + "成功!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "批量删除") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "ids", value = "技术指标id", dataTypeClass = String.class,required = true) |
| | | @ApiImplicitParam(name = "ids", value = "技术指标id", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @PostMapping("/delAllPro") |
| | | public Result delAllPro(String ids) { |
| | |
| | | return Result.success("添加生产工艺成功"); |
| | | } |
| | | |
| | | @ApiOperation("添加同一个型号生产工艺的版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId,Integer version ) { |
| | | Integer version1 = techniqueService.addVersion(specificationsId,version); |
| | | return Result.success("添加型号"+specificationsId+"的生产工艺版本"+version1+"成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "生产工艺id", dataTypeClass = Integer.class,required = true) |
| | |
| | | return Result.fail("更新失败"); |
| | | } |
| | | |
| | | @ApiOperation("添加同一个型号工艺路线的版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId ,Integer version) { |
| | | Integer version1 = technologyService.addVersion(specificationsId,version); |
| | | return Result.success("添加型号"+specificationsId+"的工艺路线版本"+version1+"成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除") |
| | | @ApiImplicitParams(value = { |
| | |
| | | //根据技术指标id批量删除 |
| | | void delAllPro(String ids); |
| | | |
| | | //查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | List<Product> selProByVerSpe(Integer technologyId, Integer ver); |
| | | //查询标准BOM技术指标中该型号工艺下的检验项目 |
| | | List<Product> selProByVerSpe(Integer technologyId); |
| | | } |
| | | |
| | | |
| | |
| | | String addMaterial(MaterialDto materialDto); |
| | | |
| | | |
| | | /** |
| | | * 添加同一个型号工艺路线,技术指标,物料清单,生产工艺的版本 |
| | | * @param specificationsId |
| | | * @param version |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId, Integer version); |
| | | } |
| | |
| | | */ |
| | | Integer write(Integer id, Integer num); |
| | | |
| | | /** |
| | | * 添加同一个型号物料清单的版本 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId,Integer version); |
| | | |
| | | /** |
| | | * 删除 |
| | |
| | | * @param internal |
| | | * @return |
| | | */ |
| | | Integer write(Integer id, String required, String internal); |
| | | |
| | | /** |
| | | * 添加同一个型号技术指标的版本 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId,Integer version); |
| | | String write(Integer id, String required, String internal); |
| | | |
| | | /** |
| | | * 删除 |
| | |
| | | void delAllPro(String ids); |
| | | |
| | | /** |
| | | * 查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | * 查询标准BOM技术指标中该型号工艺下的检验项目 |
| | | * @param technologyId |
| | | * @param ver |
| | | * @return |
| | | */ |
| | | List<Product> selProByVerSpe(Integer technologyId, Integer ver); |
| | | List<Product> selProByVerSpe(Integer technologyId); |
| | | } |
| | |
| | | void addTechnique(Integer technologyId, TechniqueDto techniqueDto); |
| | | |
| | | /** |
| | | * 添加同一个型号生产工艺的版本 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId,Integer version); |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param id |
| | | */ |
| | |
| | | Integer write(Integer id, Integer productionQuota); |
| | | |
| | | /** |
| | | * 添加同一个型号工艺路线的版本 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId,Integer version); |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param id |
| | | */ |
| | |
| | | @Resource |
| | | DeviceMapper deviceMapper; |
| | | |
| | | @Resource |
| | | TechnologyMapper technologyMapper; |
| | | |
| | | @Resource |
| | | ProductMapper productMapper; |
| | | |
| | | @Resource |
| | | MbomMapper mbomMapper; |
| | | |
| | | @Resource |
| | | TechniqueMapper techniqueMapper; |
| | | |
| | | //标准MOM-->左侧五级树展示 |
| | | @Override |
| | | public List<Map<String, Object>> selectTreeByMaterial() { |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String addMaterial(MaterialDto materialDto) { |
| | | //校验添加物料是否重复 |
| | | if (materialMapper.selectOne(Wrappers.<Material>query() |
| | | List<Material> materialList = materialMapper.selectList(Wrappers.<Material>query() |
| | | .eq("type", materialDto.getType()) |
| | | .eq("father", materialDto.getFather())).getName().equals(materialDto.getName())) { |
| | | return "该类型产品大类下有该产品名称"; |
| | | .eq("father", materialDto.getFather())); |
| | | for (Material material : materialList) { |
| | | if (material.getName().equals(materialDto.getName())) { |
| | | return "该类型产品大类下有该产品名称"; |
| | | } |
| | | } |
| | | /*新增物料表*/ |
| | | Material material = new Material(); |
| | |
| | | } |
| | | |
| | | |
| | | //添加同一个型号工艺路线,技术指标,物料清单,生产工艺的版本 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addVersion(Integer specificationsId, Integer version) { |
| | | List<Technology> technologyList = technologyMapper.selectList(Wrappers.<Technology>query() |
| | | .eq("specifications_id", specificationsId) |
| | | .eq("version", version)); |
| | | /*上一个版本的工艺路线id集合*/ |
| | | List<Integer> techTemIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList()); |
| | | for (Technology technology : technologyList) { |
| | | technology.setId(null); |
| | | //最新版本+1 |
| | | technology.setVersion(technologyMapper.selectVerByTec(specificationsId).get(0) + 1); |
| | | } |
| | | technologyService.saveBatch(technologyList); |
| | | /*工艺路线的版本新增的同时该工艺路线下下的技术指标,生产工艺,物料清单都要新增*/ |
| | | //新增版本的工艺路线id集合 |
| | | List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList()); |
| | | //两者长度一定一样 |
| | | List<Product> productList = new ArrayList<>(); |
| | | for (int i = 0; i < technologyIds.size(); i++) { |
| | | List<Product> products = productMapper.selectList(Wrappers.<Product>query().eq("technology_id", techTemIds.get(i))); |
| | | for (Product pro : products) { |
| | | Product product = new Product(); |
| | | product.setFather(pro.getFather()); |
| | | product.setName(pro.getName()); |
| | | product.setUnit(pro.getUnit()); |
| | | product.setRequired(pro.getRequired()); |
| | | product.setInternal(pro.getInternal()); |
| | | product.setVersion(pro.getVersion()+1); |
| | | product.setTechnologyId(technologyIds.get(i)); |
| | | productList.add(product); |
| | | } |
| | | } |
| | | productService.saveBatch(productList); |
| | | /*新增标准BOM-->物料清单(批量添加)*/ |
| | | List<Mbom> mbomList = new ArrayList<>(); |
| | | for (int i = 0; i < technologyIds.size(); i++) { |
| | | List<Mbom> mboms = mbomMapper.selectList(Wrappers.<Mbom>query().eq("technology_id", techTemIds.get(i))); |
| | | for (Mbom mb : mboms) { |
| | | Mbom mbom = new Mbom(); |
| | | mbom.setUnit(mb.getUnit()); |
| | | mbom.setName(mb.getName()); |
| | | mbom.setSupplier(mb.getSupplier()); |
| | | mbom.setQualityTraceability(mb.getQualityTraceability()); |
| | | mbom.setSpecifications(mb.getSpecifications()); |
| | | mbom.setVersion(mb.getVersion()+1); |
| | | mbom.setNum(mb.getNum()); |
| | | mbom.setTechnologyId(technologyIds.get(i)); |
| | | mbomList.add(mbom); |
| | | } |
| | | } |
| | | mbomService.saveBatch(mbomList); |
| | | /*新增标准BOM-->生产工艺(批量添加)*/ |
| | | List<Technique> techniqueList = new ArrayList<>(); |
| | | for (int i = 0; i < technologyIds.size(); i++) { |
| | | List<Technique> techniques = techniqueMapper.selectList(Wrappers.<Technique>query().eq("technology_id", techTemIds.get(i))); |
| | | for (Technique teque : techniques) { |
| | | Technique technique = new Technique(); |
| | | technique.setTechnologyId(technologyIds.get(i)); |
| | | technique.setDevice(teque.getDevice()); |
| | | technique.setProductFather(teque.getProductFather()); |
| | | technique.setProduct(teque.getProduct()); |
| | | technique.setUnit(teque.getUnit()); |
| | | technique.setVersion(teque.getVersion()+1); |
| | | techniqueList.add(technique); |
| | | } |
| | | } |
| | | techniqueService.saveBatch(techniqueList); |
| | | return technologyList.get(0).getVersion(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | return mbomMapper.updateById(mbom); |
| | | } |
| | | |
| | | //添加同一个型号物料清单的版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId,Integer version) { |
| | | List<Mbom> mbomList = mbomMapper.selAllBySpeId(specificationsId,version); |
| | | for (Mbom mbom : mbomList) { |
| | | mbom.setId(null); |
| | | //最新版本+1 |
| | | mbom.setVersion(mbomMapper.selectVerByMbom(specificationsId).get(0) + 1); |
| | | } |
| | | saveBatch(mbomList); |
| | | return mbomList.get(0).getVersion(); |
| | | } |
| | | |
| | | //删除 |
| | | @Override |
| | | public void delMbomById(Integer id) { |
| | |
| | | |
| | | //填写标准值与内控值,鼠标移开保存 |
| | | @Override |
| | | public Integer write(Integer id, String required, String internal) { |
| | | public String write(Integer id, String required, String internal) { |
| | | //校验标准值,内控值格式 |
| | | char inter = internal.charAt(0); |
| | | char requ = required.charAt(0); |
| | | if (inter != '>' && inter != '<' && inter != '=') { |
| | | return "内控值输入格式有问题!"; |
| | | } |
| | | if (requ != '>' && requ != '<' && requ != '=') { |
| | | return "标准值输入格式有问题!"; |
| | | } |
| | | |
| | | Product product = new Product(); |
| | | product.setId(id); |
| | | product.setRequired(required); |
| | | product.setInternal(internal); |
| | | return productMapper.updateById(product); |
| | | } |
| | | |
| | | //添加同一个型号技术指标的版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId,Integer version) { |
| | | List<Product> productList = productMapper.selAllBySpeId(specificationsId,version); |
| | | for (Product product : productList) { |
| | | product.setId(null); |
| | | //最新版本+1 |
| | | product.setVersion(productMapper.selectVerByPro(specificationsId).get(0)+1); |
| | | } |
| | | saveBatch(productList); |
| | | return productList.get(0).getVersion(); |
| | | productMapper.updateById(product); |
| | | return "保存成功!"; |
| | | } |
| | | |
| | | //删除 |
| | |
| | | |
| | | //查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |
| | | @Override |
| | | public List<Product> selProByVerSpe(Integer technologyId, Integer ver) { |
| | | return productMapper.selProByVerSpe(technologyId,ver); |
| | | public List<Product> selProByVerSpe(Integer technologyId) { |
| | | return productMapper.selProByVerSpe(technologyId); |
| | | } |
| | | } |
| | | |
| | |
| | | techniqueMapper.insert(technique); |
| | | } |
| | | |
| | | //添加同一个型号生产工艺的版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId,Integer version) { |
| | | List<Technique> techniqueList = techniqueMapper.selAllBySpeId(specificationsId,version); |
| | | for (Technique technique : techniqueList) { |
| | | technique.setId(null); |
| | | //最新版本+1 |
| | | technique.setVersion(techniqueMapper.selectVerByTeq(specificationsId).get(0)+1); |
| | | } |
| | | saveBatch(techniqueList); |
| | | return techniqueList.get(0).getVersion(); |
| | | } |
| | | |
| | | //删除 |
| | | @Override |
| | | public void delTeqById(Integer id) { |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.Technology; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.pojo.dto.TechnologyDto; |
| | | import com.yuanchu.mom.service.TechnologyService; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | MbomMapper mbomMapper; |
| | | |
| | | @Resource |
| | | MbomService mbomService; |
| | | |
| | | @Resource |
| | | TechniqueMapper techniqueMapper; |
| | | |
| | | @Resource |
| | | ProductService productService; |
| | | |
| | | @Resource |
| | | TechniqueService techniqueService; |
| | | |
| | | |
| | | //根据型号id查询版本 |
| | |
| | | |
| | | //右上角新增-->工艺路线 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addTechnology(Integer specificationsId, TechnologyDto technologyDto) { |
| | | Technology technology = new Technology(); |
| | | BeanUtils.copyProperties(technologyDto, technology); |
| | |
| | | technology.setId(id); |
| | | technology.setProductionQuota(productionQuota); |
| | | return technologyMapper.updateById(technology); |
| | | } |
| | | |
| | | //添加同一个型号工艺路线的版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId, Integer version) { |
| | | List<Technology> technologyList = technologyMapper.selectList(Wrappers.<Technology>query() |
| | | .eq("specifications_id", specificationsId) |
| | | .eq("version", version)); |
| | | for (Technology technology : technologyList) { |
| | | technology.setId(null); |
| | | //最新版本+! |
| | | technology.setVersion(technologyMapper.selectVerByTec(specificationsId).get(0) + 1); |
| | | } |
| | | saveBatch(technologyList); |
| | | return technologyList.get(0).getVersion(); |
| | | } |
| | | |
| | | //删除 |
| | |
| | | select * |
| | | from mom_ocean.product |
| | | where state = 1 |
| | | and version = #{ver} |
| | | and technology_id = #{technologyId} |
| | | </select> |
| | | |