Exemplo n.º 1
0
        public List <Ticket> PrintTickets(MetaResouceState rs, List <IProduct> pro, IConOL cl)
        {
            //(cl as CnNestingOL).NeedToRefresh.Clear();
            List <Ticket> res = new List <Ticket>();

            foreach (IProduct p in pro)
            {
                //从一个包含产品的列车中打印车票
                BucketGroup   tg   = (cl as CnNestingOL).TrainGroupList.FirstOrDefault(i => i.ProList.Contains(p));
                List <Bucket> temp = null;
                res.Add(tg.PrintTicket(rs, p, out temp));
                (cl as CnNestingOL).NeedToRefresh.AddRange(temp);
            }
            return(res);
        }
Exemplo n.º 2
0
        }                               //存储读取的方案

        public IConOL GenConOL()
        {
            CnNestingOL res = new CnNestingOL();

            string[]     a; string temp = "";
            BucketGroup  train = new BucketGroup();
            StreamReader sr    = new StreamReader(Path, Encoding.Default);

            for (int i = 0; sr.EndOfStream == false; i++)
            {
                string line = sr.ReadLine();
                a = line.Split(';');
                if (a[0] != temp)
                {
                    if (temp != "")
                    {
                        res.TrainGroupList.Add(train);
                    }
                    train = new BucketGroup();
                    temp  = a[0];
                }
                if (a[1] == "0")
                {
                    train.LBucket.Seats.AddRange((m_DataAdapter.MetaResSpace.SeatSet as List <Seat>).Where(k => k.IDinTrain >= Convert.ToInt32(a[2]) && k.IDinTrain <= Convert.ToInt32(a[3]) && k.Tag == a[0]));
                    string[] aa = a[4].Split(',');
                    foreach (string s in aa)
                    {
                        train.LBucket.ProList.Add((m_DataAdapter.ProSpace as List <Product>).First(proid => proid.ProID == Convert.ToInt32(s)));
                    }
                    train.ProList.AddRange(train.LBucket.ProList);
                    res.NeedToRefresh.Add(train.LBucket);
                }
                else
                {
                    Bucket bucket = new Bucket();
                    bucket.Seats.AddRange((m_DataAdapter.MetaResSpace.SeatSet as List <Seat>).Where(k => k.IDinTrain >= Convert.ToInt32(a[2]) && k.IDinTrain <= Convert.ToInt32(a[3]) && k.Tag == a[0]));
                    string[] aa = a[4].Split(',');
                    foreach (string s in aa)
                    {
                        bucket.ProList.Add((m_DataAdapter.ProSpace as List <Product>).First(proid => proid.ProID == Convert.ToInt32(s)));
                    }
                    train.Buckets.Add(bucket);
                    res.NeedToRefresh.Add(bucket);
                }
            }
            res.TrainGroupList.Add(train);
            return(res);
        }