Example #1
0
        /// <summary>
        /// Get current PO sequence list
        /// </summary>
        /// <param name="_PreFilterPo"></param>
        /// <returns></returns>
        public List <OriginalPOsequence> Handle_getOriginalPOsequences(PreFilterPo _PreFilterPo)
        {
            try
            {
                var seqs = new List <OriginalPOsequence>();

                int total_sequence = _PreFilterPo.EndAddr - _PreFilterPo.StartAddr + 1;

                for (int i = _PreFilterPo.StartAddr; i <= _PreFilterPo.EndAddr; i++)
                {
                    var currentSeq = Handle_getOrderSequence(i, total_sequence);
                    if (currentSeq != null)
                    {
                        seqs.Add(currentSeq);
                    }
                }
                return(seqs);
            }
            catch
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// Pre Filtering data form excel table
        /// </summary>
        /// <param name="_Table"></param>
        /// <returns></returns>
        public List <PreFilterPo> Handle_getPreFilterOrder()
        {
            PreviewPos      = new List <PreFilterPo>();
            TotalRowPreview = _ExcelTable.Rows.Count;

            PreFilterPo po_addr = new PreFilterPo {
                StartAddr = 1
            };


            for (int i = 0; i < TotalRowPreview; i++)
            {
                //string str = OleDb_readCellValue(i, (int)ExcelNum.ArticleColumn);//_ExcelTable.Rows[i][(int)ExcelNum.ArticleColumn] as string;

                string str = "";
                try
                {
                    str = OleDb_readCellValue(i, ExcelColumnDef.ArticleCol);//_ExcelTable.Rows[i][(int)ExcelNum.ArticleColumn] as string;
                }
                catch (Exception e)
                { }

                if (!ExcelColumnDef.NewProductionLineFormat)
                {
                    if (str == null)
                    {
                        continue;
                    }

                    if (str.IndexOf("ART") > -1 || str.IndexOf("TOTAL") > -1)
                    {
                        if (i > 0)
                        {
                            po_addr.EndAddr = i - 1;
                            try
                            {
                                if (OleDb_readCellValue(i, ExcelColumnDef.QuantityCol) != null)
                                {
                                    po_addr.PO.Quantity = OleDb_readCellNumber(i, ExcelColumnDef.QuantityCol);
                                }

                                ProductionLine line = null;
                                if (ExcelColumnDef.NewProductionLineFormat)
                                {
                                    line = BuildingQuery.GetProductionLineByName(po_addr.PO.Line);
                                }
                                else
                                {
                                    line = BuildingQuery.GetProductionLineByCode(po_addr.PO.Line);
                                }

                                if (line != null)
                                {
                                    po_addr.PO.ProductionLine_Id = line.id;
                                    PreviewPos.Add(po_addr);
                                }
                            }
                            catch (Exception e)
                            { }

                            po_addr = new PreFilterPo {
                                StartAddr = i + 1
                            };
                        }

                        try
                        {
                            po_addr.PO = Handle_getOriginalPO(po_addr.StartAddr);
                        }
                        catch (Exception e)
                        { }
                    }
                }
                else
                {
                    if (str == null)
                    {
                        //get total qty
                        po_addr.EndAddr = i - 1;
                        try
                        {
                            object ok = _ExcelTable.Rows[i];
                            if (OleDb_readCellValue(i, ExcelColumnDef.QuantityCol) != null)
                            {
                                po_addr.PO.Quantity = OleDb_readCellNumber(i, ExcelColumnDef.QuantityCol);
                            }

                            ProductionLine line = null;
                            if (ExcelColumnDef.NewProductionLineFormat)
                            {
                                line = BuildingQuery.GetProductionLineByName(po_addr.PO.Line);
                            }
                            else
                            {
                                line = BuildingQuery.GetProductionLineByCode(po_addr.PO.Line);
                            }

                            if (line != null)
                            {
                                po_addr.PO.ProductionLine_Id = line.id;
                                PreviewPos.Add(po_addr);
                            }
                        }
                        catch (Exception e)
                        { }
                    }
                    else
                    {
                        if (str.IndexOf("ART") > -1 || str.IndexOf("TOTAL") > -1)
                        {
                            po_addr = new PreFilterPo {
                                StartAddr = i + 1
                            };
                            try
                            {
                                po_addr.PO = Handle_getOriginalPO(po_addr.StartAddr);
                            }
                            catch (Exception e)
                            { }
                        }
                    }
                }
            }
            return(PreviewPos);
        }