public async Task <IActionResult> Edit(int id, [Bind("StandartId,Standart1")] Standart standart)
        {
            if (id != standart.StandartId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(standart);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StandartExists(standart.StandartId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(standart));
        }
 public Standart newStandart(Standart Standart)
 {
     _repository.Create <Standart>(Standart);
     return(new Standart {
         id = Standart.id
     });
 }
        private void wizardControl1_SelectedPageChanging(object sender, WizardPageChangingEventArgs e)
        {
            if (e.Page == wpUngrouppedPositions)
            {
                var log = new Logger();
                switch (cbWeigthMethodCalculate.SelectedIndex)
                {
                    case 0:
                        _standart = _controller.CreateStandartByDrawing(log);
                        break;
                    case 1:
                        var koefList = TryConvertToDouble(teListKoef.Text);
                        var koefSort = TryConvertToDouble(teSortKoef.Text);
                        _standart = _controller.CreateStandartByDrawingByClearWeights(log, koefList, koefSort);
                        break;
                }
               
                gcUngPositions.DataSource = _standart.Positions;
                lbMessages.DataSource =
                    log.Messages.Select(mess => new MessageListBox {Tag = mess.Tag, Message = mess.Message}).ToList();
            }

            if (e.Page == wpGrouppedPositions)
            {
                _standart = _controller.GroupPositionsStandart(_standart);
                gcGrpPositions.DataSource = _standart.Positions;
            }

            if (e.Page == completionWizardPage)
            {
                completionWizardPage.AllowFinish = _controller.IsEnabledSave();
            }
        }
Beispiel #4
0
    // TO-DO: Generate Level based on current level
    private void GenerateLevel(int level_number, Style style)
    {
        Level new_level;

        switch (style)
        {
        case Style.Standart:
            new_level = new Standart();
            break;

        case Style.SimpleShort:
            new_level = new SimpleShort();
            break;

        case Style.SimpleLong:
            new_level = new SimpleLong();
            break;

        case Style.ComplexShort:
            new_level = new ComplexShort();
            break;

        case Style.ComplexLong:
            new_level = new ComplexLong();
            break;

        case Style.GoldRich:
            new_level = new GoldRich();
            break;

        default:
            new_level = new Standart();
            break;
        }

        generated_levels.Add(level_number, new_level);


        Segment station = SpawnSegment("station");

        new_level.start_station = station;
        new_level.level_state   = LevelState.Queued;
        new_level.number        = level_number;


        new_level.GenerateTracks();

        if (generated_levels.ContainsKey(level_number - 1))
        {
            Level prev_level = generated_levels[level_number - 1];
            prev_level.end_station = station;
        }

        //GenerateTrees(new_level.start_station,new_level.end_station);
        //GenerateCows(new_level.start_station,new_level.end_station);

        tracks_object.UpdateArrays();
        //GameHandler.UpdateNextJunction();
        game_handler.AddLevel(new_level);
    }
Beispiel #5
0
 /// <summary>
 /// Переводит тип директивы в строку
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return((string.IsNullOrEmpty(Reference) ? "" : Reference + "  ") +
            (string.IsNullOrEmpty(Name) ? "" : " | " + Name + "  ") +
            (Standart == null || string.IsNullOrEmpty(Standart.ToString()) ? "" : " | " + Standart + "  ") +
            (string.IsNullOrEmpty(PartNumber) ? "" : " | " + PartNumber + "  "));
 }
Beispiel #6
0
        public ActionResult <Standart> NewStandart([FromBody] Standart Standart)
        {
            var r = service.newStandart(Standart);

            return(new ObjectResult(r.id)
            {
                StatusCode = StatusCodes.Status201Created
            });
        }
Beispiel #7
0
 public void Add([FromBody] Standart standart) =>
 _standartRepository.Add(new Standart
 {
     Code        = standart.Code,
     Description = standart.Description,
     EndDate     = standart.EndDate,
     Name        = standart.Name,
     StartDate   = standart.StartDate,
 });
Beispiel #8
0
		public override int GetHashCode()
		{
			int detailTypeHash = GoodsClass != null ? GoodsClass.GetHashCode() : -1;
			int standartHash = Standart != null ? Standart.GetHashCode() : -1;
			int partNumberHash = PartNumber.GetHashCode();
			int descriptionHash = Description.GetHashCode();

			return detailTypeHash ^ standartHash ^ partNumberHash ^ descriptionHash;
		}
        public async Task <IActionResult> Create([Bind("StandartId,Standart1")] Standart standart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(standart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(standart));
        }
        public void CopyDocument(Standart doc)
        {
            if (doc == null)
                return;

            var copy = doc.Copy();
            copy.OrderId = null;
            copy.Id = null;

            _dataManagersFactory.GetDataManager<Standart>().Insert(copy);
        }
Beispiel #11
0
 public async Task Add(Standart entity)
 {
     await ExecuteAndHandleException.Execute(async() =>
     {
         if (entity.InternalId == ObjectId.Empty)
         {
             entity.InternalId = ObjectId.GenerateNewId();
         }
         await _context.Standarts.InsertOneAsync(entity);
     }
                                             );
 }
 private static CheckResult WarningCheck(Homologation homologation, Standart standart, DateTime checkTime)
 {
     return(new CheckResult
     {
         ResultCode = ResultCode.ExpiresSoon,
         CheckTime = checkTime,
         Homologation = homologation,
         Standart = standart,
         InternalId = ObjectId.GenerateNewId(),
         SessionId = Guid.NewGuid()
     });
 }
Beispiel #13
0
        public int GetHashCode(AccessoryRequired other)
        {
            if (ReferenceEquals(other, null) == true)
            {
                return(0);
            }
            int standartHash = Standart != null?Standart.GetHashCode() : -1.GetHashCode();

            int partNumberHash  = PartNumber.GetHashCode();
            int descriptionHash = Description.GetHashCode();

            return(standartHash ^ partNumberHash ^ descriptionHash);
        }
 public List <HistoryRecord <Standart> > GetHistoryDocStandart(Standart doc)
 {
     _logger.Trace("Trace method GetHistoryList for document: {0}", typeof(Standart).Name);
     return(_historyManager.GetHistoryDoc(doc));
 }
 public void PutStandart(long id, Standart Standart)
 {
     _repository.Update <Standart>(Standart);
 }
 public void Add([FromBody] Standart standart) =>
 _standartRepository.Add(new Standart
 {
     Code = standart.Code
 });
 public void Save(Standart document)
 {
     _dataManagersFactory.GetDataManager<Standart>().InsertOrUpdate(document);
 }
 public void Delete(Standart doc)
 {
     _dataManagersFactory.GetDataManager<Standart>().Delete(doc);
     DataRefreshed?.Invoke(this, EventArgs.Empty);
 }
