hexagon logo

Badge Scan for Employee

Hello All,

Is there any line of code i can enter to make PC-DMIS search for an ID number inside an excel file or something? The reason i ask is we have been having unauthorized users using the CMM without training and we want to be able to hold them accountable. We would also like for that same transaction to be able to place there info into the report as well in case they are using someone else badge because they don't have training to hold them both accountable.

Parents
  • You can start requiring a badge number at the start of your programs, and in the background hardcode the numbers to the corresponding employees. That way there is only a set of valid inputs allowed. Then you can send it to a text file or the report file if you save them after each run. Only downside will be that like you said, other people can use their badge or simply just write the number down. You could also generate your own internal system of "badge numbers" or essentially access codes/passwords give them out to the employees.

  • yes thats true, we were hoping for an excel option or somthing along those lines since the people who are using it are running like 10 different programs and we didnt want to have to edit all of them, but instead as they get trained add them to an excel sheet that it can trace back or whatever.

  • You could certainly do this with an excel option. What is your current reporting method? The built in pc-dmis one? Or a custom one?

    You could have an extra command at the end that adds their badge number + name, and part ran in a separate excel file

  • START      =LABEL/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter Badge Number
                IF/C1.INPUT == "1234567"
                  ASSIGN/NAME="JOHN SMITH"
                  GOTO/NEXT
                END_IF/
                IF/C1.INPUT == "7654321"
                  ASSIGN/NAME="JANE SMITH"
                  GOTO/NEXT
                END_IF/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
                Invalid Badge Number
                GOTO/START
    NEXT       =LABEL/
                ASSIGN/PART=GETPROGRAMINFO("PARTNAME")
                ASSIGN/DATE=SYSTEMDATE("dd/MM/yy")
                ASSIGN/TIME=SYSTEMTIME("HH:mm:ss")
                ASSIGN/FILEPATH="C:\CMM\\"+PART+"_TESTFILE"+".CSV"
    VERIFY      =FILE/EXISTS,FILEPATH
                IF/VERIFY == 0
                  ASSIGN/HEADERS="Date,Time,Part,Name,Badge"
    FPTR         =FILE/OPEN,FILEPATH,WRITE
                  FILE/WRITELINE,FPTR,HEADERS
                  FILE/CLOSE,FPTR,KEEP
                END_IF/
    FPTR       =FILE/OPEN,FILEPATH,APPEND
                ASSIGN/DATALINE=DATE+","+TIME+","+PART+","+NAME+","+C1.INPUT+"
                FILE/WRITELINE,FPTR,DATALINE
                FILE/CLOSE,FPTR,KEEP

    Try this out, change your names, badge numbers, file path, and any other input values as needed. I tested it and this is the result. This is currently saving to its own excel file in a location separate from the program results. 

    You can put this at the end of any of your programs and it should not interfere. You can also put it at the beginning instead if you want to know right away if someone who should not be running the program is running it.

    As  just reminded me, you can use IF/GOTO instead of IF, then adding a GOTO command.

                IF_GOTO/C1.INPUT == "1234567",GOTO = NEXT
                ASSIGN/NAME="JOHN SMITH"

    Looking back at this, I am not sure it will work the same way I have it above, I don't use IF GOTO enough. I do not know if the variable will assign before the actual GOTO. I imagine it will not due to the order of commands. So use my example above, and ignore this portion.

Reply
  • START      =LABEL/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter Badge Number
                IF/C1.INPUT == "1234567"
                  ASSIGN/NAME="JOHN SMITH"
                  GOTO/NEXT
                END_IF/
                IF/C1.INPUT == "7654321"
                  ASSIGN/NAME="JANE SMITH"
                  GOTO/NEXT
                END_IF/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
                Invalid Badge Number
                GOTO/START
    NEXT       =LABEL/
                ASSIGN/PART=GETPROGRAMINFO("PARTNAME")
                ASSIGN/DATE=SYSTEMDATE("dd/MM/yy")
                ASSIGN/TIME=SYSTEMTIME("HH:mm:ss")
                ASSIGN/FILEPATH="C:\CMM\\"+PART+"_TESTFILE"+".CSV"
    VERIFY      =FILE/EXISTS,FILEPATH
                IF/VERIFY == 0
                  ASSIGN/HEADERS="Date,Time,Part,Name,Badge"
    FPTR         =FILE/OPEN,FILEPATH,WRITE
                  FILE/WRITELINE,FPTR,HEADERS
                  FILE/CLOSE,FPTR,KEEP
                END_IF/
    FPTR       =FILE/OPEN,FILEPATH,APPEND
                ASSIGN/DATALINE=DATE+","+TIME+","+PART+","+NAME+","+C1.INPUT+"
                FILE/WRITELINE,FPTR,DATALINE
                FILE/CLOSE,FPTR,KEEP

    Try this out, change your names, badge numbers, file path, and any other input values as needed. I tested it and this is the result. This is currently saving to its own excel file in a location separate from the program results. 

    You can put this at the end of any of your programs and it should not interfere. You can also put it at the beginning instead if you want to know right away if someone who should not be running the program is running it.

    As  just reminded me, you can use IF/GOTO instead of IF, then adding a GOTO command.

                IF_GOTO/C1.INPUT == "1234567",GOTO = NEXT
                ASSIGN/NAME="JOHN SMITH"

    Looking back at this, I am not sure it will work the same way I have it above, I don't use IF GOTO enough. I do not know if the variable will assign before the actual GOTO. I imagine it will not due to the order of commands. So use my example above, and ignore this portion.

Children