Ejemplo n.º 1
0
        /// <summary>
        /// (新)打印报告单事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPrintNew_Click(object sender, EventArgs e)
        {
            string mac = hdMac.Text.ToString();

            if (string.IsNullOrEmpty(mac))
            {
                MessageBoxShow("获取MAC失败!");
                return;
            }
            SetInitlocalsetting(mac);//取mac地址
            string printName = string.Empty;

            if (Userinfo.initlocalsetting == null)
            {
                MessageBoxShow("加载本地打印配置失败");
                return;
            }
            else
            {
                Initlocalsetting initlocalsetting = Userinfo.initlocalsetting;
                printName = initlocalsetting.A4printer ?? initlocalsetting.A5printer;
                if (string.IsNullOrEmpty(printName))
                {
                    MessageBoxShow("请先维护打印机!"); return;
                }
            }
            string ordernums = GetSelectOrderNums();

            if (ordernums == string.Empty)
            {
                return;
            }
            //打印3.0
            foreach (int row in gdOrders.SelectedRowIndexArray)
            {
                string    ordernum             = gdOrders.DataKeys[row][0].ToString();
                string    dictreporttemplateid = gdOrders.DataKeys[row][4].ToString();
                Hashtable htprint = commonReport.getPrintData(ordernum, dictreporttemplateid);
                string    repCode = htprint["repCode"].ToString();
                string    dsjson  = htprint["dsjson"].ToString();
                #region 修改打印状态、添加操作日志
                Hashtable ht = new Hashtable();
                ht.Add("ordernum", ordernum);
                ht.Add("oldstatus", (int)ParamStatus.OrdersStatus.FinishCheck);
                ht.Add("status", (int)ParamStatus.OrdersStatus.FinishPrint);
                ordersService.EditStatusByOldStatus(ht);
                ordersService.AddOperationLog(ordernum, null, "报告单集中打印", "新版打印报告单", "修改留痕", "");
                #endregion
                ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport2(\'{0}\',\'{1}\',\'{2}\');", printName, repCode, dsjson));
            }
        }