示例#1
0
        private void PrintLabel()
        {
            if (lstMain == null || lstMain.Count <= 0)
            {
                return;
            }

            btnSearch.Focus();

            if (!Print_Func.CheckPrinter(false))
            {
                return;
            }

            bool isPrinted = false;

            string strPrintCode = string.Empty;
            int    iPrintQty    = 0;
            int    iPrintCount  = 0;

            foreach (Barcode_Model barcode in lstBarcode)
            {
                iPrintQty = barcode.PRINTQTY.ToInt32();
                if (iPrintQty <= 0)
                {
                    Common.Common_Func.ErrorMessage("外箱标签 " + barcode.SERIALNO + " 打印份数输入错误", "打印失败");
                    continue;
                }

                isPrinted = true;

                if (iPrintCount / Print_Var.OutboxPrintNum >= 1 || iPrintCount % Print_Var.OutboxPrintNum == 0)
                {
                    iPrintCount = 0;
                    if (!string.IsNullOrEmpty(strPrintCode))
                    {
                        Print_Func.SendStringToPrinter(strPrintCode);
                    }

                    strPrintCode = string.Empty;
                }

                if (!PrintRow(barcode, iPrintQty, ref strPrintCode))
                {
                    continue;
                }

                iPrintCount += iPrintQty;
            }

            if (!isPrinted)
            {
                Common.Common_Func.ErrorMessage("请先选中需要打印的货位", "打印失败");
                return;
            }
            else
            {
                if (iPrintCount >= 1 && !string.IsNullOrEmpty(strPrintCode))
                {
                    Print_Func.SendStringToPrinter(strPrintCode);
                }

                //GetListQueryData();
            }
        }
示例#2
0
        private void PrintBarcode()
        {
            btnSearch.Focus();

            bool isPrinted = false;

            string strPrintCode = string.Empty;
            int    iPrintQty    = 0;
            int    iPrintCount  = 0;
            string strLogo      = Print_Func.GetBoxLogoStr(_type);
            string strContent   = string.Empty;
            string strClear     = Print_Func.GetBoxClearStr(_type);

            foreach (Barcode_Model barcode in lstBarcode)
            {
                iPrintQty = barcode.PRINTQTY.ToInt32();
                if (iPrintQty <= 0)
                {
                    Common.Common_Func.ErrorMessage("外箱标签 " + barcode.SERIALNO + " 打印份数输入错误", "打印失败");
                    continue;
                }

                isPrinted = true;

                if (iPrintCount / Print_Var.OutboxPrintNum >= 1 || iPrintCount % Print_Var.OutboxPrintNum == 0)
                {
                    iPrintCount = 0;
                    if (!string.IsNullOrEmpty(strContent))
                    {
                        strPrintCode += strLogo;
                        strPrintCode += strContent;
                        strPrintCode += strClear;
                        Print_Func.SendStringToPrinter(strPrintCode);
                    }

                    strPrintCode = string.Empty;
                    strContent   = string.Empty;
                }

                if (!PrintRow(barcode, iPrintQty, ref strContent))
                {
                    continue;
                }

                iPrintCount += iPrintQty;
            }

            if (!isPrinted)
            {
                Common.Common_Func.ErrorMessage("请先选中需要打印的货位", "打印失败");
                return;
            }
            else
            {
                if (iPrintCount >= 1 && !string.IsNullOrEmpty(strContent))
                {
                    strPrintCode += strLogo;
                    strPrintCode += strContent;
                    strPrintCode += strClear;
                    Print_Func.SendStringToPrinter(strPrintCode);
                }

                //GetListQueryData();
            }

            SetBarcodeParameter(dgvList.CurrentCell.RowIndex);
        }
