yangys
2025-06-16 bba9d9bd7bbebbdfda231c2edb1d339cec54cd03
补充机床接口2
已修改8个文件
已添加6个文件
470 ■■■■ 文件已修改
blade-service/blade-mdm/src/main/java/org/springblade/mdm/basesetting/machine/MachineService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/basesetting/machine/controller/MachineController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/basesetting/machine/mapper/MachineMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/commons/vo/BaseVO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/excution/AutoAssignUsersService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/excution/StartDispatcher.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/task/dispatch/CureProgramCheckTask.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/task/dispatch/ProgramEmptyUpgradeProcessEdtionTask.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/entity/NcProgram.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/mapper/NcProgramMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/mapper/NcProgramMapper.xml 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramService.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/resources/processesbpmn/dispatch.bpmn20.xml 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/sql/mdm/mdm.all.create.sql 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
blade-service/blade-mdm/src/main/java/org/springblade/mdm/basesetting/machine/MachineService.java
@@ -132,4 +132,14 @@
        return true;
    }
    /**
     * æ ¹æ®æœºåºŠç¼–码获取机床
     * @param machineCode æœºåºŠç¼–码
     * @return
     */
    public Machine getByCode(String machineCode) {
        return this.getOne(this.lambdaQuery().eq(Machine::getCode, machineCode));
    }
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/basesetting/machine/controller/MachineController.java
@@ -97,7 +97,7 @@
    @GetMapping("export")
    @ApiOperationSupport(order = 13)
    @Operation(summary = "导出机床", description = "名称或编码")
    public void exportUser(MachineQueryVO query, HttpServletResponse response) {
    public void export(MachineQueryVO query, HttpServletResponse response) {
        query.setCurrent(1);
        query.setSize(Integer.MAX_VALUE);
        IPage<MachineVO> pages = service.pageQuery(query);
blade-service/blade-mdm/src/main/java/org/springblade/mdm/basesetting/machine/mapper/MachineMapper.xml
@@ -9,8 +9,8 @@
        <result column="name" property="name"/>
        <result column="status" property="status"/>
        <result column="createTime" property="create_time"/>
        <result column="updateTime" property="update_time"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="pageQuery" resultType="org.springblade.mdm.basesetting.machine.vo.MachineVO">
blade-service/blade-mdm/src/main/java/org/springblade/mdm/commons/vo/BaseVO.java
@@ -1,5 +1,6 @@
package org.springblade.mdm.commons.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -9,7 +10,7 @@
@Getter
public class BaseVO {
    private Long id;
    @Schema(description = "状态")
    private Integer status;
    private Long createUser;
    private Date createTime;
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/excution/AutoAssignUsersService.java
@@ -14,15 +14,16 @@
@Service
public class AutoAssignUsersService {
    @Autowired
    private ProduceDivisionMapper planMapper;
    private ProduceDivisionMapper divMapper;
    public Map<String,Object> autoAssignUsers(long producePlanId){
        ProduceDivision pplan = planMapper.selectById(producePlanId);
        ProduceDivision pplan = divMapper.selectById(producePlanId);
        Map<String,Object> result = new HashMap<String,Object>();
        result.put("teamLeader",pplan.getTeamLeaderId());
        result.put("programmer",pplan.getProgrammerId());
        result.put("checker",pplan.getCheckerId());
        result.put("senior",pplan.getSeniorId());
        return result;
    }
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/excution/StartDispatcher.java
@@ -10,6 +10,8 @@
import org.springblade.flow.core.pojo.entity.BladeFlow;
import org.springblade.flow.core.utils.TaskUtil;
import org.springblade.mdm.flow.vo.TaskAssignVO;
import org.springblade.mdm.program.entity.NcProgram;
import org.springblade.mdm.program.service.NcProgramService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.flowable.engine.RuntimeService;
@@ -25,6 +27,9 @@
    private AutoAssignUsersService autoAssignUsersService;
    @Autowired
    private IdentityService identityService;
    @Autowired
    private NcProgramService ncProgramService;
    private static final String PROCESS_KEY = "dispatch";
    public void start(TaskAssignVO startVO){
@@ -45,8 +50,15 @@
        vars.put("drawingNoEdition",startVO.getDrawingNoEdition());
        vars.put("planLockDays",startVO.getPlanLockDays());
        //vars.put("producePlanId",startVO.getCraftEdition());
        //零组件代码
        String partNo = generatePartNo(startVO);
        vars.put("partNo",partNo);
        NcProgram curedNcProgram = ncProgramService.getCuredNcProgram(partNo,startVO.getMachineMode());
        vars.put("curedNcProgram",curedNcProgram);
        //设置是否有固化程序标记
        vars.put("hasCuredProgram",curedNcProgram != null ? "Y":"N");
        String businessKey = "0";//业务表key
@@ -72,6 +84,5 @@
            startVO.getProcessName(),
            startVO.getCraftEdition(),
            startVO.getProcessEdition());
    }
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/task/dispatch/CureProgramCheckTask.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package org.springblade.mdm.flow.task.dispatch;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.springblade.mdm.program.entity.NcProgram;
import org.springframework.stereotype.Component;
@Slf4j
@Component("cureProgramCheckTask")
public class CureProgramCheckTask {
    public void execute(DelegateExecution execution) {
        //固化程序检查有效期,
        String hasCuredProgram =  (String)execution.getVariable("hasCuredProgram");
        NcProgram ncProgram =  (NcProgram)execution.getVariable("curedNcProgram");
        System.out.println("执行服务任务");
    }
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/task/dispatch/ProgramEmptyUpgradeProcessEdtionTask.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package org.springblade.mdm.flow.task.dispatch;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.mdm.program.entity.NcProgram;
import org.springblade.mdm.program.service.NcProgramService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component("programEmptyUpgradeProcessEdtionTask")
public class ProgramEmptyUpgradeProcessEdtionTask {
    @Autowired
    private NcProgramService ncProgramService;
    public void execute(DelegateExecution execution) {
        //空升版,新加入一条程序数据,并且将工序版次processEdition设置为用户输入的新版本
        NcProgram ncProgram =  (NcProgram)execution.getVariable("curedNcProgram");
        //将现有程序设置为非最新的
        ncProgram.setIsLastEdition(0);
        ncProgramService.updateById(ncProgram);
        NcProgram newNcProgram = new NcProgram();
        BeanUtil.copyProperties(ncProgram, newNcProgram);
        newNcProgram.setIsLastEdition(1);
        newNcProgram.setId(null);
        ncProgramService.save(newNcProgram);
        log.info("空升版完成,新的程序id为{}",newNcProgram.getId());
    }
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/entity/NcProgram.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
package org.springblade.mdm.program.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import org.springblade.core.mp.base.BizEntity;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Setter
@Getter
@TableName("mdm_nc_program")
public class NcProgram extends BizEntity {
    private String name;
    private String code;
    /**
     * ç¨‹åºåŒ…名
      */
    private String packageName;
    /**
     * è®¾å¤‡ï¼ˆæœºåºŠï¼‰ç¼–码
     */
    private String machineCode;
    /**
     * é›¶ç»„件号
     */
    private String partNo;
    /**
     * æ˜¯å¦å›ºåŒ–
     */
    private Integer isCured;
    /**
     * è¿‡æœŸæ—¥æœŸ
     */
    private LocalDate expireDate;
    /**
     * å·¥åºç‰ˆæ¬¡
     */
    private String processEdition;
    /**
     * æ˜¯å¦æœ€æ–°ç‰ˆæ¬¡ï¼Œ1:最新版次;0:历史版次
     */
    private Integer isLastEdition;
    /**
     * æ˜¯å¦é”å®š
     */
    private Integer isLocked;
    /**
     * ä»»åŠ¡åˆ†æ´¾æ—¶é—´
     */
    private LocalDateTime taskAssignTime;
    /**
     * æ˜¯å¦åœ¨æœ‰æ•ˆæœŸå†…
     * @param effectiveMonths æœ‰æ•ˆæ—¶é•¿ï¼ˆæœˆæ•°ï¼‰ï¼Œåœ¨ç³»ç»Ÿå‚数中配置
     * @return
     */
    public boolean withinValidity(int effectiveMonths){
        //有效期按照什么时间计算推算?暂时按照任务分配时间, ä»»åŠ¡åˆ†é…æ—¶é—´ + æœ‰æ•ˆæœˆä»½ < å½“前时间为有效
        if(taskAssignTime == null ){
            return false;
        }
        //
        return taskAssignTime.plusMonths(effectiveMonths).isBefore(LocalDateTime.now());
    }
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/mapper/NcProgramMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package org.springblade.mdm.program.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.mp.mapper.BladeMapper;
import org.springblade.mdm.basesetting.machine.entity.Machine;
import org.springblade.mdm.basesetting.machine.vo.MachineVO;
import org.springblade.mdm.program.entity.NcProgram;
public interface NcProgramMapper extends BladeMapper<NcProgram> {
    /**
     * èŽ·å–æœ€æ–°å›ºåŒ–ç¨‹åº
     * @param partNo é›¶ç»„件号
     * @param machineGroupCode æœºåºŠç»„代码
     * @return
     */
    NcProgram getCuredNcProgram(@Param("")String partNo,@Param("machineGroupCode")String machineGroupCode);
}
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/mapper/NcProgramMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.mdm.program.mapper.NcProgramMapper">
    <resultMap id="BaseResultMap" type="org.springblade.mdm.program.entity.NcProgram">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="name" property="name"/>
        <result column="package_name" property="packageName"/>
        <result column="machine_code" property="machineCode"/>
        <result column="part_no" property="partNo"/>
        <result column="is_cured" property="isCured"/>
        <result column="expire_date" property="expireDate"/>
        <result column="process_edition" property="processEdition"/>
        <result column="is_last_edition" property="isLastEdition"/>
        <result column="is_locked" property="isLocked"/>
        <result column="task_assign_time" property="taskAssignTime"/>
        <result column="status" property="status"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
<!--
    <select id="pageQuery" resultType="org.springblade.mdm.basesetting.machine.vo.MachineVO">
        select m.id,m.name,m.code,g.dict_key machine_group_code,g.dict_value machine_group_name,m.machine_spec,m.manufacturer,m.operator
        from mdm_machine m join blade_dict_biz g on m.machine_group_code=g.dict_key and g.code='machine_group' and g.is_deleted=0
            ${ew.customSqlSegment}
    </select>
-->
    <!--    <select id="parentTree" resultMap="treeNodeResultMap">-->
<!--        select id, parent_id, dict_value as title, id as "value", id as "key" from blade_dict where is_deleted = 0 and parent_id = 0-->
<!--    </select>-->
    <sql id="all_columns">id,tenant_id,nc_node_id,code,name,package_name,machine_code,part_no,is_cured,
  expire_date,process_edition,is_last_edition,is_locked,task_assign_time,status,create_dept,is_deleted,create_time,create_user,update_time,update_user</sql>
    <select id="getCuredNcProgram" resultMap="BaseResultMap">
        select <include refid="all_columns"/> from mdm_nc_program
        where is_deleted=0 and is_cured=1 and part_no=#{partNo} and is_last_edition=1
        and machine_code in (select code from mdm_machine where machine_group_code=#{machineGroupCode})
        order by create_time desc
        limit 1
    </select>
</mapper>
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
/**
 * BladeX Commercial License Agreement
 * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
 * <p>
 * Use of this software is governed by the Commercial License Agreement
 * obtained after purchasing a license from BladeX.
 * <p>
 * 1. This software is for development use only under a valid license
 * from BladeX.
 * <p>
 * 2. Redistribution of this software's source code to any third party
 * without a commercial license is strictly prohibited.
 * <p>
 * 3. Licensees may copyright their own code but cannot use segments
 * from this software for such purposes. Copyright of this software
 * remains with BladeX.
 * <p>
 * Using this software signifies agreement to this License, and the software
 * must not be used for illegal purposes.
 * <p>
 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
 * not liable for any claims arising from secondary or illegal development.
 * <p>
 * Author: Chill Zhuang (bladejava@qq.com)
 */
package org.springblade.mdm.program.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.*;
import org.springblade.core.mp.base.BizServiceImpl;
import org.springblade.mdm.basesetting.machine.MachineService;
import org.springblade.mdm.basesetting.machine.entity.Machine;
import org.springblade.mdm.program.mapper.NcProgramMapper;
import org.springblade.mdm.program.entity.NcProgram;
import org.springblade.mdm.program.vo.DncSendBackData;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
 * å·¥ä½œæµæœåŠ¡å®žçŽ°ç±»
 *
 * @author Chill
 */
@Slf4j
@Service
@AllArgsConstructor
public class NcProgramService  extends BizServiceImpl<NcProgramMapper, NcProgram> {
    private final ObjectMapper objectMapper;
    private final RepositoryService repositoryService;
    private final RuntimeService runtimeService;
    private final HistoryService historyService;
    private final TaskService taskService;
    private final ProcessEngine processEngine;
    private final MachineService machineService;
    /**
     * æŸ¥è¯¢çŽ°æœ‰å›ºåŒ–çš„ç¨‹åºï¼Œæš‚å®šæ¡ä»¶ï¼šé›¶ç»„ä»¶å·ç›¸åŒï¼Œä¸”æ˜¯åŒä¸€æœºåºŠç»„
     * @param partNo
     * @param machineCode
     * @return
     */
    public NcProgram getCuredNcProgram(String partNo,String machineCode) {
        Machine machine = machineService.getByCode(machineCode);
        return this.getBaseMapper().getCuredNcProgram(partNo,machine.getMachineGroupCode());
    }
}
blade-service/blade-mdm/src/main/resources/processesbpmn/dispatch.bpmn20.xml
@@ -5,34 +5,51 @@
    <sequenceFlow id="sid-c1619263-d1ff-4106-9315-f9ab9a3bee71" sourceRef="start" targetRef="teamLeaderTask"/>
    <userTask id="teamLeaderTask" name="专业组长" flowable:assignee="${teamLeader}"/>
    <userTask id="programmingTask" name="编制" flowable:assignee="${programmer}"/>
    <sequenceFlow id="sid-ac678e85-9f7b-4e8d-903f-2591ea7721ab" sourceRef="teamLeaderTask" targetRef="programmingTask"/>
    <userTask id="check" name="校对" flowable:assignee="${checker}"/>
    <sequenceFlow id="sid-6c33a84d-d03e-47f6-87c1-8e676b25e572" sourceRef="programmingTask" targetRef="programGateway"/>
    <userTask id="approveTask" name="高师审批" flowable:assignee="${senior}"/>
    <sequenceFlow id="toCheckApproveGateway" sourceRef="check" targetRef="checkApproveGateway" name="校对审批判断网关"/>
    <endEvent id="approveEnd" name="审批完成"/>
    <sequenceFlow id="sid-1a414739-a80f-4436-8d7a-e7b65fae8233" sourceRef="approveTask" targetRef="seriorApproveGateway"/>
    <exclusiveGateway id="programGateway" name="编制完成判断网关"/>
    <sequenceFlow id="programingToCheck" sourceRef="programGateway" targetRef="check" name="编制完成给校对">
    <sequenceFlow id="programingToCheck" sourceRef="programmingTask" targetRef="check" name="编制完成给校对">
      <conditionExpression xsi:type="tFormalExpression">${approve=='Y'}</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="programingBackToLeader" sourceRef="programGateway" targetRef="teamLeaderTask" name="编制驳回">
    <sequenceFlow id="programingBackToLeader" sourceRef="programmingTask" targetRef="teamLeaderTask" name="编制驳回">
      <conditionExpression xsi:type="tFormalExpression">${approve=='N'}</conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="checkApproveGateway" name="校对审批判断网关"/>
    <sequenceFlow id="flowCheckToPrograming" sourceRef="checkApproveGateway" targetRef="programmingTask" name="flow校对驳回到编制">
    <sequenceFlow id="flowCheckToPrograming" sourceRef="check" targetRef="programmingTask" name="flow校对驳回到编制">
      <conditionExpression xsi:type="tFormalExpression">${approve=='N'}</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flowToSeriorTask" sourceRef="checkApproveGateway" targetRef="approveTask" name="到高师审批">
    <sequenceFlow id="flowToSeriorTask" sourceRef="check" targetRef="approveTask" name="到高师审批">
      <conditionExpression xsi:type="tFormalExpression">${approve=='Y'}</conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="seriorApproveGateway" name="高师判断网关"/>
    <sequenceFlow id="sid-c0b195e7-17e5-44bf-8115-8b7126cb3ab3" sourceRef="seriorApproveGateway" targetRef="approveEnd">
    <sequenceFlow id="sid-c0b195e7-17e5-44bf-8115-8b7126cb3ab3" sourceRef="approveTask" targetRef="approveEnd">
      <conditionExpression xsi:type="tFormalExpression">${approve=='Y'}</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-03430665-d042-46b3-ab65-5ecde104ce8e" sourceRef="seriorApproveGateway" targetRef="check">
      <conditionExpression xsi:type="tFormalExpression"/>
    <serviceTask id="cureCheckServiceTask" flowable:exclusive="true" name="固化程序检查服务任务" flowable:expression="cureProgramCheckTask.execute(execution)"/>
    <userTask id="sid-015ac835-1083-489a-9496-97dbb9432d09" name="检查程序是否可用"/>
    <sequenceFlow id="sid-46ccac64-2d48-4933-88a6-f2941ae131dd" sourceRef="teamLeaderTask" targetRef="programmingTask">
      <conditionExpression xsi:type="tFormalExpression">hasCuredProgram==‘N'</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-af92e6ab-bc80-43ed-8b09-1d3ec54cc9e7" sourceRef="teamLeaderTask" targetRef="cureCheckServiceTask">
      <conditionExpression xsi:type="tFormalExpression">hasCuredProgram==‘Y'</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-353381d5-35c7-47b0-bf5b-2bafe865ab5e" sourceRef="cureCheckServiceTask" targetRef="sid-015ac835-1083-489a-9496-97dbb9432d09"/>
    <sequenceFlow id="sid-d144dad0-dc94-4a2b-96d6-9d8451b05ec1" sourceRef="sid-015ac835-1083-489a-9496-97dbb9432d09" targetRef="sid-82237034-5cb2-45c7-9a74-e2d5abb3b398" name="固化程序可用">
      <conditionExpression>approve=='Y'</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-d4133565-1a45-4bb6-b603-9b9e4db1cdbb" sourceRef="approveTask" targetRef="check">
      <conditionExpression>{approve=='N'}</conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="sid-82237034-5cb2-45c7-9a74-e2d5abb3b398" name="可用程序流转网关"/>
    <sequenceFlow id="sid-b15dcf6a-a48c-4e01-b6bc-5c2a74ca817e" sourceRef="sid-82237034-5cb2-45c7-9a74-e2d5abb3b398" targetRef="check" name="工序版次一致并且可用">
      <conditionExpression xsi:type="tFormalExpression">processEditionEqual=='Y'</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-6249886b-7c4a-4904-9b0b-cf743932be9f" sourceRef="sid-82237034-5cb2-45c7-9a74-e2d5abb3b398" targetRef="emptyUpgradeProcessEdtionServiceTask">
      <conditionExpression xsi:type="tFormalExpression">processEditionEqual=='N'</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-598e1dbe-85b3-40d0-89c8-bd2580ecbfc5" sourceRef="emptyUpgradeProcessEdtionServiceTask" targetRef="check"/>
    <sequenceFlow id="sid-80b50f96-7601-4ba2-8c32-968923170d25" sourceRef="sid-015ac835-1083-489a-9496-97dbb9432d09" targetRef="programmingTask">
      <conditionExpression>approve=='N'</conditionExpression>
    </sequenceFlow>
    <serviceTask id="emptyUpgradeProcessEdtionServiceTask" flowable:exclusive="true" name="空升版" flowable:expression="programEmptyUpgradeProcessEdtionTask.execute(execution)"/>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_dispatch">
    <bpmndi:BPMNPlane bpmnElement="dispatch" id="BPMNPlane_dispatch">
@@ -41,72 +58,91 @@
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-5783eb04-78a8-4bde-b8bb-c12d28f07609" bpmnElement="sid-c1619263-d1ff-4106-9315-f9ab9a3bee71">
        <omgdi:waypoint x="-290.0" y="-92.5"/>
        <omgdi:waypoint x="-240.0" y="-92.5"/>
        <omgdi:waypoint x="-262.5" y="-92.50001"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-720b1ec1-043e-4a8a-bc4d-c50cf01678d7" bpmnElement="teamLeaderTask">
        <omgdc:Bounds x="-240.0" y="-125.0" width="70.0" height="65.0"/>
        <omgdc:Bounds x="-262.5" y="-125.00001" width="70.0" height="65.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="shape-b1baea86-1882-4c5c-886f-44e3d9be3746" bpmnElement="programmingTask">
        <omgdc:Bounds x="-115.0" y="-122.5" width="85.0" height="60.0"/>
        <omgdc:Bounds x="-72.5" y="-137.5" width="85.0" height="60.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-0079d499-1c0d-4745-9886-40df39794833" bpmnElement="sid-ac678e85-9f7b-4e8d-903f-2591ea7721ab">
        <omgdi:waypoint x="-170.0" y="-92.5"/>
        <omgdi:waypoint x="-115.0" y="-92.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-9237838e-5de2-4db7-8d46-3f4a69de7e6e" bpmnElement="check">
        <omgdc:Bounds x="85.0" y="-120.0" width="60.0" height="55.0"/>
        <omgdc:Bounds x="130.0" y="-135.0" width="60.0" height="55.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-72007fd8-6ed8-402f-8bbc-81bd6c856fa7" bpmnElement="sid-6c33a84d-d03e-47f6-87c1-8e676b25e572">
        <omgdi:waypoint x="-30.0" y="-77.5"/>
        <omgdi:waypoint x="-30.0" y="-15.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-a42e90ff-9c82-4d5b-8f5b-0804754e89a6" bpmnElement="approveTask">
        <omgdc:Bounds x="130.0" y="1.0" width="50.0" height="45.0"/>
        <omgdc:Bounds x="220.0" y="-14.0" width="50.0" height="45.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-7fe1281a-3bbf-4308-90a5-cbf70aa019dd" bpmnElement="toCheckApproveGateway">
        <omgdi:waypoint x="145.0" y="-92.5"/>
        <omgdi:waypoint x="240.0" y="-30.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-f14acaf6-9747-4d52-87a1-d4c5b8f3d166" bpmnElement="approveEnd">
        <omgdc:Bounds x="245.0" y="51.0" width="30.0" height="30.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-9cb8c108-2b94-4e39-b7ed-93ff0d86fe73" bpmnElement="sid-1a414739-a80f-4436-8d7a-e7b65fae8233">
        <omgdi:waypoint x="130.0" y="34.75"/>
        <omgdi:waypoint x="55.0" y="70.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-b505d942-4475-416a-aec6-c02164e6ee05" bpmnElement="programGateway">
        <omgdc:Bounds x="-50.0" y="-15.0" width="40.0" height="40.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-6f05f47f-7804-4dd0-b6d2-e435b9efaa3c" bpmnElement="programingToCheck">
        <omgdi:waypoint x="-10.0" y="5.0"/>
        <omgdi:waypoint x="85.0" y="-78.75"/>
        <omgdi:waypoint x="12.5" y="-92.5"/>
        <omgdi:waypoint x="130.00002" y="-107.49999"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-b38a8021-a54d-4671-aaf2-408bdbbbd374" bpmnElement="programingBackToLeader">
        <omgdi:waypoint x="-50.0" y="5.0"/>
        <omgdi:waypoint x="-170.0" y="-76.25"/>
        <omgdi:waypoint x="-72.5" y="-92.5"/>
        <omgdi:waypoint x="-192.5" y="-76.25001"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-b113f604-a178-455b-9518-9f4953322948" bpmnElement="checkApproveGateway">
        <omgdc:Bounds x="220.0" y="-30.0" width="40.0" height="40.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-c2232174-4a73-4c39-ac85-fc3854f0f18c" bpmnElement="flowCheckToPrograming">
        <omgdi:waypoint x="220.0" y="-10.0"/>
        <omgdi:waypoint x="-30.0" y="-92.5"/>
        <omgdi:waypoint x="130.0" y="-121.25"/>
        <omgdi:waypoint x="12.5" y="-107.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-d05b5f9f-9108-4a41-9e48-4db1e1b1e325" bpmnElement="flowToSeriorTask">
        <omgdi:waypoint x="240.0" y="10.0"/>
        <omgdi:waypoint x="180.0" y="12.25"/>
        <omgdi:waypoint x="190.0" y="-93.75"/>
        <omgdi:waypoint x="270.0" y="-2.75"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-6be62567-0538-4a4f-b3ce-e819d7182666" bpmnElement="seriorApproveGateway">
        <omgdc:Bounds x="35.0" y="70.0" width="40.0" height="40.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-715efa53-6c03-407b-87ec-640f99c481a0" bpmnElement="sid-c0b195e7-17e5-44bf-8115-8b7126cb3ab3">
        <omgdi:waypoint x="75.0" y="90.0"/>
        <omgdi:waypoint x="245.0" y="73.5"/>
        <omgdi:waypoint x="270.0" y="19.749996"/>
        <omgdi:waypoint x="245.0" y="58.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-782277fd-866f-44d5-9046-af7c34c4b85c" bpmnElement="sid-03430665-d042-46b3-ab65-5ecde104ce8e">
        <omgdi:waypoint x="35.0" y="90.0"/>
        <omgdi:waypoint x="100.0" y="-65.0"/>
      <bpmndi:BPMNShape id="shape-8455618d-c1b9-4e6a-bca4-de965cc81633" bpmnElement="cureCheckServiceTask">
        <omgdc:Bounds x="-275.0" y="37.500004" width="65.0" height="39.999996"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="shape-8f7064fc-4838-44cc-bf6d-ca15932a1e2e" bpmnElement="sid-015ac835-1083-489a-9496-97dbb9432d09">
        <omgdc:Bounds x="-165.0" y="37.5" width="55.0" height="40.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-0408fc3c-c133-40e3-9006-c315b12e9790" bpmnElement="sid-46ccac64-2d48-4933-88a6-f2941ae131dd">
        <omgdi:waypoint x="-192.5" y="-92.500015"/>
        <omgdi:waypoint x="-72.49999" y="-107.50001"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-d8883eca-269a-42cd-b2d4-134da6596afb" bpmnElement="sid-af92e6ab-bc80-43ed-8b09-1d3ec54cc9e7">
        <omgdi:waypoint x="-227.5" y="-60.000008"/>
        <omgdi:waypoint x="-242.5" y="37.500008"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-44016aa6-bf48-4c73-8aaa-4cedf795d68b" bpmnElement="sid-353381d5-35c7-47b0-bf5b-2bafe865ab5e">
        <omgdi:waypoint x="-210.0" y="57.5"/>
        <omgdi:waypoint x="-165.0" y="57.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-64e64024-1ffd-4cdf-be8f-4c5e4911a5bb" bpmnElement="sid-d144dad0-dc94-4a2b-96d6-9d8451b05ec1">
        <omgdi:waypoint x="-110.0" y="47.5"/>
        <omgdi:waypoint x="-60.0" y="0.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-7a5135fe-5eb1-425c-b920-3e2b5bf18454" bpmnElement="sid-d4133565-1a45-4bb6-b603-9b9e4db1cdbb">
        <omgdi:waypoint x="257.5" y="-14.0"/>
        <omgdi:waypoint x="175.0" y="-80.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-50f64465-52e3-4ba9-b36d-ebac41ab8b22" bpmnElement="sid-82237034-5cb2-45c7-9a74-e2d5abb3b398">
        <omgdc:Bounds x="-60.0" y="-20.0" width="40.0" height="40.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="edge-4b95c6df-601d-48e8-a9a4-98499ae5ddf3" bpmnElement="sid-b15dcf6a-a48c-4e01-b6bc-5c2a74ca817e">
        <omgdi:waypoint x="-20.0" y="0.0"/>
        <omgdi:waypoint x="130.0" y="-93.75"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-dbb7a807-e493-42fe-b229-b9f2ec25b5ee" bpmnElement="sid-6249886b-7c4a-4904-9b0b-cf743932be9f">
        <omgdi:waypoint x="-40.0" y="20.0"/>
        <omgdi:waypoint x="30.0" y="57.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-092f7d8d-2467-4794-af93-fdc9ad503923" bpmnElement="sid-598e1dbe-85b3-40d0-89c8-bd2580ecbfc5">
        <omgdi:waypoint x="86.25" y="30.0"/>
        <omgdi:waypoint x="145.0" y="-79.99999"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="edge-223da197-47f2-44ef-847e-40d1fae1009b" bpmnElement="sid-80b50f96-7601-4ba2-8c32-968923170d25">
        <omgdi:waypoint x="-123.75" y="37.5"/>
        <omgdi:waypoint x="-51.25" y="-77.5"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="shape-0fe942f6-dea9-427c-aef6-0db9c3e3707b" bpmnElement="emptyUpgradeProcessEdtionServiceTask">
        <omgdc:Bounds x="30.0" y="30.0" width="75.0" height="55.0"/>
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
doc/sql/mdm/mdm.all.create.sql
@@ -78,6 +78,7 @@
                                  UNIQUE KEY `uniqueCodeIndex` (`code`,`is_deleted`) USING BTREE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='程序节点目录';
DROP TABLE IF EXISTS `mdm_nc_program`;
CREATE TABLE `mdm_nc_program` (
  `id` bigint NOT NULL,
  `tenant_id` varchar(6) DEFAULT NULL COMMENT '所属租户',
@@ -86,11 +87,13 @@
  `name` varchar(100) NOT NULL COMMENT '程序名称',
  `package_name` varchar(100) NOT NULL COMMENT '程序包名',
  `machine_code` bigint DEFAULT NULL COMMENT '设备编号/机床编号',
  `part_no` varchar(100) NOT NULL COMMENT '零组件编号',
  `is_cured` int DEFAULT NULL COMMENT '是否固化,1是;0否',
  `expire_date` date DEFAULT NULL COMMENT '到期时间,根据有效期时长计算而来',
  `process_edition` varchar(40) DEFAULT NULL COMMENT '工序版次,升版就是变更改该字段,需要保留历史记录',
  `is_last_edition` int NOT NULL COMMENT '是否最新版次,1:最新版次;0:历史版次,主要取该字段=1的数据,0是历史版次',
  `is_locked` int DEFAULT NULL COMMENT '锁定状态,1:锁定;0:正常',
  `task_assign_time` datetime DEFAULT NULL COMMENT '程序的任务下发的时间(用于检查是否为重复的任务)',
  `status` int DEFAULT NULL COMMENT '业务状态',
  `create_dept` bigint DEFAULT NULL COMMENT '创建单位',
  `is_deleted` int DEFAULT NULL,
@@ -101,6 +104,7 @@
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='数控程序';
DROP TABLE IF EXISTS `mdm_nc_program_file`;
CREATE TABLE `mdm_nc_program_file` (
  `id` bigint NOT NULL,
  `tenant_id` varchar(6) DEFAULT NULL COMMENT '所属租户',
@@ -117,20 +121,19 @@
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='数控程序文件';
CREATE TABLE `mdm_task_receive` (
DROP TABLE IF EXISTS `mdm_machine_back_file`;
CREATE TABLE `mdm_machine_back_file` (
  `id` bigint NOT NULL,
  `name` varchar(100) NOT NULL COMMENT '程序名称',
  `machine_group_id` bigint DEFAULT NULL COMMENT '所属机床组ID',
  `flow_task_id` bigint DEFAULT NULL COMMENT '任务ID,接收下发任务时确定的任务id,非流程示例id',
  `is_cured` int DEFAULT NULL COMMENT '是否固化,1是;0否',
    `filename` varchar(255) NOT NULL COMMENT '文件名称',
    `machine_code` bigint DEFAULT NULL COMMENT '所属机床代码',
  `status` int DEFAULT NULL COMMENT '业务状态',
  `create_dept` bigint DEFAULT NULL COMMENT '创建单位',
  `is_deleted` int DEFAULT NULL,
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `update_user` bigint DEFAULT NULL COMMENT '更新人'
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uniqueCodeIndex` (`name`,`is_deleted`) USING BTREE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='任务接收表';
    `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='机床回传文件';