public DropFileData(PrinterArea eArea, LabelTypes eType)
        {
            ePrinterArea = eArea;
            eLabelType   = eType;

            // ja - convert printer area and type of label to public strings

            //if (ConfigValues.LabelOverride == LabelOverrides.none)
            if (ConfigValues.ConfigLabelName == "none")
            {
                LabelTypeString = Enum.GetName(typeof(LabelTypes), eLabelType);
            }
            else
            {
                //LabelTypeString = Enum.GetName(typeof(LabelOverrides), ConfigValues.LabelOverride);
                LabelTypeString = ConfigValues.ConfigLabelName;
            }

            PrinterAreaString = Enum.GetName(typeof(PrinterArea), ePrinterArea);

            // ja - get the filename and printer from the config file
            ReadConfigFile();

            // ja - create the header for the printer file
            DropFileHeaderObj = new DropFileHeader(_sBtwFileName, _sPrinterName);
        }
        // ja - for single label type
        public AssignedLabelTypes(LabelTypes eLabelType, PrinterArea eArea)
        {
            ePrinterArea = eArea;

            // ja - here we are only going to print a single label type and it is passed in
            AssignedLabels.Add(GetDefaultLabelProperity(eLabelType));
        }
        public static void ReadConfigFile(PrinterArea ePrinterArea, LabelTypes eLabelType)
        {
            try
            {
                // ja - get all the types of labels we need to print from the config
                XmlDocument doc = new XmlDocument();
                doc.Load(ConfigFilePath);

                // ja - global printer area
                string sArea = Enum.GetName(typeof(PrinterArea), ePrinterArea);

                // ja - get the list of labels
                string sLabelTypeString = Enum.GetName(typeof(LabelTypes), eLabelType);

                XmlNode LabelTypeNode = doc.SelectSingleNode("/configuration/printerStations/" + sArea + "//" + sLabelTypeString);

                string sPrinterName = LabelTypeNode.Attributes.GetNamedItem("printer_name").Value;
                string sBtwFileName = LabelTypeNode.Attributes.GetNamedItem("bt_filename").Value;

                // TODO: change this to Customer in config file
                string sCustomer = LabelTypeNode.Attributes.GetNamedItem("customer").Value;
            }
            catch (System.Exception ex)
            {
                TheLog.WriteInfo(ex.Message);
            }
        }
