| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.mapper.InspectUnacceptedMapper; |
| | | import com.yuanchu.mom.pojo.InspectUnaccepted; |
| | | import com.yuanchu.mom.pojo.RawInspect; |
| | | import com.yuanchu.mom.mapper.InspectionItemMapper; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.pojo.dto.InspectionItemDto; |
| | | import com.yuanchu.mom.pojo.vo.RawInspectVo; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.xml.crypto.Data; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 不合格品检验表(InspectUnaccepted)表服务实现类 |
| | |
| | | @Autowired |
| | | private ProcessInspectService processInspectService; |
| | | |
| | | //查询成品不合格品检验单列表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectUnRawInspectsList(Page<Object> page, String formTime, Integer dealState, Integer productCategories) { |
| | | return inspectUnacceptedMapper.selectInsList(page, formTime, dealState, productCategories); |
| | | } |
| | | @Resource |
| | | InspectionItemMapper inspectionItemMapper; |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> selectUnqualifiedRawMaterials(Page<Object> page, String formTime, String productName, String supplier, Integer processingStatus) { |
| | | return inspectUnacceptedMapper.selectUnqualifiedRawMaterials(page, formTime, productName, supplier, processingStatus); |
| | | } |
| | | @Resource |
| | | InspectionItemService inspectionItemService; |
| | | |
| | | //不合格处置列表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectDisposal(Page<Object> page, String specificationModel, String productName, Integer productCategories, Integer state) { |
| | | return inspectUnacceptedMapper.selectDisposal(page, specificationModel, productName, productCategories, state); |
| | | } |
| | | |
| | | //现象描述失焦保存 |
| | | @Override |
| | | public Integer descriptionUpdate(Integer rawUnacceptedId, String tell) { |
| | | LambdaUpdateWrapper<InspectUnaccepted> updateWrapper = Wrappers.<InspectUnaccepted>lambdaUpdate() |
| | |
| | | return inspectUnacceptedMapper.update(new InspectUnaccepted(), updateWrapper); |
| | | } |
| | | |
| | | //评审 |
| | | @Override |
| | | public Integer rawEvaluate(Integer rawId, Integer passOrNo) { |
| | | LambdaUpdateWrapper<InspectUnaccepted> updateWrapper = Wrappers.<InspectUnaccepted>lambdaUpdate() |
| | | .eq(InspectUnaccepted::getId, rawId) |
| | | .set(InspectUnaccepted::getDealReasult, passOrNo); |
| | | return inspectUnacceptedMapper.update(new InspectUnaccepted(), updateWrapper); |
| | | } |
| | | |
| | | //编辑处置意见确定按钮 |
| | | @Override |
| | | public Integer editDisposalOpinionConfirmation(Integer rawUnacceptedId, String opinionTell, Integer way, Integer type) { |
| | | //根据不合格品id查询不合格品信息 |
| | | InspectUnaccepted inspectUnaccepted = inspectUnacceptedMapper.selectById(rawUnacceptedId); |
| | | LambdaUpdateWrapper<InspectUnaccepted> updateWrapper = Wrappers.<InspectUnaccepted>lambdaUpdate() |
| | | .eq(InspectUnaccepted::getId, rawUnacceptedId) |
| | | .set(InspectUnaccepted::getWay, way) |
| | | .set(InspectUnaccepted::getDealState, 1) |
| | | .set(InspectUnaccepted::getDealTime, new Date()) |
| | | .set(InspectUnaccepted::getOpinionTell, opinionTell); |
| | | if (way == 1){ |
| | | if (way == 1) { |
| | | // 等于0:原材料 |
| | | if (type == 0){ |
| | | // 根据Id查询原材料检验信息信息 |
| | | if (type == 0) { |
| | | // 根据Id查询原材料检验信息 |
| | | RawInspectVo map = inspectUnacceptedMapper.editDisposalOpinionConfirmation(rawUnacceptedId); |
| | | RawInspect rawInspect = new RawInspect(); |
| | | BeanUtils.copyProperties(map, rawInspect); |
| | |
| | | // 批量保存子级 |
| | | rawInsProductService.batchAddInsProduct(rawInspect.getId(), map.getRawInsProducts()); |
| | | } |
| | | // 等于1:产品 |
| | | // 等于1:产品检验(半成品) |
| | | else if (type == 1) { |
| | | // TODO 该接口只剩余这两处 |
| | | //根据id查询产品检验信息 |
| | | FinishedInspect finishedInspect = finishedInspectService.getById(inspectUnaccepted.getRawInspectId()); |
| | | //根据产品检验单id查询检验项目 |
| | | List<InspectionItem> inspectionItems = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query() |
| | | .eq("inspect_id", finishedInspect.getId()) |
| | | .eq("type", 2)); |
| | | //保存产品单 |
| | | finishedInspect.setId(null); |
| | | finishedInspect.setResult(null); |
| | | finishedInspectService.save(finishedInspect); |
| | | //保存产品项目 |
| | | List<InspectionItem> inspectionItemList = inspectionItems.stream().map(inspectionItem -> { |
| | | inspectionItem.setId(null); |
| | | inspectionItem.setInspectionValue(null); |
| | | inspectionItem.setDeviceId(null); |
| | | inspectionItem.setResult(null); |
| | | inspectionItem.setInspectId(finishedInspect.getId()); |
| | | inspectionItem.setUsername(null); |
| | | return inspectionItem; |
| | | }).collect(Collectors.toList()); |
| | | inspectionItemService.saveBatch(inspectionItemList); |
| | | } |
| | | // 等于2:过程 |
| | | // 等于2:过程检验(在制品) |
| | | else if (type == 2) { |
| | | // TODO 该接口只剩余这两处 |
| | | //根据id查询产品检验信息 |
| | | ProcessInspect processInspect = processInspectService.getById(inspectUnaccepted.getRawInspectId()); |
| | | //根据产品检验单id查询检验项目 |
| | | List<InspectionItem> inspectionItems = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query() |
| | | .eq("inspect_id", processInspect.getId()) |
| | | .eq("type", 1)); |
| | | //保存产品单 |
| | | processInspect.setId(null); |
| | | processInspect.setResult(null); |
| | | processInspectService.save(processInspect); |
| | | //保存产品项目 |
| | | List<InspectionItem> inspectionItemList = inspectionItems.stream().map(inspectionItem -> { |
| | | inspectionItem.setId(null); |
| | | inspectionItem.setInspectionValue(null); |
| | | inspectionItem.setDeviceId(null); |
| | | inspectionItem.setResult(null); |
| | | inspectionItem.setInspectId(processInspect.getId()); |
| | | inspectionItem.setUsername(null); |
| | | return inspectionItem; |
| | | }).collect(Collectors.toList()); |
| | | inspectionItemService.saveBatch(inspectionItemList); |
| | | } |
| | | } else if (way == 2 || way == 3 || way == 4){ |
| | | } else if (way == 2 || way == 3 || way == 4) { |
| | | updateWrapper.set(InspectUnaccepted::getFaultyMaterials, 1); |
| | | } |
| | | return inspectUnacceptedMapper.update(new InspectUnaccepted(), updateWrapper); |