示例#1
0
        /// <summary>
        /// 打印正常箱标
        /// </summary>
        /// <param name="inventoryResult">盘点结果</param>
        /// <param name="boxNo">箱码</param>
        /// <param name="zsatnr">品号</param>
        /// <param name="zcolsn">色号</param>
        /// <param name="zsiztx">规格</param>
        /// <param name="charg">批次</param>
        /// <param name="qty">数量</param>
        /// <returns></returns>
        public static bool PrintRightBoxTag(bool inventoryResult, string boxNo, List <ListViewTagInfo> lvTagInfo)
        {
            string data = SysConfig.RightPrintTemplate;

            ListViewTagInfo tagDetailItem = lvTagInfo[0];
            string          zsatnr        = tagDetailItem.ZSATNR;
            string          zcolsn        = tagDetailItem.ZCOLSN;
            string          zsiztx        = tagDetailItem.ZSIZTX;
            string          charg         = tagDetailItem.CHARG;
            int             qty           = tagDetailItem.QTY;

            string newzsiztx = null;

            try
            {
                newzsiztx = zsiztx.Substring(zsiztx.IndexOf('(') + 1).TrimEnd(')');
            }
            catch (Exception ex)
            {
                LogHelper.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
                newzsiztx = zsiztx;
            }
            data = data.Replace("12345678", boxNo);
            data = data.Replace("#PINHAO#", zsatnr);
            data = data.Replace("#SEHAO#", zcolsn);
            data = data.Replace("#GUIGE#", newzsiztx);
            data = data.Replace("#PICI#", charg);
            data = data.Replace("#SHULIANG#", qty.ToString());
            data = data.Replace("#JIEGUO#", inventoryResult ? "S" : "E");
            bool result = ZebraPrintHelper.PrintWithDRV(data, SysConfig.PrinterName, false);

            return(result);
        }
示例#2
0
        /// <summary>
        /// 打印异常箱标
        /// </summary>
        /// <param name="inventoryResult">盘点结果</param>
        /// <param name="boxNo">箱码</param>
        /// <param name="listviewItems"></param>
        /// <returns></returns>
        public static bool PrintErrorBoxTag(bool inventoryResult, string boxNo, List <ListViewTagInfo> lvTagInfo)
        {
            string data = SysConfig.ErrorPrintTemplate;

            data = data.Replace("12345678", boxNo);
            int i = 1;

            if (lvTagInfo.Count > 0)
            {
                foreach (ListViewTagInfo item in lvTagInfo)
                {
                    if (i > 5)
                    {
                        break;
                    }

                    string zsatnr    = item.ZSATNR;
                    string zcolsn    = item.ZCOLSN;
                    string zsiztx    = item.ZSIZTX;
                    string charg     = item.CHARG;
                    int    qty       = item.QTY;
                    string newzsiztx = null;
                    try
                    {
                        newzsiztx = zsiztx.Substring(zsiztx.IndexOf('(') + 1).TrimEnd(')');
                    }
                    catch (Exception ex)
                    {
                        LogHelper.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
                        newzsiztx = zsiztx;
                    }
                    data = data.Replace(string.Format("#PINHAO{0}#", i), zsatnr);
                    data = data.Replace(string.Format("#SEHAO{0}#", i), zcolsn);
                    data = data.Replace(string.Format("#GUIGE{0}#", i), newzsiztx);
                    data = data.Replace(string.Format("#SHULIANG{0}#", i), qty.ToString());

                    i++;
                }
            }

            while (i <= 5)
            {
                data = data.Replace(string.Format("#PINHAO{0}#", i), " ");
                data = data.Replace(string.Format("#SEHAO{0}#", i), " ");
                data = data.Replace(string.Format("#GUIGE{0}#", i), " ");
                data = data.Replace(string.Format("#SHULIANG{0}#", i), " ");

                i++;
            }

            bool result = ZebraPrintHelper.PrintWithDRV(data, SysConfig.PrinterName, false);

            return(result);
        }