| | |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.service.InsOrderService; |
| | | import com.yuanchu.mom.service.InsProductService; |
| | | import com.yuanchu.mom.utils.GiveCode; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import com.yuanchu.mom.vo.SampleDefectsFatherVo; |
| | |
| | | private InsSampleMapper insSampleMapper; |
| | | |
| | | private InsProductMapper insProductMapper; |
| | | private InsProductService insProductService; |
| | | |
| | | private GiveCode giveCode; |
| | | |
| | |
| | | } |
| | | insSampleMapper.insert(a); |
| | | if (ObjectUtil.isNotEmpty(a.getInsProduct())) { |
| | | //普通检验项目(除了光纤接头损耗)的添加 |
| | | addInsProductMethod(a.getId(), a.getInsProduct(), null, 0); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(a.getInsulating())) { |
| | |
| | | sample.setId(null); |
| | | insSampleMapper.insert(sample); |
| | | try { |
| | | InsProduct insProduct = sample.getInsProduct().stream().filter(a -> Objects.equals(a.getInspectionItem(), "熔接损耗")).findFirst().get(); |
| | | insProduct.setId(null); |
| | | insProduct.setInsSampleId(sample.getId()); |
| | | insProductMapper.insert(insProduct); |
| | | List<InsProduct> insProducts = sample.getInsProduct().stream().filter(a -> Objects.equals(a.getInspectionItem(), "光纤接头损耗")).collect(Collectors.toList()); |
| | | for (InsProduct insProduct : insProducts) { |
| | | insProduct.setId(null); |
| | | insProduct.setInsSampleId(sample.getId()); |
| | | insProductMapper.insert(insProduct); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | private void addInsProductMethod(Integer sampleId, List<InsProduct> productList, Integer id, Integer type) { |
| | | InsOrder insOrder = insOrderMapper.selectById(insSampleMapper.selectById(sampleId).getInsOrderId()); |
| | | for (InsProduct product : productList) { |
| | | /*if(product.getState()==1 && (product.getAsk().indexOf("D")>-1||product.getAsk().indexOf("W")>-1||product.getAsk().indexOf("X")>-1 |
| | | ||product.getAsk().indexOf("RTS")>-1||product.getAsk().indexOf("H")>-1||product.getAsk().indexOf("L")>-1)){ |
| | | throw new ErrorException("提交失败,存在未填写的变量:"+product.getInspectionItem()+" "+product.getInspectionItemSubclass()); |
| | | }*/ |
| | | if (product.getState() == 1 && !product.getInspectionItem().equals("熔接损耗")) { |
| | | switch (type) { |
| | | case 1: |
| | | product.setInsFibersId(id); |
| | | break; |
| | | case 2: |
| | | product.setInsFiberId(id); |
| | | break; |
| | | if (product.getState() == 1 && !product.getInspectionItem().equals("光纤接头损耗")) { |
| | | //判断光缆的温度循环项目添加 |
| | | if (insOrder.getSampleType().equals("光缆") && product.getInspectionItem().equals("温度循环") && type != 0) { |
| | | List<InsProduct> insProductes = new ArrayList<>(); |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | String[] strings = product.getAsk().split(";"); |
| | | for (int i = 0; i < strings.length; i++) { |
| | | if (i != strings.length - 1) { |
| | | InsProduct insProduct = new InsProduct(); |
| | | switch (type) { |
| | | case 1: |
| | | insProduct.setInsFibersId(id); |
| | | break; |
| | | case 2: |
| | | insProduct.setInsFiberId(id); |
| | | break; |
| | | } |
| | | String[] split = strings[i].split(","); |
| | | insProduct.setInspectionItem("1次");//检验项--循环次数 |
| | | insProduct.setInspectionItemSubclass(split[0]);//检验项--温度 |
| | | insProduct.setInspectionItemClass(split[1]);//检验项--光纤项目 |
| | | insProduct.setAsk(split[2]);//检验要求 |
| | | insProduct.setTell(strings[i]);//检验描述 |
| | | insProducts.add(insProduct); |
| | | insProductes.add(insProduct); |
| | | } else { |
| | | //最后一个数据是说明会循环多少次 |
| | | int count = Integer.parseInt(strings[i]); |
| | | if (count > 1) { |
| | | //循环超过1次 |
| | | for (int j = 2; j <= count; j++) { |
| | | for (InsProduct insProduct : insProducts) { |
| | | if (!insProduct.getInspectionItemSubclass().equals("20℃")) { |
| | | insProduct.setInspectionItem(j + "次"); |
| | | insProductes.add(insProduct); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | insProductService.saveBatch(insProductes); |
| | | } else { |
| | | switch (type) { |
| | | case 1: |
| | | product.setInsFibersId(id); |
| | | break; |
| | | case 2: |
| | | product.setInsFiberId(id); |
| | | break; |
| | | } |
| | | product.setId(null); |
| | | product.setCreateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setInsSampleId(sampleId); |
| | | if (product.getInspectionItemSubclass() == null) { |
| | | product.setInspectionItemSubclass(""); |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | product.setId(null); |
| | | product.setCreateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setInsSampleId(sampleId); |
| | | if (product.getInspectionItemSubclass() == null) { |
| | | product.setInspectionItemSubclass(""); |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | } |
| | | } |
| | |
| | | code = ""; |
| | | } |
| | | String code2 = customMapper.selectById(insOrder.getCompanyId()).getCode2(); |
| | | insOrder.setEntrustCode(giveCode.giveCode("JC/ZX" + code + "-" + code2 + "-", "ins_order", "", "yyMM")); |
| | | insOrder.setEntrustCode(giveCode.giveCode2("JCZX/" + code + "-" + code2 + "-", insOrder.getCompanyId(), insOrder.getLaboratory(), "ins_order", "", "yyMM")); |
| | | } |
| | | return insOrderMapper.updateById(insOrder); |
| | | } |