已添加5个文件
已修改36个文件
已删除4个文件
2531 ■■■■ 文件已修改
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DncHomeController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/TransferPackage.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/listener/FileListener.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPackageStrategy.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataPackageService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPackageStrategy.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPackageStrategy.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPackageStrategy.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java 131 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentLeanOutStatusEnum.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentTransferStatusEnum.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentLeanOut.java 169 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamPrecisionParametersController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSparePartRequisitionController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentLeanOut.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentScrap.java 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentSealUp.java 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java 152 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamPrecisionParameters.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentSealUpMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentLeanOutRequest.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferRequest.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentLeanOutService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSparePartRequisitionService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java 257 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSparePartRequisitionServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDayUtilizationVo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
@@ -366,6 +366,17 @@
    String YN_Y = "Y";
    String YN_N = "N";
    /**
     * 1是0否
     */
    String YN_O = "0";
    String YN_1 = "1";
    /**
     * 1通过 2驳回
     */
    String APPROVED = "1";
    String REJECTED = "2";
    /**===============================================================================================*/
    /**
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DncHomeController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package org.jeecg.modules.dnc.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author Lyh
 * @Description: DNC首页接口
 * @date 2024/3/13 14:27
 */
@Slf4j
@Api(tags = "DNC首页接口")
@RestController
@RequestMapping("/dnc/home")
//todo dnc首页相关接口待定
public class DncHomeController {
    /**
     * ä¸‰ç»´å·¥è‰ºå·¥è‰ºè§„程信息列表
     * @return
     */
    @ApiOperation(value = "三维工艺工艺规程信息列表", notes = "三维工艺工艺规程信息列表")
    @GetMapping(value = "/syncProcessSpecificationInfo")
    public Result<?> syncProcessSpecificationInfo() {
        return Result.ok();
    }
    /**
     * ä¸‰ç»´å·¥è‰ºå·¥è‰ºè§„程信息领取挂靠产品结构树
     * @param id
     * @return
     */
    @ApiOperation(value = "三维工艺工艺规程信息领取挂靠产品结构树", notes = "三维工艺工艺规程信息领取挂靠产品结构树")
    @GetMapping(value = "/receiveTree")
    public Result<?> syncProcessSpecificationInfoTree(@RequestParam(name = "id") String id) throws JsonProcessingException {
        return Result.ok();
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/TransferPackage.java
@@ -12,7 +12,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TransferPackage {
    public enum DataType { PROCESS, WORKSTEP }
    public enum DataType {PRODUCT,COMPONENT,PARTS,OPERATION,PROCESS,WORKSTEP}
    private final DataType dataType;
    private final DocRelative docRelative;
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/listener/FileListener.java
@@ -26,7 +26,7 @@
    @Override
    public void onStart(FileAlterationObserver observer) {
//        log.info("开始监听目录: {}", observer.getDirectory().getAbsolutePath());
        log.info("开始监听目录: {}", observer.getDirectory().getAbsolutePath());
    }
    @Override
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPackageStrategy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package org.jeecg.modules.dnc.service.impl;
import org.jeecg.modules.dnc.dto.TransferPackage;
import org.jeecg.modules.dnc.entity.ComponentInfo;
import org.jeecg.modules.dnc.entity.DocRelative;
import org.jeecg.modules.dnc.mapper.ComponentInfoMapper;
import org.jeecg.modules.dnc.mapper.DeviceTypeMapper;
import org.jeecg.modules.dnc.mapper.DocRelativeMapper;
import org.jeecg.modules.dnc.service.DataPackageStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ComponentPackageStrategy implements DataPackageStrategy {
    @Autowired
    private ComponentInfoMapper componentInfoMapper;
    @Autowired
    private DeviceTypeMapper deviceTypeMapper;
    @Autowired
    private FullHierarchyTraceService traceService;
    @Autowired
    private DocRelativeMapper docRelativeMapper;
    @Override
    public TransferPackage packageData(String relativeId) {
        DocRelative docRelative=docRelativeMapper.selectById(relativeId);
        ComponentInfo componentInfo=componentInfoMapper.selectById(docRelative.getAttributionId());
        if (componentInfo == null) {
            throw new IllegalArgumentException("对应的部件不存在: " + docRelative.getAttributionId());
        }
        return TransferPackage.builder()
                .dataType(TransferPackage.DataType.COMPONENT)
                .docRelative(docRelative)
                .traceChain(traceService.traceFromComponent(docRelative))
                .build();
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java
@@ -322,7 +322,6 @@
                    }
                    break;
                case "2":
                    if (StrUtil.isNotEmpty(item.getUserId())){
                        ComponentPermission componentPermission = new ComponentPermission();
                        componentPermission.setComponentId(item.getBusinessId());
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataPackageService.java
@@ -18,7 +18,15 @@
    public DataPackageService(List<DataPackageStrategy> strategyList) {
        strategies = new EnumMap<>(TransferPackage.DataType.class);
        strategyList.forEach(strategy -> {
            if (strategy instanceof ProcessPackageStrategy) {
            if (strategy instanceof ProductPackageStrategy) {
                strategies.put(TransferPackage.DataType.PRODUCT, strategy);
            } else if (strategy instanceof ComponentPackageStrategy) {
                strategies.put(TransferPackage.DataType.COMPONENT, strategy);
            } else if (strategy instanceof PartsPackageStrategy) {
                strategies.put(TransferPackage.DataType.PARTS, strategy);
            } else if (strategy instanceof ProcessSpecVersionPackageStrategy) {
                strategies.put(TransferPackage.DataType.OPERATION, strategy);
            } else if (strategy instanceof ProcessPackageStrategy) {
                strategies.put(TransferPackage.DataType.PROCESS, strategy);
            } else if (strategy instanceof WorkStepPackageStrategy) {
                strategies.put(TransferPackage.DataType.WORKSTEP, strategy);
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import liquibase.pro.packaged.S;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum;
import org.jeecg.modules.dnc.dto.ComponentHierarchy;
import org.jeecg.modules.dnc.dto.TransferPackage;
import org.jeecg.modules.dnc.entity.*;
@@ -27,6 +28,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -36,6 +38,7 @@
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
public class FileFerryService {
@@ -51,7 +54,7 @@
    @Value("${jeecg.path.upload}")
    private String upLoadPath;
    @Autowired
    @Resource
    private MdcEquipmentMapper mdcEquipmentMapper;
    @Autowired
@@ -94,8 +97,6 @@
            throw new RuntimeException("文件写入失败", e);
        }
    }
    public TransferPackage importData(String filePath) {
        try {
@@ -142,18 +143,28 @@
            long number = Long.parseLong(numericPart);
            number--;  // èŽ·å–å‰ä¸€ä¸ªåºåˆ—å·
            // ä¿æŒç›¸åŒä½æ•°æ ¼å¼
            String newNumeric = String.format("%0" + numericPart.length() + "d", number);
            String ncFileName = prefix + newNumeric + "_" + equipmentId+".NC";
            String ncFilePath = path.getParent().resolve(ncFileName).toString();
            // 6. èŽ·å–æ–‡ä»¶å¤åˆ¶ç›®æ ‡è·¯å¾„
            DocRelative docRelative=pkg.getDocRelative();
            DocFile docFile = pkg.getTraceChain().getDocFile();
            DocInfo docInfo = pkg.getTraceChain().getDocInfo();
            if (docFile == null) {
                throw new IllegalStateException("传输包中缺少文档文件信息");
            }
            // ä¿æŒç›¸åŒä½æ•°æ ¼å¼
            String newNumeric = String.format("%0" + numericPart.length() + "d", number);
            String ncFileName = "";
            if (Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) ||
                    Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) {
                //NC文件的拷贝
                ncFileName = prefix + newNumeric + "_" + equipmentId+".NC";
            }else {
                //其他文档的拷贝
                ncFileName = prefix + newNumeric + "_" + equipmentId+"."+docFile.getFileSuffix();
                docInfo.setDocDispatchStatus(3);
                pkg.getTraceChain().setDocInfo(docInfo);
            }
            String ncFilePath = path.getParent().resolve(ncFileName).toString();
            // æž„建目标路径
            String targetDirectory = fileHomePath + docFile.getFilePath();
            String targetPath = Paths.get(targetDirectory, docFile.getFileEncodeName()).toString();
@@ -183,12 +194,12 @@
                    DocClassification classification = classificationService.getByCode("send");
                    if(classification == null)
                        ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR);
                    DocRelative docRelative = new DocRelative();
                    docRelative.setDocId(docInfo.getDocId());
                    docRelative.setClassificationId(classification.getClassificationId());
                    docRelative.setAttributionType(7);
                    docRelative.setAttributionId(mdcEquipment.getId());
                    docRelativeService.save(docRelative);
                    DocRelative newDocRelative = new DocRelative();
                    newDocRelative.setDocId(docInfo.getDocId());
                    newDocRelative.setClassificationId(classification.getClassificationId());
                    newDocRelative.setAttributionType(7);
                    newDocRelative.setAttributionId(mdcEquipment.getId());
                    docRelativeService.save(newDocRelative);
                }
                String sendPath = StringUtils.join(strings.toArray(), "/");
                boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(), sendPath + "/" + mdcEquipment.getEquipmentId(),
@@ -203,37 +214,35 @@
            } else {
                throw new RuntimeException("文件传输路径获取失败");
            }
            // è®¡ç®—后一个文件名
            long nextNumber = Long.parseLong(numericPart);
            nextNumber++;
            //获取序列化的程序确认表数据
            GuideCardBatch guideCardBatch=pkg.getTraceChain().getGuideCardBatch();
            if (guideCardBatch!=null){
                // è®¡ç®—后一个文件名
                long nextNumber = Long.parseLong(numericPart);
                nextNumber++;
                //获取文件路径
                String pictureUrl=guideCardBatch.getPicture();
            //获取文件路径
            String pictureUrl=guideCardBatch.getPicture();
                // ä¿æŒç›¸åŒä½æ•°æ ¼å¼
                String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber);
                String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1];
                String nextFilePath = path.getParent().resolve(nextFileName).toString();
            // ä¿æŒç›¸åŒä½æ•°æ ¼å¼
            String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber);
            String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1];
            String nextFilePath = path.getParent().resolve(nextFileName).toString();
                //拼接现有路径
                String picturePtah=upLoadPath+"/"+pictureUrl;
            //拼接现有路径
            String picturePtah=upLoadPath+"/"+pictureUrl;
            // 9. å¤åˆ¶æ–‡ä»¶å¹¶é‡å‘½å
            logger.info("复制文件: {} â†’ {}", nextFilePath,picturePtah);
            Path PicSource= Paths.get(nextFilePath);
            Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING);
                // 9. å¤åˆ¶æ–‡ä»¶å¹¶é‡å‘½å
                logger.info("复制文件: {} â†’ {}", nextFilePath,picturePtah);
                Path PicSource= Paths.get(nextFilePath);
                Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING);
                Files.delete(PicSource);
            }
            // åˆ é™¤æ–‡ä»¶
            logger.info("删除临时文件: {}", ncFilePath);
            Files.delete(source);
            Files.delete(path);
            Files.delete(PicSource);
            return JsonUtils.fromJson(json, TransferPackage.class);
            return pkg;
        } catch (NumberFormatException e) {
            throw new RuntimeException("文件名中的数字格式无效: " + e.getMessage(), e);
@@ -251,7 +260,6 @@
                pkg.getTraceChain().getComponentHierarchy().getComponents().size() < 4) {
            return;
        }
        ComponentHierarchy hierarchy = pkg.getTraceChain().getComponentHierarchy();
        List<ComponentInfo> compressed = new ArrayList<>();
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java
@@ -6,6 +6,7 @@
import org.jeecg.modules.dnc.entity.*;
import org.jeecg.modules.dnc.mapper.*;
import org.jeecg.modules.dnc.service.IPermissionStreamNewService;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,7 +47,74 @@
    private CutterMapper cutterMapper;
    @Autowired
    private GuideCardBatchMapper guideCardBatchMapper;
    @Autowired
    private IPermissionStreamNewService permissionStreamNewService;
    @Autowired
    private ISysUserService sysUserService;
    @Autowired
    private IMdcProductionService mdcProductionService;
    /**
     * äº§å“å°è£…
     * @param docRelative
     * @return
     */
    public ProcessTraceChain traceFromProduct(DocRelative docRelative) {
        ProcessTraceChain chain = initChainWithDocInfo(docRelative);
        traceProductChain(chain, docRelative.getAttributionId());
        List<ProductMix> productMixList=buildFullTreePath(chain);
        chain.setTreePath(productMixList);
        chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList));
        return chain;
    }
    /**
     * éƒ¨ä»¶å°è£…
     * @param docRelative
     * @return
     */
    public ProcessTraceChain traceFromComponent(DocRelative docRelative) {
        ProcessTraceChain chain = initChainWithDocInfo(docRelative);
        traceComponentChain(chain, docRelative.getAttributionId());
        List<ProductMix> productMixList=buildFullTreePath(chain);
        chain.setTreePath(productMixList);
        chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList));
        return chain;
    }
    /**
     * é›¶ä»¶å°è£…
     * @param docRelative
     * @return
     */
    public ProcessTraceChain traceFromParts(DocRelative docRelative) {
        ProcessTraceChain chain = initChainWithDocInfo(docRelative);
        tracePartsChain(chain, docRelative.getAttributionId());
        List<ProductMix> productMixList=buildFullTreePath(chain);
        chain.setTreePath(productMixList);
        chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList));
        return chain;
    }
    /**
     * å·¥è‰ºè§„程版本封装
     * @param docRelative
     * @return
     */
    public ProcessTraceChain traceFromPsv(DocRelative docRelative) {
        ProcessTraceChain chain = initChainWithDocInfo(docRelative);
        traceProcessSpecVersionChain(chain, docRelative.getAttributionId());
        List<ProductMix> productMixList=buildFullTreePath(chain);
        chain.setTreePath(productMixList);
        chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList));
        return chain;
    }
    /**
     * å·¥åºå°è£…
     * @param docRelative
     * @return
     */
    public ProcessTraceChain traceFromProcess(DocRelative docRelative) {
        ProcessTraceChain chain = initChainWithDocInfo(docRelative);
        DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId());
