Exemplo n.º 1
0
        public int GenerateProcess_Download()
        {
            int ret = 0;

            if (StatusPosition == STATUS_POSITION.DOWNLOAD &&
                StatusResult == STATUS_RESULT.WORK)
            {
                return(ret);
            }
            if (StatusPosition < STATUS_POSITION.DOWNLOAD)
            {
                ret += GenerateProcess_GenerateBin();
                if (ret > 0)
                {
                    return(ret);
                }
            }
            StatusResult   = STATUS_RESULT.RUNNING;
            StatusPosition = STATUS_POSITION.DOWNLOAD;
            ret           += Download();
            if (ret > 0)
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("总共{0:d}处错误,生成终止。\r\n", ret); });
                StatusResult   = STATUS_RESULT.ERROR;
                StatusPosition = STATUS_POSITION.DOWNLOAD;
            }
            else
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("下载完毕,PLC置于运行(WORK)状态!\r\n"); });
                StatusResult   = STATUS_RESULT.WORK;
                StatusPosition = STATUS_POSITION.DOWNLOAD;
            }
            return(ret);
        }
Exemplo n.º 2
0
        public int GenerateProcess_GenerateBin()
        {
            int ret = 0;

            if (StatusPosition == STATUS_POSITION.GENERATEBIN &&
                StatusResult == STATUS_RESULT.WORK)
            {
                return(ret);
            }
            if (StatusPosition < STATUS_POSITION.GENERATEBIN)
            {
                ret += GenerateProcess_Premeasurement();
                if (ret > 0)
                {
                    return(ret);
                }
            }
            StatusResult   = STATUS_RESULT.RUNNING;
            StatusPosition = STATUS_POSITION.GENERATEBIN;
            ret           += GenerateBin();
            if (ret > 0)
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("总共{0:d}处错误,生成终止。\r\n", ret); });
                StatusResult   = STATUS_RESULT.ERROR;
                StatusPosition = STATUS_POSITION.GENERATEBIN;
            }
            else
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("设备写入程序生成完毕。\r\n"); });
                StatusResult   = STATUS_RESULT.WORK;
                StatusPosition = STATUS_POSITION.GENERATEBIN;
            }
            return(ret);
        }
Exemplo n.º 3
0
        public int GenerateProcess_GeneratePLCInstruction()
        {
            int ret = 0;

            if (StatusPosition == STATUS_POSITION.PLCINSTRUCTION &&
                StatusResult == STATUS_RESULT.WORK)
            {
                return(ret);
            }
            if (StatusPosition < STATUS_POSITION.PLCINSTRUCTION)
            {
                ret += GenerateProcess_CheckCircuit();
                if (ret > 0)
                {
                    return(ret);
                }
            }
            StatusResult   = STATUS_RESULT.RUNNING;
            StatusPosition = STATUS_POSITION.PLCINSTRUCTION;
            ret           += GeneratePLCInsts();
            if (ret > 0)
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("总共{0:d}处错误,生成终止。\r\n", ret); });
                StatusResult   = STATUS_RESULT.ERROR;
                StatusPosition = STATUS_POSITION.PLCINSTRUCTION;
            }
            else
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("PLC指令生成完毕。\r\n"); });
                StatusResult   = STATUS_RESULT.WORK;
                StatusPosition = STATUS_POSITION.PLCINSTRUCTION;
            }
            return(ret);
        }
Exemplo n.º 4
0
        public int GenerateProcess_Premeasurement()
        {
            int ret = 0;

            if (StatusPosition == STATUS_POSITION.PREMEASUREMENT &&
                StatusResult == STATUS_RESULT.WORK)
            {
                return(ret);
            }
            if (StatusPosition < STATUS_POSITION.PREMEASUREMENT)
            {
                ret += GenerateProcess_GeneratePLCInstruction();
                if (ret > 0)
                {
                    return(ret);
                }
            }
            StatusResult   = STATUS_RESULT.RUNNING;
            StatusPosition = STATUS_POSITION.PREMEASUREMENT;
            ret           += Premeasurement();
            if (ret > 0)
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("总共{0:d}处错误,生成终止。\r\n", ret); });
                StatusResult   = STATUS_RESULT.ERROR;
                StatusPosition = STATUS_POSITION.PREMEASUREMENT;
            }
            else
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("性能测评完毕。\r\n"); });
                StatusResult   = STATUS_RESULT.WORK;
                StatusPosition = STATUS_POSITION.PREMEASUREMENT;
            }
            return(ret);
        }
Exemplo n.º 5
0
        public int GenerateProcess_CheckCircuit()
        {
            if (StatusPosition == STATUS_POSITION.CHECKCIRCUIT &&
                StatusResult == STATUS_RESULT.WORK)
            {
                return(0);
            }
            CreateViewModel_FromProjectModel(_projectModel);
            StatusResult   = STATUS_RESULT.RUNNING;
            StatusPosition = STATUS_POSITION.CHECKCIRCUIT;
            int ret = CheckCircuit();

            if (ret > 0)
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("总共{0:d}处错误,生成终止。\r\n", ret); });
                StatusResult   = STATUS_RESULT.ERROR;
                StatusPosition = STATUS_POSITION.CHECKCIRCUIT;
            }
            else
            {
                report.Dispatcher.Invoke(() => { report.Text += String.Format("工程检查完毕。\r\n"); });
                StatusResult   = STATUS_RESULT.WORK;
                StatusPosition = STATUS_POSITION.CHECKCIRCUIT;
            }
            return(ret);
        }