| | |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | 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.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | import com.ruoyi.basic.mapper.StructureItemParameterMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.basic.pojo.StandardProductList; |
| | | import com.ruoyi.basic.pojo.StructureItemParameter; |
| | | import com.ruoyi.basic.pojo.StructureTestObject; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.api.IfsApiUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.mapper.*; |
| | |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import com.ruoyi.inspect.service.InsSampleService; |
| | | import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | import com.ruoyi.inspect.vo.SampleDefectsFatherVo; |
| | | import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours; |
| | | import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary; |
| | | import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService; |
| | | import com.ruoyi.system.mapper.CustomMapper; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | private IfsApiUtils ifsApiUtils; |
| | | private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | private StandardProductListMapper standardProductListMapper; |
| | | private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService; |
| | | private StructureItemParameterMapper structureItemParameterMapper; |
| | | |
| | | |
| | | |
| | | //获取检验下单数据 |
| | | @Override |
| | | public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | //todo: 只看我判断全部,个人,组织的权限 |
| | | String laboratory = null; |
| | | // 判断是否是全部 |
| | | String isOrderAll = null; |
| | |
| | | spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem); |
| | | } |
| | | |
| | | |
| | | // 创建工时暂存 |
| | | // 缓存样品id, 编号map |
| | | Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode)); |
| | | List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getState, 1)); |
| | | List<AuxiliaryOutputWorkingHoursTemporary> outputWorkingHours = insProductList.stream().map(insProduct -> { |
| | | AuxiliaryOutputWorkingHoursTemporary auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHoursTemporary(); |
| | | auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//检测项分类 |
| | | auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//检测父项 |
| | | auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//检测子项 |
| | | auxiliaryOutputWorkingHours.setSample(sampleMap.get(insProduct.getInsSampleId()));//样品编号 |
| | | auxiliaryOutputWorkingHours.setOrderId(order.getId());//订单id |
| | | auxiliaryOutputWorkingHours.setOrderNo(order.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//产量工时 |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//日期 |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//星期 |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次 |
| | | auxiliaryOutputWorkingHours.setCheck(userId);//检测人 |
| | | auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//单价 |
| | | auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//样品id |
| | | auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//检验项id |
| | | |
| | | return auxiliaryOutputWorkingHours; |
| | | }).collect(Collectors.toList()); |
| | | auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | public static String getWeek(String dayStr) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | default: |
| | | return "未知"; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 如果你使用 Java 8+,也可以用 Stream API 简化代码: |
| | | public List<StandardProductList> findMissingItemsWithStream(List<StandardProductList> standardList, |
| | | List<InsProduct> insList) { |
| | | Set<Integer> insIds = insList.stream() |
| | | .map(InsProduct::getStructureItemParameterId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | return standardList.stream() |
| | | .filter(product -> !insIds.contains(product.getStructureItemParameterId())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) { |
| | | throw new ErrorException("有检验项的要求值或要求描述为空, 请先去标准库配置要求值或要求描述"); |
| | | } |
| | | if (StringUtils.isBlank(product.getSonLaboratory())) { |
| | | throw new ErrorException("有检验项的的子实验室为绑定, 请先绑定子实验室"); |
| | | } |
| | | insProductMapper.insert(product); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void getIfsOrder() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("LOCATION_NO","1302"); |
| | | map.put("STATE_DB","To be Inspected"); |
| | | public void getIfsOrder(Map<String, Object> map,Boolean isSplitOrder) { |
| | | List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map)); |
| | | if(inventory.size() == 0) { |
| | | if(inventory.isEmpty()) { |
| | | return; |
| | | } |
| | | // 进行保存 |
| | |
| | | ifsInventoryQuantity.setIsSource(1); |
| | | ifsInventoryQuantity.setState(0); |
| | | |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | Long count = ifsInventoryQuantityMapper.selectCount(new LambdaQueryWrapper<IfsInventoryQuantity>() |
| | | .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo()) |
| | | .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo()) |
| | | .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo()) |
| | |
| | | .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo()) |
| | | .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq()) |
| | | ); |
| | | if(Objects.isNull(one)) { |
| | | |
| | | if(count == 0) { |
| | | ifsInventoryQuantity.setIsFirst(0); |
| | | if(isSplitOrder){ |
| | | ifsInventoryQuantity.setIsSplitOrder(1); |
| | | } |
| | | // 查询产业链检测数据 |
| | | String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), |
| | | ifsInventoryQuantity.getLineNo(), |
| | |
| | | * @param id |
| | | */ |
| | | @Transactional |
| | | public void updateIfsInventoryQuantity(Integer id) { |
| | | public void updateIfsInventoryQuantity(Long id) { |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsRegister, 1) |
| | | .eq(IfsInventoryQuantity::getId, id)); |
| | |
| | | |
| | | // 修改检验项 |
| | | for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) { |
| | | insSampleService.update(Wrappers.<InsSample>lambdaUpdate() |
| | | .eq(InsSample::getId, sampleProductDto.getId()) |
| | | .set(InsSample::getSpecialStandardMethod, sampleProductDto.getSpecialStandardMethod())); |
| | | |
| | | insProductService.updateBatchById(sampleProductDto.getInsProduct()); |
| | | } |
| | | |
| | |
| | | // 查询标准树 |
| | | List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() |
| | | .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId()) |
| | | .eq(StandardProductList::getTree, tree)); |
| | | .eq(StandardProductList::getTree, tree) |
| | | .orderByAsc(StandardProductList::getSort)); |
| | | for (StandardProductList standardProductList : standardProductLists) { |
| | | standardProductList.setId(null); |
| | | } |
| | |
| | | product.setCreateUser(null); |
| | | product.setUpdateTime(null); |
| | | product.setUpdateUser(null); |
| | | product.setSection(null); |
| | | product.setInsSampleId(omitOrderProductDto.getInsSampleId()); |
| | | if (StringUtils.isBlank(product.getCableTag())) { |
| | | product.setCableTag(null); |
| | |
| | | */ |
| | | @Override |
| | | public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) { |
| | | //判断全部,个人,组织的权限 |
| | | //todo:仅看我获取当前人所属实验室id |
| | | String laboratory = null; |
| | | // 判断是否是全部 |
| | | String isOrderAll = null; |
| | | if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { |
| | | isOrderAll = "1"; |
| | | sampleOrderDto.setState(null); |
| | | List<SampleOrderDto> sampleOrderDtoList = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(sampleOrderDto.getIds())) { |
| | | List<String> orderIds = StrUtil.split(sampleOrderDto.getIds(), ","); |
| | | sampleOrderDtoList = insOrderMapper.getInsOrderExportByIds(orderIds); |
| | | } else { |
| | | String laboratory = null; |
| | | // 判断是否是全部 |
| | | String isOrderAll = null; |
| | | if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) { |
| | | isOrderAll = "1"; |
| | | sampleOrderDto.setState(null); |
| | | } |
| | | sampleOrderDto.setIds(null); |
| | | sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | } |
| | | List<SampleOrderDto> sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll); |
| | | |
| | | // 判断是否是不合格, 不合格查询不合格项 |
| | | for (SampleOrderDto orderDto : sampleOrderDtoList) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改样品型号 |
| | | * @param insSample |
| | | */ |
| | | @Override |
| | | public void updateSampleModel(InsSample insSample) { |
| | | // 判断当前订单是否生成了报告, 生成了报告不能修改单号 |
| | | Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insSample.getInsOrderId())); |
| | | if (count > 0 ) { |
| | | throw new ErrorException("当前订单已经生成了报告不能修改编号"); |
| | | } |
| | | |
| | | insSampleService.update(Wrappers.<InsSample>lambdaUpdate() |
| | | .eq(InsSample::getId, insSample.getId()) |
| | | .set(InsSample::getModel, insSample.getModel())); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间是否没有该检测项的抽样计划 |
| | | * @param sampleList |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder) { |
| | | // todo: 下单判断抽样计划的唯一性 |
| | | if (insOrder.getQuarterItemId() != null) { |
| | | Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) |
| | | .notIn(InsOrder::getState, -1 ,2 ,3)); |
| | | if (quarterItemCount > 0) { |
| | | throw new ErrorException("该抽样计划已被绑定过"); |
| | | } |
| | | } |
| | | |
| | | // 判断是否是抽样检测 |
| | | if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) { |
| | | Set<String> monthMessageSet = new HashSet<>(); |
| | | Set<String> quarterMessageSet = new HashSet<>(); |
| | | Set<String> yearMessageSet = new HashSet<>(); |
| | | |
| | | String formatTime = "yyyy-MM-dd HH:mm:ss"; |
| | | // 查询当前所有样品的检验项 |
| | | for (SampleProductDto sampleProductDto : sampleList) { |
| | | List<StandardProductList> standardProductList = getProductTreeBySampleId(sampleProductDto.getId()); |
| | | |
| | | Set<Integer> insIds = sampleProductDto.getInsProduct().stream() |
| | | .map(InsProduct::getStructureItemParameterId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | List<StandardProductList> productLists = standardProductList.stream() |
| | | .filter(product -> !insIds.contains(product.getStructureItemParameterId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 查询检验项基础表, 查询是否有月度, 季度, 年度的检验项 |
| | | List<StructureItemParameter> itemParameterList = structureItemParameterMapper.selectList(Wrappers.<StructureItemParameter>lambdaQuery() |
| | | .in(StructureItemParameter::getId, productLists.stream().map(StandardProductList::getStructureItemParameterId).collect(Collectors.toList()))); |
| | | |
| | | for (StructureItemParameter item : itemParameterList) { |
| | | if (StringUtils.isNotBlank(item.getSpotCheckType())) { |
| | | switch (item.getSpotCheckType()) { |
| | | case "1": // 月度 |
| | | // 查询当月是否有该检测项的抽样计划 |
| | | // 当月开始时间 |
| | | DateTime monthStart = DateUtil.beginOfMonth(DateUtil.date()); |
| | | String monthStartTime = monthStart.toString(formatTime); |
| | | // 当月结束时间 |
| | | DateTime monthEnd = DateUtil.endOfMonth(DateUtil.date()); |
| | | String monthEndTime = monthEnd.toString(formatTime); |
| | | Integer count = insOrderMapper.selectNotSpotCheckOrder(item.getId(), monthStartTime, monthEndTime); |
| | | if (count == 0) { |
| | | String monthMessage = item.getInspectionItemClass() + |
| | | item.getInspectionItem() + |
| | | item.getInspectionItemSubclass(); |
| | | monthMessageSet.add(monthMessage); |
| | | } |
| | | break; |
| | | case "2": // 季度 |
| | | DateTime quarterStart = DateUtil.beginOfQuarter(DateUtil.date()); |
| | | String quarterStartTime = quarterStart.toString(formatTime); |
| | | // 当月结束时间 |
| | | DateTime quarterEnd = DateUtil.endOfQuarter(DateUtil.date()); |
| | | String quarterEndTime = quarterEnd.toString(formatTime); |
| | | Integer quarterCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), quarterStartTime, quarterEndTime); |
| | | if (quarterCount == 0) { |
| | | String quarterMessage = item.getInspectionItemClass() + |
| | | item.getInspectionItem() + |
| | | item.getInspectionItemSubclass(); |
| | | quarterMessageSet.add(quarterMessage); |
| | | } |
| | | |
| | | break; |
| | | case "3": // 年度 |
| | | DateTime yearStart = DateUtil.beginOfQuarter(DateUtil.date()); |
| | | String yearStartTime = yearStart.toString(formatTime); |
| | | // 当月结束时间 |
| | | DateTime yearEnd = DateUtil.endOfQuarter(DateUtil.date()); |
| | | String yearEndTime = yearEnd.toString(formatTime); |
| | | Integer yearCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), yearStartTime, yearEndTime); |
| | | if (yearCount == 0) { |
| | | String yearMessage = item.getInspectionItemClass() + |
| | | item.getInspectionItem() + |
| | | item.getInspectionItemSubclass(); |
| | | yearMessageSet.add(yearMessage); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String message = ""; |
| | | if (CollectionUtils.isNotEmpty(monthMessageSet)) { |
| | | message += StrUtil.format("<p>检验项<span style=\"color: red\">{}</span>当月还未进行抽样检测, 请查看是否需要添加当前检验项</p>", CollUtil.join(monthMessageSet, ", ")); |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(quarterMessageSet)) { |
| | | message += StrUtil.format("<p>检验项<span style=\"color: red\">{}</span>当前季度还未进行抽样检测, 请看是否需要添加当前检验项</p>", CollUtil.join(quarterMessageSet, ", ")); |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(yearMessageSet)) { |
| | | message += StrUtil.format("<p>检验项<span style=\"color: red\">{}</span>今年还未进行抽样检测, 请看是否需要添加当前检验项</p>", CollUtil.join(yearMessageSet, ", ")); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(message)) { |
| | | return Result.success(false, message); |
| | | } |
| | | } |
| | | return Result.success(true); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * ifs移库操作 |
| | | * @param inventoryQuantity |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | public String moveRawMaterial(IfsInventoryQuantity inventoryQuantity) { |
| | | //查询ifs订单详情 |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(inventoryQuantity.getId()); |
| | | String toLocation; |
| | | // 登记采购检验结果STD |
| | | if (one.getIsRegister().equals(0)) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | map.put("LINE_NO", one.getLineNo()); // 行号 |
| | | map.put("RELEASE_NO", one.getReleaseNo()); // 下达号 |
| | | map.put("RECEIPT_NO", one.getReceiptNo()); // 接收号 |
| | | map.put("PURCH_QTY", one.getQtyToInspect()); // 要检验的采购数量 |
| | | resultList.add(map); |
| | | resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | resultMap.put("SYSCODE", "LIMS"); |
| | | resultMap.put("SYSMODEL", "登记采购检验结果"); |
| | | resultMap.put("BATCH_INFO", resultList); |
| | | Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap)); |
| | | if (result.getCode() != 200) { |
| | | throw new ErrorException("IFS登记采购检验结果失败: " + result.getMessage()); |
| | | } |
| | | //如果是拆分订单,则将同一接收号的订单标记已登记校验 |
| | | if(one.getIsSplitOrder()==1){ |
| | | //查询其余拆分的订单 |
| | | List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | .eq(IfsInventoryQuantity::getOrderNo, one.getOrderNo()) |
| | | .eq(IfsInventoryQuantity::getPartNo, one.getPartNo()) |
| | | .eq(IfsInventoryQuantity::getLineNo, one.getLineNo()) |
| | | .eq(IfsInventoryQuantity::getReleaseNo, one.getReleaseNo()) |
| | | .eq(IfsInventoryQuantity::getReceiptNo, one.getReceiptNo()) |
| | | .eq(IfsInventoryQuantity::getIsSplitOrder, 1) |
| | | ); |
| | | if(Objects.nonNull(quantityList) && !quantityList.isEmpty()){ |
| | | //修改采购订单登记状态 |
| | | List<Long> ids = quantityList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList()); |
| | | ifsInventoryQuantityMapper.update(null,Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsRegister,1) |
| | | .in(IfsInventoryQuantity::getId, ids) |
| | | ); |
| | | } |
| | | }else{ |
| | | this.updateIfsInventoryQuantity(one.getId()); |
| | | } |
| | | } |
| | | /** |
| | | * TODO 后续需要调用IFS的接口 移入的库位号 toLocation |
| | | */ |
| | | // 检验后移库 |
| | | toLocation = "1301"; |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | | moveMap.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | moveMap.put("LINE_NO", one.getLineNo()); |
| | | moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | moveMap.put("PART_NO", one.getPartNo()); |
| | | moveMap.put("QTY", one.getPurQtyInStore()); |
| | | moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | moveMap.put("TO_LOCATION_NO", toLocation); |
| | | moveMap.put("LOT_BATCH_NO", one.getLotBatchNo()); |
| | | moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | moveResultList.add(moveMap); |
| | | moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | moveResultMap.put("SYSCODE", "LIMS"); |
| | | moveResultMap.put("SYSMODEL", "检验后移库"); |
| | | moveResultMap.put("BATCH_INFO", moveResultList); |
| | | |
| | | Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | // 如果有必须为零件指定批号报错需要重新提交移库信息去指定批号 |
| | | if (result1.getCode() != 200) { |
| | | String message = result1.getMessage(); |
| | | if (message.contains("必须为零件") && message.contains("指定批号")) { |
| | | updaeBatch(one, toLocation); |
| | | } else { |
| | | throw new ErrorException("IFS检验后移库失败: " + result1.getMessage()); |
| | | } |
| | | } |
| | | return toLocation; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 先修改采购订单批次号, 后进行移库操作 |
| | | * @param one |
| | | * @param toLocation |
| | | */ |
| | | private void updaeBatch(IfsInventoryQuantity one, String toLocation) { |
| | | if (one.getIsUpdateBatch().equals(0)) { |
| | | // 先修改批次号后进行移库 |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | map.put("LINE_NO", one.getLineNo()); // 行号 |
| | | map.put("RELEASE_NO", one.getReleaseNo()); // 下达号 |
| | | map.put("RECEIPT_NO", one.getReceiptNo()); // 接收号 |
| | | map.put("PART_NO", one.getPartNo()); //零件号 |
| | | map.put("CONFIGURATION_ID", one.getConfigurationId()); // 配置标识 |
| | | map.put("LOCATION_NO", one.getLocationNo()); // 库位号 |
| | | map.put("LOT_BATCH_NO", one.getLotBatchNo());// 批次号 |
| | | map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // 目标批次号 |
| | | map.put("SERIAL_NO", one.getSerialNo()); // 序列号 |
| | | map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // 版本号 |
| | | map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdr号 |
| | | map.put("ACTIVITY_SEQ", one.getActivitySeq()); // 活动序号 |
| | | map.put("QTY_TO_CHANGE", one.getQtyArrived()); // 变更数量 |
| | | resultList.add(map); |
| | | resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | resultMap.put("SYSCODE", "LIMS"); |
| | | resultMap.put("SYSMODEL", "修改采购订单批次号"); |
| | | resultMap.put("BATCH_INFO", resultList); |
| | | |
| | | Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap)); |
| | | |
| | | if (result.getCode() != 200) { |
| | | throw new ErrorException("IFS修改批次号失败: " + result.getMessage()); |
| | | } |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsUpdateBatch, 1) |
| | | .eq(IfsInventoryQuantity::getId, one.getId())); |
| | | } |
| | | |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | | moveMap.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | moveMap.put("LINE_NO", one.getLineNo()); |
| | | moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | moveMap.put("PART_NO", one.getPartNo()); |
| | | moveMap.put("QTY", one.getQtyArrived()); |
| | | moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | moveMap.put("TO_LOCATION_NO", toLocation); |
| | | moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo()); |
| | | moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | moveResultList.add(moveMap); |
| | | moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | moveResultMap.put("SYSCODE", "LIMS"); |
| | | moveResultMap.put("SYSMODEL", "检验后移库"); |
| | | moveResultMap.put("BATCH_INFO", moveResultList); |
| | | |
| | | Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | if (result1.getCode() != 200) { |
| | | throw new ErrorException("IFS检验后移库失败: " + result1.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |