Exemple #1
0
 public void PrintSuperTaskToDistrict(SuperTaskToDistrict task)
 {
     var docDataManager = _dataManagersFactory.GetDataManager<SuperTaskToDistrict>();
     var tos = _dataManagersFactory.GetDataManager<TechOperation>().GetListCollection();
     var ors = _dataManagersFactory.GetDataManager<Order>().GetListCollection();
     var doc = docDataManager.GetDocument(task.Id);
     _dataExport.CreateReportSuperTaskToDept(doc, ors, tos);
     _dataExport.SaveReport();
 }
 public void Delete(SuperTaskToDistrict doc)
 {
     _dataManager.Delete(doc);
 }
Exemple #3
0
        public void CreateReportSuperTaskToDept(SuperTaskToDistrict superTask, List<Order> orders, List<TechOperation> techOperations)
        {
            _pck = new ExcelPackage();
            var workSheet = _pck.Workbook.Worksheets.Add("Задание на участок");
            CreateHeaderTaskToDept(workSheet);
            var to = techOperations.FirstOrDefault(x => x.Id == superTask.TechOperationId);
            workSheet.Cells["A1:L1"].Value = to == null ? string.Empty : to.FullName;
            workSheet.Cells["A1:L1"].Value = $"Сводное задание № {superTask.Id} {(to == null ? string.Empty : to.FullName)}";

            var countRowExcel = 3;
            foreach (var task in superTask.Tasks)
            {
                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.DrawingId;
                    SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 2], ExcelBorderStyle.Thin);

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

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

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

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

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

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

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

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

                    workSheet.Cells[countRowExcel, 11].Value = string.Empty;
                    SetStyleToAllLinesSquare(workSheet.Cells[countRowExcel, 11], ExcelBorderStyle.Thin);

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

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

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

                    countRowExcel++;
                }
            }

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

            workSheet.Cells[countRowExcel + 2, 8, countRowExcel + 2, 9].Merge = true;
            workSheet.Cells[countRowExcel + 2, 8, countRowExcel + 2, 9].Value = "Задание выдал:";
            workSheet.Cells[countRowExcel + 2, 10, countRowExcel + 2, 14].Merge = true;
        }
 public void Save(SuperTaskToDistrict task)
 {
     _dataManager.InsertOrUpdate(task);
 }