示例#3
0
        private void PrintLabel()
        {
            if (lstMain == null || lstMain.Count <= 0)
            {
                return;
            }

            btnSearch.Focus();

            if (!Print_Func.CheckPrinter(false))
            {
                return;
            }

            bool isPrinted = false;

            string strPrintCode = string.Empty;
            int    iPrintQty    = 0;
            int    iPrintCount  = 0;
            string strLogo      = Print_Func.GetBoxLogoStr(_type);
            string strContent   = string.Empty;
            string strClear     = Print_Func.GetBoxClearStr(_type);

            foreach (DataGridViewRow dgvr in dgvList.Rows)
            {
                if (dgvr.Cells["colSelect"].Value.ToBoolean())
                {
                    if (dgvr.Cells["colPrintQty"].Value == null)
                    {
                        iPrintQty = colPrintQty.DefaultCellStyle.NullValue.ToInt32();
                    }
                    else
                    {
                        try { iPrintQty = Convert.ToInt32(dgvr.Cells["colPrintQty"].Value); }
                        catch { iPrintQty = 0; }
                    }
                    if (iPrintQty <= 0)
                    {
                        Common.Common_Func.ErrorMessage("第" + dgvr.Index + 1 + "行数量输入错误", "打印失败");
                        continue;
                    }

                    isPrinted = true;

                    if (iPrintCount / Print_Var.OutboxPrintNum >= 1 || iPrintCount % Print_Var.OutboxPrintNum == 0)
                    {
                        iPrintCount = 0;
                        if (!string.IsNullOrEmpty(strContent))
                        {
                            strPrintCode += strLogo;
                            strPrintCode += strContent;
                            strPrintCode += strClear;
                            Print_Func.SendStringToPrinter(strPrintCode);
                        }

                        strPrintCode = string.Empty;
                        strContent   = string.Empty;
                    }

                    if (!PrintRow(lstMain[dgvr.Index], iPrintQty, ref strContent))
                    {
                        continue;
                    }

                    iPrintCount += iPrintQty;
                }
            }

            if (!isPrinted)
            {
                Common.Common_Func.ErrorMessage("请先选中需要打印的货位", "打印失败");
                return;
            }
            else
            {
                if (iPrintCount >= 1 && !string.IsNullOrEmpty(strContent))
                {
                    strPrintCode += strLogo;
                    strPrintCode += strContent;
                    strPrintCode += strClear;
                    Print_Func.SendStringToPrinter(strPrintCode);
                }

                if (cbxSelectAll.Checked)
                {
                    cbxSelectAll.Checked = false;
                }
                else
                {
                    SelectAll();
                }

                //GetListQueryData();
            }
        }
示例#4
0
        private void PrintBarcode()
        {
            btnGetMaterial.Focus();

            bool isPrinted = false;

            string strPrintCode = string.Empty;
            int    iPrintQty    = 0;
            int    iPrintCount  = 0;
            string strLogo      = Print_Func.GetBoxLogoStr(VoucherType.任意单据);
            string strContent   = string.Empty;
            string strClear     = Print_Func.GetBoxClearStr(VoucherType.任意单据);

            foreach (Barcode_Model barcode in lstBarcode)
            {
                iPrintQty = barcode.PRINTQTY.ToInt32();
                if (iPrintQty <= 0)
                {
                    Common.Common_Func.ErrorMessage("外箱标签 " + barcode.SERIALNO + " 打印份数输入错误", "打印失败");
                    continue;
                }

                isPrinted = true;

                if (iPrintCount / Print_Var.OutboxPrintNum >= 1 || iPrintCount % Print_Var.OutboxPrintNum == 0)
                {
                    iPrintCount = 0;
                    if (!string.IsNullOrEmpty(strContent))
                    {
                        strPrintCode += strLogo;
                        strPrintCode += strContent;
                        strPrintCode += strClear;
                        Print_Func.SendStringToPrinter(strPrintCode);
                    }

                    strPrintCode = string.Empty;
                    strContent   = string.Empty;
                }

                if (!PrintRow(barcode, iPrintQty, ref strContent))
                {
                    continue;
                }

                iPrintCount += iPrintQty;
            }

            if (!isPrinted)
            {
                Common.Common_Func.ErrorMessage("生成物料标签错误", "打印失败");
                return;
            }
            else
            {
                if (iPrintCount >= 1 && !string.IsNullOrEmpty(strContent))
                {
                    strPrintCode += strLogo;
                    strPrintCode += strContent;
                    strPrintCode += strClear;
                    Print_Func.SendStringToPrinter(strPrintCode);
                }

                ClearForm();
            }
        }