@@ -60,9 +128,15 @@
        completeChainWithProductInfo(chain);
        List<ProductMix> productMixList=buildFullTreePath(chain);
        chain.setTreePath(productMixList);
        chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList));
        return chain;
    }
    /**
     * å·¥æ­¥å°è£…
     * @param docRelative
     * @return
     */
    public ProcessTraceChain traceFromWorkStep(DocRelative docRelative) {
        ProcessTraceChain chain = initChainWithDocInfo(docRelative);
        DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId());
@@ -76,6 +150,7 @@
        completeChainWithProductInfo(chain);
        List<ProductMix> productMixList=buildFullTreePath(chain);
        chain.setTreePath(productMixList);
        chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList));
        return chain;
    }
@@ -85,9 +160,11 @@
                .ifPresent(doc -> {
                    chain.setDocInfo(doc);
                    chain.setDocFile(docFileMapper.selectById(doc.getPublishFileId()));
                    chain.setCutterList(getCuttersByDocId(doc.getDocId()));
                    getLatestGuideCardBatch(doc.getDocId()).ifPresent(chain::setGuideCardBatch);
                });
                    if (Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) ||
                            Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) {
                        chain.setCutterList(getCuttersByDocId(doc.getDocId()));
                        getLatestGuideCardBatch(doc.getDocId()).ifPresent(chain::setGuideCardBatch);
                    }});
        return chain;
    }
