示例#1
0
        protected void BindInputPageValue()
        {
            //获取当前模板前缀
            Model.QB_ModelEL model = new Model.QB_ModelEL {
                ID = GetId()
            };
            DataTable dt_Model = model.ExecDT(4);
            string    strpre   = "";

            if (dt_Model.Rows.Count > 0)
            {
                strpre = dt_Model.Rows[0]["ENTag"].ToString();
            }

            Model.QB_CodeEL qbCode = new Model.QB_CodeEL()
            {
                MainID = 0,
                QBCode = strpre
            };

            DataTable dt = new DataTable();

            dt = qbCode.ExecDT(59);//此服务商下面还没有打印的二维码

            if (dt != null)
            {
                this.lblNotPrintNum.Text = dt.Rows.Count.ToString();
            }
            else
            {
                this.lblNotPrintNum.Text = "0";
            }
        }
示例#2
0
        /// <summary>
        /// 生成Html
        /// </summary>
        protected void GenerateHtml()
        {
            string sqlWhere = string.Empty;

            string pt  = GetPrintType();
            int    pn  = GetPrintNumber();
            long   sid = GetPrintStartId();
            long   eid = GetPrintEndId();

            long tid = GetTemplateId();

            string mainIdS = GetQueryString("mainId");
            long   mainId  = 0;

            if (mainIdS != string.Empty)
            {
                mainId = long.Parse(mainIdS);
            }

            if (!string.IsNullOrEmpty(pt))
            {
                DataTable dt          = new DataTable();
                DataTable detailTable = new DataTable();

                Model.QB_CodeEL qbCode = new Model.QB_CodeEL();

                Model.QB_ModelDetailEL modelDetail = new Model.QB_ModelDetailEL();

                if (pt == "newprint")
                {
                    qbCode.MainID  = mainId;
                    qbCode.ID      = sid;
                    qbCode.AssetID = eid;//结束Id

                    dt = qbCode.ExecDT(54);
                }
                else if (pt == "oldprint")
                {
                    dt = qbCode.ExecuteSqlString(GetQBCodeSql(pn));
                }

                modelDetail.MainID = mainId;
                modelDetail.QBID   = tid;
                detailTable        = modelDetail.ExecDT(52);

                Model.QB_ModelEL model = new Model.QB_ModelEL();
                model.ID = tid;
                model.ExecuteEL(4);

                if (dt != null && dt.Rows.Count > 0)
                {
                    //bool isNewPage = true;

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        #region 2017-8-30 老版本原代码01
                        //if (isNewPage)
                        //{
                        //    html.Append("<div style='height:48px;'></div><div class='bar'>");
                        //}

                        //html.Append("<div class='bar-code' style='padding:" + (model.Padding == string.Empty ? "0px 25px 0px 20px" : model.Padding) + ";height:" + model.QBHeight.ToString() + "px'>");
                        //html.Append("<div class='barc-left'>");
                        //html.Append("<img src='" + dt.Rows[i]["QBPath"] + "' width='" + model.ImgWidth.ToString() + "px' height='" + model.ImgHeight.ToString() + "px' alt=''/>");
                        //html.Append("<div class='barc-left-code' pkey='code' pvalue='" + dt.Rows[i]["QBCode"] + "' >编号:" + dt.Rows[i]["QBCode"] + "</div>");
                        //html.Append("</div>");
                        //html.Append("<div class='barc-right'>");
                        //if (detailTable.Rows.Count > 0)
                        //{
                        //    html.Append("<h4>" + detailTable.Rows[0]["QBDetail"] + "</h4>");
                        //    for (int j = 0; j < detailTable.Rows.Count; j++)
                        //    {
                        //        if (j == 0)
                        //        {
                        //            continue;
                        //        }
                        //        html.Append("<p>" + detailTable.Rows[j]["QBDetail"] + "</p>");
                        //    }
                        //}
                        //else
                        //{
                        //    html.Append("<p></p>");
                        //}
                        //html.Append("</div>");
                        #endregion


                        #region 新代码
                        //html.Append("<div class='tag' style='padding:" + (model.Padding == string.Empty ? "40px 25px 0px 20px;" : model.Padding) + ";width:" + model.QBWidth + "px;height:" + model.QBHeight + "px;float:left;'>");
                        //html.Append("<img src='" + dt.Rows[i]["QBPath"] + "' width='" + model.ImgWidth.ToString() + "px' height='" + model.ImgHeight.ToString() + "px' alt=''/>");
                        //html.Append("<div class='tag-right' style=\"float:right;width:170px;margin-top:10px;margin-right:10px;\">");
                        //if (detailTable.Rows.Count > 0)
                        //{
                        //    html.Append("<h4>" + detailTable.Rows[0]["QBDetail"] + "</h4>");

                        //    for (int j = 0; j < detailTable.Rows.Count; j++)
                        //    {
                        //        if (j == 0)
                        //        {
                        //            continue;
                        //        }
                        //        html.Append("<p>" + detailTable.Rows[j]["QBDetail"] + "</p>");
                        //    }
                        //}
                        //else
                        //{
                        //    html.Append("<p></p>");
                        //}
                        //html.Append("</div>");

                        //html.Append("<div style='text-align:center;width:" + model.ImgWidth.ToString() + "px;' pkey='code' pvalue='" + dt.Rows[i]["QBCode"] + "' >编号:" + dt.Rows[i]["QBCode"] + "</div>");
                        //html.Append("</div>");
                        //html.Append("</div>");//tag
                        #endregion


                        #region 2017-8-30老版本原代码02
                        //html.Append("</div>");//bar

                        //if ((i + 1) % (model.PrintW != 0 ? (model.PrintW * model.PrintH) : 21) != 0)
                        //{
                        //    isNewPage = false;
                        //}
                        //else
                        //{
                        //    isNewPage = true;

                        //    html.Append("</div>");
                        //}

                        //if (i == dt.Rows.Count - 1 && (i + 1) % (model.PrintW != 0 ? (model.PrintW * model.PrintH) : 21) != 0)
                        //{
                        //    html.Append("</div>");
                        //}
                        #endregion

                        #region   版本二
                        ////版本二 2017-9-5
                        //html.Append("<li>");
                        //html.Append("<div class='outer'>");
                        //if (detailTable.Rows.Count > 0)
                        //{
                        //    html.Append("<span class='tel'>" + detailTable.Rows[0]["QBDetail"] + "</span>");
                        //}
                        //html.Append("<div class='inner'>");
                        //html.Append("<img class='QR' src='" + dt.Rows[i]["QBPath"] + "'>");
                        //html.Append("<span class='num'  pkey='code' pvalue='" + dt.Rows[i]["QBCode"] + "'>编号:" + dt.Rows[i]["QBCode"] + "</span>");
                        //html.Append("</div>");
                        //html.Append("</div>");
                        //html.Append("<div class='PageNext'></div>");
                        //html.Append("</li>");
                        #endregion


                        html.Append("<li>");
                        html.Append("<div class='outer'>");
                        if (detailTable.Rows.Count > 0)
                        {
                            html.Append("<span class='title'>" + detailTable.Rows[0]["QBDetail"] + "</span>");
                            html.Append("<span class='tel'>" + detailTable.Rows[1]["QBDetail"] + "</span>");
                        }


                        html.Append("<div class='inner'>");
                        html.Append("<img class='QR' src='" + dt.Rows[i]["QBPath"] + "'>");
                        html.Append("<div class='num'  pkey='code' pvalue='" + dt.Rows[i]["QBCode"] + "'>编号:" + dt.Rows[i]["QBCode"] + "</div>");
                        html.Append("</div>");
                        html.Append("</div>");
                        html.Append("<div class='PageNext'></div>");
                        html.Append("</li>");
                        html.Append("");
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string tips = ValidateInputValue();

            if (tips == string.Empty)
            {
                DataTable dt = new DataTable();

                string maxQBCode = string.Empty;
                string scpt      = string.Empty;

                string mainIdS = GetQueryString("mainId");
                long   mainId  = 0;

                if (mainIdS != string.Empty)
                {
                    mainId = long.Parse(mainIdS);
                }

                //前缀修改为从数据库读取
                Model.QB_ModelEL model = new Model.QB_ModelEL {
                    ID = GetId()
                };
                DataTable dt_Model = model.ExecDT(4);
                string    strpre   = "";
                if (dt_Model.Rows.Count > 0)
                {
                    strpre = dt_Model.Rows[0]["ENTag"].ToString();
                }

                Model.QB_CodeEL qbCode = new Model.QB_CodeEL()
                {
                    MainID = mainId,
                    QBCode = strpre   //这里QBCode只是前缀,存储过程中用来查找有此前缀的二维码
                };

                dt = qbCode.ExecDT(53);

                if (dt != null && dt.Rows.Count > 0)             //获取最大的标签
                {
                    maxQBCode = dt.Rows[0]["QBCode"].ToString(); //注释掉的话就可以从0开始打印标签了
                    //maxQBCode = "wsjd00002519";//用这个可以从HF00000101开始打印标签了
                }

                if (this.rblPrintSelect.SelectedValue == "1")
                {
                    string newQBCode = string.Empty;//新的标签号
                    long   startId   = 0;
                    long   endId     = 0;

                    string qbCodeUriPath = CommonDAL.ConfigHelper.GetConfigString("QBCodeUrlPath");

                    int gnum = 0;

                    gnum = int.Parse(this.txtPrintNum.Text.Trim());

                    newQBCode = GenerateQBCode(maxQBCode);

                    for (int i = 0; i < gnum; i++)
                    {
                        if (newQBCode != string.Empty)
                        {
                            if (i == 0)
                            {
                                startId = CreatCode(qbCodeUriPath + "?mid=" + mainId + "&cid=" + newQBCode, newQBCode);
                            }
                            else if (i == gnum - 1)
                            {
                                endId = CreatCode(qbCodeUriPath + "?mid=" + mainId + "&cid=" + newQBCode, newQBCode);
                            }
                            else
                            {
                                CreatCode(qbCodeUriPath + "?mid=" + mainId + "&cid=" + newQBCode, newQBCode);
                            }

                            newQBCode = GenerateQBCode(newQBCode);
                        }
                    }

                    if (gnum == 1)
                    {
                        endId = startId;
                    }

                    //pt 打印类型
                    //pn 打印数量
                    if (startId > 0 && endId > 0)
                    {
                        scpt = "open('" + "QBCodePrint.aspx?sid=" + startId + "&eid=" + endId + "&pt=newprint" + "&tid=" + GetId() + "&mainId=" + mainId + "');";
                        BLL.Common.MessageBox.ResponseScript(this, scpt);
                        //BLL.Common.MessageBox.Redirect(this, "/QBCode/QBCodePrint.aspx?sid=" + startId + "&eid=" + endId + "&pt=newprint" + "&tid=" + GetId());
                    }
                }
                else if (this.rblPrintSelect.SelectedValue == "2")
                {
                    scpt = "open('" + "QBCodePrint.aspx?pn=" + this.txtPrintNum.Text.Trim() + "&pt=oldprint" + "&tid=" + GetId() + "&mainId=" + mainId + "');";
                    BLL.Common.MessageBox.ResponseScript(this, scpt);
                    //BLL.Common.MessageBox.Redirect(this, "/QBCode/QBCodePrint.aspx?pn=" + this.txtPrintNum.Text.Trim() + "&pt=oldprint" + "&tid=" + GetId());
                }
            }
            else
            {
                BLL.Common.MessageBox.Show(this, tips);
            }
        }