Beispiel #1
0
 public static Weighing GetInstance()
 {
     return(_instance ?? (_instance = new Weighing()));
 }
        public void KeepPressure(bool bmanual = false)
        {
            WaranResult waranResult;

            if (SocketMgr.GetInstance().socketArr[(int)SocketType.press].socketState == SocketState.HaveOK || bmanual)
            {
retry_press_up2:
                IOMgr.GetInstace().WriteIoBit("保压气缸电磁阀", false);
                waranResult = CheckIobyName("保压上下气缸原位", true, "流水线站:保压上下气缸原位 没有到位,请检查感应器,气缸,气压,线路等", bmanual);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_press_up2;
                }
retry_messureA:
                waranResult = dowhileCheckA.doSomething(this, dowhileCheckA, bmanual, null);
                if (waranResult != WaranResult.Run)
                {
                    waranResult = AlarmMgr.GetIntance().WarnWithDlg("保压时 ,A模块读不出数据 ", this, CommonDlg.DlgWaranType.Waran_Stop_Retry);
                    if (waranResult == WaranResult.Retry)
                    {
                        goto retry_messureA;
                    }
                }
retry_messureB:
                waranResult = dowhileCheckB.doSomething(this, dowhileCheckA, bmanual, null);
                if (waranResult != WaranResult.Run)
                {
                    waranResult = AlarmMgr.GetIntance().WarnWithDlg("保压时 ,B模块读不出数据 ", this, CommonDlg.DlgWaranType.Waran_Stop_Retry);
                    if (waranResult == WaranResult.Retry)
                    {
                        goto retry_messureB;
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    pressvals[i]     = press1[i];
                    pressvals[4 + i] = press2[i];
                }

retry_press_down:
                IOMgr.GetInstace().WriteIoBit("保压气缸电磁阀", true);
                waranResult = CheckIobyName("保压上下气缸到位", true, "流水线站:保压上下气缸到位 没有到位,请检查感应器,气缸,气压,线路等", bmanual);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_press_down;
                }

                Thread.Sleep(ParamSetMgr.GetInstance().GetIntParam("保压时间"));

retry_messureA2:
                waranResult = dowhileCheckA.doSomething(this, dowhileCheckA, bmanual, null);
                if (waranResult != WaranResult.Run)
                {
                    waranResult = AlarmMgr.GetIntance().WarnWithDlg("保压时 ,A模块读不出数据 ", this, CommonDlg.DlgWaranType.Waran_Stop_Retry);
                    if (waranResult == WaranResult.Retry)
                    {
                        goto retry_messureA2;
                    }
                }
retry_messureB2:
                waranResult = dowhileCheckB.doSomething(this, dowhileCheckA, bmanual, null);
                if (waranResult != WaranResult.Run)
                {
                    waranResult = AlarmMgr.GetIntance().WarnWithDlg("保压时 ,B模块读不出数据 ", this, CommonDlg.DlgWaranType.Waran_Stop_Retry);
                    if (waranResult == WaranResult.Retry)
                    {
                        goto retry_messureB2;
                    }
                }
                for (int i = 0; i < 4; i++)
                {
                    pressvals[i]     = Math.Abs(pressvals[i] - press1[i]);
                    pressvals[4 + i] = Math.Abs(pressvals[i + 4] - press2[i]);
                }
                Thread.Sleep(500);
                Weighing.GetInstance().Update(new int[] { pressvals[0], pressvals[1], pressvals[2], pressvals[3] }, new int[] { pressvals[4], pressvals[5], pressvals[6], pressvals[7] });
retry_press_up:
                IOMgr.GetInstace().WriteIoBit("保压气缸电磁阀", false);
                waranResult = CheckIobyName("保压上下气缸原位", true, "流水线站:保压上下气缸原位 没有到位,请检查感应器,气缸,气压,线路等", bmanual);
                if (waranResult == WaranResult.Retry)
                {
                    goto retry_press_up;
                }
            }
        }