Beispiel #19
0
        public void CreateLZK(Order order, Standart standart)
        {
            _pck = new ExcelPackage();
            var workSheet = _pck.Workbook.Worksheets.Add("Задание на участок");
            CreateHeaderLZK(workSheet);

            workSheet.Cells[2, 3].Value = order?.OrderNo + " " + order?.Name;

            var countRowExcel = 8;
            var countPositions = 0;
            for (; countPositions < standart.Positions.Count; countPositions++)
            {
                var curPos = standart.Positions[countPositions];
                workSheet.Cells[countRowExcel, 1, countRowExcel + 1, 1].Merge = true;
                workSheet.Cells[countRowExcel, 1, countRowExcel + 1, 1].Value = countPositions + 1;
                workSheet.Cells[countRowExcel, 1, countRowExcel + 1, 1].Style.HorizontalAlignment =
                    ExcelHorizontalAlignment.Center;
                workSheet.Cells[countRowExcel, 1, countRowExcel + 1, 1].Style.VerticalAlignment =
                    ExcelVerticalAlignment.Center;

                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 1, countRowExcel + 1, 1], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 2].Value = curPos.Profile;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 2], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 2], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 3].Value = curPos.StandartSize;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 3], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 3], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 4].Value = curPos.MarkSteal;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 4], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 4], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 5].Value = curPos.GostOnSort;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 5], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 5], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 6].Value = curPos.AdditionalMeasurementWithWaste.ToString("N3") + " " +
                                                          ConvertExtraDimensions(curPos.TypeAdditionalMeasurement) +
                                                          " / " + curPos.WeightWithWaste.ToString("N3") + " кг.";
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 6], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 6], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 7].Value = string.Empty;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 7], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 7], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 8].Value = string.Empty;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 8], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 8], ExcelBorderStyle.Thin);
                workSheet.Cells[countRowExcel, 9].Value = string.Empty;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 9], ExcelBorderStyle.Thin);
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel + 1, 9], ExcelBorderStyle.Thin);
                countRowExcel = countRowExcel + 2;
            }

            countRowExcel++;

            workSheet.Cells[countRowExcel, 4, countRowExcel, 5].Merge = true;
            workSheet.Cells[countRowExcel, 4, countRowExcel, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            workSheet.Cells[countRowExcel, 4, countRowExcel, 5].Value = "Сформировал: ";
            workSheet.Cells[countRowExcel, 4, countRowExcel, 5].Style.Font.Bold = true;
            workSheet.Cells[countRowExcel, 6, countRowExcel, 9].Merge = true;
            workSheet.Cells[countRowExcel, 6, countRowExcel, 9].Value = standart.Responsible;

            workSheet.Cells[countRowExcel + 2, 4, countRowExcel + 2, 5].Merge = true;
            workSheet.Cells[countRowExcel + 2, 4, countRowExcel + 2, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            workSheet.Cells[countRowExcel + 2, 4, countRowExcel + 2, 5].Value = "Начальник ОЗ: ";
            workSheet.Cells[countRowExcel + 2, 4, countRowExcel + 2, 5].Style.Font.Bold = true;
            workSheet.Cells[countRowExcel + 2, 6, countRowExcel + 2, 9].Merge = true;
            workSheet.Cells[countRowExcel + 2, 6, countRowExcel + 2, 9].Value = string.Empty;

            workSheet.Cells[countRowExcel + 4, 4, countRowExcel + 4, 5].Merge = true;
            workSheet.Cells[countRowExcel + 4, 4, countRowExcel + 4, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            workSheet.Cells[countRowExcel + 4, 4, countRowExcel + 4, 5].Value = "ОТК: ";
            workSheet.Cells[countRowExcel + 4, 4, countRowExcel + 4, 5].Style.Font.Bold = true;
            workSheet.Cells[countRowExcel + 4, 6, countRowExcel + 4, 9].Merge = true;
            workSheet.Cells[countRowExcel + 4, 6, countRowExcel + 4, 9].Value = string.Empty;
        }
 public void PutPost(long id, Standart Standart)
 {
     repo.PutStandart(id, Standart);
 }
Beispiel #21
0
        public void CreateReportBigNorms(Standart standart)
        {
            _pck = new ExcelPackage();
            var workSheet = _pck.Workbook.Worksheets.Add("Норма");
            CreateHeaderBigNorms(workSheet);
            var i = 8;

            workSheet.Cells["A6:L6"].Value = standart.Name;

            foreach (var positionStandart in standart.Positions)
            {
                workSheet.Cells[i, 1].Value = i - 7;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 1], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 2].Value = positionStandart.Profile;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 2], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 3].Value = positionStandart.StandartSize;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 3], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 4].Value = positionStandart.MarkSteal;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 4], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 5].Value = positionStandart.GostOnSort;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 5], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 6].Value = positionStandart.UtilizationRatio;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 6], ExcelBorderStyle.Thin);

                workSheet.Cells[i, 7].Value = positionStandart.Weight;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 7], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 7].Style.Numberformat.Format = "0.000";

                workSheet.Cells[i, 8].Value = positionStandart.WeightWithWaste;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 8], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 8].Style.Numberformat.Format = "0.000";

                workSheet.Cells[i, 9].Value = positionStandart.AdditionalMeasurement;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 9], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 9].Style.Numberformat.Format = "0.000";

                workSheet.Cells[i, 10].Value = positionStandart.AdditionalMeasurementWithWaste;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 10], ExcelBorderStyle.Thin);
                workSheet.Cells[i, 10].Style.Numberformat.Format = "0.000";

                workSheet.Cells[i, 11].Value = ConvertExtraDimensions(positionStandart.TypeAdditionalMeasurement);
                SetStyleToAllLinesSquare(workSheet.Cells[i, 11], ExcelBorderStyle.Thin);

                workSheet.Cells[i, 12].Value = positionStandart.Note;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 12], ExcelBorderStyle.Thin);

                workSheet.Cells[i, 12].Value = positionStandart.Note;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 13], ExcelBorderStyle.Thin);

                workSheet.Cells[i, 12].Value = positionStandart.Note;
                SetStyleToAllLinesSquare(workSheet.Cells[i, 14], ExcelBorderStyle.Thin);


                i++;
            }

            workSheet.Cells[i, 5, i, 6].Merge = true;
            workSheet.Cells[i, 5].Value = "Итого:";
            workSheet.Cells[i, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;

            workSheet.Cells[i, 7].Formula = $"=SUM(G8:{workSheet.Cells[i - 1, 7].Address})";
            workSheet.Cells[i, 8].Formula = $"=SUM(H8:{workSheet.Cells[i - 1, 8].Address})";

            i = i + 2;

            workSheet.Cells[i, 4, i, 5].Merge = true;
            workSheet.Cells[i, 4, i, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            workSheet.Cells[i, 4, i, 5].Value = "Сформировал: ";
            workSheet.Cells[i, 4, i, 5].Style.Font.Bold = true;
            workSheet.Cells[i, 6, i, 9].Merge = true;
            workSheet.Cells[i, 6, i, 9].Value = "___________________" + standart.Responsible;

            for (int j = 1; j <= 11; j++)
            {
                workSheet.Column(j).AutoFit();
            }
        }
Beispiel #22
0
        public void CreateReportClearWeights(Standart standart)
        {
            _pck = new ExcelPackage();
            var workSheet = _pck.Workbook.Worksheets.Add("Чистые веса");
            CreateHeaderClearWeights(workSheet);
            var i = 4;

            workSheet.Cells["A2:H2"].Value = standart.Name;

            foreach (var positionStandart in standart.Positions)
            {
                workSheet.Cells["A" + i].Value = i - 3;
                SetStyleToAllLinesSquare(workSheet.Cells["A" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["B" + i].Value = positionStandart.Profile;
                SetStyleToAllLinesSquare(workSheet.Cells["B" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["C" + i].Value = positionStandart.StandartSize;
                SetStyleToAllLinesSquare(workSheet.Cells["C" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["D" + i].Value = positionStandart.MarkSteal;
                SetStyleToAllLinesSquare(workSheet.Cells["D" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["E" + i].Value = positionStandart.GostOnSort;
                SetStyleToAllLinesSquare(workSheet.Cells["E" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["F" + i].Value = positionStandart.Weight;
                SetStyleToAllLinesSquare(workSheet.Cells["F" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["G" + i].Value = positionStandart.UtilizationRatio;
                SetStyleToAllLinesSquare(workSheet.Cells["G" + i], ExcelBorderStyle.Thin);
                workSheet.Cells["H" + i].Value = positionStandart.WeightWithWaste;
                SetStyleToAllLinesSquare(workSheet.Cells["H" + i], ExcelBorderStyle.Thin);
                i++;
            }

            workSheet.Cells["E" + i].Value = "Итого: ";
            SetStyleToAllLinesSquare(workSheet.Cells["E" + i], ExcelBorderStyle.Thin);
            workSheet.Cells["F" + i].Formula = $"=SUM(F4:F{i - 1})";
            SetStyleToAllLinesSquare(workSheet.Cells["F" + i], ExcelBorderStyle.Thin);
            workSheet.Cells["H" + i].Formula = $"=SUM(H4:H{i - 1})";
            SetStyleToAllLinesSquare(workSheet.Cells["H" + i], ExcelBorderStyle.Thin);
        }
 public Standart newStandart(Standart Standart)
 {
     return(repo.newStandart(Standart));
 }
 public void DeleteStandart(TicketAutUser ticket, Standart doc)
 {
     _logger.Trace("Trace method Delete for document: {0}. Id: {2}. User: {1}", typeof(Standart).Name, ticket, doc.Id);
     _dataManagers.Delete(doc, ticket);
 }
 public Standart GroupPositionsStandart(Standart standart)
 {
     var helper = new DrawingsToStandartHelper();
     standart = helper.GroupAndSumPositionsStandart(standart);
     return standart;
 }
Beispiel #26
0
        public async Task PrintClearWeigths(int? headDrawingId)
        {
            var task = new Task(() =>
            {
                var topParentId = GetTopParentId(headDrawingId, _dataManagersFactory.GetDataManager<Drawing>());
                var dm = _dataManagersFactory.GetFilteredDrawingsByContainsId(topParentId);

                var ss = new Standart();
                var data = dm.GetListCollection();

                var allParentId = data.Select(x => x.ParentId).ToList();
                var allChildrens = data.Where(x => allParentId.All(p => p != null && p.Value != x.Id)).ToList();

                ss.Positions = (from allChildren in allChildrens
                                group allChildren by
                                    new
                                    {
                                        allChildren.Profile,
                                        allChildren.StandartSize,
                                        allChildren.GostOnSort,
                                        allChildren.MarkSteal
                                    }
                    into g
                                select new PositionStandart
                                {
                                    GostOnSort = g.Key.GostOnSort,
                                    Profile = g.Key.Profile,
                                    MarkSteal = g.Key.MarkSteal,
                                    StandartSize = g.Key.StandartSize,
                                    UtilizationRatio = 0.8,
                                    Weight = (double)g.Sum(x => x.WeightAll),
                                    WeightWithWaste = (double)g.Sum(x => x.WeightAll) / 0.8
                                }).OrderBy(x => x.Profile, new ProfileComparer())
                    .ThenBy(x => x.StandartSize, new StandartSizeComparer())
                    .ThenBy(x => x.MarkSteal)
                    .ToList();

                _dataExport.CreateReportClearWeights(ss);
            });

            task.Start();
            await task;

            _dataExport.SaveReport();
        }
 public Standart InsertStandart(TicketAutUser ticket, Standart doc)
 {
     _logger.Trace("Trace method Insert for document: {0}. User: {1}", typeof(Standart).Name, ticket);
     _dataManagers.Insert(doc, ticket);
     return(doc);
 }