示例#1
0
 public void SyncExecute()
 {
     try
     {
         foreach (DataSet.MaterialsRow materialRow in _dataSet.Materials.Rows)
         {
             _optimizer = new Optimizer();
             foreach (DataSet.DetailsListsDetailsRow row in materialRow.GetDetailsListsDetailsRows())
             {
                 Part part = new Part();
                 part.Length    = row.Length;
                 part.Width     = row.Width;
                 part.Quantity  = row.Amount;
                 part.CanRotate = !row.MaterialsRow.HaveDirection;
                 _optimizer.Parts.Add(part);
             }
             foreach (DataSet.SheetsRow row in materialRow.GetSheetsRows())
             {
                 Sheet sheet = new Sheet();
                 sheet.Width  = row.Length;
                 sheet.Height = row.Width;
                 // TODO: добавить в схему БД поле Толщина для листов
                 //sheet.Thickness = row.Thickness;
                 sheet.Thickness = 16M;
                 _optimizer.Sheets.Add(sheet);
             }
             while (_optimizer.NextResult())
             {
                 _optimizer.CurrentResult.Material = new Material(materialRow.MaterialID, materialRow.Name, !materialRow.HaveDirection);
                 _schemes.Add(_optimizer.CurrentResult);
             }
         }
         _status = StatusType.Completed;
     }
     catch (CannotCutDetailsException ex)
     {
         _status = StatusType.Error;
         _error  = ex;
     }
 }
示例#2
0
		public void SyncExecute()
		{
			try
			{
				foreach (DataSet.MaterialsRow materialRow in _dataSet.Materials.Rows)
				{
                    _optimizer = new Optimizer();
					foreach (DataSet.DetailsListsDetailsRow row in materialRow.GetDetailsListsDetailsRows())
					{
						Part part = new Part();
						part.Length = row.Length;
						part.Width = row.Width;
						part.Quantity = row.Amount;
						part.CanRotate = !row.MaterialsRow.HaveDirection;
						_optimizer.Parts.Add(part);
					}
					foreach (DataSet.SheetsRow row in materialRow.GetSheetsRows())
					{
						Sheet sheet = new Sheet();
						sheet.Width = row.Length;
						sheet.Height = row.Width;
						// TODO: добавить в схему БД поле Толщина для листов
						//sheet.Thickness = row.Thickness;
						sheet.Thickness = 16M;
						_optimizer.Sheets.Add(sheet);
					}
					while (_optimizer.NextResult())
					{
						_optimizer.CurrentResult.Material = new Material(materialRow.MaterialID, materialRow.Name, !materialRow.HaveDirection);
						_schemes.Add(_optimizer.CurrentResult);
					}
				}
				_status = StatusType.Completed;
			}
			catch (CannotCutDetailsException ex)
			{
				_status = StatusType.Error;
				_error = ex;
			}
		}