| | |
| | | import com.ruoyi.basic.dto.*; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | 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.properties.WechatProperty; |
| | | import com.ruoyi.common.config.WechatProperty; |
| | | import com.ruoyi.common.utils.LimsDateUtil; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | |
| | | |
| | | |
| | | @Override |
| | | public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) { |
| | | if (StringUtils.isBlank(partNo)) { |
| | | throw new ErrorException("零件号丢失"); |
| | | } |
| | | public Result selectStandardTreeListByPartNo(String partNo) { |
| | | List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo); |
| | | if (CollectionUtil.isEmpty(factoryDtos)) { |
| | | throw new ErrorException("零件号为" + partNo + "的原材料没有对应的标准库配置"); |
| | | return Result.success(null, "零件号为" + partNo + "的原材料没有对应的标准库配置"); |
| | | } |
| | | RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto(); |
| | | Set<String> sampleTypeValues = new HashSet<>(); |
| | | for (FactoryDto factoryDto : factoryDtos) { |
| | | for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) { |
| | | for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | if (sampleTypeDto.getChildren().size() == 0) { |
| | | sampleTypeValues.add(sampleTypeDto.getValue()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 批量查询所有 sampleTypeDto 的数据 |
| | | List<SampleDto> standardList = standardTreeMapper.getStandardTree3Batch(sampleTypeValues); |
| | | Map<String, List<SampleDto>> standardTreeMap = standardList.stream().collect(Collectors.groupingBy(SampleDto::getValue)); |
| | | |
| | | for (FactoryDto factoryDto : factoryDtos) { |
| | | for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) { |
| | | for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | List<SampleDto> standardTreeList = standardTreeMap.get(sampleTypeDto.getValue()); |
| | | if (sampleTypeDto.getChildren().size() == 0) { |
| | | sampleTypeDto.getChildren().addAll(standardTreeList); |
| | | sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue())); |
| | | } |
| | | // 判断绑定的是否是当前零件号 |
| | | if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) { |
| | |
| | | } |
| | | } |
| | | } |
| | | return rawMaterialStandardTreeDto; |
| | | return Result.success(rawMaterialStandardTreeDto); |
| | | } |
| | | |
| | | @Override |
| | |
| | | String code = "Y"; |
| | | // 生成编号 |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | |
| | | insOrderMapper.insert(insOrder); // 主表 |
| | |
| | | ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | |
| | | return standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | return ifsByOver; |
| | | } |
| | | |
| | | /** |
| | |
| | | String code = "Y"; |
| | | // 生成编号 |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | insOrder.setExamineTime(LocalDateTime.now()); |
| | | insOrder.setEntrustCode(no); |
| | |
| | | String code = "Y"; |
| | | // 生成编号 |
| | | String no = numberGenerator.generateNumberWithPrefix(3, |
| | | "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), |
| | | InsOrder::getEntrustCode); |
| | | |
| | | insOrderMapper.insert(insOrder); // 主表 |
| | |
| | | */ |
| | | @Override |
| | | public void rawAllExport(IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto, HttpServletResponse response) throws UnsupportedEncodingException { |
| | | //查询导出的费用统计数据 |
| | | String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | List<IfsInventoryQuantitySupplierDto> ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | // 判断是否是根据选择的导出 |
| | | List<IfsInventoryQuantitySupplierDto> ifsByOverList = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(ifsInventoryQuantityDto.getIds())) { |
| | | List<String> ifsIds = StrUtil.split(ifsInventoryQuantityDto.getIds(), ","); |
| | | ifsByOverList = standardTreeMapper.getIfsByIds(ifsIds); |
| | | } else { |
| | | String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate(); |
| | | String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate(); |
| | | ifsInventoryQuantityDto.setBeginDeclareDate(null); |
| | | ifsInventoryQuantityDto.setEndDeclareDate(null); |
| | | ifsInventoryQuantityDto.setIds(null); |
| | | ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate); |
| | | } |
| | | |
| | | for (IfsInventoryQuantitySupplierDto dto : ifsByOverList) { |
| | | dto.setSendTimeString(dto.getSendTime() == null ? "" : dto.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |