From a049dda2f63d59f5092994b44387fe0aa889d375 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 14 八月 2025 15:01:04 +0800
Subject: [PATCH] 固化流程
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramExportDNCService.java | 64 ++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 19 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramExportDNCService.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramExportDNCService.java
index a0a2e65..3617173 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramExportDNCService.java
+++ b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramExportDNCService.java
@@ -58,9 +58,10 @@
private final NcNodeService ncNodeService;
private final OssTemplate ossTemplate;
private final FlowProgramFileService flowProgramFileService;
+ private final ProgramAnnotationService programAnnotationService;
//public static final String PROGRAM_JSON_FILE = "exp_mdm_nc_program.json";
- public static final String NODE_JSON_FILE = "exp_mdm_nc_node.json";
- public static final String APPROVE_RECORD_JSON_FILE = "exp_mdm_approve_record.json";
+ //public static final String NODE_JSON_FILE = "exp_mdm_nc_node.json";
+ //public static final String APPROVE_RECORD_JSON_FILE = "exp_mdm_approve_record.json";
public static final String ANNOTATION_DICT = "machine_annotation";
@@ -75,21 +76,25 @@
/**
* 瀵煎嚭dnc鍘嬬缉鍖�
- * @param approvedIdArr 寰呭鍑哄鎵硅〃id鏁扮粍
+ * @param approvedIdArray 寰呭鍑哄鎵硅〃id鏁扮粍
*/
- public void exportDnc(Long[] approvedIdArr, OutputStream os) throws IOException {
+ public void exportDnc(Long[] approvedIdArray, OutputStream os) throws IOException {
//FileOutputStream fos = new FileOutputStream("d:/exportDnc.zip");
try (ZipOutputStream zipOut = new ZipOutputStream(os);) {//os
- ArrayList<Long> programPackageNodeIdList = new ArrayList<Long>();
+ //ArrayList<Long> programPackageNodeIdList = new ArrayList<Long>();
- for (Long approvedId : approvedIdArr) {
+ for (Long approvedId : approvedIdArray) {
NcProgramApproved approved = approvedService.getById(approvedId);
- programPackageNodeIdList.add(approved.getNcNodeId());
+ //programPackageNodeIdList.add(approved.getNcNodeId());
addProgramPackageToZip(zipOut,approved);
}
- addDataJson(zipOut, programPackageNodeIdList);
+
+ //鐘舵�佷慨鏀逛负宸插鍑�
+ approvedService.lambdaUpdate().in(NcProgramApproved::getId, approvedIdArray)
+ .set(NcProgramApproved::getStatus,NcProgramApproved.STATUS_EXPORTED).update();
+ //addDataJson(zipOut, programPackageNodeIdList);
}
os.close();
@@ -117,7 +122,7 @@
}else if(programPackageNode.hasCured()){
status = "GH";
}
- List<Dict> annotationList = getAnnotionList();
+ List<Dict> annotationList = programAnnotationService.getAnnotionList();
for (NcNode node : programNodes) {
String filePathInZip = packageFolder + node.getName();
programFile = this.flowProgramFileService.getById(node.getFlowProgramFileId());
@@ -152,7 +157,11 @@
* @return
*/
InputStream addSendDirAnnotation(InputStream inputStream,Machine machine,List<Dict> annotationList) throws IOException {
- return FileContentUtil.insertLine(inputStream,1,generateAnnotation(machine.getProgSendDir()==null? StringUtil.EMPTY:machine.getProgSendDir(),machine.getMachineGroupCode(),annotationList));
+ //妫�娴嬬浜岃鏄惁鏄矾寰�
+ String annotationText = programAnnotationService.generateAnnotation(machine.getProgSendDir()==null? StringUtil.EMPTY:machine.getProgSendDir(),machine.getMachineGroupCode(),annotationList);
+
+ //TODO 鏀瑰垽鏂鍐呭
+ return FileContentUtil.insertLine(inputStream,1,annotationText);
}
/**
@@ -165,8 +174,24 @@
* @throws IOException
*/
InputStream addProgramStatusAnnotation(InputStream inputStream,String status,Machine machine,List<Dict> annotationList) throws IOException {
- return FileContentUtil.insertLine(inputStream,2,generateAnnotation(status,machine.getMachineGroupCode(),annotationList));
+ String annoText= programAnnotationService.generateAnnotation(status,machine.getMachineGroupCode(),annotationList);
+
+ return FileContentUtil.insertLine(inputStream,2,annoText);
}
+
+ /**
+ * 鍒ゆ柇涓�琛屾枃鏈槸鍚︽槸娉ㄩ噴
+ * @param line
+ * @param annotationList
+ * @return
+ */
+ boolean isAnnotation(String line,List<Dict> annotationList){
+ boolean isAnno = false;
+
+ return isAnno;
+ }
+
+
String generateAnnotation(String oriTest,String machineGroupCode,List<Dict> annotationList) {
R<List<Dict>> dictsResult = dictClient.getList(ANNOTATION_DICT);
@@ -193,11 +218,12 @@
* 瀵煎叆鏁版嵁鏂囦欢
* @param zipOut
*/
+ /*
void addDataJson(ZipOutputStream zipOut, List<Long> programPackageNodeIdList) throws IOException {
addNodeDataJson(zipOut, programPackageNodeIdList);
addApproveRecordDataJson(zipOut, programPackageNodeIdList);
}
-
+ */
/**
* zip淇濋噸鍔犲叆鑺傜偣鐨勬暟鎹�
@@ -205,6 +231,7 @@
* @param pkgNodeIdList
* @throws IOException
*/
+ /*
void addNodeDataJson(ZipOutputStream zipOut,List<Long> pkgNodeIdList) throws IOException {
List<NcNode> pkgNodes = this.ncNodeService.lambdaQuery().in(NcNode::getId, pkgNodeIdList).list();
@@ -229,7 +256,8 @@
addInputStreamToZip(zipOut,new ByteArrayInputStream(jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8)),NODE_JSON_FILE);
}
-
+ */
+ /*
@NotNull
private static JSONObject getNodeJsonObject(NcNode node) {
JSONObject recObj = new JSONObject();
@@ -253,17 +281,15 @@
recObj.put("processInstanceId", node.getProcessInstanceId());
return recObj;
}
-
+ */
/**
* 瀵煎叆瀹℃壒璁板綍
* @param zipOut
* @param programPackageNodeIdList 绋嬪簭鍖呭悕鐨刬d鍒楄〃
*/
+ /*
void addApproveRecordDataJson(ZipOutputStream zipOut, List<Long> programPackageNodeIdList) throws IOException {
- /*
- List<String> instanceIds = this.ncNodeService.lambdaQuery().in(NcNode::getId, programPackageNodeIdList)
- .list().stream().map(NcNode::getProcessInstanceId).toList();
-*/
+
//List<ApproveRecord> records = approveRecordService.lambdaQuery().in(ApproveRecord::getProcessInstanceId, instanceIds).list();
List<ApproveRecord> records = approveRecordService.lambdaQuery().in(ApproveRecord::getNcNodeId, programPackageNodeIdList).list();
@@ -285,7 +311,7 @@
}
addInputStreamToZip(zipOut,new ByteArrayInputStream(jsonArray.toJSONString().getBytes(StandardCharsets.UTF_8)),"exp_mdm_approve_record.json");
- }
+ }*/
void addSuperProperties(JSONObject recObj, BizEntity entity){
recObj.put("tenantId",entity.getTenantId());
--
Gitblit v1.9.3