コード例 #1
0
ファイル: CPrintMethods.cs プロジェクト: Jusharra/RMS
        //public void SerialPrint(PRINTER_TYPES inPrinterType, String inHeader, List<CSerialPrintContent> inBody, String inFooter, String inSerialNumber)
        //{
        //    try
        //    {
        //        InitSerialPort();
        //        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
        //        if (inPrinterType == PRINTER_TYPES.NORMAL_PRINTER)
        //        {
        //            Debug.WriteLine("Write to Port Started");
        //            SerialPrintHeader();
        //            SerialPrintBody(inBody);
        //            SerialPrintFooter();
        //            SerialPrintBarCode(inSerialNumber);
        //            m_pSerialPort.Write(m_oCommonConstants.BeepCode, 0, m_oCommonConstants.BeepCode.Length);
        //            m_pSerialPort.Write(m_oCommonConstants.CutPaperCode, 0, m_oCommonConstants.CutPaperCode.Length);
        //            m_pSerialPort.Write("\n");
        //            Debug.WriteLine("Write to Port Ended");
        //        }
        //        else if (inPrinterType == PRINTER_TYPES.KITCHEN_PRINTER)
        //        {
        //        }
        //        DisposeSerialPort();
        //    }
        //    catch (Exception ex)
        //    {
        //        Debug.WriteLine("In SerialPrint Method catch");
        //        Debug.WriteLine(ex.ToString());
        //    }
        //}
        public void SerialPrint(PRINTER_TYPES inPrinterType, String inHeader, string inBody, String inFooter, String inSerialNumber)
        {
            try
            {
                InitSerialPort();
                m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                if (inPrinterType == PRINTER_TYPES.NORMAL_PRINTER)
                {
                    Debug.WriteLine("Write to Port Started");
                    SerialPrintHeader();
                    m_pSerialPort.Write(inBody);
                    SerialPrintFooter();
                    SerialPrintBarCode(inSerialNumber);
                    m_pSerialPort.Write(m_oCommonConstants.BeepCode, 0, m_oCommonConstants.BeepCode.Length);
                    m_pSerialPort.Write(m_oCommonConstants.CutPaperCode, 0, m_oCommonConstants.CutPaperCode.Length);
                    m_pSerialPort.Write("\n");
                    Debug.WriteLine("Write to Port Ended");
                }
                else if (inPrinterType == PRINTER_TYPES.KITCHEN_PRINTER)
                {

                }

                DisposeSerialPort();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("In SerialPrint Method catch");
                Debug.WriteLine(ex.ToString());
            }
        }
コード例 #2
0
ファイル: CPrintMethods.cs プロジェクト: Jusharra/RMS
        public void SerialPrint(PRINTER_TYPES inPrinterType, String inHeader, string inBody, String inFooter,String inSerialNumber)
        {
            try
            {
                InitSerialPort();
                m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();

                m_oCommonConstants.CutPaperCode = ToByteArray(RMSGlobal.m_printer_kitchen_cut_command); //Added by at 08.07.2009

                if (inPrinterType == PRINTER_TYPES.NORMAL_PRINTER)
                {
                    Debug.WriteLine("Write to Port Started");
                    SerialPrintHeader();
                    m_pSerialPort.Write(inBody);
                    SerialPrintFooter();
                   // SerialPrintBarCode(inSerialNumber);
                   // m_pSerialPort.Write("\r\n              VAT No: 870028049\r\n");
                    m_pSerialPort.Write("\r\n\r\n\r\n\r\n\r\n\r\n");
                    m_pSerialPort.Write(m_oCommonConstants.BeepCode, 0, m_oCommonConstants.BeepCode.Length);
                    m_pSerialPort.Write(m_oCommonConstants.CutPaperCode, 0, m_oCommonConstants.CutPaperCode.Length);
                    m_pSerialPort.Write("\n");
                    Debug.WriteLine("Write to Port Ended");
                }
                else if (inPrinterType == PRINTER_TYPES.KITCHEN_PRINTER)
                {

                }
                DisposeSerialPort();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("In SerialPrint Method catch");
                Debug.WriteLine(ex.ToString());
            }
        }