コード例 #1
0
 public void Insert(int index, BaseInfo info)
 {
     this.Collection.Insert(index, info);
     this.Refresh();
 }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 private void btnJiagong_CheckedChanged(object sender, EventArgs e)
 {
     if (!btnJiagong.Checked || OtherSet.ShuibengDelay == 0) //延时加工
     {
         IOHelper.SetJiagong(btnJiagong.Checked ? 1 : 0);
         plcHelper.SendMsg(btnJiagong.Checked ? PortHelper.JiagongOn : PortHelper.JiagongOff);
     }
     if (!isM21 && btnJiagong.Checked)
     {
         param = L.R("FormMain.Manual", "手动");
         M21();
     }
     else if (isM21 && !btnJiagong.Checked)
     {
         StopImmediately();
         inputInfo = null;
         inputHole = null;
         timerTotal.Enabled = false;
         timerCurrent.Enabled = false;
         isM21FinishCloseShuibeng = false;
         this.btnFushi.Value = this.btnFushi.Value == 2 ? 2 : 1; //绿色的变成绿色红色的变成黄色
         this.btnMen.Value = this.btnMen.Value == 2 ? 2 : 1;//绿色的变成绿色红色的变成黄色
         IOHelper.SetMen(0);
         plcHelper.SendMsg(PortHelper.FushiOff);
         isM21 = false;
     }
     else if (!btnJiagong.Checked)
     {
         btnMen.Value = btnMen.Value == 2 ? 2 : 1; //绿色的变成绿色红色的变成黄色
         IOHelper.SetMen(0);
     }
 }
コード例 #3
0
 public void Insert(BaseInfo info)
 {
     Insert(Index, info);
     if (info != null)
         this.SelectedItem = info;
 }
