| | |
| | | //分页查询不合格品处置 |
| | | IPage<Map<String, Object>> selectDisposal(Page<Object> page, String specificationModel, String productName, Integer productCategories, Integer state); |
| | | |
| | | //根据Id查询原材料检验信息 |
| | | RawInspectVo editDisposalOpinionConfirmation(Integer rawUnacceptedId); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | private String userName; |
| | | |
| | | /** |
| | | * IFS中该物料的其他信息 |
| | | */ |
| | | private String message; |
| | | |
| | | @ApiModelProperty(value = "逻辑删除 正常>=1,删除<=0", hidden = true) |
| | | private Integer state; |
| | | |
| | |
| | | @JsonSerialize |
| | | private String userName; |
| | | |
| | | /** |
| | | * IFS中该物料的其他信息 |
| | | */ |
| | | private String message; |
| | | |
| | | /* 检验项目 */ |
| | | @JsonSerialize |
| | | private List<RawInsProductVo> rawInsProducts; |
| | |
| | | */ |
| | | void updateDevByRpId(Integer rpId, Integer devId); |
| | | |
| | | void batchAddInsProduct(Integer id, List<RawInsProductVo> rawInsProducts); |
| | | } |
| | | |
| | |
| | | } 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 = null; |
| | | for (InspectionItem inspectionItem : inspectionItemList) { |
| | | msg += inspectionItem.getName(); |
| | | } |
| | | InspectUnaccepted finishUnaccepted = InspectUnaccepted.builder() |
| | | .reason(finishedInspect.getMaterial() + "不合格") //暂且定义为产品名称不合格 |
| | | .reason(msg + "不合格") //暂且定义为项目+不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(1) //类型为成品检验 |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.mapper.InspectUnacceptedMapper; |
| | | import com.yuanchu.mom.mapper.InspectionItemMapper; |
| | | import com.yuanchu.mom.mapper.RawInsProductMapper; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.pojo.dto.InspectionItemDto; |
| | | import com.yuanchu.mom.pojo.vo.RawInspectVo; |
| | |
| | | //原材料检验子数据 |
| | | @Autowired |
| | | private RawInsProductService rawInsProductService; |
| | | |
| | | @Resource |
| | | RawInsProductMapper rawInsProductMapper; |
| | | |
| | | //产品检验 |
| | | @Autowired |
| | |
| | | // 等于0:原材料 |
| | | if (type == 0) { |
| | | // 根据Id查询原材料检验信息 |
| | | RawInspectVo map = inspectUnacceptedMapper.editDisposalOpinionConfirmation(rawUnacceptedId); |
| | | RawInspect rawInspect = new RawInspect(); |
| | | BeanUtils.copyProperties(map, rawInspect); |
| | | RawInspect rawInspect = rawInspectService.getById(inspectUnaccepted.getRawInspectId()); |
| | | List<RawInsProduct> rawInsProductList = rawInsProductMapper.selectList(Wrappers.<RawInsProduct>query() |
| | | .eq("raw_inspect_id", rawInspect.getId())); |
| | | // 保存父级 |
| | | rawInspect.setId(null); |
| | | rawInspect.setInsState(0); |
| | | rawInspect.setJudgeState(null); |
| | | rawInspect.setInsTime(null); |
| | | rawInspectService.save(rawInspect); |
| | | // 批量保存子级 |
| | | rawInsProductService.batchAddInsProduct(rawInspect.getId(), map.getRawInsProducts()); |
| | | List<RawInsProduct> rawInsProducts = rawInsProductList.stream().map(rawInsProduct -> { |
| | | rawInsProduct.setId(null); |
| | | rawInsProduct.setTestValue(null); |
| | | rawInsProduct.setTestState(null); |
| | | rawInsProduct.setDeviceId(null); |
| | | rawInsProduct.setRawInspectId(rawInspect.getId()); |
| | | rawInsProduct.setUserId(null); |
| | | return rawInsProduct; |
| | | }).collect(Collectors.toList()); |
| | | rawInsProductService.saveBatch(rawInsProducts); |
| | | } |
| | | // 等于1:产品检验(半成品) |
| | | else if (type == 1) { |
| | |
| | | } else return "项目未检验完!"; |
| | | /*如果检验结论为不合格,则需要新增不合格检验单*/ |
| | | if (processInspect.getResult() == 0) { |
| | | //查询该检验单哪些检验项目不合格 |
| | | List<InspectionItem> inspectionItemList = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query() |
| | | .eq("inspect_id", id) |
| | | .eq("result", 0) |
| | | .eq("type", 1)); |
| | | String msg = null; |
| | | for (InspectionItem inspectionItem : inspectionItemList) { |
| | | msg += inspectionItem.getName(); |
| | | } |
| | | InspectUnaccepted processUnaccepted = InspectUnaccepted.builder() |
| | | .reason(processInspect.getMaterial() + processInspect.getTechname() + "不合格") //暂且定义为产品名称+工艺不合格 |
| | | .reason(processInspect.getTechname() + msg + "不合格") //定义为工艺+项目不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(2) //类型为过程检验 |
| | |
| | | rawInsProductMapper.update(new RawInsProduct(), updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void batchAddInsProduct(Integer id, List<RawInsProductVo> rawInsProducts) { |
| | | List<RawInsProduct> rawInsProductList = new ArrayList<>(); |
| | | rawInsProducts.forEach(i -> { |
| | | RawInsProduct rawInsProduct1 = new RawInsProduct(); |
| | | BeanUtils.copyProperties(i, rawInsProduct1); |
| | | rawInsProduct1.setRawInspectId(id); |
| | | rawInsProduct1.setState(1); |
| | | rawInsProductList.add(rawInsProduct1); |
| | | }); |
| | | rawInsProductMapper.insertBatchSomeColumn(rawInsProductList); |
| | | } |
| | | |
| | | /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/ |
| | | //如果是±的操作 |
| | | private int conValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.Task.BatchInfo; |
| | | import com.yuanchu.mom.Task.SyncOrder; |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.*; |
| | |
| | | rawInspectVo.setNumber(Integer.parseInt(String.valueOf(map.get("QTY_TO_INSPECT")))); //数量 |
| | | rawInspectVo.setFormTime(DateUtil.parse(map.get("APPROVED_DATE").toString())); //来料日期 |
| | | rawInspectVo.setSupplier(map.get("SUPPLIER_NAME").toString()); //供应商 |
| | | String orderNo = map.get("ORDER_NO").toString();//订单号 |
| | | String releaseNo = map.get("RELEASE_NO").toString();//下达号 |
| | | String lineNo = map.get("LINE_NO").toString();//行号 |
| | | String lotBatchNo = map.get("LOT_BATCH_NO").toString();//批号 |
| | | String locationNo = map.get("LOCATION_NO").toString();//库位号 |
| | | rawInspectVo.setMessage(orderNo+","+releaseNo+","+lineNo+","+lotBatchNo+","+locationNo); |
| | | } |
| | | } |
| | | } |
| | |
| | | } else return "项目未检验完!"; |
| | | /*如果检验结论为不合格,则需要新增不合格检验单*/ |
| | | if (rawInspect.getJudgeState() == 0) { |
| | | //查询该检验单哪些检验项目不合格 |
| | | List<RawInsProduct> rawInsProductList = rawInsProductMapper.selectList(Wrappers.<RawInsProduct>query() |
| | | .eq("raw_inspect_id", id) |
| | | .eq("test_state", 0)); |
| | | String msg = null; |
| | | for (RawInsProduct rawInsProduct : rawInsProductList) { |
| | | msg+=rawInsProduct.getName(); |
| | | } |
| | | InspectUnaccepted rawUnaccepted = InspectUnaccepted.builder() |
| | | .reason(rawInspectMapper.selectById(id).getName() + "不合格") //暂且定义为原材料不合格 |
| | | .reason(msg + "不合格") //定义为不合格的项目+不合格 |
| | | .number(number) |
| | | .rawInspectId(id) |
| | | .type(0) //类型为原材料 |
| | |
| | | inspectUnacceptedMapper.insert(rawUnaccepted); |
| | | } |
| | | /*检验完成后,无论合格与否,将IFS报检状态更改为已接收*/ |
| | | |
| | | //根据检验单id查询原材料检验单 |
| | | RawInspect rawIns = rawInspectMapper.selectById(id); |
| | | String[] split = rawIns.getMessage().split(","); |
| | | BatchInfo batchInfo = new BatchInfo(); |
| | | batchInfo.setOrderNo(split[0]); |
| | | batchInfo.setReleaseNo(split[1]); |
| | | batchInfo.setLineNo(split[2]); |
| | | batchInfo.setPartNo(rawIns.getCode()); |
| | | batchInfo.setLotBatchNo(split[3]); |
| | | batchInfo.setLocationNo(split[4]); |
| | | if (ObjectUtils.isEmpty(number)) { |
| | | //如果不合格的数量为空null |
| | | number=0; |
| | | } |
| | | batchInfo.setQtyToReceive(rawIns.getNumber()-number); //要接收的数量 |
| | | batchInfo.setQtyToInspect(rawIns.getNumber()); //要检验的数量 |
| | | batchInfo.setReceiveCase("接收到来料区"); |
| | | List<BatchInfo> batchInfos = Arrays.asList(batchInfo); |
| | | //发送IFS请求 |
| | | String s = SyncOrder.importPolReceive(batchInfos); |
| | | System.out.println(s); |
| | | System.out.println("'''''''''''''''''''''''"); |
| | | return rawInspect.getJudgeState().toString(); |
| | | } |
| | | |
| | |
| | | <?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="selectDisposal" resultType="map"> |
| | | 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`, i.way, i.faulty_materials, i.opinion_tell |
| | | i.`tell` opinions, s.user_name, DATE_FORMAT(i.`create_time`, '%Y-%m-%d') `date`, i.`deal_state`, i.way, |
| | | i.faulty_materials, i.opinion_tell,faulty_materials,reason |
| | | FROM mom_ocean.inspect_unaccepted i |
| | | LEFT JOIN |
| | | ( |
| | |
| | | AND s.`type` = #{productCategories} |
| | | </if> |
| | | ORDER BY i.`update_time` DESC |
| | | </select> |
| | | |
| | | <resultMap id="editDisposalOpinionConfirmationMap" type="com.yuanchu.mom.pojo.vo.RawInspectVo"> |
| | | <id property="code" column="code"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="name" column="name"/> |
| | | <result property="specifications" column="specifications"/> |
| | | <result property="formTime" column="form_time"/> |
| | | <result property="number" column="number"/> |
| | | <result property="supplier" column="supplier"/> |
| | | <result property="userName" column="user_name"/> |
| | | <collection property="rawInsProducts" ofType="com.yuanchu.mom.pojo.vo.RawInsProductVo"> |
| | | <result property="name" column="pNmae"/> |
| | | <result property="unit" column="pUnit"/> |
| | | <result property="required" column="required"/> |
| | | <result property="deviceId" column="device_id"/> |
| | | <result property="internal" column="internal"/> |
| | | <result property="testValue" column="test_value"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="editDisposalOpinionConfirmation" resultMap="editDisposalOpinionConfirmationMap"> |
| | | select r.`form_time`, r.`specifications`, r.`code`, r.`name`, r.`unit`, r.`number`, r.`supplier`, r.`user_name`, p.`name` pNmae, p.`unit` pUnit, |
| | | p.`required`,p.`internal`, p.`test_value`, p.`device_id` |
| | | from (mom_ocean.inspect_unaccepted i, mom_ocean.raw_inspect r) |
| | | left join mom_ocean.raw_ins_product p on r.`id` = p.`raw_inspect_id` |
| | | where i.`id` = #{rawUnacceptedId} |
| | | and i.`raw_inspect_id` = r.`id` |
| | | </select> |
| | | </mapper> |