From 3ffe33aaa24386337e3638558eca731c62f25521 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期六, 13 九月 2025 13:30:06 +0800
Subject: [PATCH] 修改表格打印的数控程序编号
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/execute/TryFlowCompleteService.java | 96 +++++++++++++++++++++++++++---------------------
1 files changed, 54 insertions(+), 42 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/execute/TryFlowCompleteService.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/execute/TryFlowCompleteService.java
index 1819d08..443eef8 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/execute/TryFlowCompleteService.java
+++ b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/execute/TryFlowCompleteService.java
@@ -8,13 +8,15 @@
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.mdm.basesetting.machine.entity.Machine;
+import org.springblade.mdm.basesetting.machine.service.MachineService;
+import org.springblade.mdm.commons.service.ParamService;
+import org.springblade.mdm.commons.service.UserCommonService;
import org.springblade.mdm.flow.constants.FlowContants;
+import org.springblade.mdm.flow.constants.FlowVariableContants;
import org.springblade.mdm.flow.service.FlowCommonService;
import org.springblade.mdm.flow.service.FlowProgramFileService;
import org.springblade.mdm.flow.service.FlowProgramProperties;
-import org.springblade.mdm.program.entity.NcNode;
-import org.springblade.mdm.program.service.NcNodeAutoCreateService;
-import org.springblade.mdm.program.service.NcNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -28,72 +30,82 @@
public class TryFlowCompleteService extends AbstractFlowCompleteService {
@Autowired
private FlowProgramFileService flowProgramFileService;
+
@Autowired
- private NcNodeService ncNodeService;
- @Autowired
- private NcNodeAutoCreateService ncNodeAutoCreateService;
+ private ParamService paramService;
@Autowired
private FlowCommonService flowCommonService;
+ @Autowired
+ private UserCommonService userCommonService;
+ @Autowired
+ private MachineService machineService;
@Transactional
@Override
public void completeTask(String taskId, String processInstanceId, String comment, Map<String, Object> variables) {
Task task = currentTask(taskId);
- String operateResult = this.getApproveResult(variables);
- if(task.getTaskDefinitionKey().equals("programmingTask")) {//缂栧埗鑺傜偣
- flowProgramFileService.checkProgramFiles(processInstanceId,"Y".equals(operateResult));
- }
- if (StringUtil.isNoneBlank(processInstanceId, comment)) {
- taskService.addComment(taskId, processInstanceId, comment);
- }
// 闈炵┖鍒ゆ柇
if (Func.isEmpty(variables)) {
variables = Kv.create();
}
- variables.put(FlowContants.LAST_STEP_USER_NICKNAME, AuthUtil.getNickName());
+ String operateResult = this.getApproveResult(variables);
+ FlowProgramProperties props = flowCommonService.getProgramProperties(processInstanceId);
if(!variables.containsKey("assignee")) {
throw new ServiceException("璇锋寚瀹氭祦绋嬩笅涓�姝ュ鐞嗕汉");
}
+
+ if(task.getTaskDefinitionKey().equals("programmingTask") ) {//缂栧埗鑺傜偣
+ //璁板綍瀹為檯缂栫▼鍛�
+ variables.put(FlowVariableContants.ACT_PROGRAMMER,Func.toStr(AuthUtil.getUserId()));
+ String programOnMachine = Func.toStr(variables.getOrDefault("programOnMachine",FlowContants.N));//鏄惁鐜板満缂栫▼
+ if(this.needUploadProgramFile(props.getMachineCode()) && programOnMachine.equals(FlowContants.N)) {
+ flowProgramFileService.checkProgramFiles(processInstanceId, FlowContants.Y.equals(operateResult));
+ }
+ }else if(task.getTaskDefinitionKey().equals("teamLeaderTask")){
+ if(FlowContants.Y.equals(operateResult)) {
+ runtimeService.setVariable(task.getExecutionId(),FlowContants.PROGRAMMER_NAME,userCommonService.getUserNameById(Func.toLong(variables.get("assignee"))));
+ }
+ }else if(task.getTaskDefinitionKey().equals("check")){
+ variables.put(FlowVariableContants.ACT_CHECKER,Func.toStr(AuthUtil.getUserId()));
+ }else if(task.getTaskDefinitionKey().equals("approveTask")){
+ variables.put(FlowVariableContants.ACT_SENIOR,Func.toStr(AuthUtil.getUserId()));
+ }
+ variables.remove("programOnMachine");//鍏朵粬鑺傜偣锛屽拷鐣ョ幇鍦虹紪绋嬫爣璁�
+ if (StringUtil.isNoneBlank(processInstanceId, comment)) {
+ taskService.addComment(taskId, processInstanceId, comment);
+ }
+
+ variables.put(FlowContants.LAST_STEP_USER_NICKNAME, AuthUtil.getNickName());
+
addApproveRecord(taskId,comment,variables);
- //鍦ㄧ紪鍒朵换鍔℃椂锛屽垱寤鸿妭鐐癸紙娌℃湁鑺傜偣鍒欏垱寤猴紝鏈夊氨鐩存帴浣跨敤
- /*
- if(task.getTaskDefinitionKey().equals("programmingTask") && FlowContants.Y.equals(operateResult)) {
- FlowProgramProperties progProperties = flowCommonService.getProgramProperties(processInstanceId);
- ncNodeAutoCreateService.createNodeTreeWithProgram(progProperties);
- //鍘熸潵鐗堟鐨勭▼搴忥紝姝ゆ椂搴旇娓呴櫎锛屾槸涓嶆槸瑕佹尓杩囨潵鍛紵鐗堟宸茬粡涓嶅浜�
- //TODO 鑰佽妭鐐规竻闄ゅ悧
-
- //璧板埌缂栧埗鑺傜偣锛屽鏋滄槸鏈夊浐鍖栫▼搴忎笖閫氳繃浜嗭紝璇存槑闇�瑕佸崌鐗堬紙閲嶆柊缂栧啓锛夛紝灏嗗浐鍖栫殑鍘熸潵鐨勭▼搴忚缃甽astEdition=0
- if(FlowContants.Y.equals(progProperties.getHasCuredProgram())) {
- NcNode curedProgramPackage = ncNodeService.getById(Func.toLong(progProperties.getCuredNodeId()));
- curedProgramPackage.setIsLastEdition(0);
- curedProgramPackage.setIsLocked(1);
- ncNodeService.updateById(curedProgramPackage);
- }
-
- }*/
- if(task.getTaskDefinitionKey().equals("approveTask") && FlowContants.Y.equals(operateResult)) {
- //璇曞垏娴佺▼锛屾垨鑰� 鍋忕娴佺▼ 楂樺笀閫氳繃鐨勬椂鍊欏垱寤鸿妭鐐�
- //createProgramNodes(processInstanceId);
- }
variables.remove(FlowContants.PROCESS_EDITION);//涓嶈鍗囩増浜�
- //if(!"confirmIsUseableTask".equals(task.getTaskDefinitionKey())){
+
if("confirmIsUseableTask".equals(task.getTaskDefinitionKey())){
- //宸ュ簭鐗堟涓嶄竴鑷达紝骞朵笖瀹℃牳閫氳繃锛堝彲鐢級鏄紝鎵嶆洿鏂颁负鏂扮殑versionNumber
- FlowProgramProperties progProperties = flowCommonService.getProgramProperties(processInstanceId);
variables.put(FlowContants.CURE_PROGRAM_USEABLE,operateResult);
- if(FlowContants.Y.equals(operateResult) && FlowContants.N.equals(progProperties.getIsProcessEditionSame())) {
- //纭绋嬪簭鍙敤 涓� 宸ュ簭鐗堟涓嶄竴鑷达紝杩涘叆鏍″銆傝繖閲岄渶瑕佸崌绾х▼搴忕殑鐗堟湰鍙�
- Long curedNodeId = progProperties.getCuredNodeId();
- ncNodeService.upgradeVersionNumber(curedNodeId);
+ if(FlowContants.Y.equals(operateResult)) {
+ //鍒ゅ畾鍙敤锛岃褰曚负瀹為檯缂栫▼鍛�
+ variables.put(FlowVariableContants.ACT_PROGRAMMER,Func.toStr(AuthUtil.getUserId()));
}
}
taskService.complete(taskId, variables);
}
+ /**
+ * 鏄惁闇�瑕佷笂浼犳枃浠讹紙杞﹀簥涓嶉渶瑕侊級
+ * @param machineCode 鏈哄簥缂栫爜
+ * @return 鏄惁闇�瑕佷笂浼�
+ */
+ boolean needUploadProgramFile(String machineCode){
+ boolean need;
+ Machine machine = machineService.getByCode(machineCode);
+ String turning = paramService.turninngValue();
+ need = !StringUtils.equals(turning,machine.getMachineSpec());
+ return need;
+ }
+
}
--
Gitblit v1.9.3