Beispiel #1
0
        //接收要打印的菜品信息
        private void ReceiveFood()
        {
            System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(queuePath);
            queue.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(AppExt.CAppExt.FoodInfo)});

            foreach (System.Messaging.Message msg in queue)
            {
                AppExt.CAppExt.FoodInfo Food = (AppExt.CAppExt.FoodInfo) msg.Body;

                switch (Food.OperateCode)
                {
                    case 0: //传菜
                        Label9.Text = "正在接收并打印 传菜单......";
                        Label9.Refresh();
                        //对该菜品进行 传菜 打印处理

                        PrintFood(Food.OperateCode.ToString(), Food.Billno, Food.Tableno, Food.PsnCount, Food.FoodName, Food.unit, Food.quantity, Food.operandi, Food.taste, Food.operatorid, Food.BarCode);

                        ListBox1.Items.Add(DateTime.Now + " 已成功接收并处理来自 " + Food.Tableno + " 号桌台,单据号为 " + Food.Billno + " 的传菜单,菜品名称:" + Food.FoodName + " 数量:" + Food.quantity + " -> 操作员:" + Food.operatorid);
                        ListBox1.Refresh();
                        break;
                    case 1: //催菜
                        Label9.Text = "正在接收并打印 催菜单......";
                        Label9.Refresh();
                        //对该菜品进行 催菜 打印处理

                        PrintFood(Food.OperateCode.ToString(), Food.Billno, Food.Tableno, Food.PsnCount, Food.FoodName, Food.unit, Food.quantity, Food.operandi, Food.taste, Food.operatorid, Food.BarCode);

                        ListBox1.Items.Add(DateTime.Now + " 已成功接收并处理来自 " + Food.Tableno + " 号桌台的 催菜单,菜品名称:" + Food.FoodName + " 数量:" + Food.quantity + " -> 操作员:" + Food.operatorid);
                        ListBox1.Refresh();
                        break;

                    case 2: //缓菜
                        Label9.Text = "正在接收并打印 退菜单......";
                        Label9.Refresh();
                        //对该菜品进行 缓菜 打印处理

                        PrintFood(Food.OperateCode.ToString(), Food.Billno, Food.Tableno, Food.PsnCount, Food.FoodName, Food.unit, Food.quantity, Food.operandi, Food.taste, Food.operatorid, Food.BarCode);

                        ListBox1.Items.Add(DateTime.Now + " 已成功接收并处理来自 " + Food.Tableno + " 号桌台的 缓菜单,菜品名称:" + Food.FoodName + " 数量:" + Food.quantity + " -> 操作员:" + Food.operatorid);
                        ListBox1.Refresh();
                        break;

                    case 3: //退菜
                        Label9.Text = "正在接收并打印 退菜单......";
                        Label9.Refresh();
                        //对该菜品进行 退菜 打印处理

                        PrintFood(Food.OperateCode.ToString(), Food.Billno, Food.Tableno, Food.PsnCount, Food.FoodName, Food.unit, Food.quantity, Food.operandi, Food.taste, Food.operatorid, Food.BarCode);

                        ListBox1.Items.Add(DateTime.Now + " 已成功接收并处理来自 " + Food.Tableno + " 号桌台的 退菜单,菜品名称:" + Food.FoodName + " 数量:" + Food.quantity + " ,退菜原因:" + Food.CancelRsn + " -> 操作员:" + Food.operatorid);
                        ListBox1.Refresh();
                        break;
                }
                queue.ReceiveById(msg.Id);
            }
            Label9.Text = "状态:空闲";
            Label9.Refresh();
        }