public void CopyDocument(TaskToDistrict doc)
        {
            if (doc == null)
                return;

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

            _dataManagersFactory.GetDataManager<TaskToDistrict>().Insert(copy);
        }
Example #2
0
        public void PrintGrouppedTaskWithTechOperWithRates(TaskToDistrict document)
        {
            var docDataManager = _dataManagersFactory.GetDataManager<TaskToDistrict>();
            var tos = _dataManagersFactory.GetDataManager<TechOperation>().GetListCollection();
            var ors = _dataManagersFactory.GetDataManager<Order>().GetListCollection();
            var doc = docDataManager.GetDocument(document.Id);
            var position = doc.Positions;
            doc.Positions =
                doc.GetGrouppedPositionsToPrintWithTechRoutes()
                    .OrderBy(x => x.Profile)
                    .ThenBy(x => x.StandartSize, new StandartSizeComparer())
                    .ThenBy(x => x.MarkSteal)
                    .ToList();

            var ratesDataManager = _dataManagersFactory.GetDataManager<WorkHourDrawing>();
            var collRates = ratesDataManager.GetListCollection();
            var rates =
                collRates.Where(
                    x => position.Any(y => y.DrawingId == x.DrawingId && x.TechOperationId == document.TechOperationId))
                    .ToList();

            Func<PositionTaskToDept, WorkHourDrawing> f = dept =>
            {
                var positionsWithId = position.Where(y => y.Designation == dept.Designation
                                                          && y.Name == dept.Name
                                                          && y.Profile == dept.Profile
                                                          && y.StandartSize == dept.StandartSize
                                                          && y.GostOnSort == dept.StandartSize
                                                          && y.MarkSteal == dept.StandartSize
                                                          && y.Length == dept.Length
                                                          && y.Width == dept.Width
                                                          && y.NextRoute == dept.NextRoute).ToList();

                return rates.FirstOrDefault(x => positionsWithId.Any(z => z.DrawingId == x.DrawingId));
            };

            _dataExport.CreateReportTaskToDept(doc, ors, tos, f);
            _dataExport.SaveReport();
        }
Example #3
0
 public void PrintGrouppedTaskWithTechOper(TaskToDistrict document)
 {
     var docDataManager = _dataManagersFactory.GetDataManager<TaskToDistrict>();
     var tos = _dataManagersFactory.GetDataManager<TechOperation>().GetListCollection();
     var ors = _dataManagersFactory.GetDataManager<Order>().GetListCollection();
     var doc = docDataManager.GetDocument(document.Id);
     doc.Positions =
         doc.GetGrouppedPositionsToPrintWithTechRoutes()
             .OrderBy(x => x.Profile)
             .ThenBy(x => x.StandartSize, new StandartSizeComparer())
             .ThenBy(x => x.MarkSteal)
             .ToList();
     _dataExport.CreateReportTaskToDept(doc, ors, tos);
     _dataExport.SaveReport();
 }
Example #4
0
 public void PrintTaskToDistrictOneDimensionsWithRates(TaskToDistrict document)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public void PrintTaskToDistrictOneDimensions(TaskToDistrict task)
 {
     var docDataManager = _dataManagersFactory.GetDataManager<TaskToDistrict>();
     var tos = _dataManagersFactory.GetDataManager<TechOperation>().GetListCollection();
     var ors = _dataManagersFactory.GetDataManager<Order>().GetListCollection();
     var doc = docDataManager.GetDocument(task.Id);
     _dataExport.CreateReportTaskToDeptOneDimension(doc, ors, tos);
     _dataExport.SaveReport();
 }
Example #6
0
        public void PrintTaskToDistrictWithRates(TaskToDistrict task)
        {
            var docDataManager = _dataManagersFactory.GetDataManager<TaskToDistrict>();
            var tos = _dataManagersFactory.GetDataManager<TechOperation>().GetListCollection();
            var ors = _dataManagersFactory.GetDataManager<Order>().GetListCollection();
            var doc = docDataManager.GetDocument(task.Id);
            var ratesDataManager = _dataManagersFactory.GetDataManager<WorkHourDrawing>();
            var collRates = ratesDataManager.GetListCollection();
            var draws =
                collRates.Where(
                    x => doc.Positions.Any(y => y.DrawingId == x.DrawingId && x.TechOperationId == task.TechOperationId))
                    .ToList();

            _dataExport.CreateReportTaskToDept(doc, ors, tos, x => draws.FirstOrDefault(y => y.DrawingId == x.DrawingId));
            _dataExport.SaveReport();
        }
