Esempio n. 1
0
        public void execute(Form hander)
        {
            MainForm mf = hander as MainForm;

            if (ViewUtil.IsEmptyOrder(mf))
            {
                return;
            }

            PayListForm form = new PayListForm(showPayDialog);

            form.listBox1.SelectedValue = typeCode;
            DialogResult dr = form.ShowDialog();

            if (dr == DialogResult.Cancel)  //非正常关闭不做任何处理
            {
                logger.Debug("PayListForm close by esc");
            }
            else
            {
                SystemInfo.LastOrderId = SystemInfo.CurrentOrderId;
                saleOrderService.updateState(SystemInfo.CurrentOrderId, OrderState.Payed.ToString());
                SaleOrder order = saleOrderService.getOrderEntityById(SystemInfo.CurrentOrderId);
                if (SystemInfo.MQ_STATE)  //MQ连接存在发送同步消息
                {
                    logger.Debug("Send sync message Order code is " + order.ordercode);
                    MessageSender.getInstance().asyncSendMessage(order);
                }
                mf.presenter.init();
            }
            if (mf != null)
            {
                mf.barcodeInput.Text = "";
            }
        }
Esempio n. 2
0
        void consumer_Listener(IMessage message)
        {
            ITextMessage msg = (ITextMessage)message;

            //异步调用下,否则无法回归主线程
            if (message != null)
            {
                try
                {
                    DownMessage dm = Newtonsoft.Json.JsonConvert.DeserializeObject <DownMessage>(msg.Text);
                    if (dm != null)
                    {
                        switch (dm.actionKey)
                        {
                        case "ordersync":
                            SaleOrderService orderService = new SaleOrderService();
                            orderService.updateState(dm.objKey, OrderState.Synced.ToString());
                            break;
                        }
                    }
                }
                catch (JsonReaderException e)
                {
                    logger.Debug("MQCustomer listener parse JSON error:" + msg.Text);
                }
            }
        }