| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.dto.CostStatisticsDto; |
| | | import com.yuanchu.mom.dto.SampleOrderDto; |
| | | import com.yuanchu.mom.dto.SampleProductDto; |
| | | import com.yuanchu.mom.dto.SampleProductDto2; |
| | | import com.yuanchu.mom.dto.*; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.*; |
| | |
| | | UserMapper userMapper; |
| | | |
| | | PowerMapper powerMapper; |
| | | |
| | | private InsBushingMapper insBushingMapper; |
| | | |
| | | private InsFibersMapper insFibersMapper; |
| | | |
| | | private InsFiberMapper insFiberMapper; |
| | | |
| | | |
| | | //获取检验下单数据 |
| | |
| | | } |
| | | insSampleMapper.insert(a); |
| | | if (ObjectUtil.isNotEmpty(a.getInsProduct())) { |
| | | for (InsProduct product : a.getInsProduct()) { |
| | | product.setId(null); |
| | | product.setCreateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setInsSampleId(a.getId()); |
| | | if (product.getInspectionItemSubclass() == null) { |
| | | product.setInspectionItemSubclass(""); |
| | | addInsProductMethod(a.getId(), a.getInsProduct(), null, 0); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(a.getBushing())) { |
| | | for (BushingDto bushingDto : a.getBushing()) { |
| | | bushingDto.setInsSampleId(a.getInsOrderId()); |
| | | insBushingMapper.insert(bushingDto); |
| | | if(bushingDto.getFiber().size()!=0){ |
| | | for (FiberDto fiberDto : bushingDto.getFiber()) { |
| | | fiberDto.setInsBushingId(bushingDto.getId()); |
| | | insFiberMapper.insert(fiberDto); |
| | | addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2); |
| | | } |
| | | }else{ |
| | | for (FibersDto fibersDto : bushingDto.getFibers()) { |
| | | fibersDto.setInsBushingId(bushingDto.getId()); |
| | | insFibersMapper.insert(fibersDto); |
| | | for (FiberDto fiberDto : fibersDto.getFiber()) { |
| | | fiberDto.setInsFibersId(fibersDto.getId()); |
| | | insFiberMapper.insert(fiberDto); |
| | | addInsProductMethod(a.getId(), fiberDto.getProductList(), fiberDto.getId(), 2); |
| | | } |
| | | addInsProductMethod(a.getId(), fibersDto.getProductList(), fibersDto.getId(), 1); |
| | | } |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | } |
| | | }); |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | private void addInsProductMethod(Integer sampleId, List<InsProduct> productList, Integer id, Integer type) { |
| | | for (InsProduct product : productList) { |
| | | if(product.getState()==1){ |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getInsOrder(Integer id) { |
| | | Map<String, Object> map = new HashMap<>(); |