From 0871a25215fb468f121785600f796a14b54d8ebc Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期五, 06 六月 2025 15:47:00 +0800
Subject: [PATCH] 1.刀具添加字段 2.新增dnc传输日志表 3.导入NC文件默认产生nc文件对应数控程序加工确认表 4.拆分两网 修改yml配置

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java |   74 +++++++++++++++++++++++++++++++------
 1 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
index 3bfd2bb..a287e73 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
@@ -44,6 +44,7 @@
 import org.jeecg.modules.flowable.service.IFlowTaskService;
 import org.jeecg.modules.mdc.entity.MdcEquipment;
 import org.jeecg.modules.mdc.service.IMdcEquipmentService;
+import org.jeecg.modules.message.enums.DeployEnum;
 import org.jeecg.modules.system.service.IMdcProductionService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -103,11 +104,14 @@
     private IFlowMyBusinessService flowMyBusinessService;
     @Autowired
     private PermissionService permissionService;
-
-    @Value("${securedoc.whether}")
-    private String whether;
-    @Value("${securedoc.localFilePath}")
-    private String localFilePath;
+    @Autowired
+    private IDncPassLogService dncPassLogService;
+    @Value("${deploy.deployType}")
+    //宸ユ帶缃�/娑夊瘑缃戦儴缃� 0涓哄伐鎺х綉 1涓烘秹瀵嗙綉
+    private String deployType;
+    @Value("${deploy.secretFolder}")
+    //娑夊瘑缃戜紶杈搉c鏂囦欢澶�
+    private String secretFolder;
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
@@ -258,7 +262,10 @@
 
         }
         handleFileTransfer(mdcEquipment, docFile);
-        handleFileProcessing(docFile, mdcEquipment, whether, localFilePath);
+        //娉ㄦ剰----鍖哄垎宸ユ帶缃戜笌娑夊瘑缃戯紒锛侊紒  娑夊瘑缃戣繘琛孨C鏂囦欢鐨勬嫹璐濓紝宸ユ帶缃戣礋璐h繘琛岃В鏋怤C鏂囦欢
+        if (deployType.equals(DeployEnum.SMW.getCode())) {
+            handleFileProcessing(docFile, mdcEquipment, secretFolder);
+        }
         synchronizedFlagService.updateFlag(2);
         return Result.OK("鎿嶄綔鎴愬姛");
     }
@@ -380,6 +387,10 @@
                                 docFile.getFileName(),docFile.getFileSuffix());
                     }
                 }
+            }
+            //娉ㄦ剰----鍖哄垎宸ユ帶缃戜笌娑夊瘑缃戯紒锛侊紒  娑夊瘑缃戣繘琛孨C鏂囦欢鐨勬嫹璐濓紝宸ユ帶缃戣礋璐h繘琛岃В鏋怤C鏂囦欢
+            if (deployType.equals(DeployEnum.SMW.getCode())) {
+                handleFileProcessing(docFile, mdcEquipment, secretFolder);
             }
             return synchronizedFlagService.updateFlag(1);
         }else if(up.getStatus() == 3) {
@@ -650,22 +661,61 @@
     }
 
     //灏佽澶勭悊鏂囦欢
-    private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String whether, String localFilePath) {
-        if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) {
+    private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String secretFolder) {
+        if (!docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) {
             String size = FileUtilS.fileSizeNC(docFile.getFilePath(), docFile.getFileEncodeName());
             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 fileTxt = 0, fileNc =0;
+                if (dncPassLog !=null) {
+                    fileTxt = dncPassLog.getSequenceNumber() + 1;
+                } else {
+                    fileTxt =  1;
+                }
+                fileNc = fileTxt + 1;
+                //澶勭悊鏂囦欢鍚嶇О  鏂囦欢璺緞
+                String sequence = String.format("%06d",fileTxt);
+                String sequenceNc = String.format("%06d",fileNc);
+                passInfoTxt.setSequenceNumber(fileTxt);
+                passInfoTxt.setSequenceOrder(sequence);
+                passInfoTxt.setCreateTime(dateFirst);
+                System.out.println(DateUtil.format(dateFirst,DateUtil.STR_DATE_TIME));
+                passInfoTxt.setPassType("02");
+                dncPassLogService.save(passInfoTxt);
+
+                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);
                 NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo();
                 ncTxt.setEquipmentId(mdcEquipment.getEquipmentId());
-                ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
-                ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY));
+                ncTxt.setFileNcName("10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc);
+                ncTxt.setFileTxtName("10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequence);
                 ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/");
                 ncTxt.setOrigFileName(docFile.getFileName());
                 ncTxt.setOrigFileSuffix(docFile.getFileSuffix());
                 ncTxt.setFileAddOrDelete(1);
-                String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc";
+                String loFilePath = secretFolder +"/"+ ncTxt.getFileTxtName() + ".nc";
                 try {
                     String allList = ncTxt.getFileTxtName() + "\n"
                             + ncTxt.getFileNcName() + "\n"
@@ -678,7 +728,7 @@
                     FileUtilS.fileWriterSql(loFilePath, allList);
                     boolean copyFileNc = FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" +
                                     docFile.getFileName(),
-                            localFilePath + ncTxt.getFileNcName(),
+                            secretFolder +"/"+ncTxt.getFileNcName(),
                             docFile.getFileSuffix(), "NC");
                     if (!copyFileNc) {
                         FileUtilS.deleteNcFile(loFilePath);

--
Gitblit v1.9.3