コード例 #4
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 void watch_ButtonEvent(ButtonWatchEventArgs args)
 {
     if (IOSet.ShouLunType == 2)
     {
         if (formMove == null)
         {
             if (args.ButtonNum == 0 && args.State == 1)
             {
                 if (formEdit == null)
                 {
                     //ContraHelper.ShowMessage("F1短按");
                     btnJiagong.Checked = true;
                     isM21FinishCloseShuibeng = true;
                 }
             }
             else if (args.ButtonNum == 0 && args.State == 2)
             {
                 //ContraHelper.ShowMessage("F1长按");
                 if (this.btnStart.Enabled && formEdit == null)
                     miStart_ItemClick(null, null);
             }
             else if (args.ButtonNum == 1 && args.State == 1)
             {
                 //ContraHelper.ShowMessage("F2短按");
                 if (formEdit != null)
                 {
                     formEdit.FocusedPrevious();
                 }
                 else if (this.btnStart.Enabled && currPostion > 0)
                 {
                     currPostion--;
                     this.gridViewCnc.FocusedRowHandle = currPostion;
                 }
             }
             else if (args.ButtonNum == 1 && args.State == 2)
             {
                 //ContraHelper.ShowMessage("F2长按");
                 if (this.btnStart.Enabled)
                 {
                     HoleInfo hole = null;
                     if (formEdit != null)
                     {
                         hole = formEdit.GetMoveInfo();
                     }
                     else
                     {
                         if (currPostion >= this.gridViewCnc.RowCount)
                         {
                             currPostion = this.gridViewCnc.RowCount - 1;
                         }
                         else if (currPostion < 0)
                         {
                             currPostion = 0;
                         }
                         hole = HoleInfo;
                     }
                     if (hole != null)
                     {
                         inputInfo = new SingleMoveInfo()
                         {
                             X = hole.X,
                             Y = hole.Y,
                             W = hole.W,
                             B = hole.B,
                             C = hole.C,
                             AxisType = hole.AxisType ?? this.axisType
                         };
                         isInput = true;
                     }
                 }
             }
             else if (args.ButtonNum == 2 && args.State == 1)
             {
                 //ContraHelper.ShowMessage("F3短按");
                 CancelZero();
             }
             else if (args.ButtonNum == 2 && args.State == 2)
             {
                 //ContraHelper.ShowMessage("F3长按");
                 if (this.btnStart.Enabled && formEdit == null)
                     miRestart_ItemClick(null, null);
             }
             else if (args.ButtonNum == 3 && args.State == 1)
             {
                 //ContraHelper.ShowMessage("F4短按");
                 if (this.btnStart.Enabled)
                 {
                     if (formEdit != null)
                     {
                         formEdit.FocusedNext();
                     }
                     else if (currPostion < this.gridViewCnc.RowCount)
                     {
                         currPostion++;
                         this.gridViewCnc.FocusedRowHandle = currPostion;
                     }
                 }
             }
             else if (args.ButtonNum == 3 && args.State == 2)
             {
                 //ContraHelper.ShowMessage("F4长按");
                 if (this.btnStart.Enabled)
                 {
                     HoleInfo hole = null;
                     if (formEdit != null)
                     {
                         hole = formEdit.GetMoveInfo();
                     }
                     else
                     {
                         if (currPostion >= this.gridViewCnc.RowCount)
                         {
                             currPostion = this.gridViewCnc.RowCount - 1;
                         }
                         else if (currPostion < 0)
                         {
                             currPostion = 0;
                         }
                         hole = HoleInfo;
                     }
                     if (hole != null)
                     {
                         inputInfo = new SingleMoveInfo()
                         {
                             X = hole.X,
                             Y = hole.Y,
                             W = hole.W,
                             B = hole.B,
                             C = hole.C,
                             AxisType = hole.AxisType ?? this.axisType
                         };
                         isInput = true;
                     }
                 }
             }
             else if (args.ButtonNum == 4 && args.State == 1)
             {
                 if (this.btnStop.Enabled)
                     StopImmediately();
             }
             else if (args.ButtonNum == 4 && args.State == 2)
             {
                 //ContraHelper.ShowMessage("F5长按");
                 isContinue = false;
                 lbStopWarning.Visible = true;
             }
             else if (args.ButtonNum == 5 && args.State == 1)
             {
                 //ContraHelper.ShowMessage("F6短按");
                 btnAxisR.Checked = !btnAxisR.Checked;
             }
             else if (args.ButtonNum == 5 && args.State == 2)
             {
                 //ContraHelper.ShowMessage("F6长按");
                 IOHelper.SetChongShui(0);
                 IOHelper.SetJixing(0);
                 isSkipProtect = true;
             }
             else if (args.ButtonNum == 5 && args.State == 0)
             {
                 //ContraHelper.ShowMessage("F6长按");
                 if (!isAutoCenter)
                     isSkipProtect = false;
             }
             else if (args.ButtonNum == 6 && args.State == 1)
             {
                 //ContraHelper.ShowMessage("F7短按");
                 btnShuibang.Checked = !btnShuibang.Checked;
             }
             else if (args.ButtonNum == 6 && args.State == 2)
             {
                 if (!this.btnJiagong.Checked && this.formEdit != null)
                     this.formEdit.btnAddHole_Click(null, null);
                 //ContraHelper.ShowMessage("F7长按");
             }
         }
     }
 }
コード例 #5
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 private void btnInput_ItemClick(object sender, EventArgs e)
 {
     if (this.txtInput1.EditValue != null && this.txtInput1.EditValue.ToString() != "")
     {
         this.inputInfo = BaseInfoCollection.CreateBaseInfoByString((string)this.txtInput1.EditValue);
         this.isInput = true;
     }
 }
コード例 #6
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 public void ChangeDaoMove(bool isChangeDao)
 {
     inputInfo = new SingleMoveInfo()
     {
         X = OtherSet.DaoXSafeHeight + CurrInfo.GetActPosX(axisType) - CurrInfo.LogPosX,
         Y = OtherSet.DaoYSafeHeight + CurrInfo.GetActPosY(axisType) - CurrInfo.LogPosY,
         W = OtherSet.DaoWSafeHeight + CurrInfo.GetActPosW(axisType) - CurrInfo.LogPosW,
         A = 0 + CurrInfo.GetActPosZ(axisType) - CurrInfo.LogPosZ,
         AxisType = this.axisType
     };
     plcHelper.SendMsg(PortHelper.ZUpOn);
     card.moveState = 0;
     isInput = true;
     isChangeDaoMove = true;
     this.isChangeDao = isChangeDao;
     isChangeDaoCheckFailureHeight = false;
 }
