Ejemplo n.º 1
0
        public List <CTagDetail> getTags()
        {
            List <CTagDetail> re = new List <CTagDetail>();

            try
            {
                List <string> barList = tagDetailList.Select(i => i.BARCD).Distinct().ToList();
                foreach (var v in barList)
                {
                    TagDetailInfo ti = tagDetailList.FirstOrDefault(i => i.BARCD == v);

                    CTagDetail t = new CTagDetail();
                    t.bar    = ti.BARCD;
                    t.zsatnr = ti.ZSATNR;
                    t.zcolsn = ti.ZCOLSN;
                    t.zsiztx = ti.ZSIZTX;
                    t.charg  = ti.CHARG;
                    t.quan   = tagDetailList.Count(i => i.BARCD == v && !i.IsAddEpc);

                    re.Add(t);
                }
            }

            catch (Exception)
            { }

            return(re);
        }
Ejemplo n.º 2
0
        public static void PrintRightTag(List <CTagDetail> box, string curBoxNo)
        {
            try
            {
                if (box.Count <= 0)
                {
                    return;
                }

                int skuCount = 0;
                if (box != null && box.Count > 0)
                {
                    skuCount = box.Count();
                }
                string filepath = "";
                if (skuCount > 10)
                {
                    filepath = Application.StartupPath + "\\Label10Sku.mrt";
                }
                else
                {
                    if (skuCount > 1)
                    {
                        if (box.Exists(i => !i.zsiztx.Contains("/")))
                        {
                            filepath = Application.StartupPath + "\\LabelMultiSku_Small.mrt";
                        }
                        else
                        {
                            filepath = Application.StartupPath + "\\LabelMultiSku.mrt";
                        }
                    }
                    else
                    {
                        if (box.Exists(i => !i.zsiztx.Contains("/")))
                        {
                            filepath = Application.StartupPath + "\\LabelSku_Small.mrt";
                        }
                        else
                        {
                            filepath = Application.StartupPath + "\\LabelSku.mrt";
                        }
                    }
                }
                StiReport report = new StiReport();
                report.Load(filepath);
                report.Compile();
                if (skuCount > 10)
                {
                    report["HU"]      = curBoxNo;
                    report["CONTENT"] = box.Count.ToString();
                }
                else if (skuCount > 1)
                {
                    report["HU"] = curBoxNo;
                    string content = "";
                    foreach (var matnr in box)
                    {
                        string zsatnr    = matnr.zsatnr;
                        string zcolsn    = matnr.zcolsn;
                        string zsiztx    = matnr.zsiztx;
                        int    count     = matnr.quan;
                        string newzsiztx = null;
                        if (zsiztx.Contains("/"))
                        {
                            try
                            {
                                newzsiztx = zsiztx.Substring(zsiztx.IndexOf('(') + 1).TrimEnd(')');
                            }
                            catch (Exception)
                            {
                                newzsiztx = zsiztx;
                            }
                        }
                        else
                        {
                            newzsiztx = zsiztx;
                        }

                        content += string.Format("{0}/{1}/{2}/{3}\r\n",
                                                 zsatnr, zcolsn, newzsiztx, count);
                    }
                    report["CONTENT"] = content;
                }
                else
                {
                    CTagDetail matnr     = box[0];
                    string     zsatnr    = matnr.zsatnr;
                    string     zcolsn    = matnr.zcolsn;
                    string     zsiztx    = matnr.zsiztx;
                    int        count     = matnr.quan;
                    string     newzsiztx = null;
                    if (zsiztx.Contains("/"))
                    {
                        try
                        {
                            newzsiztx = zsiztx.Substring(zsiztx.IndexOf('(') + 1).TrimEnd(')');
                        }
                        catch (Exception)
                        {
                            newzsiztx = zsiztx;
                        }
                    }
                    else
                    {
                        newzsiztx = zsiztx;
                    }

                    report["HU"]       = curBoxNo;
                    report["PINHAO"]   = zsatnr;
                    report["SEHAO"]    = zcolsn;
                    report["GUIGE"]    = newzsiztx;
                    report["SHULIANG"] = count.ToString();
                }

                PrinterSettings printerSettings = new PrinterSettings();
                report.Print(false, printerSettings);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLine(ex.ToString());
            }
        }