diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/template/物料接收单模版.docx b/xinnengyuan/ruoyi-admin/src/main/resources/template/物料接收单模版.docx new file mode 100644 index 00000000..5c54f75f Binary files /dev/null and b/xinnengyuan/ruoyi-admin/src/main/resources/template/物料接收单模版.docx differ diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/template/物料领料单模版.docx b/xinnengyuan/ruoyi-admin/src/main/resources/template/物料领料单模版.docx new file mode 100644 index 00000000..0ff4f486 Binary files /dev/null and b/xinnengyuan/ruoyi-admin/src/main/resources/template/物料领料单模版.docx differ diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/template/设计变更申请单模版.docx b/xinnengyuan/ruoyi-admin/src/main/resources/template/设计变更申请单模版.docx index 2b6dadc8..d41672e8 100644 Binary files a/xinnengyuan/ruoyi-admin/src/main/resources/template/设计变更申请单模版.docx and b/xinnengyuan/ruoyi-admin/src/main/resources/template/设计变更申请单模版.docx differ diff --git a/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java b/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java index fae75919..67feee62 100644 --- a/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java +++ b/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java @@ -4,7 +4,10 @@ import cn.hutool.core.io.FileUtil; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.dromara.design.service.IDesTechnicalStandardService; +import org.dromara.facility.domain.FacMatrix; +import org.dromara.facility.service.IFacMatrixService; import org.dromara.facility.service.IFacPhotovoltaicPanelPartsService; +import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.project.service.IBusProjectService; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @@ -23,6 +26,12 @@ public class DemoTest { @Resource private IFacPhotovoltaicPanelPartsService photovoltaicPanelPartsService; + @Resource + private IPgsProgressCategoryService progressCategoryService; + + @Resource + private IFacMatrixService matrixService; + @Resource private IBusProjectService projectService; @@ -62,4 +71,12 @@ public class DemoTest { String suffix = FileUtil.getSuffix(originalFilename); System.out.println(suffix); } + + @Test + void testTemple() { + List matrixList = matrixService.lambdaQuery() + .eq(FacMatrix::getProjectId, 1906557369562726402L) + .list(); + Boolean result = progressCategoryService.insertByTemplate(1906557369562726402L, matrixList, null); + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/pom.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/pom.xml index 032c128b..d2e4c00b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/pom.xml +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/pom.xml @@ -62,6 +62,12 @@ 2.0.29 + + com.deepoove + poi-tl + 1.12.2 + + org.dromara diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/JSTUtil.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/JSTUtil.java index ce4f53c8..2e78c5b9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/JSTUtil.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/JSTUtil.java @@ -246,6 +246,9 @@ public class JSTUtil { FacFeatureByPlane nearestPolygon = null; double minDistance = Double.MAX_VALUE; for (FacFeatureByPlane polygonFeature : polygons) { + if (polygonFeature == null || polygonFeature.getGeometry() == null) { + continue; // 跳过空对象 + } List> polyCoords = polygonFeature.getGeometry().getCoordinates().getFirst(); Coordinate[] polygonCoords = polyCoords.stream() .map(c -> new Coordinate(c.getFirst(), c.get(1))) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/documentOperations/WordToPdfToImg.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/documentOperations/WordToPdfToImg.java index ba262a3a..a0891668 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/documentOperations/WordToPdfToImg.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/documentOperations/WordToPdfToImg.java @@ -1,17 +1,13 @@ package org.dromara.common.utils.documentOperations; -import io.swagger.v3.oas.annotations.security.OAuthFlow; import jakarta.annotation.Resource; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.rendering.PDFRenderer; import org.docx4j.Docx4J; import org.docx4j.openpackaging.exceptions.Docx4JException; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; - -import org.apache.pdfbox.pdmodel.PDDocument; -import org.apache.pdfbox.rendering.PDFRenderer; -import org.dromara.common.oss.core.OssClient; import org.dromara.system.domain.vo.SysOssUploadVo; import org.dromara.system.service.ISysOssService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; @@ -19,19 +15,24 @@ import org.springframework.web.multipart.MultipartFile; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; -import java.io.*; -import java.util.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; import static org.dromara.common.constant.MinioPathConstant.ContactNotice; @Component public class WordToPdfToImg { - @Autowired + + @Resource private ISysOssService ossService; /** * wordToImg 根据file生成缩略图(路径) + * * @param file 文件 */ public String wordToImg(MultipartFile file) throws Docx4JException, IOException { @@ -75,6 +76,7 @@ public class WordToPdfToImg { /** * convertWordToImage 根据MultipartFile转成缩略图 并上传至minio + * * @param wordFile 文件 */ public SysOssUploadVo convertWordToImage(MultipartFile wordFile) throws Exception { @@ -119,7 +121,7 @@ public class WordToPdfToImg { "image/png", // ContentType new ByteArrayInputStream(imageOut.toByteArray()) // 文件内容 ); - return ossService.uploadWithNoSave(image,ossService.minioFileName(ContactNotice,image)); + return ossService.uploadWithNoSave(image, ossService.minioFileName(ContactNotice, image)); } // public static void main(String[] args) throws Exception { diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cory/service/impl/BusContactnoticeServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cory/service/impl/BusContactnoticeServiceImpl.java index bbc1ce71..0919dcb9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cory/service/impl/BusContactnoticeServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cory/service/impl/BusContactnoticeServiceImpl.java @@ -1,23 +1,23 @@ package org.dromara.cory.service.impl; -import org.dromara.common.core.utils.MapstructUtils; -import org.dromara.common.core.utils.StringUtils; -import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.common.mybatis.core.page.PageQuery; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.ObjectUtils; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.cory.domain.BusContactnotice; import org.dromara.cory.domain.bo.BusContactnoticeBo; import org.dromara.cory.domain.vo.BusContactnoticeVo; -import org.dromara.cory.domain.BusContactnotice; import org.dromara.cory.mapper.BusContactnoticeMapper; import org.dromara.cory.service.IBusContactnoticeService; +import org.springframework.stereotype.Service; +import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Collection; /** * 联系单Service业务层处理 @@ -38,7 +38,7 @@ public class BusContactnoticeServiceImpl implements IBusContactnoticeService { * @return 联系单 */ @Override - public BusContactnoticeVo queryById(Long id){ + public BusContactnoticeVo queryById(Long id) { return baseMapper.selectVoById(id); } @@ -73,6 +73,7 @@ public class BusContactnoticeServiceImpl implements IBusContactnoticeService { LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.orderByAsc(BusContactnotice::getId); lqw.eq(bo.getProjectId() != null, BusContactnotice::getProjectId, bo.getProjectId()); + lqw.eq(ObjectUtils.isNotEmpty(bo.getType()), BusContactnotice::getType, bo.getType()); lqw.in(bo.getTypes() != null, BusContactnotice::getType, bo.getTypes()); return lqw; } @@ -87,7 +88,7 @@ public class BusContactnoticeServiceImpl implements IBusContactnoticeService { public Boolean insertByBo(BusContactnoticeBo bo) { BusContactnotice add = MapstructUtils.convert(bo, BusContactnotice.class); validEntityBeforeSave(add); - return baseMapper.insert(add) > 0; + return baseMapper.insert(add) > 0; } /** @@ -106,7 +107,7 @@ public class BusContactnoticeServiceImpl implements IBusContactnoticeService { /** * 保存前的数据校验 */ - private void validEntityBeforeSave(BusContactnotice entity){ + private void validEntityBeforeSave(BusContactnotice entity) { //TODO 做一些数据校验,如唯一约束 } @@ -119,7 +120,7 @@ public class BusContactnoticeServiceImpl implements IBusContactnoticeService { */ @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesDrawingConstant.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesDrawingConstant.java deleted file mode 100644 index 1c7134e2..00000000 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesDrawingConstant.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.dromara.design.constant; - -/** - * @author lcj - * @date 2025/7/2 19:59 - */ -public interface DesDrawingConstant { - - /** - * 对象存储前缀 - */ - String OSS_PREFIX = "doc/design/drawing/"; - - /** - * 获取项目对象存储前缀 - * - * @param projectId 项目id - * @return 项目对象存储前缀 - */ - static String getProjectOssPrefix(Long projectId) { - return String.format("%s%s/", OSS_PREFIX, projectId); - } -} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesSpecialSchemeConstant.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesSpecialSchemeConstant.java deleted file mode 100644 index 64d8ecf2..00000000 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/constant/DesSpecialSchemeConstant.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.dromara.design.constant; - -/** - * @author lcj - * @date 2025/7/3 11:35 - */ -public interface DesSpecialSchemeConstant { - - /** - * 对象存储前缀 - */ - String OSS_PREFIX = "doc/design/special/scheme/"; - - /** - * 获取项目对象存储前缀 - * - * @param projectId 项目id - * @return 项目对象存储前缀 - */ - static String getProjectOssPrefix(Long projectId) { - return String.format("%s%s/", OSS_PREFIX, projectId); - } - -} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesDesignChangeController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesDesignChangeController.java index 8816b300..f667e3c4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesDesignChangeController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesDesignChangeController.java @@ -48,7 +48,7 @@ public class DesDesignChangeController extends BaseController { } /** - * 根据主键设计变更单 + * 根据主键导出设计变更单 */ @SaCheckPermission("design:designChange:export") @Log(title = "设计变更管理", businessType = BusinessType.EXPORT) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesDesignChangeServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesDesignChangeServiceImpl.java index 66a7c77c..2c4bdd1c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesDesignChangeServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesDesignChangeServiceImpl.java @@ -364,8 +364,19 @@ public class DesDesignChangeServiceImpl extends ServiceImpl designChangeVoList = designChangeList.stream().map(this::getVo).toList(); + Set ossIdList = designChangeList.stream().map(DesDesignChange::getFileId).map(Long::parseLong).collect(Collectors.toSet()); + List ossVoList = ossService.listByIds(ossIdList); + Map ossVoMap = ossVoList.stream().collect(Collectors.toMap(SysOssVo::getOssId, Function.identity(), (a, b) -> a)); + List designChangeVoList = designChangeList.stream().map(designChange -> { + DesDesignChangeVo designChangeVo = new DesDesignChangeVo(); + BeanUtils.copyProperties(designChange, designChangeVo); + String fileId = designChange.getFileId(); + if (StringUtils.isNotBlank(fileId)) { + SysOssVo file = ossVoMap.get(Long.valueOf(fileId)); + designChangeVo.setFile(file); + } + return designChangeVo; + }).toList(); designChangeVoPage.setRecords(designChangeVoList); return designChangeVoPage; } @@ -394,7 +405,7 @@ public class DesDesignChangeServiceImpl extends ServiceImpl> future = executorService.submit(() -> { + FacProperties nameProperties = nameFeature.getProperties(); + String name = nameProperties.getText(); + // ① 获取名称 + if (StringUtils.isBlank(name)) return Collections.emptyList(); + if (!name.startsWith("G")) return Collections.emptyList(); List panelList = new ArrayList<>(); - // ① 找到该点对应的 polygon(优先包含,否则最近) + // ② 找到该点对应的 polygon(优先包含,否则最近) FacFeatureByPlane matchedPolygon = JSTUtil.findNearestOrContainingPolygon(nameFeature, locationFeatures); if (matchedPolygon == null) return Collections.emptyList(); - // ② 获取 geometry 坐标 + // ③ 获取 geometry 坐标 List> coordinates = matchedPolygon.getGeometry().getCoordinates().getFirst(); - // ③ 判断所属方阵 + // ④ 判断所属方阵 FacMatrix matrix = matrixService.getMatrixIdBy2Coordinates(matrixList, coordinates); if (matrix == null) return Collections.emptyList(); Long matrixId = matrix.getId(); - // ④ 获取进度类别 + // ⑤ 获取进度类别 List progressCategoryListByMatrix = progressCategoryMap.get(matrixId); if (CollUtil.isEmpty(progressCategoryListByMatrix)) return Collections.emptyList(); - // ⑤ 获取名称 - String name = nameFeature.getProperties() != null ? nameFeature.getProperties().getText() : null; - if (StringUtils.isBlank(name)) return Collections.emptyList(); + // ⑥ 构建面板数据 for (PgsProgressCategory progressCategory : progressCategoryListByMatrix) { FacPhotovoltaicPanel panel = new FacPhotovoltaicPanel(); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/constants/MatMaterialsConstant.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/constants/MatMaterialsConstant.java new file mode 100644 index 00000000..d9bf74ad --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/constants/MatMaterialsConstant.java @@ -0,0 +1,67 @@ +package org.dromara.materials.constants; + +import org.dromara.common.core.utils.DateUtils; +import org.dromara.materials.domain.MatMaterialIssue; +import org.dromara.materials.domain.MatMaterialReceive; + +import java.text.SimpleDateFormat; + +/** + * @author lcj + * @date 2025/7/4 18:26 + */ +public interface MatMaterialsConstant { + + /** + * 物料领料单文件路径 + */ + String MATERIALS_ISSUE_FILE_URL = "docs/materials/issue/"; + + /** + * 物料接收单文件路径 + */ + String MATERIALS_RECEIVE_FILE_URL = "docs/materials/receive/"; + + /** + * 物料领料单模版路径 + */ + String MATERIALS_ISSUE_TEMPLATE_PATH = "template/物料领料单模版.docx"; + + /** + * 物料接收单模版路径 + */ + String MATERIALS_RECEIVE_TEMPLATE_PATH = "template/物料接收单模版.docx"; + + /** + * 获取物料领料单文件名 + */ + static String getMatMaterialIssueFileUrl(MatMaterialIssue materialIssue) { + String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(materialIssue.getUpdateTime()); + return String.format("%s%s/%s", MATERIALS_ISSUE_FILE_URL, materialIssue.getId(), timestamp); + } + + /** + * 获取物料领料单文件名 + */ + static String getMatMaterialIssueFileName(MatMaterialIssue materialIssue) { + String createDate = DateUtils.formatDate(materialIssue.getCreateTime()); + return String.format("物料领料单(%s).docx", createDate); + } + + /** + * 获取物料接收单文件名 + */ + static String getMatMaterialReceiveFileUrl(MatMaterialReceive materialReceive) { + String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(materialReceive.getUpdateTime()); + return String.format("%s%s/%s", MATERIALS_ISSUE_FILE_URL, materialReceive.getId(), timestamp); + } + + /** + * 获取物料接收单文件名 + */ + static String getMatMaterialReceiveFileName(MatMaterialReceive materialReceive) { + String createDate = DateUtils.formatDate(materialReceive.getCreateTime()); + return String.format("物料接收单(%s).docx", createDate); + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/controller/MatMaterialIssueController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/controller/MatMaterialIssueController.java new file mode 100644 index 00000000..776ee2a1 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/controller/MatMaterialIssueController.java @@ -0,0 +1,105 @@ +package org.dromara.materials.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.domain.R; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.web.core.BaseController; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueCreateReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueQueryReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq; +import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; +import org.dromara.materials.service.IMatMaterialIssueService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 物料领料单 + * + * @author lcj + * @date 2025-07-04 + */ +@Validated +@RestController +@RequestMapping("/materials/materialIssue") +public class MatMaterialIssueController extends BaseController { + + @Resource + private IMatMaterialIssueService matMaterialIssueService; + + /** + * 查询物料领料单列表 + */ + @SaCheckPermission("materials:materialIssue:list") + @GetMapping("/list") + public TableDataInfo list(MatMaterialIssueQueryReq req, PageQuery pageQuery) { + return matMaterialIssueService.queryPageList(req, pageQuery); + } + + /** + * 根据主键导出物料领料单详细信息 + */ + @SaCheckPermission("materials:materialIssue:export") + @Log(title = "物料领料单", businessType = BusinessType.EXPORT) + @PostMapping("/export/word") + public void exportWordById(@NotNull(message = "主键不能为空") Long id, + HttpServletResponse response) { + matMaterialIssueService.exportWordById(id, response); + } + + /** + * 获取物料领料单详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("materials:materialIssue:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(matMaterialIssueService.queryById(id)); + } + + /** + * 新增物料领料单 + */ + @SaCheckPermission("materials:materialIssue:add") + @Log(title = "物料领料单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated @RequestBody MatMaterialIssueCreateReq req) { + return toAjax(matMaterialIssueService.insertByBo(req)); + } + + /** + * 修改物料领料单 + */ + @SaCheckPermission("materials:materialIssue:edit") + @Log(title = "物料领料单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated @RequestBody MatMaterialIssueUpdateReq req) { + return toAjax(matMaterialIssueService.updateByBo(req)); + } + + /** + * 删除物料领料单 + * + * @param ids 主键串 + */ + @SaCheckPermission("materials:materialIssue:remove") + @Log(title = "物料领料单", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(matMaterialIssueService.deleteByIds(List.of(ids))); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/controller/MatMaterialReceiveController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/controller/MatMaterialReceiveController.java new file mode 100644 index 00000000..d08efa88 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/controller/MatMaterialReceiveController.java @@ -0,0 +1,105 @@ +package org.dromara.materials.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.domain.R; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.web.core.BaseController; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveCreateReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveQueryReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveUpdateReq; +import org.dromara.materials.domain.vo.materialreceive.MatMaterialReceiveVo; +import org.dromara.materials.service.IMatMaterialReceiveService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 物料接收单 + * + * @author lcj + * @date 2025-07-04 + */ +@Validated +@RestController +@RequestMapping("/materials/materialReceive") +public class MatMaterialReceiveController extends BaseController { + + @Resource + private IMatMaterialReceiveService matMaterialReceiveService; + + /** + * 查询物料接收单列表 + */ + @SaCheckPermission("materials:materialReceive:list") + @GetMapping("/list") + public TableDataInfo list(MatMaterialReceiveQueryReq req, PageQuery pageQuery) { + return matMaterialReceiveService.queryPageList(req, pageQuery); + } + + /** + * 根据主键导出物料接收单详细信息 + */ + @SaCheckPermission("materials:materialReceive:export") + @Log(title = "物料接收单", businessType = BusinessType.EXPORT) + @PostMapping("/export/word") + public void exportWordById(@NotNull(message = "主键不能为空") Long id, + HttpServletResponse response) { + matMaterialReceiveService.exportWordById(id, response); + } + + /** + * 获取物料接收单详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("materials:materialReceive:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(matMaterialReceiveService.queryById(id)); + } + + /** + * 新增物料接收单 + */ + @SaCheckPermission("materials:materialReceive:add") + @Log(title = "物料接收单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated @RequestBody MatMaterialReceiveCreateReq req) { + return toAjax(matMaterialReceiveService.insertByBo(req)); + } + + /** + * 修改物料接收单 + */ + @SaCheckPermission("materials:materialReceive:edit") + @Log(title = "物料接收单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated @RequestBody MatMaterialReceiveUpdateReq req) { + return toAjax(matMaterialReceiveService.updateByBo(req)); + } + + /** + * 删除物料接收单 + * + * @param ids 主键串 + */ + @SaCheckPermission("materials:materialReceive:remove") + @Log(title = "物料接收单", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(matMaterialReceiveService.deleteByIds(List.of(ids))); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialIssue.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialIssue.java new file mode 100644 index 00000000..698ce888 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialIssue.java @@ -0,0 +1,126 @@ +package org.dromara.materials.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.dromara.common.mybatis.core.domain.BaseEntity; + +import java.io.Serial; + +/** + * 物料领料单对象 mat_material_issue + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("mat_material_issue") +public class MatMaterialIssue extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 领料单位 + */ + private String issueUnit; + + /** + * 保管单位 + */ + private String storageUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 合格证份数 + */ + private Integer certCount; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 出厂报告份数 + */ + private Integer reportCount; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 技术资料份数 + */ + private Integer techDocCount; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 厂家资质文件份数 + */ + private Integer licenseCount; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialIssueItem.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialIssueItem.java new file mode 100644 index 00000000..b7c7ae78 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialIssueItem.java @@ -0,0 +1,77 @@ +package org.dromara.materials.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.dromara.common.mybatis.core.domain.BaseEntity; + +import java.io.Serial; +import java.math.BigDecimal; + +/** + * 物料领料单明细项对象 mat_material_issue_item + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("mat_material_issue_item") +public class MatMaterialIssueItem extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 领料单id + */ + private Long issueId; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 库存 + */ + private BigDecimal stockQuantity; + + /** + * 领取 + */ + private BigDecimal issuedQuantity; + + /** + * 剩余 + */ + private BigDecimal remainingQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialReceive.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialReceive.java new file mode 100644 index 00000000..048b5f36 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialReceive.java @@ -0,0 +1,126 @@ +package org.dromara.materials.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.dromara.common.mybatis.core.domain.BaseEntity; + +import java.io.Serial; + +/** + * 物料接收单对象 mat_material_receive + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("mat_material_receive") +public class MatMaterialReceive extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 合同名称 + */ + private String contractName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 合格证份数 + */ + private Integer certCount; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 出厂报告份数 + */ + private Integer reportCount; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 技术资料份数 + */ + private Integer techDocCount; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 厂家资质文件份数 + */ + private Integer licenseCount; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 设备材料入库/移交 + */ + private String storageType; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialReceiveItem.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialReceiveItem.java new file mode 100644 index 00000000..b84995a6 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialReceiveItem.java @@ -0,0 +1,77 @@ +package org.dromara.materials.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.dromara.common.mybatis.core.domain.BaseEntity; + +import java.io.Serial; +import java.math.BigDecimal; + +/** + * 物料接收单明细项对象 mat_material_receive_item + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("mat_material_receive_item") +public class MatMaterialReceiveItem extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 接收单id + */ + private Long receiveId; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private BigDecimal quantity; + + /** + * 验收 + */ + private BigDecimal acceptedQuantity; + + /** + * 缺件 + */ + private BigDecimal shortageQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueCreateReq.java new file mode 100644 index 00000000..8fef6583 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueCreateReq.java @@ -0,0 +1,105 @@ +package org.dromara.materials.domain.dto.materialissue; + +import lombok.Data; +import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * @author lcj + * @date 2025/7/4 15:02 + */ +@Data +public class MatMaterialIssueCreateReq implements Serializable { + + @Serial + private static final long serialVersionUID = 2742974667799153892L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 领料单位 + */ + private String issueUnit; + + /** + * 保管单位 + */ + private String storageUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 明细项 + */ + private List itemList; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueQueryReq.java new file mode 100644 index 00000000..6f563e98 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueQueryReq.java @@ -0,0 +1,63 @@ +package org.dromara.materials.domain.dto.materialissue; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/7/4 15:02 + */ +@Data +public class MatMaterialIssueQueryReq implements Serializable { + + @Serial + private static final long serialVersionUID = -4011015750160760763L; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 领料单位 + */ + private String issueUnit; + + /** + * 保管单位 + */ + private String storageUnit; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueUpdateReq.java new file mode 100644 index 00000000..3898a21d --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueUpdateReq.java @@ -0,0 +1,100 @@ +package org.dromara.materials.domain.dto.materialissue; + +import lombok.Data; +import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * @author lcj + * @date 2025/7/4 15:02 + */ +@Data +public class MatMaterialIssueUpdateReq implements Serializable { + + @Serial + private static final long serialVersionUID = 2053113999402012882L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 领料单位 + */ + private String issueUnit; + + /** + * 保管单位 + */ + private String storageUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 明细项 + */ + private List itemList; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueWordDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueWordDto.java new file mode 100644 index 00000000..a3ed7be4 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissue/MatMaterialIssueWordDto.java @@ -0,0 +1,39 @@ +package org.dromara.materials.domain.dto.materialissue; + +import lombok.Data; +import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto; + +import java.util.List; + +@Data +public class MatMaterialIssueWordDto { + + // 顶部信息 + private String projectName; + private String formCode; + private String materialName; + private String supplierUnit; + private String orderingUnit; + private String issueUnit; + private String storageUnit; + + // 表格数据 - 这是一个列表! + private List items; + + // 合计行数据 + private Integer totalStockQuantity; + private Integer totalIssuedQuantity; + private Integer totalRemainingQuantity; + + // 缺陷情况及附件 + private String defectDescription; + private String isCertCount; + private Integer certCount; + private String isReportCount; + private Integer reportCount; + private String isTechDocCount; + private Integer techDocCount; + private String isLicenseCount; + private Integer licenseCount; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissueitem/MatMaterialIssueItemDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissueitem/MatMaterialIssueItemDto.java new file mode 100644 index 00000000..a65e9ecb --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissueitem/MatMaterialIssueItemDto.java @@ -0,0 +1,58 @@ +package org.dromara.materials.domain.dto.materialissueitem; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author lcj + * @date 2025/7/4 15:21 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class MatMaterialIssueItemDto { + + /** + * 主键id + */ + private Long id; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 库存 + */ + private BigDecimal stockQuantity; + + /** + * 领取 + */ + private BigDecimal issuedQuantity; + + /** + * 剩余 + */ + private BigDecimal remainingQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissueitem/MatMaterialIssueItemWordDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissueitem/MatMaterialIssueItemWordDto.java new file mode 100644 index 00000000..d47d7602 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialissueitem/MatMaterialIssueItemWordDto.java @@ -0,0 +1,21 @@ +package org.dromara.materials.domain.dto.materialissueitem; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class MatMaterialIssueItemWordDto { + + private Integer no; // 序号 + private String name; // 名称 + private String specification; // 规格 + private String unit; // 单位 + private Integer stockQuantity; // 库存数量 + private Integer issuedQuantity; // 领取数量 + private Integer remainingQuantity;// 剩余数量 + private String remark; // 备注 + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java new file mode 100644 index 00000000..bdf649e3 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveCreateReq.java @@ -0,0 +1,100 @@ +package org.dromara.materials.domain.dto.materialreceive; + +import lombok.Data; +import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * @author lcj + * @date 2025/7/4 15:03 + */ +@Data +public class MatMaterialReceiveCreateReq implements Serializable { + + @Serial + private static final long serialVersionUID = 1826521942178676812L; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 合同名称 + */ + private String contractName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 明细项 + */ + private List itemList; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 设备材料入库/移交 + */ + private String storageType; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveQueryReq.java new file mode 100644 index 00000000..242d4690 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveQueryReq.java @@ -0,0 +1,63 @@ +package org.dromara.materials.domain.dto.materialreceive; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lcj + * @date 2025/7/4 15:03 + */ +@Data +public class MatMaterialReceiveQueryReq implements Serializable { + + @Serial + private static final long serialVersionUID = 5772774919127572167L; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 合同名称 + */ + private String contractName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 设备材料入库/移交 + */ + private String storageType; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveUpdateReq.java new file mode 100644 index 00000000..792c9742 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveUpdateReq.java @@ -0,0 +1,100 @@ +package org.dromara.materials.domain.dto.materialreceive; + +import lombok.Data; +import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * @author lcj + * @date 2025/7/4 15:03 + */ +@Data +public class MatMaterialReceiveUpdateReq implements Serializable { + + @Serial + private static final long serialVersionUID = 5686357336524453994L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 合同名称 + */ + private String contractName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 明细项 + */ + private List itemList; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 设备材料入库/移交 + */ + private String storageType; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveWordDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveWordDto.java new file mode 100644 index 00000000..f276b36c --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceive/MatMaterialReceiveWordDto.java @@ -0,0 +1,48 @@ +package org.dromara.materials.domain.dto.materialreceive; + +import lombok.Data; +import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemWordDto; + +import java.util.List; + +/** + * @author lcj + * @date 2025/7/6 13:56 + */ +@Data +public class MatMaterialReceiveWordDto { + + // 顶部信息 + private String formCode; + private String projectName; + private String materialName; + private String contractName; + private String orderingUnit; + private String supplierUnit; + + // 表格数据 - 这是一个列表! + private List items; + + // 合计行数据 + private Integer totalQuantity; + private Integer totalAcceptedQuantity; + private Integer totalShortageQuantity; + + // 缺陷情况及附件 + private String defectDescription; + private String isCertCount; + private Integer certCount; + private String isReportCount; + private Integer reportCount; + private String isTechDocCount; + private Integer techDocCount; + private String isLicenseCount; + private Integer licenseCount; + + + // 设备材料入库/移交 + private String storageType1; + private String storageType2; + private String storageType3; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceiveitem/MatMaterialReceiveItemDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceiveitem/MatMaterialReceiveItemDto.java new file mode 100644 index 00000000..3aec0b7b --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceiveitem/MatMaterialReceiveItemDto.java @@ -0,0 +1,58 @@ +package org.dromara.materials.domain.dto.materialreceiveitem; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author lcj + * @date 2025/7/4 15:24 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class MatMaterialReceiveItemDto { + + /** + * 主键id + */ + private Long id; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private BigDecimal quantity; + + /** + * 验收 + */ + private BigDecimal acceptedQuantity; + + /** + * 缺件 + */ + private BigDecimal shortageQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceiveitem/MatMaterialReceiveItemWordDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceiveitem/MatMaterialReceiveItemWordDto.java new file mode 100644 index 00000000..e9d7800c --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/dto/materialreceiveitem/MatMaterialReceiveItemWordDto.java @@ -0,0 +1,56 @@ +package org.dromara.materials.domain.dto.materialreceiveitem; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author lcj + * @date 2025/7/6 14:04 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class MatMaterialReceiveItemWordDto { + + /** + * 序号 + */ + private Integer no; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private Integer quantity; + + /** + * 验收 + */ + private Integer acceptedQuantity; + + /** + * 缺件 + */ + private Integer shortageQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialissue/MatMaterialIssueVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialissue/MatMaterialIssueVo.java new file mode 100644 index 00000000..0b3411d8 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialissue/MatMaterialIssueVo.java @@ -0,0 +1,152 @@ +package org.dromara.materials.domain.vo.materialissue; + +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.materials.domain.MatMaterialIssue; +import org.dromara.materials.domain.vo.materialissueitem.MatMaterialIssueItemVo; +import org.dromara.system.domain.vo.SysOssVo; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + + +/** + * 物料领料单视图对象 mat_material_issue + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@AutoMapper(target = MatMaterialIssue.class) +public class MatMaterialIssueVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 领料单位 + */ + private String issueUnit; + + /** + * 保管单位 + */ + private String storageUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 合格证份数 + */ + private Integer certCount; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 合格证文件 + */ + private List certCountFile; + + /** + * 出厂报告份数 + */ + private Integer reportCount; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 出厂报告文件 + */ + private List reportCountFile; + + /** + * 技术资料份数 + */ + private Integer techDocCount; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 技术资料文件 + */ + private List techDocCountFile; + + /** + * 厂家资质文件份数 + */ + private Integer licenseCount; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 厂家资质文件 + */ + private List licenseCountFile; + + /** + * 备注 + */ + private String remark; + + /** + * 明细项列表 + */ + private List itemList; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialissueitem/MatMaterialIssueItemVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialissueitem/MatMaterialIssueItemVo.java new file mode 100644 index 00000000..a816f264 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialissueitem/MatMaterialIssueItemVo.java @@ -0,0 +1,75 @@ +package org.dromara.materials.domain.vo.materialissueitem; + +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.materials.domain.MatMaterialIssueItem; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + + +/** + * 物料领料单明细项视图对象 mat_material_issue_item + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@AutoMapper(target = MatMaterialIssueItem.class) +public class MatMaterialIssueItemVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 领料单id + */ + private Long issueId; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 库存 + */ + private BigDecimal stockQuantity; + + /** + * 领取 + */ + private BigDecimal issuedQuantity; + + /** + * 剩余 + */ + private BigDecimal remainingQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialreceive/MatMaterialReceiveVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialreceive/MatMaterialReceiveVo.java new file mode 100644 index 00000000..10bb48b4 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialreceive/MatMaterialReceiveVo.java @@ -0,0 +1,152 @@ +package org.dromara.materials.domain.vo.materialreceive; + +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.materials.domain.MatMaterialReceive; +import org.dromara.materials.domain.vo.materialreceiveitem.MatMaterialReceiveItemVo; +import org.dromara.system.domain.vo.SysOssVo; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + + +/** + * 物料接收单视图对象 mat_material_receive + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@AutoMapper(target = MatMaterialReceive.class) +public class MatMaterialReceiveVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 材料来源(1甲供 2乙供) + */ + private String materialSource; + + /** + * 表单编号 + */ + private String formCode; + + /** + * 工程名称 + */ + private String projectName; + + /** + * 设备材料名称 + */ + private String materialName; + + /** + * 合同名称 + */ + private String contractName; + + /** + * 订货单位 + */ + private String orderingUnit; + + /** + * 供货单位 + */ + private String supplierUnit; + + /** + * 缺陷情况(承包单位填写) + */ + private String defectDescription; + + /** + * 合格证份数 + */ + private Integer certCount; + + /** + * 合格证文件 + */ + private String certCountFileId; + + /** + * 合格证文件 + */ + private List certCountFile; + + /** + * 出厂报告份数 + */ + private Integer reportCount; + + /** + * 出厂报告文件 + */ + private String reportCountFileId; + + /** + * 出厂报告文件 + */ + private List reportCountFile; + + /** + * 技术资料份数 + */ + private Integer techDocCount; + + /** + * 技术资料文件 + */ + private String techDocCountFileId; + + /** + * 技术资料文件 + */ + private List techDocCountFile; + + /** + * 厂家资质文件份数 + */ + private Integer licenseCount; + + /** + * 厂家资质文件 + */ + private String licenseCountFileId; + + /** + * 厂家资质文件 + */ + private List licenseCountFile; + + /** + * 设备材料入库/移交 + */ + private String storageType; + + /** + * 备注 + */ + private String remark; + + /** + * 明细项列表 + */ + private List itemList; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialreceiveitem/MatMaterialReceiveItemVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialreceiveitem/MatMaterialReceiveItemVo.java new file mode 100644 index 00000000..ad28588f --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialreceiveitem/MatMaterialReceiveItemVo.java @@ -0,0 +1,75 @@ +package org.dromara.materials.domain.vo.materialreceiveitem; + +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.materials.domain.MatMaterialReceiveItem; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; + + +/** + * 物料接收单明细项视图对象 mat_material_receive_item + * + * @author lcj + * @date 2025-07-04 + */ +@Data +@AutoMapper(target = MatMaterialReceiveItem.class) +public class MatMaterialReceiveItemVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private Long id; + + /** + * 项目id + */ + private Long projectId; + + /** + * 接收单id + */ + private Long receiveId; + + /** + * 名称 + */ + private String name; + + /** + * 规格 + */ + private String specification; + + /** + * 单位 + */ + private String unit; + + /** + * 数量 + */ + private BigDecimal quantity; + + /** + * 验收 + */ + private BigDecimal acceptedQuantity; + + /** + * 缺件 + */ + private BigDecimal shortageQuantity; + + /** + * 备注 + */ + private String remark; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialIssueItemMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialIssueItemMapper.java new file mode 100644 index 00000000..65c0baa4 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialIssueItemMapper.java @@ -0,0 +1,15 @@ +package org.dromara.materials.mapper; + +import org.dromara.materials.domain.MatMaterialIssueItem; +import org.dromara.materials.domain.vo.materialissueitem.MatMaterialIssueItemVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 物料领料单明细项Mapper接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface MatMaterialIssueItemMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialIssueMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialIssueMapper.java new file mode 100644 index 00000000..63033f01 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialIssueMapper.java @@ -0,0 +1,15 @@ +package org.dromara.materials.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.materials.domain.MatMaterialIssue; +import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; + +/** + * 物料领料单Mapper接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface MatMaterialIssueMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialReceiveItemMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialReceiveItemMapper.java new file mode 100644 index 00000000..333779ab --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialReceiveItemMapper.java @@ -0,0 +1,15 @@ +package org.dromara.materials.mapper; + +import org.dromara.materials.domain.MatMaterialReceiveItem; +import org.dromara.materials.domain.vo.materialreceiveitem.MatMaterialReceiveItemVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 物料接收单明细项Mapper接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface MatMaterialReceiveItemMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialReceiveMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialReceiveMapper.java new file mode 100644 index 00000000..13bf8246 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/mapper/MatMaterialReceiveMapper.java @@ -0,0 +1,15 @@ +package org.dromara.materials.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.materials.domain.MatMaterialReceive; +import org.dromara.materials.domain.vo.materialreceive.MatMaterialReceiveVo; + +/** + * 物料接收单Mapper接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface MatMaterialReceiveMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialIssueItemService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialIssueItemService.java new file mode 100644 index 00000000..a999c41d --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialIssueItemService.java @@ -0,0 +1,41 @@ +package org.dromara.materials.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.dromara.materials.domain.MatMaterialIssueItem; +import org.dromara.materials.domain.vo.materialissueitem.MatMaterialIssueItemVo; + +import java.util.List; + +/** + * 物料领料单明细项Service接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface IMatMaterialIssueItemService extends IService { + + /** + * 查询物料领料单明细项列表 + * + * @param issueId 领料单id + * @return 物料领料单明细项列表 + */ + List queryListByIssueId(Long issueId); + + /** + * 获取物料领料单明细项视图对象 + * + * @param matMaterialIssueItem 物料领料单明细项对象 + * @return 物料领料单明细项视图对象 + */ + MatMaterialIssueItemVo getVo(MatMaterialIssueItem matMaterialIssueItem); + + /** + * 获取物料领料单明细项视图对象列表 + * + * @param matMaterialIssueItemList 物料领料单明细项对象列表 + * @return 物料领料单明细项视图对象列表 + */ + List getVoList(List matMaterialIssueItemList); + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialIssueService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialIssueService.java new file mode 100644 index 00000000..dd96b015 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialIssueService.java @@ -0,0 +1,106 @@ +package org.dromara.materials.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import jakarta.servlet.http.HttpServletResponse; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.materials.domain.MatMaterialIssue; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueCreateReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueQueryReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq; +import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; + +import java.util.Collection; +import java.util.List; + +/** + * 物料领料单Service接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface IMatMaterialIssueService extends IService { + + /** + * 查询物料领料单 + * + * @param id 主键 + * @return 物料领料单 + */ + MatMaterialIssueVo queryById(Long id); + + /** + * 分页查询物料领料单列表 + * + * @param req 查询条件 + * @param pageQuery 分页参数 + * @return 物料领料单分页列表 + */ + TableDataInfo queryPageList(MatMaterialIssueQueryReq req, PageQuery pageQuery); + + /** + * 查询符合条件的物料领料单列表 + * + * @param req 查询条件 + * @return 物料领料单列表 + */ + List queryList(MatMaterialIssueQueryReq req); + + /** + * 根据id导出word + * + * @param id 主键 + * @param response 响应 + */ + void exportWordById(Long id, HttpServletResponse response); + + /** + * 新增物料领料单 + * + * @param req 物料领料单 + * @return 是否新增成功 + */ + Boolean insertByBo(MatMaterialIssueCreateReq req); + + /** + * 修改物料领料单 + * + * @param req 物料领料单 + * @return 是否修改成功 + */ + Boolean updateByBo(MatMaterialIssueUpdateReq req); + + /** + * 批量删除物料领料单信息 + * + * @param ids 待删除的主键集合 + * @return 是否删除成功 + */ + Boolean deleteByIds(Collection ids); + + /** + * 获取物料领料单视图对象 + * + * @param materialIssue 物料领料单对象 + * @return 物料领料单视图对象 + */ + MatMaterialIssueVo getVo(MatMaterialIssue materialIssue); + + /** + * 构建查询条件封装 + * + * @param req 查询条件 + * @return 查询条件封装 + */ + LambdaQueryWrapper buildQueryWrapper(MatMaterialIssueQueryReq req); + + /** + * 获取物料领料单分页对象视图 + * + * @param materialIssuePage 物料领料单分页对象 + * @return 物料领料单分页对象视图 + */ + Page getVoPage(Page materialIssuePage); +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialReceiveItemService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialReceiveItemService.java new file mode 100644 index 00000000..92740874 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialReceiveItemService.java @@ -0,0 +1,41 @@ +package org.dromara.materials.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.dromara.materials.domain.MatMaterialReceiveItem; +import org.dromara.materials.domain.vo.materialreceiveitem.MatMaterialReceiveItemVo; + +import java.util.List; + +/** + * 物料接收单明细项Service接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface IMatMaterialReceiveItemService extends IService { + + /** + * 查询物料接收单明细项列表 + * + * @param issueId 接收单id + * @return 物料接收单明细项列表 + */ + List queryListByReceiveId(Long issueId); + + /** + * 获取物料接收单明细项视图对象 + * + * @param matMaterialReceiveItem 物料接收单明细项对象 + * @return 物料接收单明细项视图对象 + */ + MatMaterialReceiveItemVo getVo(MatMaterialReceiveItem matMaterialReceiveItem); + + /** + * 获取物料接收单明细项视图对象列表 + * + * @param matMaterialReceiveItemList 物料接收单明细项对象列表 + * @return 物料接收单明细项视图对象列表 + */ + List getVoList(List matMaterialReceiveItemList); + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialReceiveService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialReceiveService.java new file mode 100644 index 00000000..d50e4aed --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/IMatMaterialReceiveService.java @@ -0,0 +1,106 @@ +package org.dromara.materials.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import jakarta.servlet.http.HttpServletResponse; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.materials.domain.MatMaterialReceive; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveCreateReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveQueryReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveUpdateReq; +import org.dromara.materials.domain.vo.materialreceive.MatMaterialReceiveVo; + +import java.util.Collection; +import java.util.List; + +/** + * 物料接收单Service接口 + * + * @author lcj + * @date 2025-07-04 + */ +public interface IMatMaterialReceiveService extends IService { + + /** + * 查询物料接收单 + * + * @param id 主键 + * @return 物料接收单 + */ + MatMaterialReceiveVo queryById(Long id); + + /** + * 分页查询物料接收单列表 + * + * @param req 查询条件 + * @param pageQuery 分页参数 + * @return 物料接收单分页列表 + */ + TableDataInfo queryPageList(MatMaterialReceiveQueryReq req, PageQuery pageQuery); + + /** + * 查询符合条件的物料接收单列表 + * + * @param req 查询条件 + * @return 物料接收单列表 + */ + List queryList(MatMaterialReceiveQueryReq req); + + /** + * 根据id导出word + * + * @param id 主键 + * @param response 响应 + */ + void exportWordById(Long id, HttpServletResponse response); + + /** + * 新增物料接收单 + * + * @param req 物料接收单 + * @return 是否新增成功 + */ + Boolean insertByBo(MatMaterialReceiveCreateReq req); + + /** + * 修改物料接收单 + * + * @param req 物料接收单 + * @return 是否修改成功 + */ + Boolean updateByBo(MatMaterialReceiveUpdateReq req); + + /** + * 批量删除物料接收单信息 + * + * @param ids 待删除的主键集合 + * @return 是否删除成功 + */ + Boolean deleteByIds(Collection ids); + + /** + * 获取物料接收单视图对象 + * + * @param materialReceive 物料接收单对象 + * @return 物料接收单视图对象 + */ + MatMaterialReceiveVo getVo(MatMaterialReceive materialReceive); + + /** + * 构建查询条件封装 + * + * @param req 查询条件 + * @return 查询条件封装 + */ + LambdaQueryWrapper buildQueryWrapper(MatMaterialReceiveQueryReq req); + + /** + * 获取物料接收单分页对象视图 + * + * @param materialReceivePage 物料接收单分页对象 + * @return 物料接收单分页对象视图 + */ + Page getVoPage(Page materialReceivePage); +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueItemServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueItemServiceImpl.java new file mode 100644 index 00000000..a76d0de3 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueItemServiceImpl.java @@ -0,0 +1,59 @@ +package org.dromara.materials.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.dromara.materials.domain.MatMaterialIssueItem; +import org.dromara.materials.domain.vo.materialissueitem.MatMaterialIssueItemVo; +import org.dromara.materials.mapper.MatMaterialIssueItemMapper; +import org.dromara.materials.service.IMatMaterialIssueItemService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 物料领料单明细项Service业务层处理 + * + * @author lcj + * @date 2025-07-04 + */ +@Service +public class MatMaterialIssueItemServiceImpl extends ServiceImpl + implements IMatMaterialIssueItemService { + + /** + * 查询物料领料单明细项列表 + * + * @param issueId 领料单id + * @return 物料领料单明细项列表 + */ + @Override + public List queryListByIssueId(Long issueId) { + return this.lambdaQuery() + .eq(MatMaterialIssueItem::getIssueId, issueId) + .list(); + } + + /** + * 获取物料领料单明细项视图对象 + * + * @param matMaterialIssueItem 物料领料单明细项对象 + * @return 物料领料单明细项视图对象 + */ + @Override + public MatMaterialIssueItemVo getVo(MatMaterialIssueItem matMaterialIssueItem) { + MatMaterialIssueItemVo vo = new MatMaterialIssueItemVo(); + BeanUtils.copyProperties(matMaterialIssueItem, vo); + return vo; + } + + /** + * 获取物料领料单明细项视图对象列表 + * + * @param matMaterialIssueItemList 物料领料单明细项对象列表 + * @return 物料领料单明细项视图对象列表 + */ + @Override + public List getVoList(List matMaterialIssueItemList) { + return matMaterialIssueItemList.stream().map(this::getVo).toList(); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java new file mode 100644 index 00000000..a9d044f1 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java @@ -0,0 +1,529 @@ +package org.dromara.materials.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.constant.HttpStatus; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.ObjectUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.core.utils.file.FileUtils; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.oss.core.OssClient; +import org.dromara.common.oss.exception.OssException; +import org.dromara.common.oss.factory.OssFactory; +import org.dromara.common.utils.DocumentUtil; +import org.dromara.materials.constants.MatMaterialsConstant; +import org.dromara.materials.domain.MatMaterialIssue; +import org.dromara.materials.domain.MatMaterialIssueItem; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueCreateReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueQueryReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq; +import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueWordDto; +import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto; +import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto; +import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; +import org.dromara.materials.mapper.MatMaterialIssueMapper; +import org.dromara.materials.service.IMatMaterialIssueItemService; +import org.dromara.materials.service.IMatMaterialIssueService; +import org.dromara.project.service.IBusProjectService; +import org.dromara.system.domain.vo.SysOssVo; +import org.dromara.system.service.ISysOssService; +import org.springframework.beans.BeanUtils; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.zip.ZipOutputStream; + +/** + * 物料领料单Service业务层处理 + * + * @author lcj + * @date 2025-07-04 + */ +@Slf4j +@Service +public class MatMaterialIssueServiceImpl extends ServiceImpl + implements IMatMaterialIssueService { + + @Resource + private ISysOssService ossService; + + @Resource + private IBusProjectService projectService; + + @Resource + private IMatMaterialIssueItemService materialIssueItemService; + + /** + * 查询物料领料单 + * + * @param id 主键 + * @return 物料领料单 + */ + @Override + public MatMaterialIssueVo queryById(Long id) { + MatMaterialIssue materialIssue = this.getById(id); + if (materialIssue == null) { + throw new ServiceException("物料领料单信息不存在", HttpStatus.NOT_FOUND); + } + return this.getVo(materialIssue); + } + + /** + * 分页查询物料领料单列表 + * + * @param req 查询条件 + * @param pageQuery 分页参数 + * @return 物料领料单分页列表 + */ + @Override + public TableDataInfo queryPageList(MatMaterialIssueQueryReq req, PageQuery pageQuery) { + Page issuePage = this.page(pageQuery.build(), this.buildQueryWrapper(req)); + return TableDataInfo.build(this.getVoPage(issuePage)); + } + + /** + * 查询符合条件的物料领料单列表 + * + * @param req 查询条件 + * @return 物料领料单列表 + */ + @Override + public List queryList(MatMaterialIssueQueryReq req) { + return this.list(this.buildQueryWrapper(req)).stream().map(this::getVo).toList(); + } + + /** + * 根据id导出word + * + * @param id 主键 + * @param response 响应 + */ + @Override + public void exportWordById(Long id, HttpServletResponse response) { + MatMaterialIssue materialIssue = this.getById(id); + if (materialIssue == null) { + throw new ServiceException("物料领料单不存在"); + } + Path targetDir = Paths.get(MatMaterialsConstant.getMatMaterialIssueFileUrl(materialIssue)); + // 如果存在目录则直接返回,不存在则生成文件并返回 + if (!Files.exists(targetDir)) { + // 清理旧文件 + String baseUrl = MatMaterialsConstant.MATERIALS_ISSUE_FILE_URL + materialIssue.getId(); + try { + Path dirPath = Paths.get(baseUrl); + if (Files.exists(dirPath)) { + FileUtils.deleteDirectory(dirPath); + } + } catch (IOException e) { + log.error("文件目录:{},清理失败", baseUrl, e); + } + // 准备数据 + List itemList = materialIssueItemService.queryListByIssueId(id); + MatMaterialIssueWordDto data = this.getReplacementDto(materialIssue, itemList); + // 生成文件 + try (InputStream is = getClass().getClassLoader().getResourceAsStream(MatMaterialsConstant.MATERIALS_ISSUE_TEMPLATE_PATH)) { + if (is == null) { + throw new ServiceException("模板文件不存在"); + } + LoopRowTableRenderPolicy hackLoopTableRenderPolicy = new LoopRowTableRenderPolicy(); + Configure config = Configure.builder().bind("items", hackLoopTableRenderPolicy).build(); + XWPFTemplate template = XWPFTemplate.compile(is, config); + template.render(data); + // 创建目标目录 + if (!Files.exists(targetDir)) { + Files.createDirectories(targetDir); + } + // 组合目标文件名 + String fileName = MatMaterialsConstant.getMatMaterialIssueFileName(materialIssue); + // 保存修改后的文件 + try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) { + template.write(fos); + } + template.close(); + // 获取附件 + String certCountFileId = materialIssue.getCertCountFileId(); + String reportCountFileId = materialIssue.getReportCountFileId(); + String techDocCountFileId = materialIssue.getTechDocCountFileId(); + String licenseCountFileId = materialIssue.getLicenseCountFileId(); + if (StringUtils.isNotBlank(certCountFileId)) { + List ossIdList = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialIssueFileUrl(materialIssue) + "/合格证"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + if (StringUtils.isNotBlank(reportCountFileId)) { + List ossIdList = Arrays.stream(reportCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialIssueFileUrl(materialIssue) + "/出厂报告"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + if (StringUtils.isNotBlank(techDocCountFileId)) { + List ossIdList = Arrays.stream(techDocCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialIssueFileUrl(materialIssue) + "/技术资料"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + if (StringUtils.isNotBlank(licenseCountFileId)) { + List ossIdList = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialIssueFileUrl(materialIssue) + "/厂家资质文件"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + + } catch (IOException e) { + throw new OssException("生成Word文件失败,错误信息: " + e.getMessage()); + } + } + // 设置响应头,返回ZIP文件 + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); + try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) { + DocumentUtil.zipDirectory(targetDir, targetDir, zos); + zos.flush(); + } catch (Exception e) { + throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage()); + } + } + + /** + * 新增物料领料单 + * + * @param req 物料领料单 + * @return 是否新增成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean insertByBo(MatMaterialIssueCreateReq req) { + MatMaterialIssue materialIssue = new MatMaterialIssue(); + BeanUtils.copyProperties(req, materialIssue); + validEntityBeforeSave(materialIssue, true); + getFileSize(materialIssue, + req.getLicenseCountFileId(), + req.getReportCountFileId(), + req.getTechDocCountFileId(), + req.getCertCountFileId()); + boolean save = this.save(materialIssue); + if (!save) { + throw new ServiceException("物料领料单新增失败", HttpStatus.ERROR); + } + List itemList = req.getItemList(); + if (CollUtil.isNotEmpty(itemList)) { + List materialIssueItemList = itemList.stream().map(item -> { + MatMaterialIssueItem materialIssueItem = new MatMaterialIssueItem(); + BeanUtils.copyProperties(item, materialIssueItem); + materialIssueItem.setIssueId(materialIssue.getId()); + materialIssueItem.setProjectId(materialIssue.getProjectId()); + return materialIssueItem; + }).toList(); + boolean result = materialIssueItemService.saveBatch(materialIssueItemList); + if (!result) { + throw new ServiceException("物料领料单明细项新增失败", HttpStatus.ERROR); + } + } + return true; + } + + /** + * 修改物料领料单 + * + * @param req 物料领料单 + * @return 是否修改成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean updateByBo(MatMaterialIssueUpdateReq req) { + Long id = req.getId(); + MatMaterialIssue oldMaterialIssue = this.getById(id); + if (oldMaterialIssue == null) { + throw new ServiceException("修改物料收货单失败,数据不存在", HttpStatus.NOT_FOUND); + } + MatMaterialIssue materialIssue = new MatMaterialIssue(); + BeanUtils.copyProperties(req, materialIssue); + validEntityBeforeSave(materialIssue, false); + getFileSize(materialIssue, + req.getLicenseCountFileId(), + req.getReportCountFileId(), + req.getTechDocCountFileId(), + req.getCertCountFileId()); + boolean update = this.updateById(materialIssue); + if (!update) { + throw new ServiceException("物料领料单修改失败", HttpStatus.ERROR); + } + // 删除旧的 + List oldMaterialIssueItemList = materialIssueItemService.queryListByIssueId(id); + if (CollUtil.isNotEmpty(oldMaterialIssueItemList)) { + boolean result = materialIssueItemService.removeBatchByIds(oldMaterialIssueItemList); + if (!result) { + throw new ServiceException("物料领料单明细项删除失败", HttpStatus.ERROR); + } + } + // 重新添加 + List itemList = req.getItemList(); + if (CollUtil.isNotEmpty(itemList)) { + List materialIssueItemList = itemList.stream().map(item -> { + MatMaterialIssueItem materialIssueItem = new MatMaterialIssueItem(); + BeanUtils.copyProperties(item, materialIssueItem); + materialIssueItem.setIssueId(id); + materialIssueItem.setProjectId(materialIssue.getProjectId()); + return materialIssueItem; + }).toList(); + boolean result = materialIssueItemService.saveBatch(materialIssueItemList); + if (!result) { + throw new ServiceException("物料领料单明细项新增失败", HttpStatus.ERROR); + } + } + return true; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(MatMaterialIssue entity, Boolean create) { + // 做一些数据校验,如唯一约束 + Long projectId = entity.getProjectId(); + String materialSource = entity.getMaterialSource(); + if (create) { + if (projectId == null) { + throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); + } + if (StringUtils.isEmpty(materialSource)) { + throw new ServiceException("物料来源不能为空", HttpStatus.BAD_REQUEST); + } + } + // 查询项目是否存在 + if (projectId != null && projectService.getById(projectId) == null) { + throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); + } + } + + /** + * 批量删除物料领料单信息 + * + * @param ids 待删除的主键集合 + * @return 是否删除成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean deleteByIds(Collection ids) { + List itemList = materialIssueItemService.lambdaQuery() + .in(MatMaterialIssueItem::getIssueId, ids) + .list(); + if (CollUtil.isNotEmpty(itemList)) { + materialIssueItemService.removeBatchByIds(itemList); + } + return this.removeBatchByIds(ids); + } + + /** + * 获取物料领料单视图对象 + * + * @param materialIssue 物料领料单对象 + * @return 物料领料单视图对象 + */ + @Override + public MatMaterialIssueVo getVo(MatMaterialIssue materialIssue) { + MatMaterialIssueVo vo = new MatMaterialIssueVo(); + BeanUtils.copyProperties(materialIssue, vo); + List itemList = materialIssueItemService.queryListByIssueId(materialIssue.getId()); + if (CollUtil.isNotEmpty(itemList)) { + vo.setItemList(materialIssueItemService.getVoList(itemList)); + } + String licenseCountFileId = materialIssue.getLicenseCountFileId(); + if (StringUtils.isNotBlank(licenseCountFileId)) { + List ossIdList = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setLicenseCountFile(ossVoList); + } + String reportCountFileId = materialIssue.getReportCountFileId(); + if (StringUtils.isNotBlank(reportCountFileId)) { + List ossIdList = Arrays.stream(reportCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setReportCountFile(ossVoList); + } + String techDocCountFileId = materialIssue.getTechDocCountFileId(); + if (StringUtils.isNotBlank(techDocCountFileId)) { + List ossIdList = Arrays.stream(techDocCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setTechDocCountFile(ossVoList); + } + String certCountFileId = materialIssue.getCertCountFileId(); + if (StringUtils.isNotBlank(certCountFileId)) { + List ossIdList = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setCertCountFile(ossVoList); + } + return vo; + } + + /** + * 构建查询条件封装 + * + * @param req 查询条件 + * @return 查询条件封装 + */ + @Override + public LambdaQueryWrapper buildQueryWrapper(MatMaterialIssueQueryReq req) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + if (req == null) { + return lqw; + } + Long projectId = req.getProjectId(); + String materialSource = req.getMaterialSource(); + String formCode = req.getFormCode(); + String projectName = req.getProjectName(); + String materialName = req.getMaterialName(); + String orderingUnit = req.getOrderingUnit(); + String supplierUnit = req.getSupplierUnit(); + String issueUnit = req.getIssueUnit(); + String storageUnit = req.getStorageUnit(); + lqw.like(StringUtils.isNotBlank(projectName), MatMaterialIssue::getProjectName, projectName); + lqw.like(StringUtils.isNotBlank(materialName), MatMaterialIssue::getMaterialName, materialName); + lqw.like(StringUtils.isNotBlank(orderingUnit), MatMaterialIssue::getOrderingUnit, orderingUnit); + lqw.like(StringUtils.isNotBlank(supplierUnit), MatMaterialIssue::getSupplierUnit, supplierUnit); + lqw.like(StringUtils.isNotBlank(issueUnit), MatMaterialIssue::getIssueUnit, issueUnit); + lqw.like(StringUtils.isNotBlank(storageUnit), MatMaterialIssue::getStorageUnit, storageUnit); + lqw.like(StringUtils.isNotBlank(formCode), MatMaterialIssue::getFormCode, formCode); + lqw.eq(ObjectUtils.isNotEmpty(projectId), MatMaterialIssue::getProjectId, projectId); + lqw.eq(StringUtils.isNotBlank(materialSource), MatMaterialIssue::getMaterialSource, materialSource); + return lqw; + } + + /** + * 获取物料领料单分页对象视图 + * + * @param materialIssuePage 物料领料单分页对象 + * @return 物料领料单分页对象视图 + */ + @Override + public Page getVoPage(Page materialIssuePage) { + List materialIssueList = materialIssuePage.getRecords(); + Page materialIssueVoPage = new Page<>( + materialIssuePage.getCurrent(), + materialIssuePage.getSize(), + materialIssuePage.getTotal()); + if (CollUtil.isEmpty(materialIssueList)) { + return materialIssueVoPage; + } + // 对象列表 => 封装对象列表 + List materialIssueVoList = materialIssueList.stream().map(materialIssue -> { + MatMaterialIssueVo materialIssueVo = new MatMaterialIssueVo(); + BeanUtils.copyProperties(materialIssue, materialIssueVo); + return materialIssueVo; + }).toList(); + materialIssueVoPage.setRecords(materialIssueVoList); + return materialIssueVoPage; + } + + /** + * 获取文件数量 + * + * @param materialIssue 物料领料单对象 + * @param licenseCountFileId 证书文件id + * @param reportCountFileId 报表文件id + * @param techDocCountFileId 技术文档文件id + * @param certCountFileId 证书文件id + */ + private void getFileSize(MatMaterialIssue materialIssue, String licenseCountFileId, + String reportCountFileId, String techDocCountFileId, String certCountFileId) { + if (StringUtils.isNotBlank(licenseCountFileId)) { + int size = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialIssue.setLicenseCount(size); + } + if (StringUtils.isNotBlank(reportCountFileId)) { + int size = Arrays.stream(reportCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialIssue.setReportCount(size); + } + if (StringUtils.isNotBlank(techDocCountFileId)) { + int size = Arrays.stream(techDocCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialIssue.setTechDocCount(size); + } + if (StringUtils.isNotBlank(certCountFileId)) { + int size = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialIssue.setLicenseCount(size); + } + } + + /** + * 根据实体获取替换数据 + * + * @param materialIssue 物料领料单对象 + * @param items 物料领料单明细列表 + * @return 替换 Word 数据 + */ + private MatMaterialIssueWordDto getReplacementDto(MatMaterialIssue materialIssue, List items) { + MatMaterialIssueWordDto dto = new MatMaterialIssueWordDto(); + BeanUtils.copyProperties(materialIssue, dto); + // 领料总数量 + int issuedQuantity = items.stream() + .map(MatMaterialIssueItem::getIssuedQuantity) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .intValue(); + dto.setTotalIssuedQuantity(issuedQuantity); + int stockQuantity = items.stream() + .map(MatMaterialIssueItem::getStockQuantity) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .intValue(); + dto.setTotalStockQuantity(stockQuantity); + int remainingQuantity = items.stream() + .map(MatMaterialIssueItem::getRemainingQuantity) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .intValue(); + dto.setTotalRemainingQuantity(remainingQuantity); + Integer certCount = materialIssue.getCertCount(); + dto.setIsCertCount(certCount > 0 ? "☑" : "□"); + Integer licenseCount = materialIssue.getLicenseCount(); + dto.setIsLicenseCount(licenseCount > 0 ? "☑" : "□"); + Integer reportCount = materialIssue.getReportCount(); + dto.setIsReportCount(reportCount > 0 ? "☑" : "□"); + Integer techDocCount = materialIssue.getTechDocCount(); + dto.setIsTechDocCount(techDocCount > 0 ? "☑" : "□"); + // 明细项信息 + List dtoItems = new ArrayList<>(); + for (int i = 1; i <= items.size(); i++) { + MatMaterialIssueItem item = items.get(i - 1); + MatMaterialIssueItemWordDto itemDto = new MatMaterialIssueItemWordDto(); + BeanUtils.copyProperties(item, itemDto); + itemDto.setNo(i); + itemDto.setIssuedQuantity(item.getIssuedQuantity().intValue()); + itemDto.setRemainingQuantity(item.getRemainingQuantity().intValue()); + itemDto.setStockQuantity(item.getStockQuantity().intValue()); + dtoItems.add(itemDto); + } + dto.setItems(dtoItems); + return dto; + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialReceiveItemServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialReceiveItemServiceImpl.java new file mode 100644 index 00000000..e7de6ead --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialReceiveItemServiceImpl.java @@ -0,0 +1,59 @@ +package org.dromara.materials.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.dromara.materials.domain.MatMaterialReceiveItem; +import org.dromara.materials.domain.vo.materialreceiveitem.MatMaterialReceiveItemVo; +import org.dromara.materials.mapper.MatMaterialReceiveItemMapper; +import org.dromara.materials.service.IMatMaterialReceiveItemService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 物料接收单明细项Service业务层处理 + * + * @author lcj + * @date 2025-07-04 + */ +@Service +public class MatMaterialReceiveItemServiceImpl extends ServiceImpl + implements IMatMaterialReceiveItemService { + + /** + * 查询物料接收单明细项列表 + * + * @param issueId 接收单id + * @return 物料接收单明细项列表 + */ + @Override + public List queryListByReceiveId(Long issueId) { + return this.lambdaQuery() + .eq(MatMaterialReceiveItem::getReceiveId, issueId) + .list(); + } + + /** + * 获取物料接收单明细项视图对象 + * + * @param matMaterialReceiveItem 物料接收单明细项对象 + * @return 物料接收单明细项视图对象 + */ + @Override + public MatMaterialReceiveItemVo getVo(MatMaterialReceiveItem matMaterialReceiveItem) { + MatMaterialReceiveItemVo vo = new MatMaterialReceiveItemVo(); + BeanUtils.copyProperties(matMaterialReceiveItem, vo); + return vo; + } + + /** + * 获取物料接收单明细项视图对象列表 + * + * @param matMaterialReceiveItemList 物料接收单明细项对象列表 + * @return 物料接收单明细项视图对象列表 + */ + @Override + public List getVoList(List matMaterialReceiveItemList) { + return matMaterialReceiveItemList.stream().map(this::getVo).toList(); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialReceiveServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialReceiveServiceImpl.java new file mode 100644 index 00000000..c2122d67 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialReceiveServiceImpl.java @@ -0,0 +1,546 @@ +package org.dromara.materials.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.constant.HttpStatus; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.ObjectUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.core.utils.file.FileUtils; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.oss.core.OssClient; +import org.dromara.common.oss.exception.OssException; +import org.dromara.common.oss.factory.OssFactory; +import org.dromara.common.utils.DocumentUtil; +import org.dromara.materials.constants.MatMaterialsConstant; +import org.dromara.materials.domain.MatMaterialReceive; +import org.dromara.materials.domain.MatMaterialReceiveItem; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveCreateReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveQueryReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveUpdateReq; +import org.dromara.materials.domain.dto.materialreceive.MatMaterialReceiveWordDto; +import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemDto; +import org.dromara.materials.domain.dto.materialreceiveitem.MatMaterialReceiveItemWordDto; +import org.dromara.materials.domain.vo.materialreceive.MatMaterialReceiveVo; +import org.dromara.materials.mapper.MatMaterialReceiveMapper; +import org.dromara.materials.service.IMatMaterialReceiveItemService; +import org.dromara.materials.service.IMatMaterialReceiveService; +import org.dromara.project.service.IBusProjectService; +import org.dromara.system.domain.vo.SysOssVo; +import org.dromara.system.service.ISysOssService; +import org.springframework.beans.BeanUtils; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.zip.ZipOutputStream; + +/** + * 物料接收单Service业务层处理 + * + * @author lcj + * @date 2025-07-04 + */ +@Slf4j +@Service +public class MatMaterialReceiveServiceImpl extends ServiceImpl + implements IMatMaterialReceiveService { + + @Resource + private ISysOssService ossService; + + @Resource + private IBusProjectService projectService; + + @Resource + private IMatMaterialReceiveItemService materialReceiveItemService; + + /** + * 查询物料接收单 + * + * @param id 主键 + * @return 物料接收单 + */ + @Override + public MatMaterialReceiveVo queryById(Long id) { + MatMaterialReceive materialReceive = this.getById(id); + if (materialReceive == null) { + throw new ServiceException("物料接收单信息不存在", HttpStatus.NOT_FOUND); + } + return this.getVo(materialReceive); + } + + /** + * 分页查询物料接收单列表 + * + * @param req 查询条件 + * @param pageQuery 分页参数 + * @return 物料接收单分页列表 + */ + @Override + public TableDataInfo queryPageList(MatMaterialReceiveQueryReq req, PageQuery pageQuery) { + Page receivePage = this.page(pageQuery.build(), this.buildQueryWrapper(req)); + return TableDataInfo.build(this.getVoPage(receivePage)); + } + + /** + * 查询符合条件的物料接收单列表 + * + * @param req 查询条件 + * @return 物料接收单列表 + */ + @Override + public List queryList(MatMaterialReceiveQueryReq req) { + return this.list(this.buildQueryWrapper(req)).stream().map(this::getVo).toList(); + } + + /** + * 根据id导出word + * + * @param id 主键 + * @param response 响应 + */ + @Override + public void exportWordById(Long id, HttpServletResponse response) { + MatMaterialReceive materialReceive = this.getById(id); + if (materialReceive == null) { + throw new ServiceException("物料接收单不存在"); + } + Path targetDir = Paths.get(MatMaterialsConstant.getMatMaterialReceiveFileUrl(materialReceive)); + // 如果存在目录则直接返回,不存在则生成文件并返回 + if (!Files.exists(targetDir)) { + // 清理旧文件 + String baseUrl = MatMaterialsConstant.MATERIALS_RECEIVE_FILE_URL + materialReceive.getId(); + try { + Path dirPath = Paths.get(baseUrl); + if (Files.exists(dirPath)) { + FileUtils.deleteDirectory(dirPath); + } + } catch (IOException e) { + log.error("文件目录:{},清理失败", baseUrl, e); + } + // 准备数据 + List itemList = materialReceiveItemService.queryListByReceiveId(id); + MatMaterialReceiveWordDto data = this.getReplacementDto(materialReceive, itemList); + // 生成文件 + try (InputStream is = getClass().getClassLoader().getResourceAsStream(MatMaterialsConstant.MATERIALS_RECEIVE_TEMPLATE_PATH)) { + if (is == null) { + throw new ServiceException("模板文件不存在"); + } + LoopRowTableRenderPolicy hackLoopTableRenderPolicy = new LoopRowTableRenderPolicy(); + Configure config = Configure.builder().bind("items", hackLoopTableRenderPolicy).build(); + XWPFTemplate template = XWPFTemplate.compile(is, config); + template.render(data); + // 创建目标目录 + if (!Files.exists(targetDir)) { + Files.createDirectories(targetDir); + } + // 组合目标文件名 + String fileName = MatMaterialsConstant.getMatMaterialReceiveFileName(materialReceive); + // 保存修改后的文件 + try (FileOutputStream fos = new FileOutputStream(targetDir.resolve(fileName).toFile())) { + template.write(fos); + } + template.close(); + // 获取附件 + String certCountFileId = materialReceive.getCertCountFileId(); + String reportCountFileId = materialReceive.getReportCountFileId(); + String techDocCountFileId = materialReceive.getTechDocCountFileId(); + String licenseCountFileId = materialReceive.getLicenseCountFileId(); + if (StringUtils.isNotBlank(certCountFileId)) { + List ossIdList = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialReceiveFileUrl(materialReceive) + "/合格证"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + if (StringUtils.isNotBlank(reportCountFileId)) { + List ossIdList = Arrays.stream(reportCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialReceiveFileUrl(materialReceive) + "/出厂报告"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + if (StringUtils.isNotBlank(techDocCountFileId)) { + List ossIdList = Arrays.stream(techDocCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialReceiveFileUrl(materialReceive) + "/技术资料"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + if (StringUtils.isNotBlank(licenseCountFileId)) { + List ossIdList = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + String baseFile = MatMaterialsConstant.getMatMaterialReceiveFileUrl(materialReceive) + "/厂家资质文件"; + for (SysOssVo ossVo : ossVoList) { + OssClient storage = OssFactory.instance(ossVo.getService()); + storage.fileDownload(ossVo.getUrl(), ossVo.getOriginalName(), baseFile); + } + } + + } catch (IOException e) { + throw new OssException("生成Word文件失败,错误信息: " + e.getMessage()); + } + } + // 设置响应头,返回ZIP文件 + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); + try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) { + DocumentUtil.zipDirectory(targetDir, targetDir, zos); + zos.flush(); + } catch (Exception e) { + throw new OssException("生成ZIP文件失败,错误信息: " + e.getMessage()); + } + } + + /** + * 新增物料接收单 + * + * @param req 物料接收单 + * @return 是否新增成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean insertByBo(MatMaterialReceiveCreateReq req) { + MatMaterialReceive materialReceive = new MatMaterialReceive(); + BeanUtils.copyProperties(req, materialReceive); + validEntityBeforeSave(materialReceive, true); + getFileSize(materialReceive, + req.getLicenseCountFileId(), + req.getReportCountFileId(), + req.getTechDocCountFileId(), + req.getCertCountFileId()); + boolean save = this.save(materialReceive); + if (!save) { + throw new ServiceException("物料接收单新增失败", HttpStatus.ERROR); + } + List itemList = req.getItemList(); + if (CollUtil.isNotEmpty(itemList)) { + List materialReceiveItemList = itemList.stream().map(item -> { + MatMaterialReceiveItem materialReceiveItem = new MatMaterialReceiveItem(); + BeanUtils.copyProperties(item, materialReceiveItem); + materialReceiveItem.setReceiveId(materialReceive.getId()); + materialReceiveItem.setProjectId(materialReceive.getProjectId()); + return materialReceiveItem; + }).toList(); + boolean result = materialReceiveItemService.saveBatch(materialReceiveItemList); + if (!result) { + throw new RuntimeException("物料接收单明细项新增失败"); + } + } + return true; + } + + /** + * 修改物料接收单 + * + * @param req 物料接收单 + * @return 是否修改成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean updateByBo(MatMaterialReceiveUpdateReq req) { + Long id = req.getId(); + MatMaterialReceive oldMaterialReceive = this.getById(id); + if (oldMaterialReceive == null) { + throw new ServiceException("修改物料收货单失败,数据不存在", HttpStatus.NOT_FOUND); + } + MatMaterialReceive materialReceive = new MatMaterialReceive(); + BeanUtils.copyProperties(req, materialReceive); + validEntityBeforeSave(materialReceive, false); + getFileSize(materialReceive, + req.getLicenseCountFileId(), + req.getReportCountFileId(), + req.getTechDocCountFileId(), + req.getCertCountFileId()); + boolean update = this.updateById(materialReceive); + if (!update) { + throw new ServiceException("物料接收单修改失败", HttpStatus.ERROR); + } + List oldMaterialReceiveItemList = materialReceiveItemService.queryListByReceiveId(id); + if (CollUtil.isNotEmpty(oldMaterialReceiveItemList)) { + boolean result = materialReceiveItemService.removeByIds(oldMaterialReceiveItemList); + if (!result) { + throw new ServiceException("物料接收单明细项删除失败", HttpStatus.ERROR); + } + } + List itemList = req.getItemList(); + if (CollUtil.isNotEmpty(itemList)) { + List materialReceiveItemList = itemList.stream().map(item -> { + MatMaterialReceiveItem materialReceiveItem = new MatMaterialReceiveItem(); + BeanUtils.copyProperties(item, materialReceiveItem); + materialReceiveItem.setReceiveId(materialReceive.getId()); + materialReceiveItem.setProjectId(materialReceive.getProjectId()); + return materialReceiveItem; + }).toList(); + boolean result = materialReceiveItemService.saveOrUpdateBatch(materialReceiveItemList); + if (!result) { + throw new ServiceException("物料接收单明细项新增失败", HttpStatus.ERROR); + } + } + return true; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(MatMaterialReceive entity, Boolean create) { + // 做一些数据校验,如唯一约束 + Long projectId = entity.getProjectId(); + String materialSource = entity.getMaterialSource(); + if (create) { + if (projectId == null) { + throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); + } + if (StringUtils.isEmpty(materialSource)) { + throw new ServiceException("物料来源不能为空", HttpStatus.BAD_REQUEST); + } + } + // 查询项目是否存在 + if (projectId != null && projectService.getById(projectId) == null) { + throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); + } + } + + /** + * 批量删除物料接收单信息 + * + * @param ids 待删除的主键集合 + * @return 是否删除成功 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean deleteByIds(Collection ids) { + List itemList = materialReceiveItemService.lambdaQuery() + .in(MatMaterialReceiveItem::getReceiveId, ids) + .list(); + if (CollUtil.isNotEmpty(itemList)) { + materialReceiveItemService.removeBatchByIds(itemList); + } + return this.removeBatchByIds(ids); + } + + /** + * 获取物料接收单视图对象 + * + * @param materialReceive 物料接收单对象 + * @return 物料接收单视图对象 + */ + @Override + public MatMaterialReceiveVo getVo(MatMaterialReceive materialReceive) { + MatMaterialReceiveVo vo = new MatMaterialReceiveVo(); + BeanUtils.copyProperties(materialReceive, vo); + List itemList = materialReceiveItemService.queryListByReceiveId(materialReceive.getId()); + if (CollUtil.isNotEmpty(itemList)) { + vo.setItemList(materialReceiveItemService.getVoList(itemList)); + } + String certCountFileId = materialReceive.getCertCountFileId(); + if (StringUtils.isNotBlank(certCountFileId)) { + List ossIdList = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setCertCountFile(ossVoList); + } + String reportCountFileId = materialReceive.getReportCountFileId(); + if (StringUtils.isNotBlank(reportCountFileId)) { + List ossIdList = Arrays.stream(reportCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setReportCountFile(ossVoList); + } + String techDocCountFileId = materialReceive.getTechDocCountFileId(); + if (StringUtils.isNotBlank(techDocCountFileId)) { + List ossIdList = Arrays.stream(techDocCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setTechDocCountFile(ossVoList); + } + String licenseCountFileId = materialReceive.getLicenseCountFileId(); + if (StringUtils.isNotBlank(licenseCountFileId)) { + List ossIdList = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList(); + List ossVoList = ossService.listByIds(ossIdList); + vo.setLicenseCountFile(ossVoList); + } + return vo; + } + + /** + * 构建查询条件封装 + * + * @param req 查询条件 + * @return 查询条件封装 + */ + @Override + public LambdaQueryWrapper buildQueryWrapper(MatMaterialReceiveQueryReq req) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + if (req == null) { + return lqw; + } + Long projectId = req.getProjectId(); + String materialSource = req.getMaterialSource(); + String formCode = req.getFormCode(); + String projectName = req.getProjectName(); + String materialName = req.getMaterialName(); + String contractName = req.getContractName(); + String orderingUnit = req.getOrderingUnit(); + String supplierUnit = req.getSupplierUnit(); + String storageType = req.getStorageType(); + lqw.like(StringUtils.isNotBlank(projectName), MatMaterialReceive::getProjectName, projectName); + lqw.like(StringUtils.isNotBlank(materialName), MatMaterialReceive::getMaterialName, materialName); + lqw.like(StringUtils.isNotBlank(contractName), MatMaterialReceive::getContractName, contractName); + lqw.like(StringUtils.isNotBlank(orderingUnit), MatMaterialReceive::getOrderingUnit, orderingUnit); + lqw.like(StringUtils.isNotBlank(supplierUnit), MatMaterialReceive::getSupplierUnit, supplierUnit); + lqw.like(StringUtils.isNotBlank(formCode), MatMaterialReceive::getFormCode, formCode); + lqw.like(StringUtils.isNotBlank(storageType), MatMaterialReceive::getStorageType, storageType); + lqw.eq(ObjectUtils.isNotEmpty(projectId), MatMaterialReceive::getProjectId, projectId); + lqw.eq(StringUtils.isNotBlank(materialSource), MatMaterialReceive::getMaterialSource, materialSource); + return lqw; + } + + /** + * 获取物料接收单分页对象视图 + * + * @param materialReceivePage 物料接收单分页对象 + * @return 物料接收单分页对象视图 + */ + @Override + public Page getVoPage(Page materialReceivePage) { + List materialReceiveList = materialReceivePage.getRecords(); + Page materialReceiveVoPage = new Page<>( + materialReceivePage.getCurrent(), + materialReceivePage.getSize(), + materialReceivePage.getTotal()); + if (CollUtil.isEmpty(materialReceiveList)) { + return materialReceiveVoPage; + } + // 对象列表 => 封装对象列表 + List materialReceiveVoList = materialReceiveList.stream().map(materialReceive -> { + MatMaterialReceiveVo materialReceiveVo = new MatMaterialReceiveVo(); + BeanUtils.copyProperties(materialReceive, materialReceiveVo); + return materialReceiveVo; + }).toList(); + materialReceiveVoPage.setRecords(materialReceiveVoList); + return materialReceiveVoPage; + } + + /** + * 获取文件数量 + * + * @param materialReceive 物料接收单对象 + * @param licenseCountFileId 证书文件id + * @param reportCountFileId 报表文件id + * @param techDocCountFileId 技术文档文件id + * @param certCountFileId 证书文件id + */ + private void getFileSize(MatMaterialReceive materialReceive, String licenseCountFileId, + String reportCountFileId, String techDocCountFileId, String certCountFileId) { + if (StringUtils.isNotBlank(licenseCountFileId)) { + int size = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialReceive.setLicenseCount(size); + } + if (StringUtils.isNotBlank(reportCountFileId)) { + int size = Arrays.stream(reportCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialReceive.setReportCount(size); + } + if (StringUtils.isNotBlank(techDocCountFileId)) { + int size = Arrays.stream(techDocCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialReceive.setTechDocCount(size); + } + if (StringUtils.isNotBlank(certCountFileId)) { + int size = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList().size(); + materialReceive.setLicenseCount(size); + } + } + + /** + * 根据实体获取替换数据 + * + * @param materialReceive 物料接收单对象 + * @param items 物料接收单明细列表 + * @return 替换 Word 数据 + */ + private MatMaterialReceiveWordDto getReplacementDto(MatMaterialReceive materialReceive, List items) { + MatMaterialReceiveWordDto dto = new MatMaterialReceiveWordDto(); + BeanUtils.copyProperties(materialReceive, dto); + // 接收总数量 + int quantity = items.stream() + .map(MatMaterialReceiveItem::getQuantity) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .intValue(); + dto.setTotalQuantity(quantity); + int shortageQuantity = items.stream() + .map(MatMaterialReceiveItem::getShortageQuantity) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .intValue(); + dto.setTotalShortageQuantity(shortageQuantity); + int acceptedQuantity = items.stream() + .map(MatMaterialReceiveItem::getAcceptedQuantity) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add) + .intValue(); + dto.setTotalAcceptedQuantity(acceptedQuantity); + Integer certCount = materialReceive.getCertCount(); + dto.setIsCertCount(certCount > 0 ? "☑" : "□"); + Integer licenseCount = materialReceive.getLicenseCount(); + dto.setIsLicenseCount(licenseCount > 0 ? "☑" : "□"); + Integer reportCount = materialReceive.getReportCount(); + dto.setIsReportCount(reportCount > 0 ? "☑" : "□"); + Integer techDocCount = materialReceive.getTechDocCount(); + dto.setIsTechDocCount(techDocCount > 0 ? "☑" : "□"); + // 明细项信息 + List dtoItems = new ArrayList<>(); + for (int i = 1; i <= items.size(); i++) { + MatMaterialReceiveItem item = items.get(i - 1); + MatMaterialReceiveItemWordDto itemDto = new MatMaterialReceiveItemWordDto(); + BeanUtils.copyProperties(item, itemDto); + itemDto.setNo(i); + itemDto.setQuantity(item.getQuantity().intValue()); + itemDto.setShortageQuantity(item.getShortageQuantity().intValue()); + itemDto.setAcceptedQuantity(item.getAcceptedQuantity().intValue()); + dtoItems.add(itemDto); + } + dto.setItems(dtoItems); + // 设备材料入库/移交 + String storageType = materialReceive.getStorageType(); + dto.setStorageType1("□"); + dto.setStorageType2("□"); + dto.setStorageType3("□"); + if (StringUtils.isNotBlank(storageType)) { + List storageTypeList = Arrays.stream(storageType.split(",")).map(Integer::parseInt).toList(); + for (Integer type : storageTypeList) { + if (type == 1) { + dto.setStorageType1("☑"); + } + if (type == 2) { + dto.setStorageType2("☑"); + } + if (type == 3) { + dto.setStorageType3("☑"); + } + } + } + // 封装数据 + return dto; + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java index a568db31..511a4d36 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java @@ -12,6 +12,8 @@ import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.utils.BigDecimalUtil; +import org.dromara.common.utils.JsonDimensionUtil; import org.dromara.facility.domain.*; import org.dromara.facility.service.*; import org.dromara.progress.constant.PgsProgressCategoryConstant; @@ -35,8 +37,6 @@ import org.dromara.progress.service.IPgsProgressPlanDetailService; import org.dromara.progress.service.IPgsProgressPlanService; import org.dromara.project.domain.BusProject; import org.dromara.project.service.IBusProjectService; -import org.dromara.common.utils.BigDecimalUtil; -import org.dromara.common.utils.JsonDimensionUtil; import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -338,7 +338,6 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl matrixList, List oldMatrixList) { - List oldMatrixIdList = oldMatrixList.stream().map(FacMatrix::getId).toList(); // 获取模板进度类别 List categoryTemplateList = pgsProgressCategoryTemplateService.lambdaQuery() .in(PgsProgressCategoryTemplate::getProjectId, projectId, PgsProgressCategoryConstant.PUBLIC_PROJECT_ID) @@ -351,7 +350,9 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl> oldPercentageCategoryMap = new HashMap<>(); Map> oldPlanMap = new HashMap<>(); Map> oldPlanDetailMap = new HashMap<>(); + List oldMatrixIdList = new ArrayList<>(); if (CollUtil.isNotEmpty(oldMatrixList)) { + oldMatrixIdList = oldMatrixList.stream().map(FacMatrix::getId).toList(); List oldPercentageCategoryList = this.lambdaQuery() .in(PgsProgressCategory::getMatrixId, oldMatrixIdList) .ne(PgsProgressCategory::getPid, PgsProgressCategoryConstant.TOP_PARENT_ID) @@ -473,7 +474,9 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl percentageFacilityLqw = new LambdaQueryWrapper<>(); - percentageFacilityLqw.eq(FacPercentageFacility::getMatrixId, oldMatrixIdList); + if (CollUtil.isNotEmpty(oldMatrixIdList)) { + percentageFacilityLqw.eq(FacPercentageFacility::getMatrixId, oldMatrixIdList); + } long count = percentageFacilityService.count(percentageFacilityLqw); if (count > 0) { boolean remove = percentageFacilityService.remove(percentageFacilityLqw); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialIssueItemMapper.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialIssueItemMapper.xml new file mode 100644 index 00000000..58eaffb1 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialIssueItemMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialIssueMapper.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialIssueMapper.xml new file mode 100644 index 00000000..ec3b6c40 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialIssueMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialReceiveItemMapper.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialReceiveItemMapper.xml new file mode 100644 index 00000000..3ce551d7 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialReceiveItemMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialReceiveMapper.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialReceiveMapper.xml new file mode 100644 index 00000000..9fa02c79 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/materials/MatMaterialReceiveMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/xinnengyuan/script/sql/menuInitValue.sql b/xinnengyuan/script/sql/menuInitValue.sql index 231b4791..039f6d25 100644 --- a/xinnengyuan/script/sql/menuInitValue.sql +++ b/xinnengyuan/script/sql/menuInitValue.sql @@ -947,3 +947,163 @@ values(1940723160391405573, '设计变更管理删除', 1940723160391405569, '4' insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) values(1940723160391405574, '设计变更管理导出', 1940723160391405569, '5', '#', '', 1, 0, 'F', '0', '0', 'design:designChange:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027796600016898, '物料领料单', '1940386534691717121', '1', 'materialIssue', 'materials/materialIssue/index', 1, 0, 'C', '0', '0', 'materials:materialIssue:list', '#', 103, 1, sysdate(), null, null, '物料领料单菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027796600016899, '物料领料单查询', 1941027796600016898, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027796600016900, '物料领料单新增', 1941027796600016898, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027796600016901, '物料领料单修改', 1941027796600016898, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027796600016902, '物料领料单删除', 1941027796600016898, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027796600016903, '物料领料单导出', 1941027796600016898, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027798210629634, '物料接收单', '1940386534691717121', '1', 'materialReceive', 'materials/materialReceive/index', 1, 0, 'C', '0', '0', 'materials:materialReceive:list', '#', 103, 1, sysdate(), null, null, '物料接收单菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027798210629635, '物料接收单查询', 1941027798210629634, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027798210629636, '物料接收单新增', 1941027798210629634, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027798210629637, '物料接收单修改', 1941027798210629634, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027798210629638, '物料接收单删除', 1941027798210629634, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941027798210629639, '物料接收单导出', 1941027798210629634, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028782785744898, '物料领料单', '1940389874213339138', '1', 'materialIssue', 'materials/materialIssue/index', 1, 0, 'C', '0', '0', 'materials:materialIssue:list', '#', 103, 1, sysdate(), null, null, '物料领料单菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028782785744899, '物料领料单查询', 1941028782785744898, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028782785744900, '物料领料单新增', 1941028782785744898, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028782785744901, '物料领料单修改', 1941028782785744898, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028782785744902, '物料领料单删除', 1941028782785744898, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028782785744903, '物料领料单导出', 1941028782785744898, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssue:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028820853248002, '物料接收单', '1940389874213339138', '1', 'materialReceive', 'materials/materialReceive/index', 1, 0, 'C', '0', '0', 'materials:materialReceive:list', '#', 103, 1, sysdate(), null, null, '物料接收单菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028820853248003, '物料接收单查询', 1941028820853248002, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028820853248004, '物料接收单新增', 1941028820853248002, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028820853248005, '物料接收单修改', 1941028820853248002, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028820853248006, '物料接收单删除', 1941028820853248002, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941028820853248007, '物料接收单导出', 1941028820853248002, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceive:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030734919684097, '物料领料单明细项', '1941027796600016898', '1', 'materialIssueItem', 'materials/materialIssueItem/index', 1, 0, 'C', '0', '0', 'materials:materialIssueItem:list', '#', 103, 1, sysdate(), null, null, '物料领料单明细项菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030734919684098, '物料领料单明细项查询', 1941030734919684097, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030734919684099, '物料领料单明细项新增', 1941030734919684097, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030734919684100, '物料领料单明细项修改', 1941030734919684097, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030734919684101, '物料领料单明细项删除', 1941030734919684097, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030734919684102, '物料领料单明细项导出', 1941030734919684097, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030735251034113, '物料接收单明细项', '1941027798210629634', '1', 'materialReceiveItem', 'materials/materialReceiveItem/index', 1, 0, 'C', '0', '0', 'materials:materialReceiveItem:list', '#', 103, 1, sysdate(), null, null, '物料接收单明细项菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030735251034114, '物料接收单明细项查询', 1941030735251034113, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030735251034115, '物料接收单明细项新增', 1941030735251034113, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030735251034116, '物料接收单明细项修改', 1941030735251034113, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030735251034117, '物料接收单明细项删除', 1941030735251034113, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941030735251034118, '物料接收单明细项导出', 1941030735251034113, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032197632929794, '物料接收单明细项', '1941028820853248002', '1', 'materialReceiveItem', 'materials/materialReceiveItem/index', 1, 0, 'C', '0', '0', 'materials:materialReceiveItem:list', '#', 103, 1, sysdate(), null, null, '物料接收单明细项菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032197632929795, '物料接收单明细项查询', 1941032197632929794, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032197632929796, '物料接收单明细项新增', 1941032197632929794, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032197632929797, '物料接收单明细项修改', 1941032197632929794, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032197632929798, '物料接收单明细项删除', 1941032197632929794, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032197632929799, '物料接收单明细项导出', 1941032197632929794, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialReceiveItem:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032233947213826, '物料领料单明细项', '1941028782785744898', '1', 'materialIssueItem', 'materials/materialIssueItem/index', 1, 0, 'C', '0', '0', 'materials:materialIssueItem:list', '#', 103, 1, sysdate(), null, null, '物料领料单明细项菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032233947213827, '物料领料单明细项查询', 1941032233947213826, '1', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032233947213828, '物料领料单明细项新增', 1941032233947213826, '2', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032233947213829, '物料领料单明细项修改', 1941032233947213826, '3', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032233947213830, '物料领料单明细项删除', 1941032233947213826, '4', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1941032233947213831, '物料领料单明细项导出', 1941032233947213826, '5', '#', '', 1, 0, 'F', '0', '0', 'materials:materialIssueItem:export', '#', 103, 1, sysdate(), null, null, ''); diff --git a/xinnengyuan/script/sql/xinnengyuan.sql b/xinnengyuan/script/sql/xinnengyuan.sql index fc5132c7..555dfdb0 100644 --- a/xinnengyuan/script/sql/xinnengyuan.sql +++ b/xinnengyuan/script/sql/xinnengyuan.sql @@ -1437,3 +1437,111 @@ CREATE TABLE `des_design_change` index `idx_project_id` (`project_id` asc) using btree comment '项目id' ) comment '设计变更管理' collate = utf8mb4_unicode_ci; +DROP TABLE IF EXISTS `mat_material_receive`; +CREATE TABLE `mat_material_receive` +( + `id` bigint not null auto_increment comment '主键id', + `project_id` bigint not null comment '项目id', + `material_source` char(1) not null comment '材料来源(1甲供 2乙供)', + `form_code` varchar(50) null comment '表单编号', + `project_name` varchar(255) null comment '工程名称', + `material_name` varchar(255) null comment '设备材料名称', + `contract_name` varchar(255) null comment '合同名称', + `ordering_unit` varchar(255) null comment '订货单位', + `supplier_unit` varchar(255) null comment '供货单位', + `defect_description` text null comment '缺陷情况(承包单位填写)', + `cert_count` int default 0 null comment '合格证份数', + `cert_count_file_id` varchar(1024) null comment '合格证文件', + `report_count` int default 0 null comment '出厂报告份数', + `report_count_file_id` varchar(1024) null comment '出厂报告文件', + `tech_doc_count` int default 0 null comment '技术资料份数', + `tech_doc_count_file_id` varchar(1024) null comment '技术资料文件', + `license_count` int default 0 null comment '厂家资质文件份数', + `license_count_file_id` varchar(1024) null comment '厂家资质文件', + `storage_type` char(1) null comment '设备材料入库/移交', + `remark` text null comment '备注', + `create_by` bigint null comment '创建者', + `update_by` bigint null comment '更新者', + `create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间', + `update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', + primary key (`id`) using btree, + index `idx_project_id` (`project_id` asc) using btree comment '项目id', + index `idx_material_source` (`material_source` asc) using btree comment '材料来源' +) comment '物料接收单' collate = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `mat_material_receive_item`; +CREATE TABLE `mat_material_receive_item` +( + `id` bigint not null auto_increment comment '主键id', + `project_id` bigint not null comment '项目id', + `receive_id` bigint not null comment '接收单id', + `name` varchar(255) null comment '名称', + `specification` varchar(255) null comment '规格', + `unit` varchar(255) null comment '单位', + `quantity` decimal(10, 2) null comment '数量', + `accepted_quantity` decimal(10, 2) null comment '验收', + `shortage_quantity` decimal(10, 2) null comment '缺件', + `remark` text null comment '备注', + `create_by` bigint null comment '创建者', + `update_by` bigint null comment '更新者', + `create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间', + `update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', + primary key (`id`) using btree, + index `idx_project_id` (`project_id` asc) using btree comment '项目id', + index `idx_receive_id` (`receive_id` asc) using btree comment '接收单id' +) comment '物料接收单明细项' collate = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `mat_material_issue`; +CREATE TABLE `mat_material_issue` +( + `id` bigint not null auto_increment comment '主键id', + `project_id` bigint not null comment '项目id', + `material_source` char(1) not null comment '材料来源(1甲供 2乙供)', + `form_code` varchar(50) null comment '表单编号', + `project_name` varchar(255) null comment '工程名称', + `material_name` varchar(255) null comment '设备材料名称', + `ordering_unit` varchar(255) null comment '订货单位', + `supplier_unit` varchar(255) null comment '供货单位', + `issue_unit` varchar(255) null comment '领料单位', + `storage_unit` varchar(255) null comment '保管单位', + `defect_description` text null comment '缺陷情况(承包单位填写)', + `cert_count` int default 0 null comment '合格证份数', + `cert_count_file_id` varchar(1024) null comment '合格证文件', + `report_count` int default 0 null comment '出厂报告份数', + `report_count_file_id` varchar(1024) null comment '出厂报告文件', + `tech_doc_count` int default 0 null comment '技术资料份数', + `tech_doc_count_file_id` varchar(1024) null comment '技术资料文件', + `license_count` int default 0 null comment '厂家资质文件份数', + `license_count_file_id` varchar(1024) null comment '厂家资质文件', + `remark` text null comment '备注', + `create_by` bigint null comment '创建者', + `update_by` bigint null comment '更新者', + `create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间', + `update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', + primary key (`id`) using btree, + index `idx_project_id` (`project_id` asc) using btree comment '项目id', + index `idx_material_source` (`material_source` asc) using btree comment '材料来源' +) comment '物料领料单' collate = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `mat_material_issue_item`; +CREATE TABLE `mat_material_issue_item` +( + `id` bigint not null auto_increment comment '主键id', + `project_id` bigint not null comment '项目id', + `issue_id` bigint not null comment '接收单id', + `name` varchar(255) null comment '名称', + `specification` varchar(255) null comment '规格', + `unit` varchar(255) null comment '单位', + `stock_quantity` decimal(10, 2) null comment '库存', + `issued_quantity` decimal(10, 2) null comment '领取', + `remaining_quantity` decimal(10, 2) null comment '剩余', + `remark` text null comment '备注', + `create_by` bigint null comment '创建者', + `update_by` bigint null comment '更新者', + `create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间', + `update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', + primary key (`id`) using btree, + index `idx_project_id` (`project_id` asc) using btree comment '项目id', + index `idx_issue_id` (`issue_id` asc) using btree comment '领料单id' +) comment '物料领料单明细项' collate = utf8mb4_unicode_ci; +