コード例 #7
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
        private void timer_Tick(object sender, EventArgs e)
        {
            //读取所有输入信号供下方判断
            IOHelper.ReadInputs();
            //检查轴正限位
            CheckWPlus();
            //检查伺服报警
            CheckAlarm();
            //检查Z轴正限位
            //CheckZPlus();
            CheckZPlus();
            //检测刀库
            CheckDaoKu();
            //检查Z负限位
            CheckZMinus();
            //检查急停
            CheckUrgencyStop();
            //输出清零状态
            SetZeroState();
            //输出穿透状态
            SetThrowState();
            //输出W撞击状态
            SetWHitState();
            //读取各轴位置
            card.ReadPos();
            if (isBackToZChange && card.Contra.GetActPosZ(axisType) > backToChangePosition)
            {
                isBackToZChange = false;
                plcHelper.SendMsg(PortHelper.ZUpOff);
            }
            //检查扶丝
            CheckFusi();
            //没有移动,没有执行M21
            bool flag = !card.IsRunning();
            if (flag)
            {
                if (isZeroAttemp < 20)
                {
                    isZeroAttemp++;
                }
                if (isZeroAttemp >= 20)
                {
                    isZero = false;
                }
                card.JianxiTiaozheng();
                isChangeDianji = false;
            }
            #region 按钮可用控制
            btnAutoCenter.Enabled = !isAutoCenter && !isContinue && OtherSet.UseAutoCenter;
            btnStopCenter.Enabled = isAutoCenter && !isContinue;
            //顶部
            this.btnMovePanel.Enabled = flag && !isContinue;
            this.btnDaoKu.Enabled = flag && !isContinue;
            //右侧按钮
            this.btnStart.Enabled = flag && !isContinue && !isM21;
            this.btnStop.Enabled = (!flag || isContinue || isM21);
            this.btnReset.Enabled = flag && !isContinue && !isM21;
            this.btnToZero.Enabled = flag && !isContinue && !isM21;
            this.btnNext.Enabled = flag && !isContinue && !isM21;
            this.btnZeroRestart.Enabled = flag && !isContinue && !isM21;

            this.btnDuidao.Enabled = flag && !isContinue && !isM21;

            //列表
            //this.gridViewParam.OptionsBehavior.ReadOnly = !(flag && !isContinue );

            //孔位按钮
            this.btnLoadFile.Enabled = flag && !isContinue && !isM21;
            //this.btnAddHole.Enabled = flag && !isContinue && !isM21;
            //this.btnDeleteHole.Enabled = flag && !isContinue && !isM21;
            this.btnSaveScript.Enabled = flag && !isContinue && !isM21;
            this.btnMoreOperate.Enabled = flag && !isContinue && !isM21;
            this.btnNewHoles.Enabled = flag && !isContinue && !isM21;
            this.cbEmptyRun.Enabled = flag && !isContinue && !isM21;

            //this.btnNew.Enabled = flag && !isContinue && isZero;
            //this.miEdit.Enabled = flag && !isContinue && isZero;

            //参数按钮
            this.btnAddParam.Enabled = this.btnStart.Enabled;
            this.btnDeleteParam.Enabled = this.btnStart.Enabled;
            //this.btnLoadParam.Enabled = this.btnStart.Enabled;
            //this.btnSaveParam.Enabled = this.btnStart.Enabled;

            this.btnZeroX.Enabled = flag && !isContinue && !AxisSet.IgnoreX && !isM21;
            this.btnZeroY.Enabled = flag && !isContinue && !AxisSet.IgnoreY && !isM21;
            this.btnZeroW.Enabled = flag && !isContinue && !AxisSet.IgnoreW && !isM21;
            this.btnZeroB.Enabled = flag && !isContinue && !AxisSet.IgnoreB && !isM21;
            this.btnZeroC.Enabled = flag && !isContinue && !AxisSet.IgnoreC && !isM21;
            this.btnZeroZ.Enabled = flag && !isContinue && !AxisSet.IgnoreZ && !isM21;

            this.btnSetX.Enabled = flag && !isContinue && !AxisSet.IgnoreX && !isM21;
            this.btnSetY.Enabled = flag && !isContinue && !AxisSet.IgnoreY && !isM21;
            this.btnSetW.Enabled = flag && !isContinue && !AxisSet.IgnoreW && !isM21;
            this.btnSetB.Enabled = flag && !isContinue && !AxisSet.IgnoreB && !isM21;
            this.btnSetC.Enabled = flag && !isContinue && !AxisSet.IgnoreC && !isM21;
            this.btnSetZ.Enabled = flag && !isContinue && !AxisSet.IgnoreZ && !isM21;

            this.btnHalfX.Enabled = flag && !isContinue && !AxisSet.IgnoreX && !isM21;
            this.btnHalfY.Enabled = flag && !isContinue && !AxisSet.IgnoreY && !isM21;
            this.btnHalfW.Enabled = flag && !isContinue && !AxisSet.IgnoreW && !isM21;
            this.btnHalfZ.Enabled = flag && !isContinue && !AxisSet.IgnoreZ && !isM21;
            this.btnHalfB.Enabled = flag && !isContinue && !AxisSet.IgnoreB && !isM21;
            this.btnHalfC.Enabled = flag && !isContinue && !AxisSet.IgnoreC && !isM21;

            this.btnSet.Enabled = flag && !isContinue && !isM21;
            this.btnShutdown.Enabled = flag && !isContinue && !isM21;

            this.txtInput1.Enabled = flag && !isContinue && !isM21;
            this.btnInput1.Enabled = flag && !isContinue && !isM21;

            this.spSafeHeight.Enabled = flag && !isContinue && !isM21;
            this.chkUseWSafeHeight.Enabled = flag && !isContinue && !isM21;

            this.rgThrowMode.Enabled = flag && !isContinue && !isM21;
            this.txtThrowStartHeight.Enabled = flag && !isContinue && !isM21;
            this.cmbThrowResponse.Enabled = flag && !isContinue && !isM21;
            this.txtThrowLeft.Enabled = flag && !isContinue && !isM21;
            this.txtThrowStartHeight2.Enabled = flag && !isContinue && !isM21;
            this.cmbThrowResponse2.Enabled = flag && !isContinue && !isM21;
            this.txtThrowLeft2.Enabled = flag && !isContinue && !isM21;
            //this.gridViewCnc.GridControl.Enabled = flag && !isContinue && !isM21;
            #endregion

            if (isM21)
            {
                if (flag)//如果轴停下来了,在Z轴有了穿透再下降过程中
                {
                    if (isThrowZEndStoped)
                    {
                        if (IOHelper.IsWHit())  //如果有短路信号,那么代表还没移动到位,需要等待判断是否短路信号清了继续移动
                        {
                            isThrowZWHitDetected = true;
                        }
                        else if (isThrowZWHitDetected && !IOHelper.IsWHit())  //如果检查到过有短信信号并且 短路信号又没有了,把剩下的位置走完
                        {
                            isThrowZWHitDetected = false;
                            this.CurrInfo.LogPosZ = card.GetActPos(AxisSet.ZReadAxis) * AxisSet.ZResolution;
                            var position = this.CurrInfo.GetActPosZ(axisType);
                            card.SingleMoveZ(new HoleInfo() { Z = throwZReachPosition }, this.axisType, AxisSet.ThrowSpeed);
                            plcHelper.SendMsg(PortHelper.ZDownOn);
                        }
                        else
                        {
                            isThrowZStoped = true; //如果不是短路信号 那么代表穿透已经到位,停止穿透
                            isThrowZEndStoped = false;
                        }
                    }
                    else if (isM21ZDown) //
                    {
                        if (IOHelper.IsWHit())
                        {
                            isM21ZUpWHit = true;
                        }
                        else if (isM21ZUpWHit)
                        {
                            isM21ZUpWHit = false;
                            card.SingleMoveZ(new HoleInfo() { Z = backHeight * OtherSet.BackHeightRate, IsJiaGong = false }, this.axisType);
                            PlcHelpr.SendMsg(PortHelper.ZUpOn);
                        }
                    }
                }
                CheckWaitForJiaong();
                CheckChangeDaoFailureHeight();
                CheckDuanlu();
                WaitForM21ZDown();
                WaitForM21ZUp();
            }
            this.bindingSource.ResetBindings(false);

            #region 手动执行
            //手动执行

            //继续执行
            if (isContinue && !IOHelper.IsWHit())
            {
                if (isRestart)
                {
                    isRestart = false;
                    isContinue = true;
                    StartMove();
                }
                else if (flag && !isM21)
                {
                    if (card.moveState == 1 || card.moveState == 2 || isEndStartMove)
                    {
                        StartMove();
                        if ((card.moveState == 1 || card.moveState == 2) && !isLastWMoved)
                        {
                            isLastWMoved = true;
                        }
                        else if (isEndStartMove && isLastWMoved && card.moveState == 0)
                        {
                            isLastWMoved = false;
                            isEndStartMove = false;
                        }
                    }
                    else if (isEndM21)
                    {
                        if (isSingle && isSingleM21 == false)
                        {
                            isSingleM21 = true;
                            isContinue = false;
                            isSingle = false;
                        }
                        else
                        {
                            M21();
                            isSingleM21 = false;
                        }
                    }
                    else if (isEndStop)
                    {
                        if (isChangeDaoMove && IOHelper.IsZPlusLimit())
                        {
                            isChangeDaoMove = false;
                            plcHelper.SendMsg(PortHelper.ChangePie);
                        }
                        if (!isChangeDaoMove)
                        {
                            inputHole = null;
                            inputInfo = null;
                            isEndStop = false;
                            isContinue = false;
                        }
                        if (isLnsMove)
                        {
                            inputInfo = null;
                            inputHole = null;
                            isLnsMove = false;
                            isLnsMoved = true;
                            isContinue = false;
                        }
                    }
                    else
                    {
                        currPostion += 1;
                        if (!isSingle)
                        {
                            if (currPostion >= this.gridViewCnc.RowCount || isM21FinishCloseShuibeng)//加工完成后
                            {
                                CloseAllOutput();
                                isM21FinishCloseShuibeng = false;
                                timerTotal.Enabled = false;
                                isContinue = false;
                                this.btnMen.Value = this.btnMen.Value == 2 ? 2 : 1;
                                IOHelper.SetMen(0);
                                if (currPostion >= this.gridViewCnc.RowCount)
                                    miRestart_ItemClick(null, null);
                                return;
                            }
                            StartMove();
                        }
                        else
                        {
                            isContinue = false;
                            isSingle = false;
                        }
                    }
                    if (this.gridViewCnc.RowCount > 0)
                    {
                        if (currPostion == -1)
                            this.gridViewCnc.FocusedRowHandle = 0;
                        else if (currPostion < this.gridViewCnc.RowCount)
                            this.gridViewCnc.FocusedRowHandle = currPostion;
                        else
                            this.gridViewCnc.FocusedRowHandle = this.gridViewCnc.RowCount - 1;
                        if (currPostion >= this.gridViewCnc.RowCount)
                        {
                            isContinue = false;
                            isSingle = false;
                        }
                    }
                }

            }

            if (isInput)
            {
                isInput = false;

                if (inputInfo != null)
                {
                    if (inputInfo is SingleMoveInfo)
                    {
                        var singleInfo = inputInfo as SingleMoveInfo;
                        inputHole = new HoleInfo()
                        {
                            IsJiaGong = false,
                            X = singleInfo.X,
                            Y = singleInfo.Y,
                            W = singleInfo.W,
                            B = singleInfo.B,
                            C = singleInfo.C,
                            Z = singleInfo.A,
                            AxisType = singleInfo.AxisType ?? this.axisType
                        };
                        StartMove();
                    }
                    else if (inputInfo is M21Info)
                    {
                        var m21Info = inputInfo as M21Info;
                        inputHole = new HoleInfo()
                        {
                            IsJiaGong = true,
                            Param = m21Info.E
                        };
                        StartMove();
                    }
                }
                isEndStop = true;
                isContinue = true;
            }

            #region 自动分中
            if (!isContinue && isAutoCenter && !IOHelper.IsStopButton())
            {
                //200速度X正方向
                if (centerType == 0)
                {
                    MoveCenter(AxisSet.AxisX, 1, () =>
                    {
                        centerXPlus = (firstValue + secondValue + thirdValue) / 2;
                        centerAttemps = 0;
                        centerType = 1;
                    });
                }
                else if (centerType == 1)
                {
                    MoveCenter(AxisSet.AxisX, -1, () =>
                    {
                        centerXMinus = (firstValue + secondValue + thirdValue) / 2;
                        centerX = (centerXPlus + centerXMinus) / 2;
                        centerAttemps = 0;
                        centerType = 3;
                        listBoxControl1.Items.Insert(0, string.Format(L.R("FormMain.AutoCenter.XCenter", "X中心点:{0:0.000}"), centerX));
                        card.SingleMoveX(new HoleInfo() { X = centerX }, this.axisType);
                    });
                }
                else if (centerType == 3 && flag)
                {
                    MoveCenter(AxisSet.AxisY, 1, () =>
                    {
                        centerYPlus = (firstValue + secondValue + thirdValue) / 2;
                        centerAttemps = 0;
                        centerType = 4;
                    });
                }
                else if (centerType == 4)
                {
                    MoveCenter(AxisSet.AxisY, -1, () =>
                    {
                        centerYMinus = (firstValue + secondValue + thirdValue) / 2;
                        centerY = (centerYPlus + centerYMinus) / 2;
                        centerAttemps = 0;
                        listBoxControl1.Items.Insert(0, string.Format(L.R("FormMain.AutoCenter.YCenter", "Y中心点:{0:0.000}"), centerY));
                        card.SingleMoveY(new HoleInfo() { Y = centerY }, this.axisType);
                        centerType = 5;
                    });
                }
                else if (centerType == 5 && flag)
                {
                    isSkipProtect = false;
                    IOHelper.SetHitProtect(1);
                    Thread.Sleep(50);
                    centerAttemps = 0;
                    centerType = 0;
                    isAutoCenter = false;
                }
                else if (centerType == 10)
                {
                    isSkipProtect = false;
                    IOHelper.SetHitProtect(1);
                    Thread.Sleep(50);
                    centerType = 0;
                    centerAttemps = 0;
                    card.CloseAllMove();
                    isAutoCenter = false;
                }
            }
            #endregion

            #region 雷尼绍检测
            if (!isContinue && isLNSCheck && !IOHelper.IsStopButton())
            {
                if (lnsCheckCurrentLine < pckList.Count)
                {
                    if (lnsCheckCurrentLine == 0 && lnsCheckCount == 0)
                    {
                        PlcHelpr.SendMsg(PortHelper.LNSOn);
                        Thread.Sleep(10);
                    }
                    var current = pckList[lnsCheckCurrentLine];
                    MoveLNSCheck(current, () =>
                    {
                        //1.获取锁存位置
                        var position = card.GetLockPosition();
                        if (lnsCheckType == 2)
                        {
                            current.RealValue = CurrInfo.GetWActPos(((decimal)position) / 1000, current.AxisType);
                            current.CheckValue = OtherSet.LNSAllowValue;
                        }
                        else
                        {
                            current.StandardValue = CurrInfo.GetWActPos(((decimal)position) / 1000, current.AxisType);
                            current.CheckValue = OtherSet.LNSAllowValue;
                        }
                        card.ClearLockPosition();
                        lnsCheckCurrentLine++;
                    });
                }
                else
                {
                    PlcHelpr.SendMsg(PortHelper.LNSOff);
                    isLNSCheck = false;
                }
            }
            #endregion

            #endregion
        }