@@ -111,6 +188,48 @@
    private boolean isWorkSiteType(DeviceType deviceType) {
        return deviceType != null &&
                Objects.equals(deviceType.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode());
    }
    private void traceProductChain(ProcessTraceChain chain, String productId) {
        ProductInfo product = productMapper.selectById(productId);
        chain.setProduct(product);
    }
    private void traceComponentChain(ProcessTraceChain chain, String componentId) {
        chain.setComponentHierarchy(traceComponentHierarchy(componentId));
        Optional.ofNullable(chain.getComponentHierarchy())
                .map(ComponentHierarchy::getRootProduct)
                .ifPresent(chain::setProduct);
    }
    private void tracePartsChain(ProcessTraceChain chain, String partsId) {
        PartsInfo parts = partsMapper.selectById(partsId);
        chain.setParts(parts);
        if (parts != null) {
            if (parts.getComponentId() != null) {
                chain.setComponentHierarchy(traceComponentHierarchy(parts.getComponentId()));
                Optional.ofNullable(chain.getComponentHierarchy())
                        .map(ComponentHierarchy::getRootProduct)
                        .ifPresent(chain::setProduct);
            }
        }
    }
    private void traceProcessSpecVersionChain(ProcessTraceChain chain, String psvId) {
        ProcessSpecVersion psv = psvMapper.selectById(psvId);
        chain.setProcessSpec(psv);
        if (psv != null) {
            if (psv.getPartsId() != null) {
                PartsInfo parts = partsMapper.selectById(psv.getPartsId());
                chain.setParts(parts);
                if (parts != null && parts.getComponentId() != null) {
                    chain.setComponentHierarchy(traceComponentHierarchy(parts.getComponentId()));
                    Optional.ofNullable(chain.getComponentHierarchy())
                            .map(ComponentHierarchy::getRootProduct)
                            .ifPresent(chain::setProduct);
                }
            }
        }
    }
    private void traceProcessChain(ProcessTraceChain chain, String processId) {
@@ -210,4 +329,22 @@
        return path;
    }
    private List<PermissionStreamNew> buildFullTreePathPermission(List<ProductMix> productMixList) {
        List<Long> ids=productMixList.stream().map(ProductMix::getId).collect(Collectors.toList());
        List<PermissionStreamNew> path = permissionStreamNewService
                .list(new QueryWrapper<PermissionStreamNew>().in("business_id",ids)
                        .eq("delete_flag",0));
        path.forEach(item->{
            if (item.getDepartId()!=null){
                MdcProduction mdcProduction=mdcProductionService.getById(item.getDepartId());
                if(mdcProduction!=null){
                    item.setDepartId(item.getDepartId());
                }
            }
            if (item.getUserId()!=null){
                item.setUserId(sysUserService.getById(item.getUserId()).getUsername());
            }
        });
        return path;
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPackageStrategy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package org.jeecg.modules.dnc.service.impl;
import org.jeecg.modules.dnc.dto.TransferPackage;
import org.jeecg.modules.dnc.entity.DocRelative;
import org.jeecg.modules.dnc.entity.PartsInfo;
import org.jeecg.modules.dnc.mapper.DeviceTypeMapper;
import org.jeecg.modules.dnc.mapper.DocRelativeMapper;
import org.jeecg.modules.dnc.mapper.PartsInfoMapper;
import org.jeecg.modules.dnc.service.DataPackageStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PartsPackageStrategy implements DataPackageStrategy {
    @Autowired
    private PartsInfoMapper partsInfoMapper;
    @Autowired
    private DeviceTypeMapper deviceTypeMapper;
    @Autowired
    private FullHierarchyTraceService traceService;
    @Autowired
    private DocRelativeMapper docRelativeMapper;
    @Override
    public TransferPackage packageData(String relativeId) {
        DocRelative docRelative=docRelativeMapper.selectById(relativeId);
        PartsInfo partsInfo=partsInfoMapper.selectById(docRelative.getAttributionId());
        if (partsInfo == null) {
            throw new IllegalArgumentException("对应的零件不存在: " + docRelative.getAttributionId());
        }
        return TransferPackage.builder()
                .dataType(TransferPackage.DataType.PARTS)
                .docRelative(docRelative)
                .traceChain(traceService.traceFromParts(docRelative))
                .build();
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPackageStrategy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package org.jeecg.modules.dnc.service.impl;
import org.jeecg.modules.dnc.dto.TransferPackage;
import org.jeecg.modules.dnc.entity.DocRelative;
import org.jeecg.modules.dnc.entity.ProcessSpecVersion;
import org.jeecg.modules.dnc.mapper.DeviceTypeMapper;
import org.jeecg.modules.dnc.mapper.DocRelativeMapper;
import org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper;
import org.jeecg.modules.dnc.service.DataPackageStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ProcessSpecVersionPackageStrategy implements DataPackageStrategy {
    @Autowired
    private ProcessSpecVersionMapper processSpecVersionMapper;
    @Autowired
    private DeviceTypeMapper deviceTypeMapper;
    @Autowired
    private FullHierarchyTraceService traceService;
    @Autowired
    private DocRelativeMapper docRelativeMapper;
    @Override
    public TransferPackage packageData(String relativeId) {
        DocRelative docRelative=docRelativeMapper.selectById(relativeId);
        ProcessSpecVersion processSpecVersion=processSpecVersionMapper.selectById(docRelative.getAttributionId());
        if (processSpecVersion == null) {
            throw new IllegalArgumentException("对应的工艺规程版本不存在: " + docRelative.getAttributionId());
        }
        return TransferPackage.builder()
                .dataType(TransferPackage.DataType.PROCESS)
                .docRelative(docRelative)
                .traceChain(traceService.traceFromPsv(docRelative))
                .build();
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPackageStrategy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
package org.jeecg.modules.dnc.service.impl;
import org.jeecg.modules.dnc.dto.TransferPackage;
import org.jeecg.modules.dnc.entity.DocRelative;
import org.jeecg.modules.dnc.entity.ProductInfo;
import org.jeecg.modules.dnc.mapper.DeviceTypeMapper;
import org.jeecg.modules.dnc.mapper.DocRelativeMapper;
import org.jeecg.modules.dnc.mapper.ProductInfoMapper;
import org.jeecg.modules.dnc.service.DataPackageStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ProductPackageStrategy implements DataPackageStrategy {
    @Autowired
    private ProductInfoMapper productInfoMapper;
    @Autowired
    private DeviceTypeMapper deviceTypeMapper;
    @Autowired
    private FullHierarchyTraceService traceService;
    @Autowired
    private DocRelativeMapper docRelativeMapper;
    @Override
    public TransferPackage packageData(String relativeId) {
        DocRelative docRelative=docRelativeMapper.selectById(relativeId);
        ProductInfo productInfo=productInfoMapper.selectById(docRelative.getAttributionId());
        if (productInfo == null) {
            throw new IllegalArgumentException("对应的产品不存在: " + docRelative.getAttributionId());
        }
        return TransferPackage.builder()
                .dataType(TransferPackage.DataType.PRODUCT)
                .docRelative(docRelative)
                .traceChain(traceService.traceFromProduct(docRelative))
                .build();
    }
}
lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java
@@ -82,6 +82,18 @@
     }
     /**
      * å…¶ä»–文档手动发起流程
      * @param dispatchFile
      * @return
      */
     @AutoLog(value = "nc程序与电子图版签派-其他文档手动发起流程")
     @ApiOperation(value="nc程序与电子图版签派-其他文档手动发起流程", notes="nc程序与电子图版签派-其他文档手动发起流程")
     @PostMapping(value = "/startDispatchFile")
     public Result<?> startDispatchFile(@RequestBody DispatchFile dispatchFile){
         return dispatchFileService.saveDispatchFile(dispatchFile);
     }
     /**
      * é‡æ–°å¯åЍ
      * @param dispatchFileFlowTaskVo
      * @return
lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
@@ -346,8 +346,11 @@
            DocFile docFile = docFileService.getById(en.getFileId());
            if(docFile == null)
                ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
            //修改原有状态
            docInfo.setDocDispatchStatus(4);
            //修改NC状态
            if (Objects.equals(en.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode().toString()) ||
                    Objects.equals(en.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode().toString())) {
                docInfo.setDocDispatchStatus(4);
            }
            docInfoService.updateById(docInfo);
            DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),7, en.getDeviceId());
            if(deviceDoc != null) {
@@ -378,19 +381,17 @@
            }
            if(!b)
                ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR);
            if (mdcEquipment != null) {
                List<String> strings =  iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
                if (strings != null && !strings.isEmpty()) {
                    String path = StringUtils.join(strings.toArray(), "/");
                    boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(),
                            docFile.getFileEncodeName(),
            List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
            if (strings != null && !strings.isEmpty()) {
                String path = StringUtils.join(strings.toArray(), "/");
                boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(),
                        docFile.getFileEncodeName(),
                        docFile.getFileName(),docFile.getFileSuffix());
                if (!copyFileNc) {
                    ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
                } else {
                    FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(),
                            docFile.getFileName(),docFile.getFileSuffix());
                    if (!copyFileNc) {
                        ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR);
                    } else {
                        FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(),
                                docFile.getFileName(),docFile.getFileSuffix());
                    }
                }
            }
            List<DocRelative> docRelativeList=docRelativeService.
@@ -401,13 +402,15 @@
            if (docRelativeList.isEmpty()){
                ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR);
            }
            //涉密网进行NC文件的拷贝
            handleFileTransfer(mdcEquipment, docFile);
            //NC文件的拷贝
//            handleFileProcessing(docFile, mdcEquipment, secretFolder);
            //对应产品结构树拷贝
//            handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId());
            return synchronizedFlagService.updateFlag(1);
            DocRelative docRelative=docRelativeList.get(0);
            if (!Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) ||
                    !Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) {
                //其他文件的拷贝
                handleFileOtherProcessing(docFile, mdcEquipment, secretFolder);
                //对应产品结构树拷贝
                handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId());
            }
            return true;
        }else if(up.getStatus() == 3) {
            //拒绝操作 ä»€ä¹ˆä¹Ÿä¸åš
            return true;
@@ -687,16 +690,86 @@
        passInfoTxt.setPassType(DncPassLogPassType.PRODUCTSTRUCTURE.getCode());
        dncPassLogService.save(passInfoTxt);
        String fileName="10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY);
        if (Objects.equals(docInfo.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){
            //工序对应设备类
            String filePath = ferryService.exportData(TransferPackage.DataType.PROCESS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
            System.out.println("工序数据已导出: " + filePath);
        }else {
            //工步对应设备类
            String filePath = ferryService.exportData(TransferPackage.DataType.WORKSTEP, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
            System.out.println("工步数据已导出: " + filePath);
        String filePath="";
        switch (docInfo.getAttributionType()){
            case 1:
                //产品对应其他文档
                filePath = ferryService.exportData(TransferPackage.DataType.PRODUCT, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
                System.out.println("产品数据已导出: " + filePath);
                break;
            case 2:
                //部件对应其他文档
                filePath = ferryService.exportData(TransferPackage.DataType.COMPONENT, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
                System.out.println("部件数据已导出: " + filePath);
                break;
            case 3:
                //零件对应其他文档
                filePath = ferryService.exportData(TransferPackage.DataType.PARTS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
                System.out.println("零件数据已导出: " + filePath);
                break;
            case 4:
                //工艺版本对应其他文档
                filePath = ferryService.exportData(TransferPackage.DataType.OPERATION, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
                System.out.println("工艺版本数据已导出: " + filePath);
                break;
            case 5:
                //工序对应设备类
                filePath = ferryService.exportData(TransferPackage.DataType.PROCESS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
                System.out.println("工序数据已导出: " + filePath);
                break;
            case 6:
                //工步对应设备类
                filePath = ferryService.exportData(TransferPackage.DataType.WORKSTEP, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry");
                System.out.println("工步数据已导出: " + filePath);
                break;
            default:
                break;
        }
    }
    //封装处理其他文件
    private void handleFileOtherProcessing(DocFile docFile, MdcEquipment mdcEquipment, String secretFolder) {
        if (!docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) {
            List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
            if (strings != null && !strings.isEmpty()) {
                DncPassLog passInfoTxt = new DncPassLog();
                String path = StringUtils.join(strings.toArray(), "/");
                Date dateFirst = DateUtil.getNow();
                passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY));
                /*查询最后一条记录*/
                //休眠 500毫秒
                DncPassLog dncPassLog  = dncPassLogService.findDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY));
                int fileNc =0;
                if (dncPassLog !=null) {
                    fileNc = dncPassLog.getSequenceNumber() + 1;
                } else {
                    fileNc =  1;
                }
                //处理文件名称  æ–‡ä»¶è·¯å¾„
                String sequenceNc = String.format("%06d",fileNc);
                DncPassLog passInfoNc = new DncPassLog();
                passInfoNc.setSequenceNumber(fileNc);
                passInfoNc.setSequenceOrder(sequenceNc);
                passInfoNc.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY));
                passInfoNc.setPassType("02");
                passInfoNc.setPassName(docFile.getFileName());
                try {
                    Thread.sleep(1000);
                    Date date = new Date();
                    passInfoNc.setCreateTime(date);
                    System.out.println(DateUtil.format(date,DateUtil.STR_DATE_TIME));
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                dncPassLogService.save(passInfoNc);
                FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" +
                                docFile.getFileName(),
                        secretFolder +"/"+"10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc+"_"+mdcEquipment.getEquipmentId(),
                        docFile.getFileSuffix(), docFile.getFileSuffix());
            }
        }
    }
    @Override
    public void afterFlowHandle(FlowMyBusiness business) {
        business.getTaskNameId();//接下来审批的节点
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
@@ -68,5 +68,9 @@
    String PCR0006 = "PCR0006";
    //备件管理员
    String PCR0007 = "PCR0007";
    //单位领导
    String PCR0008 = "PCR0008";
    //公司领导
    String PCR0009 = "PCR0009";
}
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentLeanOutStatusEnum.java
@@ -2,9 +2,12 @@
public enum EquipmentLeanOutStatusEnum {
    WAIT_SUBMIT, //待提交
    WAIT_APPROVAL, //待审批
    WAIT_APPROVAL_OUT, //待使用单位出厂审批
    WAIT_APPROVAL_IN, //待入厂审批
    WAIT_RETURN, //待归还
    WAIT_CONFIRM, //待确认
    WAIT_CONFIRM_RETURN, //待归还方确认
    WAIT_CONFIRM_BORROW, //待借用方确认
    REJECT, //已驳回
    COMPLETE, //已完成
    ;
    public static EquipmentLeanOutStatusEnum getInstance(String code) {
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/EquipmentTransferStatusEnum.java
@@ -6,7 +6,11 @@
 */
public enum EquipmentTransferStatusEnum {
    WAIT_SUBMIT, //待提交
    WAIT_CHECK, //待审核
    WAIT_USE_LEADER_CHECK, //待使用单位领导审批
    WAIT_TRANSFER_LEADER_CHECK, //待调入单位领导审批
    WAIT_EXTERNAL_CONFIRM, //待机动办确认人
    WAIT_COMPANY_LEADER_CHECK, //待公司领导审批
    REJECT, //已驳回
    COMPLETE, //已完成
    ;
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentLeanOut.java
@@ -16,157 +16,144 @@
import java.io.Serializable;
import java.util.Date;
/**
 * @Description: è®¾å¤‡å€Ÿå‡ºå½’还
 * @Author: jeecg-boot
 * @Date: 2025-05-13
 * @Date:   2025-05-13
 * @Version: V1.0
 */
@Data
@TableName("eam_equipment_lean_out")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "eam_equipment_lean_out对象", description = "设备借出归还")
@ApiModel(value="eam_equipment_lean_out对象", description="设备借出归还")
public class EamEquipmentLeanOut implements Serializable {
    /**
     * ä¸»é”®
     */
    /**主键*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * åˆ›å»ºäºº
     */
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    /**创建时间*/
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**
     * æ›´æ–°äºº
     */
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**
     * æ›´æ–°æ—¶é—´
     */
    /**更新时间*/
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    /**
     * åˆ é™¤æ ‡è®°
     */
    /**删除标记*/
    @ApiModelProperty(value = "删除标记")
    private Integer delFlag;
    /**
     * è®¾å¤‡ID
     */
    /**设备ID*/
    @ApiModelProperty(value = "设备ID")
    private String equipmentId;
    /**
     * å•据号
     */
    /**单据号*/
    @Excel(name = "单据号", width = 15)
    @ApiModelProperty(value = "单据号")
    private String code;
    /**
     * å€Ÿå…¥éƒ¨é—¨
     */
    /**借入部门*/
    @Excel(name = "借入部门", width = 15, dictTable = "mdc_production", dicText = "production_name", dicCode = "id")
    @ApiModelProperty(value = "借入部门")
    @Dict(dicCode = "mdc_production, production_name, id")
    private String leanDepartId;
    /**
     * å€Ÿå…¥è´£ä»»äºº
     */
    /**借入责任人*/
    @Excel(name = "借入责任人", width = 15)
    @ApiModelProperty(value = "借入责任人")
    @Dict(dicCode = "sys_user, realname, username")
    private String leanPerson;
    /**
     * å€Ÿç”¨åŽŸå› 
     */
    /**借用原因*/
    @ApiModelProperty(value = "借用原因")
    private String leanReason;
    /**
     * å®¡æ‰¹ç±»åž‹
     */
    @ApiModelProperty(value = "审批类型")
    @Dict(dicCode = "approved_rejected")
    private String approvalDealType;
    /**
     * å€Ÿå‡ºçŠ¶æ€
     */
    /**借出状态*/
    @Excel(name = "借出状态", width = 15)
    @ApiModelProperty(value = "借出状态")
    @Dict(dicCode = "equipment_lean_out_status")
    private String leanStatus;
    /**
     * å€Ÿå‡ºå¼€å§‹æ—¶é—´
     */
    /**借出开始时间*/
    @ApiModelProperty(value = "借出时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date leanStartTime;
    /**
     * å€Ÿå‡ºå½’还时间
     */
    /**借出归还时间*/
    @ApiModelProperty(value = "归还时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date leanEndTime;
    /**
     * å®¡æ ¸äºº
     */
    @Excel(name = "审核人", width = 15)
    @ApiModelProperty(value = "审核人")
    /**使用车间审核人*/
    @Excel(name = "使用车间审核人", width = 15)
    @ApiModelProperty(value = "使用车间审核人")
    @Dict(dicCode = "sys_user, realname, username")
    private String approvalUser;
    /**
     * å®¡æ ¸æ„è§
     */
    @Excel(name = "审核意见", width = 15)
    @ApiModelProperty(value = "审核意见")
    private String approvalComment;
    /**
     * å®¡æ ¸æ—¶é—´
     */
    @ApiModelProperty(value = "审核时间")
    private String useApprovalUser;
    /**使用车间审批类型*/
    @ApiModelProperty(value = "使用车间审批类型")
    @Dict(dicCode = "approved_rejected")
    private String useApprovalDealType;
    /**使用车间审核意见*/
    @Excel(name = "使用车间审核意见", width = 15)
    @ApiModelProperty(value = "使用车间审核意见")
    private String useApprovalComment;
    /**使用车间审核时间*/
    @ApiModelProperty(value = "使用车间审核时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date approvalTime;
    /**
     * ç¡®è®¤äºº
     */
    @Excel(name = "确认人", width = 15)
    @ApiModelProperty(value = "确认人")
    private Date useApprovalTime;
    /**借用车间审核人*/
    @Excel(name = "借用车间审核人", width = 15)
    @ApiModelProperty(value = "借用车间审核人")
    @Dict(dicCode = "sys_user, realname, username")
    private String confirmUser;
    /**
     * ç¡®è®¤æ„è§
     */
    @Excel(name = "确认意见", width = 15)
    @ApiModelProperty(value = "确认意见")
    private String confirmComment;
    /**
     * ç¡®è®¤æ—¶é—´
     */
    @ApiModelProperty(value = "确认时间")
    private String leanOutApprovalUser;
    /**借用车间审批类型*/
    @ApiModelProperty(value = "借用车间审批类型")
    @Dict(dicCode = "approved_rejected")
    private String leanOutApprovalDealType;
    /**借用车间审核意见*/
    @Excel(name = "借用车间审核意见", width = 15)
    @ApiModelProperty(value = "使用车间审核意见")
    private String leanOutApprovalComment;
    /**借用车间审核时间*/
    @ApiModelProperty(value = "借用车间审核时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date confirmTime;
    /**
     * å¤‡æ³¨
     */
    private Date leanOutApprovalTime;
    /**使用车间确认人*/
    @Excel(name = "使用车间确认人", width = 15)
    @ApiModelProperty(value = "使用车间确认人")
    @Dict(dicCode = "sys_user, realname, username")
    private String useConfirmUser;
    /**确认意见*/
    @Excel(name = "使用车间确认意见", width = 15)
    @ApiModelProperty(value = "使用车间确认意见")
    private String useConfirmComment;
    /**使用车间确认时间*/
    @ApiModelProperty(value = "使用车间确认时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date useConfirmTime;
    /**借用车间确认人*/
    @Excel(name = "借用车间确认人", width = 15)
    @ApiModelProperty(value = "借用车间确认人")
    @Dict(dicCode = "sys_user, realname, username")
    private String leanOutConfirmUser;
    /**借用车间确认意见*/
    @Excel(name = "借用车间确认意见", width = 15)
    @ApiModelProperty(value = "借用车间确认意见")
    private String leanOutConfirmComment;
    /**借用车间确认时间*/
    @ApiModelProperty(value = "借用车间确认时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date leanOutConfirmTime;
    /**备注*/
    @Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
    private String remark;
    /**
     * å¤‡æ³¨
     */
    /**备注*/
    @Excel(name = "归还备注", width = 15)
    @ApiModelProperty(value = "归还备注")
    private String returnComment;
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java
@@ -1,8 +1,6 @@
package org.jeecg.modules.eam.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -10,6 +8,7 @@
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
@@ -26,36 +25,10 @@
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "eam_equipment_transfer对象", description = "设备归属变动")
public class EamEquipmentTransfer implements Serializable {
public class EamEquipmentTransfer extends JeecgEntity implements Serializable {
    /**
     * ä¸»é”®
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * åˆ›å»ºäºº
     */
    @Excel(name = "创建人", width = 15)
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**
     * æ›´æ–°äºº
     */
    @Excel(name = "更新人", width = 15)
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**
     * æ›´æ–°æ—¶é—´
     */
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    private static final long serialVersionUID = -1869845900682810093L;
    /**
     * åˆ é™¤æ ‡è®°
     */
@@ -114,28 +87,94 @@
    @ApiModelProperty(value = "变动日期")
    private Date transferTime;
    /**
     * å®¡æ ¸äºº
     * ä½¿ç”¨å•位领导
     */
    @Excel(name = "审核人", width = 15)
    @ApiModelProperty(value = "审核人")
    @Excel(name = "使用单位领导", width = 15)
    @ApiModelProperty(value = "使用单位领导")
    @Dict(dicCode = "sys_user, realname, username")
    private String approvalUser;
    private String useLeader;
    /**
     * å®¡æ ¸ç±»åž‹
     * ä½¿ç”¨å•位领导审核类型
     */
    @ApiModelProperty(value = "审核类型")
    @ApiModelProperty(value = "使用单位领导审核类型")
    @Dict(dicCode = "approved_rejected")
    private String approvalDealType;
    private String useLeaderApprovalDealType;
    /**
     * å®¡æ ¸æ„è§
     * ä½¿ç”¨å•位领导审核意见
     */
    @ApiModelProperty(value = "审核意见")
    private String approvalComment;
    @ApiModelProperty(value = "使用单位领导审核意见")
    private String useLeaderApprovalComment;
    /**
     * å®¡æ ¸æ—¶é—´
     * ä½¿ç”¨å•位领导审核时间
     */
    @ApiModelProperty(value = "审核时间")
    private Date approvalTime;
    @ApiModelProperty(value = "使用单位领导审核时间")
    private Date useLeaderApprovalTime;
    /**
     * è°ƒå…¥å•位领导
     */
    @Excel(name = "调入单位领导", width = 15)
    @ApiModelProperty(value = "调入单位领导")
    @Dict(dicCode = "sys_user, realname, username")
    private String transferLeader;
    /**
     * è°ƒå…¥å•位领导审核类型
     */
    @ApiModelProperty(value = "调入单位领导审核类型")
    @Dict(dicCode = "approved_rejected")
    private String transferLeaderApprovalDealType;
    /**
     * è°ƒå…¥å•位领导审核意见
     */
    @ApiModelProperty(value = "调入单位领导审核意见")
    private String transferLeaderApprovalComment;
    /**
     * è°ƒå…¥å•位领导审核时间
     */
    @ApiModelProperty(value = "调入单位领导审核时间")
    private Date transferLeaderApprovalTime;
    /**
     * æœºåŠ¨åŠžç¡®è®¤äºº
     */
    @Excel(name = "机动办确认人", width = 15)
    @ApiModelProperty(value = "机动办确认人")
    @Dict(dicCode = "sys_user, realname, username")
    private String externalConfirm;
    /**
     * æœºåŠ¨åŠžç¡®è®¤æ—¶é—´
     */
    @ApiModelProperty(value = "机动办确认时间")
    private Date externalConfirmTime;
    /**
     * æ˜¯å¦éœ€è¦å…¬å¸é¢†å¯¼å®¡æ‰¹
     */
    @Excel(name = "是否需要公司领导审批", width = 15)
    @ApiModelProperty(value = "是否需要公司领导审批")
    @Dict(dicCode = "yn")
    private String companyLeaderCheck;
    /**
     * å…¬å¸é¢†å¯¼
     */
    @Excel(name = "公司领导", width = 15)
    @ApiModelProperty(value = "公司领导")
    @Dict(dicCode = "sys_user, realname, username")
    private String companyLeader;
    /**
     * å…¬å¸é¢†å¯¼å®¡æ ¸ç±»åž‹
     */
    @ApiModelProperty(value = "公司领导审核类型")
    @Dict(dicCode = "approved_rejected")
    private String companyLeaderApprovalDealType;
    /**
     * å…¬å¸é¢†å¯¼å®¡æ ¸æ„è§
     */
    @ApiModelProperty(value = "公司领导审核意见")
    private String companyLeaderApprovalComment;
    /**
     * å…¬å¸é¢†å¯¼å®¡æ ¸æ—¶é—´
     */
    @ApiModelProperty(value = "公司领导审核时间")
    private Date companyLeaderApprovalTime;
    /**
     * å¤‡æ³¨
     */
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentTransferController.java
@@ -123,9 +123,8 @@
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        EamEquipmentTransfer entity = eamEquipmentTransferService.getById(id);
        if (entity != null) {
            entity.setDelFlag(CommonConstant.DEL_FLAG_1);
            eamEquipmentTransferService.updateById(entity);
        if (entity != null && !EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) {
            eamEquipmentTransferService.removeById(entity);
        }
        return Result.OK("删除成功!");
    }
@@ -140,13 +139,12 @@
    @ApiOperation(value = "设备归属变动-批量删除", notes = "设备归属变动-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.eamEquipmentTransferService.removeByIds(Arrays.asList(ids.split(",")));
        List<String> list = Arrays.asList(ids.split(","));
        list.forEach(id -> {
            EamEquipmentTransfer entity = eamEquipmentTransferService.getById(id);
            if (entity != null) {
            if (entity != null && !EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) {
                entity.setDelFlag(CommonConstant.DEL_FLAG_1);
                eamEquipmentTransferService.updateById(entity);
                eamEquipmentTransferService.removeById(entity);
            }
        });
        return Result.OK("批量删除成功!");
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamPrecisionParametersController.java
@@ -6,6 +6,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
@@ -157,9 +158,10 @@
    @ApiOperation(value = "精度参数维护-查询所有", notes = "精度参数维护-查询所有")
    @GetMapping(value = "/listAll")
    public Result<?> listAll() {
    public Result<?> listAll(String equipmentType) {
        QueryWrapper<EamPrecisionParameters> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0);
        queryWrapper.eq(StringUtils.isNotEmpty(equipmentType), "equipment_type", equipmentType);
        List<EamPrecisionParameters> list = eamPrecisionParametersService.list(queryWrapper);
        return Result.OK(list);
    }
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSparePartRequisitionController.java
@@ -14,10 +14,8 @@
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.eam.constant.BusinessCodeConst;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import org.jeecg.modules.eam.entity.EamSparePartRequisition;
import org.jeecg.modules.eam.entity.EamSparePartRequisitionDetail;
import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest;
import org.jeecg.modules.eam.request.EamSparePartRequisitionRequest;
import org.jeecg.modules.eam.service.IEamSparePartRequisitionDetailService;
import org.jeecg.modules.eam.service.IEamSparePartRequisitionService;
@@ -27,8 +25,6 @@
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentLeanOut.java
ÎļþÒÑɾ³ý
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentScrap.java
ÎļþÒÑɾ³ý
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentSealUp.java
ÎļþÒÑɾ³ý
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamEquipmentTransfer.java
ÎļþÒÑɾ³ý
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamPrecisionParameters.java
@@ -58,4 +58,11 @@
    @ApiModelProperty(value = "参数分类")
    @Dict(dicCode = "precision_parameters_category")
    private String parameterCategory;
    /**
     * è®¾å¤‡ç§ç±»
     */
    @Excel(name = "设备种类", width = 15, dictTable = "sys_category", dicCode = "code", dicText = "name")
    @ApiModelProperty(value = "设备种类")
    @Dict(dictTable = "sys_category", dicCode = "code", dicText = "name")
    private String equipmentType;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentSealUpMapper.java
@@ -1,15 +1,12 @@
package org.jeecg.modules.eam.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import org.jeecg.modules.eam.entity.EamEquipmentSealUp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.eam.entity.EamEquipmentSealUp;
/**
 * @Description: è®¾å¤‡å°å­˜å¯å°
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentLeanOutRequest.java
@@ -43,6 +43,8 @@
     * åˆ›å»ºæ—¶é—´
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * æ›´æ–°äºº
@@ -53,6 +55,8 @@
     * æ›´æ–°æ—¶é—´
     */
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * åˆ é™¤æ ‡è®°
@@ -67,22 +71,17 @@
    /**
     * å•据号
     */
    @Excel(name = "单据号", width = 15)
    @ApiModelProperty(value = "单据号")
    private String code;
    /**
     * å€Ÿå…¥éƒ¨é—¨
     */
    @Excel(name = "借入部门", width = 15, dictTable = "mdc_production", dicText = "production_name", dicCode = "id")
    @ApiModelProperty(value = "借入部门")
    @Dict(dicCode = "mdc_production, production_name, id")
    private String leanDepartId;
    /**
     * å€Ÿå…¥è´£ä»»äºº
     */
    @Excel(name = "借入责任人", width = 15)
    @ApiModelProperty(value = "借入责任人")
    @Dict(dicCode = "sys_user, realname, username")
    private String leanPerson;
    /**
     * å€Ÿç”¨åŽŸå› 
@@ -90,17 +89,9 @@
    @ApiModelProperty(value = "借用原因")
    private String leanReason;
    /**
     * å®¡æ‰¹ç±»åž‹
     */
    @ApiModelProperty(value = "审批类型")
    @Dict(dicCode = "approved_rejected")
    private String approvalDealType;
    /**
     * å€Ÿå‡ºçŠ¶æ€
     */
    @Excel(name = "借出状态", width = 15)
    @ApiModelProperty(value = "借出状态")
    @Dict(dicCode = "equipment_lean_out_status")
    private String leanStatus;
    /**
     * å€Ÿå‡ºå¼€å§‹æ—¶é—´
@@ -117,55 +108,93 @@
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date leanEndTime;
    /**
     * å®¡æ ¸äºº
     * ä½¿ç”¨è½¦é—´å®¡æ ¸äºº
     */
    @Excel(name = "审核人", width = 15)
    @ApiModelProperty(value = "审核人")
    @Dict(dicCode = "sys_user, realname, username")
    private String approvalUser;
    @ApiModelProperty(value = "使用车间审核人")
    private String useApprovalUser;
    /**
     * å®¡æ ¸æ„è§
     * ä½¿ç”¨è½¦é—´å®¡æ‰¹ç±»åž‹
     */
    @Excel(name = "审核意见", width = 15)
    @ApiModelProperty(value = "审核意见")
    private String approvalComment;
    @ApiModelProperty(value = "使用车间审批类型")
    private String useApprovalDealType;
    /**
     * å®¡æ ¸æ—¶é—´
     * ä½¿ç”¨è½¦é—´å®¡æ ¸æ„è§
     */
    @ApiModelProperty(value = "审核时间")
    @ApiModelProperty(value = "使用车间审核意见")
    private String useApprovalComment;
    /**
     * ä½¿ç”¨è½¦é—´å®¡æ ¸æ—¶é—´
     */
    @ApiModelProperty(value = "使用车间审核时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date approvalTime;
    private Date useApprovalTime;
    /**
     * ç¡®è®¤äºº
     * å€Ÿç”¨è½¦é—´å®¡æ ¸äºº
     */
    @Excel(name = "确认人", width = 15)
    @ApiModelProperty(value = "确认人")
    @Dict(dicCode = "sys_user, realname, username")
    private String confirmUser;
    @ApiModelProperty(value = "借用车间审核人")
    private String leanOutApprovalUser;
    /**
     * å€Ÿç”¨è½¦é—´å®¡æ‰¹ç±»åž‹
     */
    @ApiModelProperty(value = "借用车间审批类型")
    private String leanOutApprovalDealType;
    /**
     * å€Ÿç”¨è½¦é—´å®¡æ ¸æ„è§
     */
    @ApiModelProperty(value = "使用车间审核意见")
    private String leanOutApprovalComment;
    /**
     * å€Ÿç”¨è½¦é—´å®¡æ ¸æ—¶é—´
     */
    @ApiModelProperty(value = "借用车间审核时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date leanOutApprovalTime;
    /**
     * ä½¿ç”¨è½¦é—´ç¡®è®¤äºº
     */
    @ApiModelProperty(value = "使用车间确认人")
    private String useConfirmUser;
    /**
     * ç¡®è®¤æ„è§
     */
    @Excel(name = "确认意见", width = 15)
    @ApiModelProperty(value = "确认意见")
    private String confirmComment;
    @ApiModelProperty(value = "使用车间确认意见")
    private String useConfirmComment;
    /**
     * ç¡®è®¤æ—¶é—´
     * ä½¿ç”¨è½¦é—´ç¡®è®¤æ—¶é—´
     */
    @ApiModelProperty(value = "确认时间")
    @ApiModelProperty(value = "使用车间确认时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date confirmTime;
    private Date useConfirmTime;
    /**
     * å€Ÿç”¨è½¦é—´ç¡®è®¤äºº
     */
    @ApiModelProperty(value = "借用车间确认人")
    private String leanOutConfirmUser;
    /**
     * å€Ÿç”¨è½¦é—´ç¡®è®¤æ„è§
     */
    @ApiModelProperty(value = "借用车间确认意见")
    private String leanOutConfirmComment;
    /**
     * å€Ÿç”¨è½¦é—´ç¡®è®¤æ—¶é—´
     */
    @ApiModelProperty(value = "借用车间确认时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date leanOutConfirmTime;
    /**
     * å¤‡æ³¨
     */
    @Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
    private String remark;
    /**
     * å¤‡æ³¨
     */
    @Excel(name = "归还备注", width = 15)
    @ApiModelProperty(value = "归还备注")
    private String returnComment;
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamEquipmentTransferRequest.java
@@ -6,7 +6,6 @@
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.modules.flowable.domain.vo.FlowTaskVo;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.util.Date;
@@ -91,27 +90,40 @@
    @ApiModelProperty(value = "变动日期")
    private Date transferTime;
    /**
     * å®¡æ ¸äºº
     * ä½¿ç”¨å•位领导审核类型
     */
    @Excel(name = "审核人", width = 15)
    @ApiModelProperty(value = "审核人")
    private String approvalUser;
    @ApiModelProperty(value = "使用单位领导审核类型")
    private String useLeaderApprovalDealType;
    /**
     * å®¡æ ¸æ—¶é—´
     * ä½¿ç”¨å•位领导审核意见
     */
    @ApiModelProperty(value = "审核时间")
    private Date approvalTime;
    @ApiModelProperty(value = "使用单位领导审核意见")
    private String useLeaderApprovalComment;
    /**
     * å®¡æ ¸ç±»åž‹
     * è°ƒå…¥å•位领导审核类型
     */
    @Excel(name = "审核类型", width = 15)
    @ApiModelProperty(value = "审核类型")
    private String approvalDealType;
    @ApiModelProperty(value = "调入单位领导审核类型")
    private String transferLeaderApprovalDealType;
    /**
     * å®¡æ ¸æ„è§
     * è°ƒå…¥å•位领导审核意见
     */
    @ApiModelProperty(value = "审核意见")
    private String approvalComment;
    @ApiModelProperty(value = "调入单位领导审核意见")
    private String transferLeaderApprovalComment;
    /**
     * æ˜¯å¦éœ€è¦å…¬å¸é¢†å¯¼å®¡æ‰¹
     */
    @ApiModelProperty(value = "是否需要公司领导审批")
    private String companyLeaderCheck;
    /**
     * å…¬å¸é¢†å¯¼å®¡æ ¸ç±»åž‹
     */
    @ApiModelProperty(value = "公司领导审核类型")
    private String companyLeaderApprovalDealType;
    /**
     * å…¬å¸é¢†å¯¼å®¡æ ¸æ„è§
     */
    @ApiModelProperty(value = "公司领导审核意见")
    private String companyLeaderApprovalComment;
    /**
     * å¤‡æ³¨
     */
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentLeanOutService.java
@@ -2,8 +2,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import org.jeecg.modules.eam.request.EamEquipmentLeanOutQuery;
import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest;
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamSparePartRequisitionService.java
@@ -1,9 +1,7 @@
package org.jeecg.modules.eam.service;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import org.jeecg.modules.eam.entity.EamSparePartRequisition;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest;
import org.jeecg.modules.eam.request.EamSparePartRequisitionRequest;
import java.util.List;
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentLeanOutServiceImpl.java
@@ -22,7 +22,6 @@
import org.jeecg.modules.eam.constant.*;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import org.jeecg.modules.eam.entity.EamEquipmentSealUp;
import org.jeecg.modules.eam.mapper.EamEquipmentLeanOutMapper;
import org.jeecg.modules.eam.request.EamEquipmentLeanOutQuery;
import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest;
@@ -210,7 +209,7 @@
            throw new JeecgBootException("当前用户无法编辑借用记录!");
        }
        UpdateWrapper<EamEquipmentLeanOut> updateWrapper = new UpdateWrapper<>();
        updateWrapper.set("lean_status", EquipmentLeanOutStatusEnum.WAIT_APPROVAL.name());
        updateWrapper.set("lean_status", EquipmentLeanOutStatusEnum.WAIT_APPROVAL_OUT.name());
        updateWrapper.eq("id", id);
        updateWrapper.eq("lean_person", sysUser.getUsername());
        boolean success = super.update(updateWrapper);
@@ -237,7 +236,7 @@
        Result result = flowDefinitionService.startProcessInstanceByKey("equipment_lean_out", variables);
        if (result != null) {
            entity.setLeanStartTime(new Date());
            entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_APPROVAL.name());
            entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_APPROVAL_OUT.name());
            //保存工单
            equipmentLeanOutMapper.updateById(entity);
            return result.isSuccess();
@@ -282,7 +281,7 @@
        Result result = flowDefinitionService.startProcessInstanceByKey("equipment_return", variables);
        if (result != null) {
            entity.setLeanEndTime(new Date());
            entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM.name());
            entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM_RETURN.name());
            //保存工单
            equipmentLeanOutMapper.updateById(entity);
            return result.isSuccess();
@@ -303,7 +302,7 @@
        if (user == null || StrUtil.isBlank(user.getId())) {
            throw new JeecgBootException("未获取到登录用户,请重新登录后再试!");
        }
        request.setApprovalUser(user.getUsername());
//        request.setApprovalUser(user.getUsername());
        // èŽ·å–æµç¨‹ä¸šåŠ¡è®°å½•
        FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId());
        if (flowMyBusiness == null) {
@@ -324,89 +323,146 @@
            throw new JeecgBootException("设备不存在,请检查!");
        }
        EquipmentLeanOutStatusEnum status = EquipmentLeanOutStatusEnum.getInstance(entity.getLeanStatus());
        if (status == null) {
            return null;
        }
        //流程变量
        Map<String, Object> values = new HashMap<>();
        switch (status) {
            // å®¡æ‰¹
            case WAIT_APPROVAL:
                //执行完成
                values.put("dataId", entity.getId());
                values.put("organization", request.getApprovalComment());
                values.put("comment", request.getApprovalComment());
                values.put("approvalDealType", request.getApprovalDealType());
                request.setComment(request.getApprovalComment());
                entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº
                entity.setApprovalComment(request.getApprovalComment());// å®¡æ ¸æ„è§
                entity.setApprovalTime(new Date());// å®¡æ ¸æ—¶é—´
                entity.setApprovalDealType(request.getApprovalDealType()); // å®¡æ‰¹ç±»åž‹
                // éªŒè¯é€šè¿‡è¿˜æ˜¯é©³å›ž
                if (request.getApprovalDealType().equals("1")) {
                    //设置entity
                    entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_RETURN.name());
                    List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getLeanPerson()));
                    values.put("NextAssignee", userApprovalList);
                } else {
                    //设置entity
                    entity.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name());
                    // ä¿®æ”¹è®¾å¤‡çŠ¶æ€
                    equipment.setAssetStatus(AssetStatusEnum.NORMAL.name());
                    eamEquipmentService.updateById(equipment);
                }
                break;
            // å½’还
            case WAIT_RETURN:
                if (StringUtils.isBlank(equipment.getEquipmentManager())) {
                    throw new JeecgBootException("设备未分配设备管理员,无法进入下级审批!");
                }
                List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getLeanPerson()));
                userApprovalList.add(equipment.getEquipmentManager());
                values.put("dataId", entity.getId());
                values.put("organization", request.getReturnComment());
                values.put("comment", request.getReturnComment());
                values.put("NextAssignee", userApprovalList);
                values.put("approvalDealType", "1");
                request.setComment(request.getReturnComment());
                entity.setLeanEndTime(new Date()); //归还时间
                //设置entity
                entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM.name());
                entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº
                entity.setLeanEndTime(new Date());// å½’还时间
                entity.setReturnComment(request.getReturnComment());// å½’还备注
                break;
            // å½’还确认
            case WAIT_CONFIRM:
                values.put("approvalDealType", "1");
                values.put("dataId", entity.getId());
                values.put("organization", request.getConfirmComment());
                values.put("comment", request.getConfirmComment());
                request.setComment(request.getConfirmComment());
                //设置entity
                entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº
                entity.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name());
                entity.setConfirmUser(user.getUsername());
                entity.setConfirmComment(request.getConfirmComment());
                entity.setConfirmTime(new Date());
                // ä¿®æ”¹è®¾å¤‡çŠ¶æ€0
                equipment.setAssetStatus(AssetStatusEnum.NORMAL.name());
                eamEquipmentService.updateById(equipment);
                break;
        }
        request.setValues(values);
        //设置流程变量
        setupProcessVariables(request, entity, user, equipment);
        // å®Œæˆæµç¨‹ä»»åŠ¡
        Result result = flowTaskService.complete(request);
        if (!result.isSuccess()) {
            throw new JeecgBootException("审批失败,请刷新查看!");
        }
        // æ ¹æ®ä»»åŠ¡å®Œæˆç»“æžœæ›´æ–°å·¥å•çŠ¶æ€
        updateOrderStatus(result, request, entity, user, equipment);
        //保存工单
        equipmentLeanOutMapper.updateById(entity);
        return entity;
    }
    /**
     * æ›´æ–°å·¥å•状态
     * @param result
     * @param request
     * @param entity
     * @param user
     * @param equipment
     */
    private void updateOrderStatus(Result result, EamEquipmentLeanOutRequest request, EamEquipmentLeanOut entity, LoginUser user, EamEquipment equipment) {
        if (result.isSuccess()) {
            EquipmentLeanOutStatusEnum status = EquipmentLeanOutStatusEnum.getInstance(entity.getLeanStatus());
            switch (status) {
                case WAIT_APPROVAL_OUT:
                    entity.setUseApprovalUser(user.getUsername());
                    entity.setUseApprovalComment(request.getUseApprovalComment());
                    entity.setUseApprovalTime(new Date());
                    entity.setUseApprovalDealType(request.getUseApprovalDealType());
                    if (CommonConstant.APPROVED.equals(request.getUseApprovalDealType())) {
                        entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_APPROVAL_IN.name());
                    } else {
                        entity.setLeanStatus(EquipmentLeanOutStatusEnum.REJECT.name());
                        equipment.setAssetStatus(AssetStatusEnum.LEAN_OUT.name());
                        eamEquipmentService.updateById(equipment);
                    }
                    request.setComment("使用单位出厂审批结束");
                    break;
                case WAIT_APPROVAL_IN:
                    entity.setLeanOutApprovalUser(user.getUsername());
                    entity.setLeanOutApprovalComment(request.getLeanOutApprovalComment());
                    entity.setLeanOutApprovalTime(new Date());
                    entity.setLeanOutApprovalDealType(request.getLeanOutApprovalDealType());
                    if (CommonConstant.APPROVED.equals(request.getLeanOutApprovalDealType())) {
                        entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_RETURN.name());
                    } else {
                        entity.setLeanStatus(EquipmentLeanOutStatusEnum.REJECT.name());
                        equipment.setAssetStatus(AssetStatusEnum.LEAN_OUT.name());
                        eamEquipmentService.updateById(equipment);
                    }
                    request.setComment("借用单位入厂审批结束");
                    break;
                case WAIT_CONFIRM_RETURN:
                    entity.setLeanOutConfirmUser(user.getUsername());
                    entity.setLeanOutConfirmComment(request.getLeanOutConfirmComment());
                    entity.setLeanOutConfirmTime(new Date());
                    entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM_BORROW.name());
                    request.setComment("借用单位归还审批结束");
                    break;
                case WAIT_CONFIRM_BORROW:
                    entity.setUseConfirmUser(user.getUsername());
                    entity.setUseConfirmComment(request.getUseConfirmComment());
                    entity.setUseConfirmTime(new Date());
                    entity.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name());
                    equipment.setAssetStatus(AssetStatusEnum.NORMAL.name());
                    eamEquipmentService.updateById(equipment);
                    request.setComment("使用单位归还确认结束");
                    break;
            }
        }
    }
    /**
     * æ›´æ–°æµç¨‹çŠ¶æ€
     *
     * @param request
     * @param entity
     * @param user
     * @param equipment
     */
    private void setupProcessVariables(EamEquipmentLeanOutRequest request, EamEquipmentLeanOut entity, LoginUser user, EamEquipment equipment) {
        Map<String, Object> values = new HashMap<>();
        List<UserSelector> userSelectors;
        List<String> userApprovalList;
        EquipmentLeanOutStatusEnum status = EquipmentLeanOutStatusEnum.getInstance(entity.getLeanStatus());
        switch (status) {
            case WAIT_APPROVAL_OUT:
                // ä½¿ç”¨å•位出厂审批完成
                values.put("dataId", entity.getId());
                values.put("organization", request.getUseApprovalComment());
                values.put("comment", request.getUseApprovalComment());
                if (CommonConstant.APPROVED.equals(request.getUseApprovalDealType())) {
                    // é€šè¿‡
                    values.put("approvalDealType", request.getUseApprovalDealType());
                    // èŽ·å–ä¸‹ä¸€æ­¥å®¡æ‰¹äºº
                    userSelectors = sysUserService.selectOperatorList(entity.getLeanDepartId(), BusinessCodeConst.PCR0008);
                    if (CollectionUtil.isEmpty(userSelectors)) {
                        throw new JeecgBootException("未分配借用车间单位领导,无法进入下级审批!");
                    }
                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                    values.put("NextAssignee", userApprovalList);
                } else {
                    // é©³å›ž
                    values.put("approvalDealType", request.getUseApprovalDealType());
                }
                break;
            case WAIT_APPROVAL_IN:
                // å€Ÿç”¨å•位入厂审批完成
                values.put("dataId", entity.getId());
                values.put("organization", request.getLeanOutApprovalComment());
                values.put("comment", request.getLeanOutApprovalComment());
                break;
            case WAIT_CONFIRM_RETURN:
                // å½’还单位确认完成
                values.put("dataId", entity.getId());
                values.put("organization", request.getLeanOutConfirmComment());
                values.put("comment", request.getLeanOutConfirmComment());
                // èŽ·å–ä¸‹ä¸€æ­¥å®¡æ‰¹äºº
                userSelectors = sysUserService.selectOperatorList(equipment.getOrgId(), BusinessCodeConst.PCR0008);
                if (CollectionUtil.isEmpty(userSelectors)) {
                    throw new JeecgBootException("未分配使用车间单位领导,无法进入下级审批!");
                }
                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                values.put("NextAssignee", userApprovalList);
                break;
            case WAIT_CONFIRM_BORROW:
                // å€Ÿå‡ºæ–¹ç¡®è®¤å®Œæˆ
                values.put("dataId", entity.getId());
                values.put("organization", request.getUseConfirmComment());
                values.put("comment", request.getUseConfirmComment());
                break;
        }
        request.setValues(values);
    }
    @Override
    public void afterFlowHandle(FlowMyBusiness business) {
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentTransferServiceImpl.java
@@ -88,8 +88,8 @@
            //没有选择设备,根据车间过滤设备
            queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=e.org_id ", sysUser.getId());
        }
        //控制待提交状态的数据只能本人查看
        queryWrapper.and(i -> i.ne("wmo.transfer_status", EquipmentTransferStatusEnum.WAIT_SUBMIT).or().eq("wmo.report_user", sysUser.getUsername()));
