Esempio n. 1
0
        private void PrintOrder()
        {
            ConsumptionObj obj = cqControl.GetlvConsumption().GetCurrentObj();
            if (obj != null)
            {
                string Consumptionid = obj.Consumption.id;

                Task task = new Task();
                task.kind = "bill";
                Consumption consumption = new Consumption();
                consumption.id = Consumptionid;
                task.consumption = consumption;

                System.Net.WebHeaderCollection header = new System.Net.WebHeaderCollection();
                header.Add("Authorization", PassValue.token);
                HttpWebResponse response = Post.PostHttp(header, "printing/tasks", task);
                if ((int)response.StatusCode >= 200 && (int)response.StatusCode < 300)
                {
                    var jserConsumption = new JavaScriptSerializer();
                    consumption = jserConsumption.Deserialize<Consumption>(PassValue.statucode);
                }
                MessageBox.Show("打印成功!");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 打印交接单
        /// </summary>
        private void Btn_Print_Click(object sender, EventArgs e)
        {
            this.lbMessage.Text = "正在打印请稍后。。。";
            Application.DoEvents();
            Task task = new Task();
            task.kind = "shift";
            Shift shift = new Shift();
            shift.id =PassValue.shiftId;
            task.shift = shift;

            HttpResult httpResult = httpReq.HttpPost("printing/tasks", task);
            if ((int)httpResult.StatusCode == 401)
            {
                this.lbMessage.Text = "";
                LoginBusiness lg = new LoginBusiness();
                lg.LoginAgain();
                return;
            }
            else if ((int)httpResult.StatusCode == 0)
            {
                MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            if ((int)httpResult.StatusCode >= 200 && (int)httpResult.StatusCode < 300)
            {
                MessageBox.Show("打印成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                if ((int)httpResult.StatusCode == 410)
                {
                    MessageBox.Show("请检查打印机是否连接!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("未知错误!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            PassValue.IsPrintshifts = true;
            this.lbMessage.Text = "";
        }
Esempio n. 3
0
        /// <summary>
        /// 打印对账单
        /// </summary>
        private void Btn_Print_Click(object sender, EventArgs e)
        {
            Task task = new Task();
            task.kind = "bill";
            Consumption consumption = new Consumption();
            consumption.id = PassValue.consumptionid;
            task.consumption = consumption;

            HttpResult httpResult = httpReq.HttpPost("printing/tasks", task);

            if ((int)httpResult.StatusCode >= 200 && (int)httpResult.StatusCode < 300)
            {
                MessageBox.Show("打印成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else if ((int)httpResult.StatusCode == 401)
            {
                LoginBusiness lg = new LoginBusiness();
                lg.LoginAgain();
                return;
            }
            else if ((int)httpResult.StatusCode == 0)
            {
                MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            else if ((int)httpResult.StatusCode == 410)
            {
                MessageBox.Show("请确定连接打印机!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            else
            {
                MessageBox.Show("打印失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
        }