| | |
| | | |
| | | @ApiOperation(value = "上报(更新检验状态)") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true) |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "number", value = "不合格数量", dataTypeClass = Integer.class) |
| | | }) |
| | | @PostMapping("/updateFinishInspectsById") |
| | | public Result updateFinishInspectsById(@RequestHeader("token") String token, Integer id) throws Exception { |
| | | public Result updateFinishInspectsById(@RequestHeader("token") String token, Integer id,Integer number) throws Exception { |
| | | //如果已经上报了不能再一次上报 |
| | | FinishedInspect finishedInspect = finishedInspectService.getById(id); |
| | | if (ObjectUtils.isNotEmpty(finishedInspect.getResult())) { |
| | | return Result.fail("已经上报过了,不能再次上报!"); |
| | | } |
| | | Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class); |
| | | return Result.success(finishedInspectService.updateFinishInspectsById(data.get("name").replaceAll("\"", ""), id)); |
| | | return Result.success(finishedInspectService.updateFinishInspectsById(data.get("name").replaceAll("\"", ""), id,number)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据检验单id查询成品检验单详情") |
| | |
| | | |
| | | @ApiOperation(value = "上报(更新检验状态)") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true) |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "number", value = "不合格数量", dataTypeClass = Integer.class) |
| | | }) |
| | | @PostMapping("/updateProcessInspectsById") |
| | | public Result updateProcessInspectsById(Integer id) { |
| | | public Result updateProcessInspectsById(Integer id,Integer number) { |
| | | //如果已经上报了不能再一次上报 |
| | | ProcessInspect processInspect = processInspectService.getById(id); |
| | | if (ObjectUtils.isNotEmpty(processInspect.getResult())) { |
| | | return Result.fail("已经上报过了,不能再次上报!"); |
| | | } |
| | | return Result.success(processInspectService.updateProcessInspectsById(id)); |
| | | return Result.success(processInspectService.updateProcessInspectsById(id,number)); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据检验单id查询过程检验单详情") |
| | |
| | | |
| | | @ApiOperation(value = "上报(更新检验状态)") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true) |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "number", value = "不合格数量", dataTypeClass = Integer.class) |
| | | }) |
| | | @PostMapping("/updateRawInspectsById/{id}") |
| | | public Result updateRawInspectsById(@PathVariable Integer id) { |
| | | public Result updateRawInspectsById(@PathVariable Integer id,Integer number) { |
| | | //如果已经上报了不能再一次上报 |
| | | RawInspect rawInspect = rawInspectService.getById(id); |
| | | if (rawInspect.getInsState() == 1) { |
| | | return Result.fail("已经上报过了,不能再次上报!"); |
| | | } |
| | | return Result.success(rawInspectService.updateRawInspectsById(id)); |
| | | return Result.success(rawInspectService.updateRawInspectsById(id,number)); |
| | | } |
| | | |
| | | } |
| | |
| | | private String reason; |
| | | |
| | | /** |
| | | * 数量 |
| | | **/ |
| | | private Integer number; |
| | | |
| | | /** |
| | | * 处理状态 0:待处理;1:已处理 |
| | | **/ |
| | | private Integer dealState; |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | String updateFinishInspectsById(String username,Integer id); |
| | | String updateFinishInspectsById(String username,Integer id,Integer number); |
| | | |
| | | /** |
| | | * 分页查询成品检验单列表 |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | String updateProcessInspectsById(Integer id); |
| | | String updateProcessInspectsById(Integer id,Integer number); |
| | | |
| | | /** |
| | | * 根据检验单id查询过程检验单详情 |
| | |
| | | * 更新检验状态 |
| | | * @param id |
| | | */ |
| | | String updateRawInspectsById(Integer id); |
| | | String updateRawInspectsById(Integer id,Integer number); |
| | | |
| | | |
| | | } |
| | |
| | | //上报(更新检验状态) |
| | | @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, 2); |
| | |
| | | if (finishedInspect.getResult() == 0) { |
| | | InspectUnaccepted finishUnaccepted = InspectUnaccepted.builder() |
| | | .reason(finishedInspect.getMaterial() + "不合格") //暂且定义为产品名称不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(1) //类型为成品检验 |
| | | .build(); |
| | |
| | | //上报(更新检验状态) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String updateProcessInspectsById(Integer id) { |
| | | public String updateProcessInspectsById(Integer id,Integer number) { |
| | | /*更新检验单里面的检验结论*/ |
| | | //先判断检验结果 |
| | | List<Integer> results = inspectionItemMapper.getResult(id, 1); |
| | |
| | | if (processInspect.getResult() == 0) { |
| | | InspectUnaccepted processUnaccepted = InspectUnaccepted.builder() |
| | | .reason(processInspect.getMaterial() + processInspect.getTechname() + "不合格") //暂且定义为产品名称+工艺不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(2) //类型为过程检验 |
| | | .build(); |
| | |
| | | RawInspectVo rawInspectVo = new RawInspectVo(); |
| | | List<Map<String, Object>> mapList = SyncOrder.ifsInterfaces(); |
| | | for (Map<String, Object> map : mapList) { |
| | | //todo: 后续需要将状态改成待检验 |
| | | if (map.get("STATE").equals("已接收")) { |
| | | if (map.get("PART_NO").toString().equals(code)) { |
| | | rawInspectVo.setCode(map.get("PART_NO").toString()); //原材料编码 |
| | |
| | | //更新检验状态(上报) |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String updateRawInspectsById(Integer id) { |
| | | public String updateRawInspectsById(Integer id,Integer number) { |
| | | /*更新检验单里面的检验结论*/ |
| | | //先判断检验结果 |
| | | List<Integer> results = rawInsProductMapper.getresult(id); |
| | |
| | | if (rawInspect.getJudgeState() == 0) { |
| | | InspectUnaccepted rawUnaccepted = InspectUnaccepted.builder() |
| | | .reason(rawInspectMapper.selectById(id).getName() + "不合格") //暂且定义为原材料不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(0) //类型为原材料 |
| | | .build(); |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.yuanchu.mom.mapper.InspectUnacceptedMapper"> |
| | | |
| | | |
| | | <!--不合格管理--> |
| | | <select id="selectInsList" resultType="java.util.Map"> |
| | | SELECT ru.id, |
| | |
| | | fi.project_name, |
| | | fi.specifications_model, |
| | | fi.unit, |
| | | fi.quantity, |
| | | number quantity, |
| | | DATE_FORMAT(fi.inspectionDate, '%Y-%m-%d') inspectionDate, |
| | | DATE_FORMAT(fi.processingDate, '%Y-%m-%d') processingDate |
| | | FROM mom_ocean.inspect_unaccepted ru, mom_ocean.`user` u, ( |
| | |
| | | <!--原材料不合格品--> |
| | | <select id="selectUnqualifiedRawMaterials" resultType="map"> |
| | | SELECT i.id, |
| | | DATE_FORMAT(r.form_time, '%Y-%m-%d') dateArrival, |
| | | i.`reason`, |
| | | r.`code`, |
| | | r.`name`, |
| | | r.`specifications`, |
| | | r.`unit`, |
| | | r.`number`, |
| | | DATE_FORMAT(r.`create_time`,'%Y-%m-%d') inspectionDate, |
| | | r.`user_name`, |
| | | DATE_FORMAT(r.`ins_time`,'%Y-%m-%d') processingDate, |
| | | r.`supplier`, |
| | | i.`deal_state`, |
| | | i.`deal_reasult` |
| | | DATE_FORMAT(r.form_time, '%Y-%m-%d') dateArrival, |
| | | i.`reason`, |
| | | r.`code`, |
| | | r.`name`, |
| | | r.`specifications`, |
| | | r.`unit`, |
| | | i.number, |
| | | DATE_FORMAT(r.`create_time`,'%Y-%m-%d') inspectionDate, |
| | | r.`user_name`, |
| | | DATE_FORMAT(r.`ins_time`,'%Y-%m-%d') processingDate, |
| | | r.`supplier`, |
| | | i.`deal_state`, |
| | | i.`deal_reasult` |
| | | FROM mom_ocean.inspect_unaccepted i |
| | | LEFT JOIN mom_ocean.raw_inspect r ON i.`raw_inspect_id` = r.`id` |
| | | LEFT JOIN mom_ocean.raw_inspect r ON i.`raw_inspect_id` = r.`id` |
| | | WHERE i.`state` = 1 |
| | | AND i.`type` = 0 |
| | | AND i.`type` = 0 |
| | | <if test="formTime != null and formTime != ''"> |
| | | AND r.form_time = #{formTime} |
| | | </if> |
| | |
| | | |
| | | <!--不合格处置--> |
| | | <select id="selectDisposal" resultType="map"> |
| | | SELECT i.`id`, s.`type`, s.name productName, s.`specifications`, s.number, i.`tell` description, |
| | | SELECT i.`id`, s.`type`, s.name productName, s.`specifications`, i.number, i.`tell` description, |
| | | i.`tell` opinions, s.user_name, DATE_FORMAT(i.`create_time`, '%Y-%m-%d') `date`, i.`deal_state` |
| | | FROM mom_ocean.inspect_unaccepted i |
| | | LEFT JOIN |
| | | ( |
| | | -- 原材料 |
| | | SELECT 0 AS `type`, r.`name`, r.`specifications`, r.`number`, r.`id`, r.`user_name` |
| | | FROM mom_ocean.raw_inspect r |
| | | WHERE r.state = 1 |
| | | <if test="specificationModel != null and specificationModel != ''">AND r.`specifications` LIKE CONCAT('%', |
| | | #{specificationModel}, '%') |
| | | </if> |
| | | <if test=" |
| | | productName != null and productName != ''">AND r.`name` LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | UNION ALL |
| | | -- 成品 |
| | | SELECT 1 AS `type`, f.`project_name` `name`, f.`specifications_model` specifications, f.`quantity` `number`, f.`id`, u.name user_name |
| | | FROM mom_ocean.finished_inspect f, mom_ocean.`user` u |
| | | WHERE f.`state` = 1 |
| | | AND u.id = f.user_id |
| | | <if test="specificationModel != null and specificationModel != ''"> |
| | | AND f.`specifications_model` LIKE CONCAT('%', #{specificationModel}, '%') |
| | | </if> |
| | | <if test="productName != null and productName != ''"> |
| | | AND f.`project_name` LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | UNION ALL |
| | | -- 半成品 |
| | | SELECT 2 AS `type`, p.`material` `name`, p.`specifications_model` specifications, p.`quantity` `number`, p.`id`, u.name user_name |
| | | FROM mom_ocean.process_inspect p, mom_ocean.`user` u |
| | | WHERE p.state = 1 |
| | | AND u.id = p.user_id |
| | | <if test="specificationModel != null and specificationModel != ''"> |
| | | AND p.`specifications_model` LIKE CONCAT('%', #{specificationModel}, '%') |
| | | </if> |
| | | <if test="productName != null and productName != ''"> |
| | | AND p.`material` LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | )AS s ON s.`id` = i.`raw_inspect_id` AND s.`type` = i.type |
| | | -- 原材料 |
| | | SELECT 0 AS `type`, r.`name`, r.`specifications`, r.`number`, r.`id`, r.`user_name` |
| | | FROM mom_ocean.raw_inspect r |
| | | WHERE r.state = 1 |
| | | <if test="specificationModel != null and specificationModel != ''"> |
| | | AND r.`specifications` LIKE CONCAT('%', |
| | | #{specificationModel}, '%') |
| | | </if> |
| | | <if test=" |
| | | productName != null and productName != ''"> |
| | | AND r.`name` LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | UNION ALL |
| | | -- 成品 |
| | | SELECT 1 AS `type`, f.`project_name` `name`, f.`specifications_model` specifications, f.`quantity` `number`, |
| | | f.`id`, u.name user_name |
| | | FROM mom_ocean.finished_inspect f, mom_ocean.`user` u |
| | | WHERE f.`state` = 1 |
| | | AND u.id = f.user_id |
| | | <if test="specificationModel != null and specificationModel != ''"> |
| | | AND f.`specifications_model` LIKE CONCAT('%', #{specificationModel}, '%') |
| | | </if> |
| | | <if test="productName != null and productName != ''"> |
| | | AND f.`project_name` LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | UNION ALL |
| | | -- 半成品 |
| | | SELECT 2 AS `type`, p.`material` `name`, p.`specifications_model` specifications, p.`quantity` `number`, p.`id`, |
| | | u.name user_name |
| | | FROM mom_ocean.process_inspect p, mom_ocean.`user` u |
| | | WHERE p.state = 1 |
| | | AND u.id = p.user_id |
| | | <if test="specificationModel != null and specificationModel != ''"> |
| | | AND p.`specifications_model` LIKE CONCAT('%', #{specificationModel}, '%') |
| | | </if> |
| | | <if test="productName != null and productName != ''"> |
| | | AND p.`material` LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | )AS s ON s.`id` = i.`raw_inspect_id` AND s.`type` = i.type |
| | | WHERE i.`state` = 1 |
| | | AND i.`deal_reasult` = 0 |
| | | AND i.`deal_reasult` = 0 |
| | | <if test="state != null"> |
| | | AND i.`deal_state` = #{state} |
| | | </if> |