//        æŽ§åˆ¶å¾…提交状态的数据只能本人查看
//        queryWrapper.and(i -> i.ne("wmo.transfer_status", EquipmentTransferStatusEnum.WAIT_SUBMIT).or().eq("wmo.report_user", sysUser.getUsername()));
        //查询条件过滤
        if (query != null) {
            if (StringUtils.isNotBlank(query.getEquipmentId())) {
@@ -144,7 +144,6 @@
            throw new JeecgBootException("当前设备属于此车间,不需要变动!");
        }
        request.setOldDepartId(equipment.getOrgId());
        request.setReportUser(sysUser.getUsername());
        return equipmentTransferMapper.insert(request) > 0;
    }
@@ -156,47 +155,43 @@
            throw new JeecgBootException("要提交的数据不存在,请刷新重试!");
        }
        if (!EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) {
            throw new JeecgBootException("当前数据状态不允许编辑!");
            throw new JeecgBootException("该工单已进行过提交!");
        }
        //检查设备
        EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId());
        if (equipment == null) {
            throw new JeecgBootException("设备不存在!");
            throw new JeecgBootException("设备不存在,提交失败!");
        }
        // åˆ†é…ç»™ä½¿ç”¨å•位领导
        List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0008);
        if (CollectionUtil.isEmpty(userSelectors)) {
            throw new JeecgBootException("设备未分配给单位领导,无法进入下级审批!");
        }
        List<String> usernames = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (sysUser == null) {
            throw new JeecgBootException("当前用户无法编辑转让记录!");
        if (sysUser == null || !BusinessCodeConst.PCR0004.equals(sysUser.getPost())) {
            throw new JeecgBootException("不是设备管理员,无法提交此工单!");
        }
        UpdateWrapper<EamEquipmentTransfer> updateWrapper = new UpdateWrapper<>();
        updateWrapper.set("transfer_status", EquipmentSealUpStatusEnum.WAIT_SUBMIT.name());
        updateWrapper.eq("id", id);
        updateWrapper.eq("report_user", sysUser.getUsername());
        boolean success = super.update(updateWrapper);
        if (success) {
            equipment.setAssetStatus(AssetStatusEnum.DEALT.name()); // è®¾å¤‡è½¬è®©
            eamEquipmentService.updateById(equipment);
        }
        entity.setTransferTime(new Date());
        entity.setReportUser(sysUser.getUsername());
        entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_USE_LEADER_CHECK.name());
        //保存工单
        equipmentTransferMapper.updateById(entity);
        //启动审批流程
        flowCommonService.initActBusiness("工单号:" + entity.getCode() + ";设备编号: " + equipment.getEquipmentCode() + ";进行设备转让",
        flowCommonService.initActBusiness("工单号:" + entity.getCode() + ";设备编号: " + equipment.getEquipmentCode() + ";进行设备调拨",
                entity.getId(), "IEamEquipmentTransferService", "equipment_transfer", null);
        Map<String, Object> variables = new HashMap<>();
        variables.put("dataId", entity.getId());
        variables.put("organization", entity.getTransferReason());
        variables.put("comment", entity.getTransferReason());
        variables.put("proofreading", true);
        // åˆ†é…ç»™è®¾å¤‡ç®¡ç†å‘˜
        List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0004);
        if (CollectionUtil.isEmpty(userSelectors)) {
            throw new JeecgBootException("设备未分配给设备管理员,无法进入下级审批!");
        }
        List<String> usernames = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
        variables.put("NextAssignee", usernames);
        Result result = flowDefinitionService.startProcessInstanceByKey("equipment_transfer", variables);
        if (result != null) {
            entity.setTransferTime(new Date());
            entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_CHECK.name());
            //保存工单
            equipmentTransferMapper.updateById(entity);
            equipment.setAssetStatus(AssetStatusEnum.DEALT.name()); // è®¾å¤‡è°ƒæ‹¨
            eamEquipmentService.updateById(equipment);
            return result.isSuccess();
        }
        return true;
