Ejemplo n.º 1
0
 public int CountOf(Detail detail)
 {
     foreach (OrderPair pair in Pairs)
     if (pair.Detail.Volume == detail.Volume)
       return pair.Num;
       return 0;
 }
Ejemplo n.º 2
0
 public Cut(Detail billet_, Detail mainDetail_, double sectThick_, double left_)
 {
     billet = billet_;
       mainDetail = mainDetail_;
       sectThick = sectThick_;
       left = left_;
 }
Ejemplo n.º 3
0
 public int GetNumber(Detail detail)
 {
     for (int i = 0; i < order.Count; i++) {
     if (order[i].Detail.Volume == detail.Volume)
       return i;
       }
       throw new InvalidProgramException("В разрезе нет детали, хотя должна быть)");
 }
Ejemplo n.º 4
0
 public OrderForm(int dimension)
 {
     InitializeComponent();
       tbxCount.Text = Count.ToString();
       switch(dimension){
     case 1: Detail = new Detail1D(pgrdTest, new double[] { 1.0 }); break;
     case 2: Detail = new Detail2D(pgrdTest, new double[] { 1.0, 1.0 }); break;
     default: throw new NotImplementedException();
       }
       pgrdTest.SelectedObject = Detail;
 }
Ejemplo n.º 5
0
        public OrderForm(Detail det, int num)
        {
            InitializeComponent();
              Count = num;
              tbxCount.Text = Count.ToString();

              switch(det.Dimension){
            case 1: Detail = new Detail1D(pgrdTest, new double[] { ((Detail1D)det).Length }); break;
            case 2: Detail = new Detail2D(pgrdTest, new double[] { ((Detail2D)det).Length, ((Detail2D)det).Width }); break;
            default: throw new NotImplementedException();
              }
              pgrdTest.SelectedObject = Detail;
        }
Ejemplo n.º 6
0
        public void Fill(Detail det, double sect)
        {
            int count = (int)(left / (det.Volume + sect));
              int countSect = count;
              double fillSize = count * (det.Volume + sect);
              if (left - fillSize >= det.Volume) {
            count++;
            fillSize += det.Volume;
              }
              sectThick += countSect * sect;
              left -= fillSize;

              if (count != 0)
            Pairs.Add(new OrderPair(det, count));
        }
Ejemplo n.º 7
0
        public override Cut Fill(Detail det, double sect)
        {
            int count = (int)(Volume / (det.Volume + sect));
              int countSect = count;
              double fillSize = count * (det.Volume + sect);
              if (Volume - fillSize >= det.Volume) {
            count++;
            fillSize += det.Volume;
              }

              Cut retCut = new Cut(this, det, countSect * sect, Volume - fillSize);
              retCut.Pairs.Add(new OrderPair(det, count));

              return retCut;
        }
Ejemplo n.º 8
0
        public Task(int dim, Detail billet_, OrderPair[] order_)
        {
            Dimension = dim;
              if (billet_.Dimension != Dimension)
            throw new InvalidOperationException("Размерность заготовки не совпадает с размерностью самой задачи!");

              billet = billet_;

              foreach (OrderPair p in order_) {
            if (p.Detail.Dimension == Dimension)
              order.Add(p);
            else
              throw new InvalidOperationException("Размерность одной из деталей заказа не совпадает с размерностью самой задачи!");
              }
        }
Ejemplo n.º 9
0
 public bool Add(Detail det)
 {
     if (Left >= det.Volume) {
     bool exist = false;
     foreach (OrderPair p in Pairs) {
       if (p.Detail.Volume == det.Volume) {
     p.Num++;
     exist = true;
     break;
       }
     }
     if (!exist) Pairs.Add(new OrderPair(det, 1));
     Left -= (det.Volume + sectThick);
     return true;
       }
       return false;
 }
Ejemplo n.º 10
0
        public void Remove(Detail detail, double sect)
        {
            for (int i = 0; i < Pairs.Count; i++) {
            if (Pairs[i].Detail.Volume == detail.Volume) {
              Pairs[i].Num--;
              left += sect + Pairs[i].Detail.Volume;
              sectThick -= sect;
              if (Pairs[i].Num == 0)
            Pairs.RemoveAt(i);

              break;
            }
              }
        }
Ejemplo n.º 11
0
        public Detail RemoveButNotLast(Detail lastMinDetail, double sect)
        {
            // не главную и не последнюю!
              for (int i = Pairs.Count - 1; i >= 0; i--) {
            if (Pairs[i].Detail.Volume != mainDetail.Volume) {
              if (lastMinDetail.Volume == Pairs[i].Detail.Volume)
            continue;

              Pairs[i].Num--;
              left += sect + Pairs[i].Detail.Volume;
              sectThick -= sect;

              if (i + 1 < Pairs.Count)
            for (int j = i + 1; j < Pairs.Count; j++) {
              left += (sect + Pairs[i + 1].Detail.Volume) * Pairs[i + 1].Num;
              sectThick -= sect * Pairs[i + 1].Num;
              Pairs.RemoveAt(i + 1);
            }

              if (Pairs[i].Num == 0) {
            Detail retDet = Pairs[i].Detail;
            Pairs.RemoveAt(i);
            return retDet;
              }
              return Pairs[i].Detail;
            }
              }

              return null;
        }
Ejemplo n.º 12
0
 public abstract Cut Fill(Detail det, double sect);
Ejemplo n.º 13
0
 public Task(Detail billet_)
 {
     Dimension = billet_.Dimension;
     billet    = billet_;
 }
Ejemplo n.º 14
0
 public OrderPair(Detail det, int numDet)
 {
     Detail = det;
       Num = numDet;
 }
Ejemplo n.º 15
0
 public abstract Cut Fill(Detail det, double sect);
Ejemplo n.º 16
0
 public Task(Detail billet_)
 {
     Dimension = billet_.Dimension;
       billet = billet_;
 }