Example #7
0
 public void CreateReportTaskToDeptOneDimension(TaskToDistrict doc, List<Order> ors, List<TechOperation> tos, Func<PositionTaskToDept, WorkHourDrawing> ratesFunc)
 {
     throw new NotImplementedException();
 }
Example #8
0
        public void CreateReportTaskToDeptOneDimension(TaskToDistrict task, List<Order> orders, List<TechOperation> techOperations)
        {
            _pck = new ExcelPackage();
            var workSheet = _pck.Workbook.Worksheets.Add("Задание на участок");
            CreateHeaderTaskToDeptOneDimensions(workSheet);
            var to = techOperations.FirstOrDefault(x => x.Id == task.TechOperationId);
            workSheet.Cells["A1:K1"].Value = $"Задание № {task.Id} {(to == null ? string.Empty : to.FullName)}";
            var countRowExcel = 3;
            foreach (var positionTaskToDept in task.Positions)
            {
                var order = orders.FirstOrDefault(x => x.Id == task.OrderId);
                workSheet.Cells[countRowExcel, 1].Value = order != null ? (object)order.OrderNo : task.OrderId;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 1], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 2].Value = positionTaskToDept.Designation;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 2], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 3].Value = positionTaskToDept.Name;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 3], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 4].Value =
                    $"{positionTaskToDept.Profile} {positionTaskToDept.StandartSize}";
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 4], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 5].Value = positionTaskToDept.Length;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 5], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 6].Value = positionTaskToDept.MarkSteal;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 6], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 7].Value = positionTaskToDept.CountDetails;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 7], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 8].Value = positionTaskToDept.Weight;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 8], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 9].Value = positionTaskToDept.NextOperation != null
                    ? positionTaskToDept.NextOperation.ShortName
                    : string.Empty;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 9], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 10].Value = positionTaskToDept.NextRoute;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 10], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 11].Formula = $"E{countRowExcel}*G{countRowExcel}";
                workSheet.Cells[countRowExcel, 11].Calculate();
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 11], ExcelBorderStyle.Thin);

                countRowExcel++;
            }

            workSheet.Cells[countRowExcel, 6].Value = "Кол-во всего:";
            workSheet.Cells[countRowExcel, 7].CreateArrayFormula($"SUM(J3:J{countRowExcel - 1})");
            workSheet.Cells[countRowExcel, 7].Calculate();

            workSheet.Cells[countRowExcel, 11].Formula = $"SUM(K3:K{countRowExcel - 1})";
            workSheet.Cells[countRowExcel, 11].Calculate();

            workSheet.Cells[countRowExcel + 2, 5, countRowExcel + 2, 6].Merge = true;
            workSheet.Cells[countRowExcel + 2, 5, countRowExcel + 2, 6].Value = "Задание выдал:";
            workSheet.Cells[countRowExcel + 2, 7, countRowExcel + 2, 11].Merge = true;
            workSheet.Cells[countRowExcel + 2, 7, countRowExcel + 2, 11].Value = task.Responsible;
            workSheet.Column(1).AutoFit();
            workSheet.Column(2).AutoFit();
            workSheet.Column(3).AutoFit();
            workSheet.Column(4).AutoFit();
            workSheet.Column(5).AutoFit();
            workSheet.Column(6).AutoFit();
            workSheet.Column(7).AutoFit();
            workSheet.Column(8).AutoFit();
            workSheet.Column(9).AutoFit();
            workSheet.Column(10).AutoFit();
            workSheet.Column(11).AutoFit();
        }