コード例 #8
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 private void MoveLNSCheck(PCKInfo current, Action action)
 {
     if (lnsCheckCount == 0 && isLnsMoved == false)
     {
         inputInfo = new SingleMoveInfo()
         {
             X = current.X,
             Y = current.Y,
             W = CurrInfo.LNSCheckSafeWHeight + CurrInfo.GetActPosW(current.AxisType) - CurrInfo.LogPosW,
             B = current.B,
             C = current.C,
             AxisType = current.AxisType
         };
         card.moveState = 0;
         isLnsMove = true;
         isInput = true;
     }
     else if (isLnsMoved)
     {
         if (lnsCheckCount == 0 && !IOHelper.IsLockCheck() && !card.IsMove(AxisSet.AxisW))
         {
             if (card.IsLockStatus()) //第一遍的时候检测是否已锁存
             {
                 card.ClearLockPosition();
             }
             card.isOperate = false;
             card.Operate(AxisSet.AxisW, -100000, OtherSet.LNSDownSpeed1 * 1000 / 60);
             lnsCheckCount = 1;
         }
         else if (lnsCheckCount == 1 && IOHelper.IsLockCheck() && card.IsMove(AxisSet.AxisW))
         {
             card.OperateStopRun();
             while (card.IsMove(AxisSet.AxisW))
                 Thread.Sleep(1);
             card.isOperate = false;
             card.ClearLockPosition();
             card.Operate(AxisSet.AxisW, OtherSet.LNSBackHeight * 1000, OtherSet.LNSBackSpeed * 1000 / 60);
             lnsCheckCount = 2;
         }
         else if (lnsCheckCount == 2 && !IOHelper.IsLockCheck() && !card.IsMove(AxisSet.AxisW))
         {
             card.isOperate = false;
             card.Operate(AxisSet.AxisW, -100000, OtherSet.LNSDownSpeed2 * 1000 / 60);
             lnsCheckCount = 3;
         }
         else if (lnsCheckCount == 3 && IOHelper.IsLockCheck() && card.IsMove(AxisSet.AxisW))
         {
             card.OperateStopRun();
             while (card.IsMove(AxisSet.AxisW))
                 Thread.Sleep(1);
             action();
             card.isOperate = false;
             card.Operate(AxisSet.AxisW, (int)((CurrInfo.LNSCheckSafeWHeight - CurrInfo.LogPosW) * 1000), OtherSet.LNSBackSpeed * 1000 / 60);
             lnsCheckCount = 0;
             isLnsMoved = false;
         }
     }
 }
