| | |
| | | } |
| | | } |
| | | |
| | | 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 零组件号 |
| | |
| | | */ |
| | | 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()){ |