Example #9
0
        public void CreateReportTaskToDept(TaskToDistrict task, List<Order> orders, List<TechOperation> techOperations, Func<PositionTaskToDept, WorkHourDrawing> ratesFunc)
        {
            _pck = new ExcelPackage();
            var workSheet = _pck.Workbook.Worksheets.Add("Задание на участок");
            CreateHeaderTaskToDeptWithRates(workSheet);
            var to = techOperations.FirstOrDefault(x => x.Id == task.TechOperationId);
            workSheet.Cells["A1:N1"].Value = $"Задание № {task.Id} {(to == null ? string.Empty : to.FullName)}";
            var countRowExcel = 3;
            foreach (var positionTaskToDept in task.Positions)
            {
                var order = orders.FirstOrDefault(x => x.Id == task.OrderId);
                workSheet.Cells[countRowExcel, 1].Value = order != null ? (object)order.OrderNo : task.OrderId;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 1], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 2].Value = positionTaskToDept.Designation;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 2], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 3].Value = positionTaskToDept.Name;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 3], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 4].Value =
                    $"{positionTaskToDept.Profile} {positionTaskToDept.StandartSize}";
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 4], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 5].Value = positionTaskToDept.Length;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 5], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 6].Value = positionTaskToDept.Width;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 6], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 7].Value = positionTaskToDept.MarkSteal;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 7], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 8].Value = positionTaskToDept.CountDetails;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 8], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 9].Value = positionTaskToDept.Weight;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 9], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 10].Value = positionTaskToDept.PrevOperation != null
                    ? positionTaskToDept.PrevOperation.ShortName
                    : string.Empty;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 10], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 11].Value = positionTaskToDept.NextOperation != null
                    ? positionTaskToDept.NextOperation.ShortName
                    : string.Empty;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 11], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 12].Value = positionTaskToDept.NextRoute;
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 12], ExcelBorderStyle.Thin);

                var rates = ratesFunc(positionTaskToDept);

                workSheet.Cells[countRowExcel, 13].Value = rates?.WorkHour; // M
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 13], ExcelBorderStyle.Thin);

                workSheet.Cells[countRowExcel, 14].Value = positionTaskToDept?.CountDetails * rates?.WorkHour; // N
                SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 14], ExcelBorderStyle.Thin);

                countRowExcel++;
            }

            workSheet.Cells[countRowExcel, 7].Value = "Кол-во всего:";
            workSheet.Cells[countRowExcel, 8].CreateArrayFormula($"SUM(H3:H{countRowExcel - 1})");
            workSheet.Cells[countRowExcel, 8].Calculate();

            workSheet.Cells[countRowExcel, 13].CreateArrayFormula($"SUM(M3:M{countRowExcel - 1})");
            workSheet.Cells[countRowExcel, 13].Calculate();

            workSheet.Cells[countRowExcel, 14].CreateArrayFormula($"SUM(N3:N{countRowExcel - 1})");
            workSheet.Cells[countRowExcel, 14].Calculate();

            workSheet.Cells[countRowExcel + 3, 8, countRowExcel + 3, 9].Merge = true;
            workSheet.Cells[countRowExcel + 3, 8, countRowExcel + 3, 9].Value = "Задание выдал:";
            workSheet.Cells[countRowExcel + 3, 10, countRowExcel + 3, 13].Merge = true;
            workSheet.Cells[countRowExcel + 3, 10, countRowExcel + 3, 13].Value = task.Responsible;

            workSheet.Column(1).AutoFit();
            workSheet.Column(2).AutoFit();
            workSheet.Column(3).AutoFit();
            workSheet.Column(4).AutoFit();
            workSheet.Column(5).AutoFit();
            workSheet.Column(6).AutoFit();
            workSheet.Column(7).AutoFit();
            workSheet.Column(8).AutoFit();
            workSheet.Column(9).AutoFit();
            workSheet.Column(10).AutoFit();
            workSheet.Column(11).AutoFit();
            workSheet.Column(12).AutoFit();
            workSheet.Column(13).AutoFit();
            workSheet.Column(14).AutoFit();
        }
 public void DeleteTaskToDistrict(TicketAutUser ticket, TaskToDistrict doc)
 {
     _logger.Trace("Trace method Delete for document: {0}. Id: {2}. User: {1}", typeof(TaskToDistrict).Name, ticket, doc.Id);
     _dataManagers.Delete(doc, ticket);
 }
 public TaskToDistrict InsertTaskToDistrict(TicketAutUser ticket, TaskToDistrict doc)
 {
     _logger.Trace("Trace method Insert for document: {0}. User: {1}", typeof(TaskToDistrict).Name, ticket);
     _dataManagers.Insert(doc, ticket);
     return(doc);
 }
 public List <HistoryRecord <TaskToDistrict> > GetHistoryDocTaskToDistrict(TaskToDistrict doc)
 {
     _logger.Trace("Trace method GetHistoryList for document: {0}", typeof(TaskToDistrict).Name);
     return(_historyManager.GetHistoryDoc(doc));
 }
 public void Delete(TaskToDistrict doc)
 {
     _dataManagersFactory.GetDataManager<TaskToDistrict>().Delete(doc);
 }
 public void Save(TaskToDistrict task)
 {
     _dataManagersFactory.GetDataManager<TaskToDistrict>().InsertOrUpdate(task);
 }