From d344ee41f0b39c143bf4229b5c3e7aed965c444a Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 25 四月 2026 14:00:11 +0800
Subject: [PATCH] feat(stock): 新增出入库审批流程功能
---
src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java | 85 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java b/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
index bbdbf2e..da9ed8b 100644
--- a/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
+++ b/src/main/java/com/ruoyi/technology/service/impl/TechnologyOperationServiceImpl.java
@@ -1,20 +1,89 @@
package com.ruoyi.technology.service.impl;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+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.framework.web.domain.R;
+import com.ruoyi.technology.bean.dto.TechnologyOperationDto;
+import com.ruoyi.technology.bean.vo.TechnologyOperationVo;
+import com.ruoyi.technology.mapper.TechnologyBomStructureMapper;
import com.ruoyi.technology.mapper.TechnologyOperationMapper;
+import com.ruoyi.technology.mapper.TechnologyOperationParamMapper;
+import com.ruoyi.technology.mapper.TechnologyRoutingOperationMapper;
+import com.ruoyi.technology.pojo.TechnologyBomStructure;
import com.ruoyi.technology.pojo.TechnologyOperation;
+import com.ruoyi.technology.pojo.TechnologyOperationParam;
+import com.ruoyi.technology.pojo.TechnologyRoutingOperation;
import com.ruoyi.technology.service.TechnologyOperationService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
-/**
- * <p>
- * 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-20 09:49:48
- */
+import java.util.List;
+import java.util.stream.Collectors;
+
@Service
+@RequiredArgsConstructor
public class TechnologyOperationServiceImpl extends ServiceImpl<TechnologyOperationMapper, TechnologyOperation> implements TechnologyOperationService {
+ private final TechnologyOperationMapper technologyOperationMapper;
+ private final TechnologyRoutingOperationMapper technologyRoutingOperationMapper;
+ private final TechnologyBomStructureMapper technologyBomStructureMapper;
+ private final TechnologyOperationParamMapper technologyOperationParamMapper;
+
+ /**
+ * 鍒嗛〉鏌ヨ宸ュ簭鍒楄〃銆�
+ */
+ @Override
+ public IPage<TechnologyOperationVo> listPage(Page<TechnologyOperationDto> page, TechnologyOperationDto technologyOperationDto) {
+ return technologyOperationMapper.listPage(page, technologyOperationDto);
+ }
+
+ /**
+ * 鏂板宸ュ簭骞惰ˉ榻愬伐搴忕紪鐮併��
+ */
+ @Override
+ public R add(TechnologyOperationDto technologyOperationDto) {
+ TechnologyOperation technologyOperation = new TechnologyOperation();
+ BeanUtils.copyProperties(technologyOperationDto, technologyOperation);
+ boolean saved = technologyOperationMapper.insert(technologyOperation) > 0;
+ if (saved && ObjectUtils.isNull(technologyOperationDto.getNo())) {
+ technologyOperation.setNo("GX" + String.format("%08d", technologyOperation.getId()));
+ technologyOperationMapper.updateById(technologyOperation);
+ }
+ return R.ok();
+ }
+
+ /**
+ * 鍒犻櫎宸ュ簭鍓嶆牎楠屾槸鍚﹀凡琚獴OM缁撴瀯鎴栧伐鑹鸿矾绾垮紩鐢ㄣ��
+ */
+ @Override
+ public String batchDelete(List<Long> ids) {
+ List<TechnologyRoutingOperation> routingOperations = technologyRoutingOperationMapper.selectList(
+ Wrappers.<TechnologyRoutingOperation>lambdaQuery().in(TechnologyRoutingOperation::getTechnologyOperationId, ids));
+ List<TechnologyBomStructure> bomStructures = technologyBomStructureMapper.selectList(
+ Wrappers.<TechnologyBomStructure>lambdaQuery().in(TechnologyBomStructure::getOperationId, ids));
+ if (!CollectionUtils.isEmpty(routingOperations) || !CollectionUtils.isEmpty(bomStructures)) {
+ throw new RuntimeException("Operation is referenced and cannot be deleted");
+ }
+ technologyOperationParamMapper.delete(Wrappers.<TechnologyOperationParam>lambdaQuery()
+ .in(TechnologyOperationParam::getTechnologyOperationId, ids));
+ technologyOperationMapper.deleteBatchIds(ids);
+ return null;
+ }
+
+ /**
+ * 鏌ヨ鍏ㄩ儴宸ュ簭骞惰浆鎹负杩斿洖瀵硅薄銆�
+ */
+ @Override
+ public List<TechnologyOperationVo> listVo() {
+ return this.list().stream().map(item -> {
+ TechnologyOperationVo vo = new TechnologyOperationVo();
+ BeanUtils.copyProperties(item, vo);
+ return vo;
+ }).collect(Collectors.toList());
+ }
}
--
Gitblit v1.9.3