inspect-server/src/main/java/com/yuanchu/mom/mapper/FinishedInspectMapper.java
@@ -26,4 +26,7 @@ //根据检验单id查询成品检验单详情 List<Map<String, Object>> selectFinishInspectsListById(Integer id); //清空检验状态 void updById(Integer rawInspectId); } inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java
@@ -24,4 +24,7 @@ List<InspectionItemDto> selectInspectionItem(Integer id, Integer type); //批量修改,把原有的检验项目的数据清空 void updateBatch(List<InspectionItem> inspectionItems); } inspect-server/src/main/java/com/yuanchu/mom/mapper/ProcessInspectMapper.java
@@ -24,5 +24,8 @@ //分页查询过程检验单列表 IPage<Map<String, Object>> selectProcessInspectsList(Page<Object> page, String techfather, Integer result, String name); //将检验状态修改为null void updById(Integer rawInspectId); } inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInsProductMapper.java
@@ -20,5 +20,7 @@ List<Integer> getresult(Integer id); //批量清空检验值 void updateBatch(List<RawInsProduct> rawInsProductList); } inspect-server/src/main/java/com/yuanchu/mom/mapper/RawInspectMapper.java
@@ -29,6 +29,10 @@ //根据原材料检验单id查看详情 Map<String, Object> selectRawInspectsListById(Integer id); //清空检验结论 void updById(Integer rawInspectId); } inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectUnacceptedServiceImpl.java
@@ -63,8 +63,7 @@ public Integer rawEvaluate(Integer rawId, Integer passOrNo) { LambdaUpdateWrapper<InspectUnaccepted> updateWrapper = Wrappers.<InspectUnaccepted>lambdaUpdate() .eq(InspectUnaccepted::getId, rawId) .set(InspectUnaccepted::getDealReasult, passOrNo) .set(InspectUnaccepted::getDealState, 1); .set(InspectUnaccepted::getDealReasult, passOrNo); //如果是评审不通过则新增不合格处理意见表 if (passOrNo==0) { List<Opinion> opinions = new ArrayList<>(); inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
@@ -1,18 +1,13 @@ package com.yuanchu.mom.service.impl; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.mom.pojo.InspectUnaccepted; import com.yuanchu.mom.pojo.Opinion; import com.yuanchu.mom.mapper.OpinionMapper; import com.yuanchu.mom.mapper.*; import com.yuanchu.mom.pojo.*; import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto; import com.yuanchu.mom.service.InspectUnacceptedService; import com.yuanchu.mom.service.OpinionService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.mom.utils.JackSonUtil; import com.yuanchu.mom.utils.MyUtil; import com.yuanchu.mom.vo.Result; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -20,6 +15,8 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; /** * <p> @@ -34,6 +31,24 @@ @Resource private OpinionMapper opinionMapper; @Resource InspectUnacceptedMapper inspectUnacceptedMapper; @Resource RawInspectMapper rawInspectMapper; @Resource ProcessInspectMapper processInspectMapper; @Resource FinishedInspectMapper finishedInspectMapper; @Resource InspectionItemMapper inspectionItemMapper; @Resource RawInsProductMapper rawInsProductMapper; @Override @@ -53,20 +68,67 @@ return mapList; } //编辑意见 @Override public Integer updateOpinion(String id, List<?> opinion) { List<Opinion> list = new ArrayList<>(); AtomicInteger a= new AtomicInteger(); AtomicInteger unId= new AtomicInteger(); opinion.forEach(i -> { try { Opinion unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(i), Opinion.class); unmarshal.setUserId(Integer.valueOf(id)); unmarshal.setFillDate(new Date()); list.add(unmarshal); //记录处理的方式为返修的次数 if (unmarshal.getWay()==1){ a.getAndIncrement(); } //记录这个处理意见关联的不合格订单id unId.set(opinionMapper.selectById(unmarshal.getId()).getRawUnacceptedId()); } catch (Exception e) { throw new RuntimeException(e); } }); return opinionMapper.updateOpinion(list); //编辑意见之后姜处理状态修改为1已处理 InspectUnaccepted inspectUnaccepted = inspectUnacceptedMapper.selectById(unId.get()); inspectUnaccepted.setDealState(1); inspectUnacceptedMapper.updateById(inspectUnaccepted); //如果全部都是返修则返回检验,将检验状态清空 if (a.get()==opinion.size()){ switch (inspectUnaccepted.getType()){ case 1: //成品检验单 finishedInspectMapper.updById(inspectUnaccepted.getRawInspectId()); //成品检验项目 List<InspectionItem> inspectionItemList = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query() .eq("type", 2) .eq("inspect_id", inspectUnaccepted.getRawInspectId())); inspectionItemMapper.updateBatch(inspectionItemList); break; case 2: //过程检验单 processInspectMapper.updById(inspectUnaccepted.getRawInspectId()); //过程检验项目 List<InspectionItem> inspectionItems = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query() .eq("type", 1) .eq("inspect_id", inspectUnaccepted.getRawInspectId())); inspectionItemMapper.updateBatch(inspectionItems); break; case 0: //原材料检验单 rawInspectMapper.updById(inspectUnaccepted.getRawInspectId()); //原材料检验项目 List<RawInsProduct> rawInsProductList = rawInsProductMapper.selectList(Wrappers.<RawInsProduct>query() .eq("raw_inspect_id", inspectUnaccepted.getRawInspectId())); rawInsProductMapper.updateBatch(rawInsProductList); break; default: break; } } //更新意见 return opinionMapper.updateOpinion(list); } @Override inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml
@@ -1,6 +1,12 @@ <?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.FinishedInspectMapper"> <!--清空检验状态--> <update id="updById"> update mom_ocean.finished_inspect set result=null where id = #{rawInspectId} </update> <select id="selectFinishedInspectPage" resultType="map"> SELECT f.`id`, f.`order_number`, inspect-server/src/main/resources/mapper/InspectionItemMapper.xml
@@ -1,6 +1,36 @@ <?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.InspectionItemMapper"> <!--把原有的检验项目的数据清空--> <update id="updateBatch"> UPDATE mom_ocean.inspection_item o <trim prefix="set" suffixOverrides=","> <trim prefix="inspection_value=case" suffix="end,"> <foreach collection="inspectionItems" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> <trim prefix="device_id=case" suffix="end,"> <foreach collection="inspectionItems" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> <trim prefix="result=case" suffix="end,"> <foreach collection="inspectionItems" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> <trim prefix="username=case" suffix="end,"> <foreach collection="inspectionItems" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> </trim> WHERE o.id in <foreach collection="inspectionItems" index="index" item="item" separator="," open="(" close=")"> #{item.id, jdbcType=BIGINT} </foreach> </update> <resultMap id="selectInspectionItemMap" type="inspectionItemDto"> <id property="father" column="ifather"/> <association property="children" resultMap="selectInspectionItemDto2Map"/> inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml
@@ -1,6 +1,11 @@ <?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.ProcessInspectMapper"> <!--将检验状态修改为null--> <update id="updById"> update mom_ocean.process_inspect set result=null where id=#{rawInspectId} </update> <!--新增过程检验单-根据订单号选择产品信息和工艺--> <resultMap id="oneMap" type="map"> <id property="name" column="material"/> inspect-server/src/main/resources/mapper/RawInsProductMapper.xml
@@ -1,6 +1,36 @@ <?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.RawInsProductMapper"> <!--批量清空检验状态--> <update id="updateBatch"> UPDATE mom_ocean.raw_ins_product o <trim prefix="set" suffixOverrides=","> <trim prefix="test_value=case" suffix="end,"> <foreach collection="rawInsProductList" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> <trim prefix="device_id=case" suffix="end,"> <foreach collection="rawInsProductList" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> <trim prefix="test_state=case" suffix="end,"> <foreach collection="rawInsProductList" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> <trim prefix="user_id=case" suffix="end,"> <foreach collection="rawInsProductList" item="item" index="index"> WHEN o.id = #{item.id} THEN null </foreach> </trim> </trim> WHERE o.id in <foreach collection="rawInsProductList" index="index" item="item" separator="," open="(" close=")"> #{item.id, jdbcType=BIGINT} </foreach> </update> <!--根据原材料检验单id查询检验项目--> <select id="getresult" resultType="java.lang.Integer"> select test_state inspect-server/src/main/resources/mapper/RawInspectMapper.xml
@@ -3,6 +3,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yuanchu.mom.mapper.RawInspectMapper"> <!--清空原材料检验结论--> <update id="updById"> update mom_ocean.raw_inspect set ins_state=0, ins_time=null, judge_state=null where id = #{rawInspectId} </update> <select id="selCountRaw" resultType="java.lang.Integer"> select count(id) from mom_ocean.raw_inspect inventory-server/src/main/java/com/yuanchu/mom/pojo/Sale.java
@@ -87,9 +87,10 @@ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date updateTime; @ApiModelProperty(value = "状态 0:不通过;1:通过") @ApiModelProperty(value = "状态 0:不通过;1:通过;2:未审核") private Integer type; @ApiModelProperty(value = "备注") private String note; } system-run/src/main/resources/application-dev.yml
@@ -34,7 +34,7 @@ datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.22:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 url: jdbc:mysql://114.132.189.42:9004/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 username: user password: 123456 druid: @@ -59,9 +59,9 @@ # redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突 database: 0 # redis服务器地址(默认为localhost) host: 192.168.0.22 host: 114.132.189.42 # redis端口(默认为6379) port: 6379 port: 9003 # redis访问密码(默认为空) password: null # redis连接超时时间(单位毫秒)