예제 #1
0
        // Changing the status of a receival.
        private void ROBOT_SetReceivalStatus(int processNumber, string receivalCode, EnumROBOT_Status newStatus)
        {
            string _status = "PREC_" + newStatus.ToString();

            using (var _sp = new SP(Values.gDatos, "AUTOMATIZACION..pRECIDCAX_ChangeStatus"))
            {
                _sp.AddParameterValue("@NumProceso", processNumber);
                _sp.AddParameterValue("@receival", receivalCode);
                _sp.AddParameterValue("@status", _status);
                _sp.AddParameterValue("@hsa", 1);
                try
                {
                    _sp.Execute();
                }
                catch (Exception ex)
                {
                    CTWin.MsgError("Error updating receival status: " + ex.Message);
                    return;
                }
                if (_sp.LastMsg.Substring(0, 2) != "OK")
                {
                    CTWin.MsgError("Error updating receival status: " + _sp.LastMsg);
                    return;
                }
            }

            // Set the given status.
            setROBOT_Status(newStatus);
        }
예제 #2
0
        public void setROBOT_Status(EnumROBOT_Status newValue)
        {
            // Set the picture.
            switch (newValue)
            {
            case EnumROBOT_Status.OK:
                pctRobotStatus.Image = Properties.Resources.ok_30;
                break;

            case EnumROBOT_Status.RUN:
            case EnumROBOT_Status.INI:
                pctRobotStatus.Image = Properties.Resources.process_30;
                break;

            case EnumROBOT_Status.ERR:
                pctRobotStatus.Image = Properties.Resources.nook_30;
                break;

            default:
                pctRobotStatus.Image = null;
                break;
            }
            pctRobotStatus.Show();

            // Enable/disable timer and set the new value.
            tmrRobot.Enabled = (newValue == EnumROBOT_Status.RUN) || (newValue == EnumROBOT_Status.INI);
            mROBOT_Status    = newValue;
        }
예제 #3
0
        // Getting the status of a receival.
        private void ROBOT_GetReceivalStatus(string receivalCode)
        {
            EnumROBOT_Status _status = EnumROBOT_Status.NONE;

            if (receivalCode != "")
            {
                using (var _rs = new StaticRS(string.Format("Select status=case when dbo.CheckFlag(flags,'PREC_OK')=1 then 'OK' when dbo.CheckFlag(flags,'PREC_INI')=1 then 'INI' when dbo.CheckFlag(flags,'PREC_RUN')=1 then 'RUN' when dbo.CheckFlag(flags,'PREC_ERR')=1 then 'ERR' else '' end from HSAReceivalsCab where RecCode='{0}'", receivalCode), Values.gDatos))
                {
                    _rs.Open();
                    if (_rs.RecordCount == 0)
                    {
                        CTWin.MsgError("Receival does not exist.");
                    }
                    else
                    {
                        switch (_rs["status"].ToString())
                        {
                        case "OK":
                            _status = EnumROBOT_Status.OK;
                            break;

                        case "RUN":
                            _status = EnumROBOT_Status.RUN;
                            break;

                        case "ERR":
                            _status = EnumROBOT_Status.ERR;
                            break;

                        case "INI":
                            _status = EnumROBOT_Status.INI;
                            break;

                        default:
                            _status = EnumROBOT_Status.NONE;
                            break;
                        }
                    }
                }
            }
            // Set the obtained status.
            setROBOT_Status(_status);
        }