From cc44920da3d40b8248b67560026e891afdd1a6ab Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 08 五月 2025 17:57:14 +0800
Subject: [PATCH] 1.查询可以被引用的部件接口开发完成 2.借用部件(可批量) 开发完成 3.修改原有新增、修改部件接口 完成 4.修改原有删除文档与导入文档接口 完成 5.修改工作流问题

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java |   87 ++++++++++++++++++-------------------------
 1 files changed, 36 insertions(+), 51 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java
index 2944228..0661d61 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java
@@ -3,8 +3,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.dnc.entity.DeviceInfo;
-import org.jeecg.modules.dnc.entity.DncPassLog;
+import org.apache.commons.lang3.StringUtils;
 import org.jeecg.modules.dnc.entity.DocInfo;
 import org.jeecg.modules.dnc.entity.DocRelative;
 import org.jeecg.modules.dnc.exception.ExceptionCast;
@@ -12,15 +11,16 @@
 import org.jeecg.modules.dnc.mapper.DocInfoMapper;
 import org.jeecg.modules.dnc.mapper.DocRelativeMapper;
 import org.jeecg.modules.dnc.response.CommonCode;
-
-import org.jeecg.modules.dnc.service.*;
+import org.jeecg.modules.dnc.service.IDeviceGroupService;
+import org.jeecg.modules.dnc.service.IDeviceInfoService;
+import org.jeecg.modules.dnc.service.IDocRelativeService;
 import org.jeecg.modules.dnc.utils.ValidateUtil;
 import org.jeecg.modules.dnc.utils.date.DateUtil;
-
 import org.jeecg.modules.dnc.utils.file.FileUtilS;
-import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.mdc.entity.MdcEquipment;
+import org.jeecg.modules.mdc.service.IMdcEquipmentService;
+import org.jeecg.modules.system.service.IMdcProductionService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -35,10 +35,12 @@
     private IDeviceInfoService deviceInfoService;
     @Autowired
     private IDeviceGroupService deviceGroupService;
-    @Value("${securedoc.localFilePath}")
-    private String localFilePath;
+//    @Value("${securedoc.localFilePath}")
+//    private String localFilePath;
     @Autowired
-    private IDncPassLogService dncPassLogService;
+    private IMdcEquipmentService iMdcEquipmentService;
+    @Autowired
+    private IMdcProductionService iMdcProductionService;
 
 
     @Override
@@ -80,58 +82,41 @@
 
         if (b && docRel) {
             DocInfo info = docInfoMapper.selectById(docId);
-            DeviceInfo deviceInfo = deviceInfoService.getById(attrId);
-            List<String> strings =  deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId());
+            //todo 淇敼涓簃dc璁惧
+            MdcEquipment mdcEquipment=iMdcEquipmentService.getById(attrId);
+            List<String> strings =  iMdcProductionService.findListParentTreeAll(mdcEquipment.getId());
             if (strings != null && !strings.isEmpty()) {
                 String path = StringUtils.join(strings.toArray(), "/");
-                boolean deleteFile = FileUtilS.deleteFilePathZip(path + "/"+ deviceInfo.getDeviceNo(),
+                boolean deleteFile = FileUtilS.deleteFilePathZip(path + "/"+ mdcEquipment.getEquipmentId(),
                         info.getDocName(), info.getDocSuffix());
                 if (!deleteFile) {
                     return false;
                 }
-                DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY));
-                Integer fileTxt = 0, fileNc =0;
-                if (dncPassLog !=null) {
-                    fileTxt = dncPassLog.getSequenceNumber() + 1;
-                    fileNc = fileTxt + 1;
-                } else {
-                    fileTxt =  1;
-                    fileNc = fileTxt + 1;
-                }
-                String sequence = String.format("%06d",fileTxt);
-                DncPassLog passInfoNc = new DncPassLog();
-                passInfoNc.setSequenceNumber(fileNc);
-                passInfoNc.setSequenceOrder(sequence);
-                passInfoNc.setDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY));
-                passInfoNc.setPassType("02");
-                passInfoNc.setPassName(info.getDocName()+"."+info.getDocSuffix());
-                passInfoNc.setCreateTime(DateUtil.getNow());
-                dncPassLogService.save(passInfoNc);
                 //澶勭悊鏂囦欢鍚嶇О  鏂囦欢璺緞
 
                 NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo();
-                ncTxt.setEquipmentId(deviceInfo.getDeviceNo());
-                ncTxt.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" );
-                ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)+sequence);
+                ncTxt.setEquipmentId(mdcEquipment.getEquipmentId());
+                ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" );
+                ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY));
                 ncTxt.setOrigFileName(info.getDocName());
                 ncTxt.setOrigFileSuffix(info.getDocSuffix());
                 ncTxt.setFileAddOrDelete(2);
-                String loFilePath = localFilePath + "\\" + ncTxt.getFileTxtName() + ".nc";
-                try {
-                   /* ObjectMapper mapper = new ObjectMapper();
-                    String json = mapper.writeValueAsString(ncTxt);*/
-                    String allList = new String();
-                    allList=(ncTxt.getFileTxtName()+"\n");
-                    allList+=(ncTxt.getFileNcName()+"\n");
-                    allList+=(ncTxt.getOrigFileName()+"\n");
-                    allList+=(ncTxt.getOrigFileSuffix()+"\n");
-                    allList+=(ncTxt.getFilePath()+"\n");
-                    allList+=(ncTxt.getEquipmentId()+"\n");
-                    allList+=(ncTxt.getFileAddOrDelete().toString());
-                    FileUtilS.fileWriterSql(loFilePath,allList);
-                }catch (Exception e) {
-                    return true;
-                }
+//                String loFilePath = localFilePath + "\\" + ncTxt.getFileTxtName() + ".nc";
+//                try {
+//                   /* ObjectMapper mapper = new ObjectMapper();
+//                    String json = mapper.writeValueAsString(ncTxt);*/
+//                    String allList = new String();
+//                    allList=(ncTxt.getFileTxtName()+"\n");
+//                    allList+=(ncTxt.getFileNcName()+"\n");
+//                    allList+=(ncTxt.getOrigFileName()+"\n");
+//                    allList+=(ncTxt.getOrigFileSuffix()+"\n");
+//                    allList+=(ncTxt.getFilePath()+"\n");
+//                    allList+=(ncTxt.getEquipmentId()+"\n");
+//                    allList+=(ncTxt.getFileAddOrDelete().toString());
+//                    FileUtilS.fileWriterSql(loFilePath,allList);
+//                }catch (Exception e) {
+//                    return true;
+//                }
             }
         }
         return b;
@@ -150,7 +135,7 @@
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public List<DeviceInfo> findDeviceByDocId(String docId) {
+    public List<MdcEquipment> findDeviceByDocId(String docId) {
         if(!ValidateUtil.validateString(docId))
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         return super.getBaseMapper().findDeviceByDocId(docId);

--
Gitblit v1.9.3