예제 #1
0
        public static KMStatus GetMode(uint value)
        {
            KMStatus mode = new KMStatus();

            mode.ISDown = false;
            switch (value)
            {
            case 1:
                mode.Status = "Off";
                return(mode);

            case 2:
                mode.Status = "Manual";
                return(mode);

            case 4:
                mode.Status = "SemiAuto";
                return(mode);

            case 8:
                mode.Status = "Auto";
                return(mode);

            default:
                mode.Status = "UnKonwn";
                return(mode);
            }
        }
예제 #2
0
        public static UInt64 KAGCreateNewDT(string tagid, string type, uint real)
        {
            UInt64   refid   = 0;
            KMStatus status  = new KMStatus();
            TagData  taginfo = RowConfig.TagDic[tagid];

            try
            {
                if (taginfo == null)
                {
                    return(0);
                }

                if (type == "Status")
                {
                    status = KAGStatus.GetStatus(real);
                }
                else if (type == "Operation")
                {
                    status = KAGStatus.GetMode(real);
                }
                else if (type == "Program")
                {
                    status = KAGStatus.GetProgram(real);
                }
                else if (type == "CL1OEM")
                {
                    status = QMNCPLCS7.Status.CL1OEMStatus.GetStatus(real);
                }
                else
                {
                    status.Status = "UnKnow";
                }
                refid = NewDT(taginfo.LineID, taginfo.DeviceID, tagid, status.ISDown, status.Status, real);
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                refid = DTRecord.GetMaxRefid(taginfo.DeviceID);
            }


            return(refid);
        }
예제 #3
0
        public static KMStatus GetProgram(uint value)
        {
            KMStatus program = new KMStatus();

            program.ISDown = false;
            switch (value)
            {
            case 1:
                program.Status = "Production";
                return(program);

            case 2:
                program.Status = "StartUp";
                return(program);

            case 4:
                program.Status = "RunDown";
                return(program);

            case 8:
                program.Status = "Clean";
                return(program);

            case 16:
                program.Status = "Changeover";
                return(program);

            case 32:
                program.Status = "Maintenance";
                return(program);

            case 64:
                program.Status = "Break";
                return(program);

            default:
                program.Status = "UnKonwn";
                return(program);
            }
        }
예제 #4
0
        public static KMStatus GetStatus(uint value)
        {
            KMStatus status = new KMStatus();

            switch (value)
            {
            case 1:      //Stopped
                status.Status = "Stopped";
                return(status);


            case 2:    //Starting
                status.Status = "Starting";
                return(status);



            case 4:      //Prepared
                status.Status = "Prepared";
                return(status);

            case 8:       //Lack
                status.Status = "Lack";
                status.Reason = "Abnormal";
                return(status);

            case 16:      //Tailback
                status.Status = "Tailback";
                status.Reason = "Abnormal";
                return(status);


            case 32:      //Lack Branch Line
                status.Status = "Lack_Branch";
                status.Reason = "Abnormal";
                return(status);


            case 64:      //Tailback Branch Line
                status.Status = "Tailback";
                status.Reason = "Abnormal";
                return(status);


            case 128:      //Operating
                status.Status = "Operating";
                status.ISDown = false;
                return(status);


            case 256:      //Stopping
                status.Status = "Stopping";
                return(status);


            case 512:      //Aborting
                status.Status = "Aborting";
                status.Reason = "Abnormal";
                return(status);

            case 1024:      //Equipment Failure
                status.Status = "Equipment_Failure";
                status.Reason = "Abnormal";
                return(status);


            case 2048:      //External Failure
                status.Status = "External_Failure";
                status.Reason = "Abnormal";
                return(status);



            case 4096:      //Emergency Stop
                status.Status = "Emergency_Stop";
                status.Reason = "Abnormal";
                return(status);


            case 8192:      //Holding
                status.Status = "Holding";
                status.Reason = "Abnormal";
                return(status);


            case 16384:      //Held
                status.Status = "Held";
                status.Reason = "Abnormal";
                return(status);

            case 32768:      //Idle
                status.Status = "Idle";
                status.Reason = "Abnormal";
                return(status);

            default:
                status.Status = "UnKonwn";
                status.Reason = "Abnormal";
                return(status);
            }
        }