コード例 #9
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 private void miStart_ItemClick(object sender, EventArgs e)
 {
     if (this.gridViewCnc.RowCount == 0)
     {
         throw new Exception(L.R("FormMain.ScriptNotLoad", "还未加载脚本!"));
     }
     inputHole = null;
     inputInfo = null;
     if (currPostion >= this.gridViewCnc.RowCount)
         currPostion = this.gridViewCnc.RowCount - 1;
     isContinue = true;
     isRestart = true;
     card.SetAbsolute();
     timerTotal.Enabled = true;
     this.gridViewCnc.Focus();
 }
コード例 #10
0
ファイル: FormMain.cs プロジェクト: JefferyXuHao/Contra-DC
 private void miNext_Click(object sender, EventArgs e)
 {
     var selectRow = this.gridViewCnc.FocusedRowHandle;
     if (selectRow < 0)
     {
         throw new Exception(L.R("FormMain.NotChooseAnyHole", "还未选中任何孔位!"));
     }
     if (selectRow + 1 > this.gridViewCnc.RowCount)
     {
         throw new Exception(L.R("FormMain.RunToEnd", "已运行至结尾!"));
     }
     inputHole = null;
     inputInfo = null;
     currPostion = selectRow;
     isContinue = true;
     isRestart = true;
     isSingle = true;
 }