yangys
2025-12-03 b4d10ff7535002dddb63a0b28ddb37fee7ed1e9d
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcNodeService.java
@@ -188,7 +188,6 @@
    * @return 最新版本程序报名节点
    */
   public NcNode getLastEditionTryingProgramPackage(String name){
      //.or(NcNode::getIsCured,0)
      List<NcNode> pkgList = lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE)
         .eq(NcNode::getName, name).and(i->{
            i.eq(NcNode::getIsCured, 0).or().isNull(NcNode::getIsCured);
@@ -253,18 +252,7 @@
      }
   }
   public int calculateVersionNumber(NcNode pkgNode) {
      NcNode node = this.lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE).eq(NcNode::getDrawingNo,pkgNode.getDrawingNo())
         .eq(NcNode::getProcessNo,pkgNode.getProcessNo()).eq(NcNode::getProcessEdition,pkgNode.getProcessEdition())
         .eq(NcNode::getMachineGroupCode,pkgNode.getMachineGroupCode()).last("limit 1").one();
      if(node != null && node.getVersionNumber()!=null){
         return node.getVersionNumber()+1;
      }else{
         //以往没有,生成一个新的
         return 1;
      }
   }
   /**
    * 生成程序包名/程序名称
    * @param drawingNo 零组件号
@@ -326,12 +314,13 @@
    */
   public NcNode getLastCuredProgramWithoutProcessEdition(String drawingNo, String processNo, String machineCode) {
      Machine machine = machineService.getByCode(machineCode);
      List<Machine> sameGroupMachines = machineService.lambdaQuery().eq(Machine::getMachineGroupCode,machine.getMachineGroupCode()).list();
      List<String> machineCodesInGroup = sameGroupMachines.stream().map(Machine::getCode).toList();
      //List<Machine> sameGroupMachines = machineService.lambdaQuery().eq(Machine::getMachineGroupCode,machine.getMachineGroupCode()).list();
      //List<String> machineCodesInGroup = sameGroupMachines.stream().map(Machine::getCode).toList();
      List<NcNode> nodes = lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE)
         .eq(NcNode::getDrawingNo, drawingNo).eq(NcNode::getProcessNo, processNo)
         .likeRight(NcNode::getParentIds,"0,2,").eq(NcNode::getIsCured,1)
         .in(!machineCodesInGroup.isEmpty(),NcNode::getMachineCode,machineCodesInGroup)
         .eq(NcNode::getMachineGroupCode,machine.getMachineGroupCode())
         //.in(!machineCodesInGroup.isEmpty(),NcNode::getMachineCode,machineCodesInGroup)
         .eq(NcNode::getIsLastEdition,1).orderByDesc(NcNode::getCreateTime).list();
      if(nodes.isEmpty()){