@@ -215,7 +210,6 @@
        if (user == null || StrUtil.isBlank(user.getId())) {
            throw new JeecgBootException("未获取到登录用户,请重新登录后再试!");
        }
        request.setApprovalUser(user.getUsername());
        // èŽ·å–æµç¨‹ä¸šåŠ¡è®°å½•
        FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId());
        if (flowMyBusiness == null) {
@@ -236,50 +230,182 @@
            throw new JeecgBootException("设备不存在,请检查!");
        }
        EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus());
        if (status == null) {
            return null;
        }
        //流程变量
        Map<String, Object> values = new HashMap<>();
        // å®¡æ‰¹
        if (status == EquipmentTransferStatusEnum.WAIT_CHECK) {//执行完成
            values.put("dataId", entity.getId());
            values.put("organization", request.getApprovalComment());
            values.put("comment", request.getApprovalComment());
            values.put("approvalDealType", request.getApprovalDealType());
            request.setComment(request.getApprovalComment());
            entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº
            entity.setApprovalComment(request.getApprovalComment());// å®¡æ ¸æ„è§
            entity.setApprovalTime(new Date());// å®¡æ ¸æ—¶é—´
            entity.setApprovalDealType(request.getApprovalDealType()); // å®¡æ‰¹ç±»åž‹
            // éªŒè¯é€šè¿‡è¿˜æ˜¯é©³å›ž
            if (request.getApprovalDealType().equals("1")) {
                //设置entity
                entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name());
                List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getReportUser()));
                values.put("NextAssignee", userApprovalList);
            } else {
                //设置entity
                entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name());
            }
            // ä¿®æ”¹è®¾å¤‡çŠ¶æ€
            equipment.setAssetStatus(AssetStatusEnum.NORMAL.name());
            entity.setApprovalUser(user.getUsername());
            entity.setApprovalComment(request.getApprovalComment());
            entity.setApprovalTime(new Date());
            eamEquipmentService.updateById(equipment);
        }
        request.setValues(values);
        //设置流程变量
        setupProcessVariables(request, entity, user, equipment);
        // å®Œæˆæµç¨‹ä»»åŠ¡
        Result result = flowTaskService.complete(request);
        if (!result.isSuccess()) {
            throw new JeecgBootException("审批失败,请刷新查看!");
        }
        // æ ¹æ®ä»»åŠ¡å®Œæˆç»“æžœæ›´æ–°å·¥å•çŠ¶æ€
        updateOrderStatus(result, request, entity, user, equipment);
        //保存工单
        equipmentTransferMapper.updateById(entity);
        return entity;
    }
    /**
     * è®¾ç½®å·¥å•信息
     *
     * @param result
     * @param request
     * @param entity
     * @param user
     */
    private void updateOrderStatus(Result result, EamEquipmentTransferRequest request, EamEquipmentTransfer entity, LoginUser user, EamEquipment equipment) {
        if (result.isSuccess()) {
            EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus());
            switch (status) {
                case WAIT_USE_LEADER_CHECK:
                    // ä½¿ç”¨å•位领导审批结束
                    entity.setUseLeader(user.getUsername());
                    entity.setUseLeaderApprovalComment(request.getUseLeaderApprovalComment());
                    entity.setUseLeaderApprovalTime(new Date());
                    entity.setUseLeaderApprovalDealType(request.getUseLeaderApprovalDealType());
                    if (CommonConstant.APPROVED.equals(request.getUseLeaderApprovalDealType())) {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_TRANSFER_LEADER_CHECK.name());
                    } else {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.REJECT.name());
                        equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // è®¾å¤‡è°ƒæ‹¨
                        eamEquipmentService.updateById(equipment);
                    }
                    break;
                case WAIT_TRANSFER_LEADER_CHECK:
                    // è°ƒå…¥å•位领导审批结束
                    entity.setTransferLeader(user.getUsername());
                    entity.setTransferLeaderApprovalComment(request.getTransferLeaderApprovalComment());
                    entity.setTransferLeaderApprovalTime(new Date());
                    entity.setTransferLeaderApprovalDealType(request.getTransferLeaderApprovalDealType());
                    if (CommonConstant.APPROVED.equals(request.getTransferLeaderApprovalDealType())) {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_EXTERNAL_CONFIRM.name());
                    } else {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.REJECT.name());
                        equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // è®¾å¤‡è°ƒæ‹¨
                        eamEquipmentService.updateById(equipment);
                    }
                    break;
                case WAIT_EXTERNAL_CONFIRM:
                    // æœºåŠ¨åŠžç¡®è®¤ç»“æŸ
                    entity.setExternalConfirm(user.getUsername());
                    entity.setExternalConfirmTime(new Date());
                    entity.setCompanyLeaderCheck(request.getCompanyLeaderCheck());
                    if (CommonConstant.YN_1.equals(request.getCompanyLeaderCheck())) {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_COMPANY_LEADER_CHECK.name());
                    } else {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name());
                        equipment.setOrgId(entity.getNewDepartId());
                        equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // è®¾å¤‡è°ƒæ‹¨
                        eamEquipmentService.updateById(equipment);
                    }
                    break;
                case WAIT_COMPANY_LEADER_CHECK:
                    // å…¬å¸é¢†å¯¼å®¡æ‰¹ç»“束
                    entity.setCompanyLeader(user.getUsername());
                    entity.setCompanyLeaderApprovalTime(new Date());
                    entity.setCompanyLeaderApprovalComment(request.getCompanyLeaderApprovalComment());
                    entity.setCompanyLeaderApprovalDealType(request.getCompanyLeaderApprovalDealType());
                    if (CommonConstant.APPROVED.equals(request.getCompanyLeaderApprovalDealType())) {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name());
                        equipment.setOrgId(entity.getNewDepartId());
                    } else {
                        entity.setTransferStatus(EquipmentTransferStatusEnum.REJECT.name());
                    }
                    equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // è®¾å¤‡è°ƒæ‹¨
                    eamEquipmentService.updateById(equipment);
                    break;
            }
        }
    }
    /**
     * è®¾ç½®æµç¨‹å˜é‡
     *
     * @param request
     * @param entity
     * @param user
     * @param equipment
     */
    private void setupProcessVariables(EamEquipmentTransferRequest request, EamEquipmentTransfer entity, LoginUser user, EamEquipment equipment) {
        Map<String, Object> values = new HashMap<>();
        List<UserSelector> userSelectors;
        List<String> userApprovalList;
        EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus());
        switch (status) {
            case WAIT_USE_LEADER_CHECK:
                // ä½¿ç”¨å•位领导审批结束
                values.put("dataId", entity.getId());
                values.put("organization", request.getUseLeaderApprovalComment());
                values.put("comment", request.getUseLeaderApprovalComment());
                if (CommonConstant.APPROVED.equals(request.getUseLeaderApprovalDealType())) {
                    // é€šè¿‡
                    values.put("approvalDealType", request.getUseLeaderApprovalDealType());
                    // èŽ·å–ä¸‹ä¸€æ­¥å®¡æ‰¹äºº
                    userSelectors = sysUserService.selectOperatorList(entity.getNewDepartId(), BusinessCodeConst.PCR0008);
                    if (CollectionUtil.isEmpty(userSelectors)) {
                        throw new JeecgBootException("未分配调入单位领导,无法进入下级审批!");
                    }
                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                    values.put("NextAssignee", userApprovalList);
                } else {
                    // é©³å›ž
                    values.put("approvalDealType", request.getUseLeaderApprovalDealType());
                }
                request.setComment("使用单位领导审批结束");
                break;
            case WAIT_TRANSFER_LEADER_CHECK:
                // è°ƒå…¥å•位领导审批结束
                values.put("dataId", entity.getId());
                values.put("organization", request.getTransferLeaderApprovalComment());
                values.put("comment", request.getTransferLeaderApprovalComment());
                if (CommonConstant.APPROVED.equals(request.getTransferLeaderApprovalDealType())) {
                    // é€šè¿‡
                    values.put("approvalDealType", request.getTransferLeaderApprovalDealType());
                    // èŽ·å–ä¸‹ä¸€æ­¥å®¡æ‰¹äºº
                    userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0006);
                    if (CollectionUtil.isEmpty(userSelectors)) {
                        throw new JeecgBootException("设备未分配给机动办,无法进入下级审批!");
                    }
                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                    values.put("NextAssignee", userApprovalList);
                } else {
                    // é©³å›ž
                    values.put("approvalDealType", request.getTransferLeaderApprovalDealType());
                }
                request.setComment("调入单位领导审批结束");
                break;
            case WAIT_EXTERNAL_CONFIRM:
                // æœºåŠ¨åŠžç¡®è®¤ç»“æŸ
                values.put("dataId", entity.getId());
                values.put("organization", "机动办确认结束");
                values.put("comment", "机动办确认结束");
                if (CommonConstant.YN_1.equals(request.getCompanyLeaderCheck())) {
                    // éœ€è¦
                    values.put("confirmation", request.getCompanyLeaderCheck());
                    // æµç¨‹è½¬åˆ°å…¬å¸é¢†å¯¼å®¡æ‰¹
                    // èŽ·å–ä¸‹ä¸€æ­¥å®¡æ‰¹äºº
                    userSelectors = sysUserService.selectOperatorList(BusinessCodeConst.PCR0009);
                    if (CollectionUtil.isEmpty(userSelectors)) {
                        throw new JeecgBootException("设备未分配给公司领导,无法进入下级审批!");
                    }
                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                    values.put("NextAssignee", userApprovalList);
                } else {
                    values.put("confirmation", request.getCompanyLeaderCheck());
                }
                request.setComment("机动办确认结束");
                break;
            case WAIT_COMPANY_LEADER_CHECK:
                // å…¬å¸é¢†å¯¼å®¡æ‰¹ç»“束
                values.put("dataId", entity.getId());
                values.put("organization", request.getCompanyLeaderApprovalComment());
                values.put("comment", request.getCompanyLeaderApprovalComment());
                request.setComment("公司领导审批结束");
                break;
        }
        request.setValues(values);
    }
    @Override