Exemple #4
0
        // ja - print routine for generic final labels
        private void finalPrintBtn_Click(object sender, EventArgs e)
        {
            PrinterArea printArea = PrinterArea.final;

            //LabelOverrides labelOverride = GetOverride();
            string labelOverride = GetFinalDropDownValue();

            LabelGeneratorLib = new LabelGen(labelOverride, true);

            LabelGeneratorLib.AddPrintJob(printArea);

            List <string> list = new List <string>();

            for (int i = 0; i < genericQtyUD.Value; i++)
            {
                list.Add("99999-1001");
            }

            LabelGeneratorLib.AddDataRowFromDB(list);

            if (LabelGeneratorLib.PrintLabels())
            {
                MessageBox.Show("Labels Printed Successfully");
            }
            else
            {
                MessageBox.Show("There was a Problem Printing Labels", "Label Printer", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
            }
        }
        // ja - for hard coded labels
        public bool AddPrintJob(PrinterArea ePrinterArea)
        {
            ConfigValues.TheLog.WriteInfo("AddPrintJob - trigger");

            ConfigValues.UseNewLabelCodes = true;

            return(printJobs.AddPrintJobForPM(ePrinterArea, "999999"));
        }
        // ja - for trigger based printing
        public bool AddPrintJob(PrinterArea ePrinterArea, string sWorkCode, bool bUseNewLabelCodes)
        {
            ConfigValues.TheLog.WriteInfo("AddPrintJob - trigger");

            ConfigValues.UseNewLabelCodes = bUseNewLabelCodes;

            return(printJobs.AddPrintJobForPM(ePrinterArea, sWorkCode));
        }
        // ja - for WCF Service used for Inv labels
        public int AddPrintJob(PrinterArea ePrinterArea, LabelTypes eLabelType, List <string> sColumns)
        {
            ConfigValues.TheLog.WriteInfo("AddPrintJob");

            ConfigValues.UseNewLabelCodes = false;

            return(printJobs.AddPrintJobWithColumns(ePrinterArea, eLabelType, sColumns));
        }
        // ja - reads from the SQL Location Config file to get a location from the table name
        private LabelGeneratorLib.PrinterArea FindLocation(string sTable)
        {
            PrinterArea eLoc = PrinterArea.smt;

            string sLoc = Config.ReadConfigFile(sTable);

            eLoc = (PrinterArea)Enum.Parse(typeof(PrinterArea), sLoc);

            return(eLoc);
        }
        //  ja - for regular App Calls
        public bool AddPrintJob(PrinterArea ePrinterArea, string sWorkCode)
        {
            ConfigValues.TheLog.WriteInfo("AddPrintJob");

            ConfigValues.UseNewLabelCodes = false;

            printJobs.AddPrintJobForPM(ePrinterArea, sWorkCode);

            return(true);
        }
        // ja - for PM Label Code
        public AssignedLabelTypes(string sLabelsCode, PrinterArea eArea, string sPartNumber)
        {
            LabelsCode   = sLabelsCode;
            ePrinterArea = eArea;
            PartNumber   = sPartNumber;

            // ja - here we will parse the Label Code string to get the Label Types
            if (ParseLabelCode())
            {
                AssignLabelTypes();
            }
        }
        // ja - new way ....
        // TODO: ja - move to new class?
        private void AssignLabelTypesFromDataBase()
        {
            string ConnectionString = ConfigValues.GetConnectionString();

            SqlDataReader myReader      = null;
            SqlConnection TheConnection = null;

            try
            {
                TheConnection = new SqlConnection(ConnectionString);

                TheConnection.Open();

                // ja - get the label information from the database view
                SqlCommand myCommand = new SqlCommand("select * from label_Data where Part_Number = '" + PartNumber + "' and Part_Version = '" + PartVersion + "'", TheConnection);
                myReader = myCommand.ExecuteReader();

                // ja - loop through all of the assigned label types
                while (myReader.Read())
                {
                    // ja - get the information from the database
                    string sLocation     = myReader["Location_Name"].ToString();
                    string sType         = myReader["Label_Type_Name"].ToString();
                    string sQty          = myReader["Print_Qty"].ToString();
                    string sCustomerName = myReader["Customer_Name"].ToString();

                    LabelTypes  type = (LabelTypes)Enum.Parse(typeof(LabelTypes), sType);
                    PrinterArea area = (PrinterArea)Enum.Parse(typeof(PrinterArea), sLocation);

                    // ja - if the printer area matches the passed in area (Physical Printer) add to queue
                    if (area == ePrinterArea)
                    {
                        LabelProperitys lp = new LabelProperitys
                        {
                            CustomerName  = sCustomerName,
                            LabelQuanity  = Convert.ToInt32(sQty),
                            AssingedLabel = type
                        };

                        AssignedLabels.Add(lp);
                    }
                }

                myReader.Close();
                TheConnection.Close();
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
                myReader.Close();
                TheConnection.Close();
            }
        }
Exemple #12
0
        // ja - constructor with known column names
        public int AddPrintJobWithColumns(PrinterArea eArea, LabelTypes eLabelType, List <string> sColumns)
        {
            // ja - create data class (container for 3 other classes)
            DropFileData df = new DropFileData(eArea, eLabelType);

            // ja - set the columns names
            df.SetColumnNames(sColumns);

            DropFileDataList.Add(df);

            return(DropFileDataList.Count);
        }
        // ja - for new database driven label codes
        public AssignedLabelTypes(PrinterArea eArea, string sPartNumber, string sVersion)
        {
            ePrinterArea = eArea;
            PartNumber   = sPartNumber;
            PartVersion  = sVersion;

            if (ConfigValues.ConfigLabelName != "none")
            {
                AssignLabelTypesFromOverride();
            }
            else
            {
                // ja - here we will read in the Label Types from the SQL tables
                AssignLabelTypesFromDataBase();
            }
        }
Exemple #14
0
        // ja - constructor for generic PM column names
        public bool AddPrintJobForPM(PrinterArea eArea, string sWorkCode)
        {
            bool bFoundPart = false;

            WorkCodeLabel wc = new WorkCodeLabel(sWorkCode);

            string sFomattedVer = ConfigValues.ConvertIntVersion(wc.GetWorkCodeData().nVersion);

            // TODO: ja - test for no version

            AssignedLabelTypes lt;

            // ja - read from Label Codes from the Database
            if (ConfigValues.UseNewLabelCodes)
            {
                lt = new AssignedLabelTypes(eArea, wc.GetWorkCodeData().PartNumber, sFomattedVer);
            }
            else // ja - read from LabelsCode in Workcode Table
            {
                lt = new AssignedLabelTypes(wc.GetLabelsCode(), eArea, wc.GetWorkCodeData().PartNumber);
            }

            // ja - need to fill the data for all labels type to print
            foreach (var LabelProperty in lt.AssignedLabels)
            {
                DropFileData df = new DropFileData(eArea, LabelProperty.AssingedLabel);

                df.SetPrintQuanity(LabelProperty.LabelQuanity);

                df.SetCustomerName(LabelProperty.CustomerName);

                // ja - add the data to the job
                df.SetWorkCodeData(wc);

                // ja - add the column names
                df.SetColumnNames(PMLabelData.GetPMColumnHeaders());

                // ja - add the job
                DropFileDataList.Add(df);

                bFoundPart = true;
            }

            return(bFoundPart);
        }
Exemple #15
0
        private void foo()
        {
            SqlDataReader myReader      = null;
            SqlConnection TheConnection = null;

            try
            {
                TheConnection = new SqlConnection(ConnectionString);

                TheConnection.Open();

                string sSql = "select * from label_Data where Part_Number = '" + partNumberTB.Text + "' and Part_Version = '" + versionTB.Text + "'";

                SqlCommand myCommand = new SqlCommand(sSql, TheConnection);
                myReader = myCommand.ExecuteReader();

                while (myReader.Read())
                {
                    string sLocation = myReader["Location_Name"].ToString();
                    string sType     = myReader["Label_Type_Name"].ToString();
                    string sQty      = myReader["Print_Qty"].ToString();

                    LabelTypes  type = (LabelTypes)Enum.Parse(typeof(LabelTypes), sType);
                    PrinterArea area = (PrinterArea)Enum.Parse(typeof(PrinterArea), sLocation);

                    if (area == PrinterArea.smt)
                    {
                        smtListView.Items.Add(allLabelsListView.Items[0]);
                    }
                }

                myReader.Close();
                TheConnection.Close();
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
                myReader.Close();
                TheConnection.Close();
            }
        }