예제 #1
0
        private string FillSn(SnDate snDate, LabelConfig labelConfig)
        {
            if (labelConfig.SnFormat.Trim() == "")
            {
                return(snDate.Sn);
            }

            string snFormat = labelConfig.SnFormat;

            string[] keyFormats = { "(YMD1)", "(YMD)", "y^", "yy", "(c)Y", "(c)M", "mm", "ww", "(dd)", "(ddd)", "(YMD2)", "(YMD3)" };
            foreach (string key in keyFormats)
            {
                if (snFormat.Contains(key))
                {
                    snFormat = DateReplace(snFormat, snDate.Date, key, labelConfig.WeekType, labelConfig.WeekStartDay);
                }
            }

            snFormat = SnReplace(snFormat, snDate.Sn);
            return(snFormat);
        }
예제 #2
0
        private SnDate Label2SnDate(string labelSn, LabelConfig labelConfig)
        {
            SnDate ret = new SnDate();

            switch (labelConfig.Description)
            {
            case "NoSN":
                ret.Sn   = SubRight(labelSn, 4);
                ret.Date = "20" + SubLeft(SubRight(labelSn, 12), 6);
                break;

            case "NoDate":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = DateTime.Today.ToString("yyyyMMdd");
                break;

            case "年月日":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "IOQU");
                break;

            case "年月日2":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "WXYZ");
                break;

            case "年月日3":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "WXYZ");
                break;

            case "年月日4":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "IOQ");
                break;

            case "年月日5":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "WXYZ");
                break;

            case "年月日7":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "IOX");
                break;

            case "年月日8":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDate(labelSn, labelConfig, "IOYZ");
                break;

            case "年周":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDateFromWeek_YYWW(labelSn, labelConfig);
                break;

            case "年天":
                ret.Sn   = labelSn.Substring(labelConfig.SnStart, labelConfig.SnEnd - labelConfig.SnStart + 1);
                ret.Date = GetDateFromDay(labelSn, labelConfig);
                break;

            default:
                ret.Sn   = "";
                ret.Date = DateTime.Today.ToString("yyyyMMdd");
                break;
            }

            ret.Sn   = FillSn(ret, labelConfig);
            ret.Date = SubRight(ret.Date, 6);
            return(ret);
        }
예제 #3
0
        /// <summary>
        /// 根据标签配置,标签返回模板内容
        /// </summary>
        /// <param name="labelConfig">标签配置</param>
        /// <param name="labelSn">标签sn</param>
        /// <returns>交错数组</returns>
        public byte[][] GetRomMapCross(LabelConfig labelConfig, string labelSn)
        {
            SnDate snDate = Label2SnDate(labelSn, labelConfig);

            return(FillBytes(labelConfig.TempeleteBytes, snDate.Sn, snDate.Date, labelConfig.DateCode8Value_0X30, labelConfig.Customer));
        }