@@ -331,7 +457,10 @@
    @Override
    public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) {
        return null;
        //业务是否干预流程,业务干预,流程干预,指定人员进行处理
        //获取下一步处理人
        Object object = values.get("NextAssignee");
        return (List<String>) object;
    }
    /**
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamSparePartRequisitionServiceImpl.java
@@ -6,18 +6,13 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.eam.constant.AssetStatusEnum;
import org.jeecg.modules.eam.constant.BusinessCodeConst;
import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamEquipmentLeanOut;
import org.jeecg.modules.eam.entity.EamSparePartRequisition;
import org.jeecg.modules.eam.entity.EamSparePartRequisitionDetail;
import org.jeecg.modules.eam.mapper.EamSparePartRequisitionMapper;
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -82,11 +82,13 @@
        FROM
            mdc_equipment me
            LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
        WHERE
            mpe.production_id IN
        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        WHERE 1=1
        <if test="allProductionIds != null and allProductionIds.size() > 0">
            and  mpe.production_id IN
            <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <!--根据产线id查询设备id集合-->
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -129,6 +129,11 @@
    List<String> getEquipmentIdsProduction(String userId, String key);
    /**
     * æŸ¥è¯¢äº§çº¿ä¸‹çš„æ‰€æœ‰è®¾å¤‡(首页部根据用户进行数据筛选)
     */
    List<String> getEquipmentIdsProduction(String key);
    /**
     * æ ¹æ®è®¾å¤‡id查询设备名称
     *
     * @param equipmentId
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.dto.message.MessageDTO;
@@ -634,6 +635,21 @@
    }
    /**
     * æŸ¥è¯¢äº§çº¿ä¸‹çš„æ‰€æœ‰è®¾å¤‡
     */
    @Override
    public List<String> getEquipmentIdsProduction(String key) {
        List<String> partProduction = Lists.newArrayList();
        if (StringUtils.isNotEmpty(key)) {
            //key不为空,查询所有下级产线id
            partProduction = this.findAllProductions(key);
            partProduction.add(key);
        }
        List<String> equipmentIds = this.baseMapper.queryIdsByProductions(partProduction);
        return equipmentIds;
    }
    /**
     * æ ¹æ®è®¾å¤‡id查询设备名称
     */
    @Override
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java
@@ -46,131 +46,49 @@
    @Resource
    private IMdcHomeService mdcHomeService;
    @ApiOperation(value = "MDC首页接口-查询所有车间", notes = "MDC首页接口-查询所有车间")
    @GetMapping("/getAllWorkShop")
    public Result<List<MdcProduction>> getAllWorkShop() {
        return Result.OK(mdcHomeService.getAllWorkShop());
    }
    @ApiOperation(value = "MDC首页接口-设备运行状态统计", notes = "MDC首页接口-设备运行状态统计")
    @GetMapping("/equipmentStatusStatistics")
    public Result<?> equipmentStatusStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        Integer userType = user.getUserType();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区/工段
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //判断是公司级还是厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            if (userType.equals(MdcConstant.USER_TYPE_4)) {
                //公司
                key = mdcProduction.getId();
            } else if (userType.equals(MdcConstant.USER_TYPE_3)) {
                //厂区
                key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId());
            } else if (userType.equals(MdcConstant.USER_TYPE_2)) {
                //工段 æŸ¥è¯¢ç”¨æˆ·æ‹¥æœ‰çš„工段权限
                key = mdcProductionService.findThreeProductionId(userId);
            }
        }
        List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(userId, key);
    public Result<?> equipmentStatusStatistics(String productionId) {
        List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(productionId);
        Map<String, Object> map = new HashMap<>();
        map.put("list", resultMap);
        map.put("productionId", key);
        return Result.OK(map);
    }
    @ApiOperation(value = "MDC首页接口-设备利用率统计(昨日)", notes = "MDC首页接口-设备运行状态统计(昨日)")
    @GetMapping("/equipmentUtilizationStatistics")
    public Result<?> equipmentUtilizationStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        Integer userType = user.getUserType();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //判断是公司级还是厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            if (userType.equals(MdcConstant.USER_TYPE_4)) {
                //公司
                key = mdcProduction.getId();
            } else if (userType.equals(MdcConstant.USER_TYPE_3)) {
                //厂区
                key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId());
            }
        }
        List<MdcCommonVo> result = mdcHomeService.getEquipmentUtilizationStatistics(userId, key);
    public Result<?> equipmentUtilizationStatistics(String productionId) {
        List<MdcCommonVo> result = mdcHomeService.getEquipmentUtilizationStatistics(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-设备OEE统计(上月)", notes = "MDC首页接口-设备OEE统计(上月)")
    @GetMapping("/equipmentOEEStatistics")
    public Result<?> equipmentOEEStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        Integer userType = user.getUserType();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //判断是公司级还是厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            if (userType.equals(MdcConstant.USER_TYPE_4)) {
                //公司
                key = mdcProduction.getId();
            } else if (userType.equals(MdcConstant.USER_TYPE_3)) {
                //厂区
                key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId());
            }
        }
        List<MdcCommonVo> result = mdcHomeService.getEquipmentOeeStatistics(userId, key);
    public Result<?> equipmentOEEStatistics(String productionId) {
        List<MdcCommonVo> result = mdcHomeService.getEquipmentOeeStatistics(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-设备OEE和利用率统计柱状图", notes = "MDC首页接口-设备OEE和利用率统计柱状图")
    @GetMapping("/equipmentMonthStatistics")
    public Result<?> equipmentMonthStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        Integer userType = user.getUserType();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //判断是公司级还是厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            if (userType.equals(MdcConstant.USER_TYPE_4)) {
                //公司
                key = mdcProduction.getId();
            } else if (userType.equals(MdcConstant.USER_TYPE_3)) {
                //厂区
                key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId());
            }
        }
        Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(userId, key);
    public Result<?> equipmentMonthStatistics(String productionId) {
        MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
        String key = mdcProduction.getId();
        Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-工段级前七天利用率折线图", notes = "MDC首页接口-工段级前七天利用率折线图")
    @ApiOperation(value = "MDC首页接口-工段级前15天利用率折线图", notes = "MDC首页接口-工段级前15天利用率折线图")
    @GetMapping("/equipmentDayUtilizationStatistics")
    public Result<?> equipmentDayUtilizationStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //工段 æŸ¥è¯¢ç”¨æˆ·æ‹¥æœ‰çš„工段权限
            key = mdcProductionService.findThreeProductionId(userId);
        }
        Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(userId, key);
    public Result<?> equipmentDayUtilizationStatistics(String productionId) {
        Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(productionId);
        return Result.OK(result);
    }
