Пример #1
0
        public static PopupViewModel CreateSafeDoorPopup(string message, AlcServerViewModel alcServer)
        {
            // TODO: define continue and quit message pack
            PlcMessagePack continueMessagePack = null;
            PlcMessagePack quitMessagePack     = null;

            var content = "请关门后点击继续,或者点取消退出自动模式";

            return(new PopupViewModel()
            {
                OkButtonText = "继续",
                CancelButtonText = "取消",
                OkCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(continueMessagePack, PlcMessageType.Request);
                }),
                CancelCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(quitMessagePack, PlcMessageType.Request);
                    alcServer.IsAutoRunning = false;
                }),
                MessageItem = LoggingMessageItem.CreateMessage(message),
                Content = content,
                IsSpecialPopup = true
            });
        }
Пример #2
0
        public static PopupViewModel CreateSafeDoorPopup(string message, AlcServerViewModel alcServer)
        {
            var continueMessagePack = PlcMessagePackConstants.PromptPlcToCheckDoorStateMessagePack;
            var quitMessagePack     = PlcMessagePack.AbortMessage;

            var content = "请关门后点击继续,或者点取消退出自动模式";

            return(new PopupViewModel()
            {
                OkButtonText = "继续",
                CancelButtonText = "取消",
                OkCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(continueMessagePack, PlcMessageType.Request);
                }),
                CancelCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(quitMessagePack, PlcMessageType.Request);
                    alcServer.IsAutoRunning = false;
                }),
                MessageItem = new LoggingMessageItem(message),
                Content = content,
                IsSpecialPopup = true
            });
        }
Пример #3
0
        public static void SendProductLevels(this AlcServerViewModel server, ProductLevel leftSocketLevel,
                                             ProductLevel rightSocketLevel)
        {
            server.SentToPlc(new PlcMessagePack
            {
                ChannelId = 0,
                MsgType   = 0,
                CommandId = 16,
                Param1    = leftSocketLevel.GetProductLevelValue(),
                Param2    = rightSocketLevel.GetProductLevelValue()
            }, PlcMessageType.Request);

            Logger.LogPlcMessage($"Sent {leftSocketLevel} and {rightSocketLevel} to plc");
        }
Пример #4
0
        public static PopupViewModel CreateClearProductPopup(string message, long errorCode, AlcServerViewModel alcServer)
        {
            // TODO: define continue and quit message pack
            PlcMessagePack continueMessagePack = null;
            PlcMessagePack quitMessagePack     = null;

            var content = errorCode == 2088? "请清除所有产品后点继续,或者点退出取消自动模式" : "请清料后点击继续,或者点退出再清料";

            return(new PopupViewModel()
            {
                OkButtonText = "继续",
                CancelButtonText = "退出",
                OkCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(continueMessagePack, PlcMessageType.Request);
                }),
                CancelCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(quitMessagePack, PlcMessageType.Request);
                    alcServer.IsAutoRunning = false;
                }),
                MessageItem = LoggingMessageItem.CreateMessage(message),
                Content = content,
                IsSpecialPopup = true
            });
        }
Пример #5
0
        public static PopupViewModel CreateClearProductPopup(string message, long errorCode, AlcServerViewModel alcServer)
        {
            var continueMessagePack = PlcMessagePackConstants.PlcWarningHandler8090Series[errorCode][0];
            var quitMessagePack     = PlcMessagePackConstants.PlcWarningHandler8090Series[errorCode][1];

            var content = errorCode == 2088? "请清除所有产品后点继续,或者点退出取消自动模式" : "请清料后点击继续,或者点退出再清料";

            return(new PopupViewModel()
            {
                OkButtonText = "继续",
                CancelButtonText = "退出",
                OkCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(continueMessagePack, PlcMessageType.Request);
                }),
                CancelCommand = new CloseDialogAttachedCommand(o => true, () =>
                {
                    alcServer.SentToPlc(quitMessagePack, PlcMessageType.Request);
                    alcServer.IsAutoRunning = false;
                }),
                MessageItem = new LoggingMessageItem(message),
                Content = content,
                IsSpecialPopup = true
            });
        }