示例#1
0
        public static void PrintErrorTag(CPrintErrorData ed)
        {
            try
            {
                string    filepath  = Application.StartupPath + "\\Print\\ErrorLabel.mrt";
                StiReport stiReport = new StiReport();
                stiReport.Load(filepath);
                stiReport.Compile();

                stiReport["HU"] = ed.hu;
                StringBuilder content = new StringBuilder();

                foreach (var v in ed.psg)
                {
                    string zsatnr = v.p;
                    string zcolsn = v.s;
                    string zsiztx = v.g;
                    {
                        content.AppendFormat("{0}/{1}/{2}/{3}\r\n", zsatnr, zcolsn, zsiztx, v.num);
                    }
                }
                stiReport["CONTENT"] = content.ToString();

                PrinterSettings printerSettings = new PrinterSettings();
                stiReport.Print(false, printerSettings);
            }
            catch (Exception e)
            {
                Log4netHelper.LogError(e);
            }
        }
示例#2
0
        CPrintErrorData getPrintErrorData()
        {
            CPrintErrorData re = new CPrintErrorData();

            try
            {
                re.hu = mCurBoxNo;
                Dictionary <string, int> tar = new Dictionary <string, int>();
                foreach (var v in tagDetailList)
                {
                    if (!v.IsAddEpc)
                    {
                        if (tar.ContainsKey(v.MATNR))
                        {
                            tar[v.MATNR] += 1;
                        }
                        else
                        {
                            tar.Add(v.MATNR, 1);
                        }
                    }
                }

                foreach (var v in tar)
                {
                    CPSGNum       psg = new CPSGNum();
                    TagDetailInfo ti  = tagDetailList.FirstOrDefault(i => i.MATNR == v.Key);
                    psg.p   = ti != null ? ti.ZSATNR : "";
                    psg.s   = ti != null ? ti.ZCOLSN : "";
                    psg.g   = ti != null ? ti.ZSIZTX : "";
                    psg.num = v.Value.ToString();
                    re.psg.Add(psg);
                }
            }
            catch (Exception e)
            {
                Log4netHelper.LogError(e);
            }

            return(re);
        }