@@ -249,6 +167,8 @@
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-问题列表", notes = "MDC首页接口-问题列表")
    @GetMapping("/feedbackList")
    public Result<?> feedbackList(String productionCode) {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml
@@ -4,12 +4,17 @@
    <select id="getProductionByPid" resultType="org.jeecg.modules.system.entity.MdcProduction">
        SELECT
            t1.*
        t1.*
        FROM
            mdc_production t1
                LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id
        WHERE
            t1.parent_id = #{ productionId } AND t2.user_id = #{ userId }
        mdc_production t1
        --                 LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id
        WHERE 1=1
        <if test="productionId != null and productionId != ''">
            AND t1.parent_id = #{ productionId }
        </if>
        <!--        <if test="userId != null and userId != ''">-->
        <!--            AND t2.user_id = #{ userId }-->
        <!--        </if>-->
    </select>
    <select id="getProcessCount" resultType="java.math.BigDecimal">
@@ -126,6 +131,7 @@
    <select id="getEquipmentSevenUtilizationStatistics" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
            equipment_id,
            the_date,
            SUM ( process_long ) processLong,
            SUM ( open_long ) openLong
        FROM
@@ -140,7 +146,8 @@
            </if>
        </where>
        GROUP BY
            equipment_id
        equipment_id,
        the_date
    </select>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java
@@ -6,6 +6,7 @@
import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency;
import org.jeecg.modules.mdc.vo.MdcCommonVo;
import org.jeecg.modules.mdc.vo.MdcHomeEfficiencyVo;
import org.jeecg.modules.system.entity.MdcProduction;
import java.util.List;
import java.util.Map;
@@ -19,27 +20,27 @@
    /**
     * è®¾å¤‡è¿è¡ŒçŠ¶æ€ç»Ÿè®¡
     */
    List<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key);
    List<MdcCommonVo> getEquipmentStatusStatistics(String productionId);
    /**
     * è®¾å¤‡åˆ©ç”¨çŽ‡ç»Ÿè®¡
     */
    List<MdcCommonVo> getEquipmentUtilizationStatistics(String userId, String key);
    List<MdcCommonVo> getEquipmentUtilizationStatistics(String productionId);
    /**
     * è®¾å¤‡OEE统计
     */
    List<MdcCommonVo> getEquipmentOeeStatistics(String userId, String key);
    List<MdcCommonVo> getEquipmentOeeStatistics(String productionId);
    /**
     * è®¾å¤‡OEE和利用率统计柱状图
     */
    Map<String, Object> getEquipmentMonthStatistics(String userId, String key);
    Map<String, Object> getEquipmentMonthStatistics(String productionId);
    /**
     * å·¥æ®µçº§å‰ä¸ƒå¤©åˆ©ç”¨çŽ‡æŠ˜çº¿å›¾
     */
    Map<String, Object> getEquipmentDayUtilizationStatistics(String userId, String key);
    Map<String, Object> getEquipmentDayUtilizationStatistics(String productionId);
    /**
     * æŸ¥è¯¢è®¾å¤‡ä¸ŠæœˆOEE
@@ -72,4 +73,6 @@
    MdcEquipmentDto getEquipmentDetails(String equipmentId);
    List<MdcFeedback> getFeedbackList(String key);
    List<MdcProduction> getAllWorkShop();
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
@@ -1,7 +1,9 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
@@ -20,6 +22,7 @@
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @author Lius
@@ -56,7 +59,7 @@
     * è®¾å¤‡è¿è¡ŒçŠ¶æ€ç»Ÿè®¡
     */
    @Override
    public List<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key) {
    public List<MdcCommonVo> getEquipmentStatusStatistics(String productionId) {
        List<MdcCommonVo> result = new ArrayList<>();
        MdcCommonVo mdcCommonVo1 = new MdcCommonVo();
        mdcCommonVo1.setName("关机");
@@ -75,15 +78,16 @@
        mdcCommonVo4.setValue("0");
        result.add(mdcCommonVo4);
        MdcEquipmentStatusVo mdcEquipmentStatusVo = new MdcEquipmentStatusVo();
        if (StringUtils.isBlank(key)) {
            return result;
        //获取所有设备
        List<Equipment> equipmentList = Lists.newArrayList();
        if (StringUtils.isNotBlank(productionId)) {
            List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(productionId);
            equipmentList = CollectionUtils.isNotEmpty(equipmentIdList) ? equipmentService.listByIds(equipmentIdList) : new ArrayList<>();
        }else {
            equipmentList = equipmentService.list();
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, key);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return result;
        }
//        List<EquipmentLog> logList = equipmentLogService.getEquipmentStatusList(equipmentIdList);
        List<Equipment> equipmentList = equipmentService.list(new LambdaQueryWrapper<Equipment>().in(Equipment::getEquipmentid, equipmentIdList));
        if (equipmentList != null && !equipmentList.isEmpty()) {
            for (Equipment equipment : equipmentList) {
                if (equipment.getOporation() != null) {
@@ -131,10 +135,15 @@
     * è®¾å¤‡åˆ©ç”¨çŽ‡ç»Ÿè®¡
     */
    @Override
    public List<MdcCommonVo> getEquipmentUtilizationStatistics(String userId, String key) {
    public List<MdcCommonVo> getEquipmentUtilizationStatistics(String productionId) {
        List<MdcCommonVo> result = new ArrayList<>();
        //获取公司或厂区二级信息
        List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(userId, key);
        List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(null, productionId);
        //如果不传“productionId”参数,则查所有车间,否则查询该车间下的工段等
        if (StringUtils.isEmpty(productionId)) {
            mdcProductionList = mdcProductionList.stream().filter(mdcProduction -> "2".equals(mdcProduction.getOrgType())).collect(Collectors.toList());
        }
        if (mdcProductionList != null && !mdcProductionList.isEmpty()) {
            for (MdcProduction mdcProduction : mdcProductionList) {
                MdcCommonVo mdcCommonVo = new MdcCommonVo();
@@ -142,7 +151,7 @@
                mdcCommonVo.setProductionCode(mdcProduction.getProductionCode());
                mdcCommonVo.setProductionId(mdcProduction.getId());
                //获取此层级下设备
                List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProduction.getId());
                List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(mdcProduction.getId());
                if (equipmentIdList == null || equipmentIdList.isEmpty()) {
                    mdcCommonVo.setValue("0");
                } else {
@@ -167,10 +176,14 @@
     * è®¾å¤‡OEE统计
     */
    @Override
    public List<MdcCommonVo> getEquipmentOeeStatistics(String userId, String key) {
    public List<MdcCommonVo> getEquipmentOeeStatistics(String productionId) {
        List<MdcCommonVo> result = new ArrayList<>();
        //获取公司或厂区二级信息
        List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(userId, key);
        List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(null, productionId);
        //如果不传“productionId”参数,则查所有车间,否则查询该车间下的工段等
        if (StringUtils.isEmpty(productionId)) {
            mdcProductionList = mdcProductionList.stream().filter(mdcProduction -> "2".equals(mdcProduction.getOrgType())).collect(Collectors.toList());
        }
        if (mdcProductionList != null && !mdcProductionList.isEmpty()) {
            for (MdcProduction mdcProduction : mdcProductionList) {
                MdcCommonVo mdcCommonVo = new MdcCommonVo();
@@ -178,7 +191,7 @@
                mdcCommonVo.setProductionCode(mdcProduction.getProductionCode());
                mdcCommonVo.setProductionId(mdcProduction.getId());
                //获取此层级下设备
                List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProduction.getId());
                List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(mdcProduction.getId());
                if (equipmentIdList == null || equipmentIdList.isEmpty()) {
                    mdcCommonVo.setValue("0");
                } else {
@@ -187,7 +200,7 @@
                    if (oee == null || oee.compareTo(BigDecimal.ZERO) == 0) {
                        mdcCommonVo.setValue("0");
                    } else {
                        mdcCommonVo.setValue(oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString());
                        mdcCommonVo.setValue(CollectionUtils.isNotEmpty(equipmentIdList) ? oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString() : "0");
                    }
                }
                result.add(mdcCommonVo);
@@ -200,8 +213,8 @@
     * è®¾å¤‡OEE和利用率统计柱状图
     */
    @Override
    public Map<String, Object> getEquipmentMonthStatistics(String userId, String key) {
        List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, key);
    public Map<String, Object> getEquipmentMonthStatistics(String productionId) {
        List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(productionId);
        Map<String, Object> result = new HashMap<>();
        Date end = DateUtils.toDate(LocalDate.now().plusMonths(-1).toString(), DateUtils.STR_DATE);
        Date start = DateUtils.toDate(LocalDate.now().plusMonths(-12).toString(), DateUtils.STR_DATE);
@@ -241,7 +254,7 @@
                if (oee == null || oee.compareTo(BigDecimal.ZERO) == 0) {
                    mdcCommonOeeVo.setValue("0");
                } else {
                    mdcCommonOeeVo.setValue(oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString());
                    mdcCommonOeeVo.setValue(CollectionUtils.isNotEmpty(equipmentIdList) ? oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString() : "0");
                }
            }
            utilizationList.add(mdcCommonUtilizationVo);
@@ -257,34 +270,21 @@
     * å·¥æ®µçº§å‰ä¸ƒå¤©åˆ©ç”¨çŽ‡æŠ˜çº¿å›¾
     */
    @Override
    public Map<String, Object> getEquipmentDayUtilizationStatistics(String userId, String key) {
    public Map<String, Object> getEquipmentDayUtilizationStatistics(String productionId) {
        Map<String, Object> result = new HashMap<>();
        List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, key);
        //获取前七天日期集合
        String start = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-7).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
        String end = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
        if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
            List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().in(MdcEquipment::getEquipmentId, equipmentIdList));
            result.put("mdcEquipmentList", mdcEquipmentList);
            List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end);
            List<EquipmentDayUtilizationVo> dataList = new ArrayList<>();
            if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) {
                for (MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfoList) {
                    EquipmentDayUtilizationVo equipmentDayUtilizationVo = new EquipmentDayUtilizationVo();
                    equipmentDayUtilizationVo.setEquipmentId(mdcEquipmentStatisticalInfo.getEquipmentId());
                    equipmentDayUtilizationVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(mdcEquipmentStatisticalInfoList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
                    if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) {
                        equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
                        equipmentDayUtilizationVo.setStartRate(mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(mdcEquipmentStatisticalInfoList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
                    }
                    dataList.add(equipmentDayUtilizationVo);
                }
            }
            result.put("dataList", dataList);
        }
        /*List<String> dayBetween = DateUtils.getDatesStringList2(start, end);
        List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(productionId);
        Date startDate = DateUtils.toDate(LocalDate.now().plusDays(-15).toString(), DateUtils.STR_DATE);
        String start = DateUtils.format(startDate, DateUtils.STRDATE);
        Date endDate = DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE);
        String end = DateUtils.format(endDate, DateUtils.STRDATE);
        List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfos = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end);
        Map<String, MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoMap = mdcEquipmentStatisticalInfos.stream().collect(Collectors.toMap(MdcEquipmentStatisticalInfo::getTheDate, mdcEquipmentStatisticalInfo -> mdcEquipmentStatisticalInfo, (v1, v2) -> v1));
        List<String> dayBetween = DateUtils.getDatesStringList2(startDate, endDate);
        List<String> dateList = new ArrayList<>();
        List<EquipmentDayUtilizationVo> dataList = new ArrayList<>();
        for (String date : dayBetween) {
            EquipmentDayUtilizationVo equipmentDayUtilizationVo = new EquipmentDayUtilizationVo();
            String item = date.substring(4);
@@ -292,42 +292,34 @@
                item = item.substring(1);
                String sub = item.substring(1);
                if (sub.startsWith("0")) {
                    item = item.substring(0, 1) + "月" + sub.substring(1) + "日";
                    item = item.substring(0, 1) + "-" + sub.substring(1);
                } else {
                    item = item.substring(0, 1) + "月" + item.substring(1) + "日";
                    item = item.substring(0, 1) + "-" + item.substring(1);
                }
            } else {
                String sub = item.substring(2);
                if (sub.startsWith("0")) {
                    item = item.substring(0, 2) + "月" + sub.substring(2) + "日";
                    item = item.substring(0, 2) + "-" + sub.substring(2);
                } else {
                    item = item.substring(0, 2) + "月" + item.substring(2) + "日";
                    item = item.substring(0, 2) + "-" + item.substring(2);
                }
            }
            dateList.add(item);
            equipmentDayUtilizationVo.setDate(item);
            if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
                //获取前七天利用率数据
                List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfos = mdcHomeMapper.getEquipmentDayUtilizationStatistics(equipmentIdList, dayBetween);
                if (mdcEquipmentStatisticalInfos != null && !mdcEquipmentStatisticalInfos.isEmpty()) {
                    for (MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfos) {
                        if (mdcEquipmentStatisticalInfo.getTheDate().equals(date)) {
                            equipmentDayUtilizationVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
                            if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) {
                                equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
                                equipmentDayUtilizationVo.setStartRate(mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
                            }
                        }
                    }
                } else {
                    dataList.add(equipmentDayUtilizationVo);
            if (null != mdcEquipmentStatisticalInfoMap && mdcEquipmentStatisticalInfoMap.containsKey(date)) {
                //获取当前日期下的利用率数据
                MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoMap.get(date);
                equipmentDayUtilizationVo.setUtilizationRate(CollectionUtils.isNotEmpty(equipmentIdList) ? mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) {
                    equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
                    equipmentDayUtilizationVo.setStartRate(CollectionUtils.isNotEmpty(equipmentIdList) ? mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                }
            } else {
                dataList.add(equipmentDayUtilizationVo);
            }
            dataList.add(equipmentDayUtilizationVo);
        }
        result.put("dateList", dateList);
        result.put("dataList", dataList);*/
        result.put("dataList", dataList);
        return result;
    }
@@ -505,4 +497,13 @@
    public List<MdcFeedback> getFeedbackList(String key) {
        return mdcFeedbackService.getFeedbackList(key);
    }
    @Override
    public List<MdcProduction> getAllWorkShop() {
        List<MdcProduction> list = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, "2"));
        if (CollectionUtils.isEmpty(list)) {
            return null;
        }
        return list;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDayUtilizationVo.java
@@ -15,6 +15,10 @@
     */
    private String equipmentId;
    /**
     * è®¾å¤‡ç¼–号
     */
    private String date;
    /**
     * åˆ©ç”¨çއ
     */
    private BigDecimal utilizationRate = BigDecimal.ZERO;
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
@@ -333,10 +333,18 @@
    /**
     * é€‰æ‹©ç”¨æˆ·
     * @param productionId é€‰æ‹©çš„车间ID
     * @param positionCode å²—位编号
     * @return
     */
    List<UserSelector> selectOperatorList( String positionCode);
    List<UserSelector> selectOperatorList(String productionId, String positionCode);
    /**
     * é€‰æ‹©ç”¨æˆ·
     * @param positionCode å²—位编号
     * @return
     */
    List<UserSelector> selectOperatorList(String positionCode);
    /**
     * æ ¹æ®ç”¨æˆ·åæ‰¹é‡èŽ·å–çœŸå®žå§“åæ˜ å°„
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
@@ -765,6 +765,21 @@
    }
    @Override
    public List<UserSelector> selectOperatorList(String productionId, String positionCode) {
        LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysUser::getPost, positionCode);
        if(StringUtils.isNotBlank(productionId)) {
            queryWrapper.exists("select 1 from mdc_user_production t where t.user_id=sys_user.id and t.pro_id={0}", productionId);
        }
        queryWrapper.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0);
        queryWrapper.eq(SysUser::getStatus, CommonConstant.DEL_FLAG_1);
        queryWrapper.orderByDesc(SysUser::getId);
        List<SysUser> sysUsers = userMapper.selectList(queryWrapper);
        List<UserSelector> collect = sysUsers.stream().map(user -> new UserSelector(user.getId(), user.getUsername(), user.getRealname())).collect(Collectors.toList());
        return collect;
    }
    @Override
    public List<UserSelector> selectOperatorList(String positionCode) {
        LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysUser::getPost, positionCode);