Brigade report + additional fixes
This commit is contained in:
parent
4fbeb3c6e6
commit
5cc9d26c62
@ -106,5 +106,11 @@ namespace ConstructionCompanyBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
_logger.LogInformation("Position. IngredietnName:{PositionName}. Salary:{Salary}. Id:{Id}", model.PositionName, model.Salary, model.Id);
|
_logger.LogInformation("Position. IngredietnName:{PositionName}. Salary:{Salary}. Id:{Id}", model.PositionName, model.Salary, model.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BrigadeReportViewModel> ReadPositionsAverage(DateTime dateFrom, DateTime dateTo)
|
||||||
|
{
|
||||||
|
var list = _positionStorage.GetPositionsAverage(dateFrom, dateTo);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using ConstructionCompanyContracts.BindingModels;
|
using ConstructionCompanyContracts.BindingModels;
|
||||||
|
using ConstructionCompanyContracts.SearchModels;
|
||||||
using ConstructionCompanyContracts.BusinessLogicContracts;
|
using ConstructionCompanyContracts.BusinessLogicContracts;
|
||||||
using ConstructionCompanyDataModels.Enums;
|
using ConstructionCompanyDataModels.Enums;
|
||||||
using System;
|
using System;
|
||||||
@ -30,57 +31,74 @@ namespace ConstructionCompanyBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public void GenerateEmployees()
|
public void GenerateEmployees()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 400; i++)
|
int posInd = 1;
|
||||||
|
for (int i = 0; i < 200; i++)
|
||||||
{
|
{
|
||||||
_employee.Create(new EmployeeBindingModel { EmployeeName = "testEmp", PositionID = 1 });
|
_employee.Create(new EmployeeBindingModel { EmployeeName = "testEmp" + (i + 1), PositionID = posInd });
|
||||||
|
posInd++;
|
||||||
|
if (posInd == 11) posInd = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateEmployeesOrders()
|
public void GenerateEmployeesOrders()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2000; i++)
|
for (int i = 1; i <= 200; i++)
|
||||||
{
|
{
|
||||||
Random rand = new Random();
|
_employeeOrder.Create(new EmployeeOrderBindingModel { EmployeeId = i, OrderId = i});
|
||||||
int emp = rand.Next(1, 600);
|
|
||||||
int ord = rand.Next(1, 2000);
|
|
||||||
if (_employeeOrder.ReadList(null)?.FirstOrDefault(x => x.OrderId == ord && x.EmployeeId == emp) != null) continue;
|
|
||||||
_employeeOrder.Create(new EmployeeOrderBindingModel { EmployeeId = emp, OrderId = ord});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateMaterialOrders()
|
public void GenerateMaterialOrders()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 50; i++)
|
int quantity = 1;
|
||||||
|
for (int i = 1; i <= 200; i++)
|
||||||
|
{
|
||||||
|
_materialOrder.Create(new MaterialOrderBindingModel { MaterialId = i, OrderId = i, Quantity = quantity});
|
||||||
|
quantity++;
|
||||||
|
if (quantity == 7) quantity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateAdditionalMaterialOrders()
|
||||||
|
{
|
||||||
|
Random rand = new Random();
|
||||||
|
int quantity = 1;
|
||||||
|
for (int i = 1; i <= 100; i++)
|
||||||
{
|
{
|
||||||
Random rand = new Random();
|
|
||||||
int mat = rand.Next(1, 10);
|
int mat = rand.Next(1, 10);
|
||||||
int ord = rand.Next(1, 200);
|
int ord = rand.Next(1, 100);
|
||||||
if (_materialOrder.ReadList(null)?.FirstOrDefault(x => x.OrderId == ord && x.MaterialId == mat) != null) continue;
|
if (_materialOrder.ReadElement(new MaterialOrderSearchModel { MaterialId = mat, OrderId = ord}) != null)
|
||||||
_materialOrder.Create(new MaterialOrderBindingModel { MaterialId = mat, OrderId = ord, Quantity = 1});
|
{
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_materialOrder.Create(new MaterialOrderBindingModel { MaterialId = mat, OrderId = ord, Quantity = quantity });
|
||||||
|
quantity++;
|
||||||
|
if (quantity == 7) quantity = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateMaterials()
|
public void GenerateMaterials()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 1000; i++)
|
for (int i = 0; i < 200; i++)
|
||||||
{
|
{
|
||||||
_material.Create(new MaterialBindingModel { MaterialName = "testMat", Quantity = 2000 });
|
_material.Create(new MaterialBindingModel { MaterialName = "testMat" + (i + 1), Quantity = 2000 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateOrders()
|
public void GenerateOrders()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
{
|
{
|
||||||
_order.CreateOrder(new OrderBindingModel { Description = "snfjknfjksfns", Adress = "dsdsdssd", Price=20000, Status=OrderStatus.Неизвестен, CustomerNumber="+7838347475"});
|
_order.CreateOrder(new OrderBindingModel { Description = "order" + (i + 1), Adress = "dsdsdssd", Price=20000, Status=OrderStatus.Неизвестен, CustomerNumber="+7838347475"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GeneratePositions()
|
public void GeneratePositions()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 15; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
_position.Create(new PositionBindingModel { PositionName = "testPos", Salary = 20000 });
|
_position.Create(new PositionBindingModel { PositionName = "testPos" + (i + 1), Salary = 20000 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace ConstructionCompanyContracts.BusinessLogicContracts
|
|||||||
{
|
{
|
||||||
List<PositionViewModel>? ReadList(PositionSearchModel? model);
|
List<PositionViewModel>? ReadList(PositionSearchModel? model);
|
||||||
PositionViewModel? ReadElement(PositionSearchModel model);
|
PositionViewModel? ReadElement(PositionSearchModel model);
|
||||||
|
List<BrigadeReportViewModel>? ReadPositionsAverage(DateTime dateFrom, DateTime dateTo);
|
||||||
bool Create(PositionBindingModel model);
|
bool Create(PositionBindingModel model);
|
||||||
bool Update(PositionBindingModel model);
|
bool Update(PositionBindingModel model);
|
||||||
bool Delete(PositionBindingModel model);
|
bool Delete(PositionBindingModel model);
|
||||||
|
@ -14,5 +14,7 @@ namespace ConstructionCompanyContracts.BusinessLogicContracts
|
|||||||
public void GenerateEmployees();
|
public void GenerateEmployees();
|
||||||
public void GenerateEmployeesOrders();
|
public void GenerateEmployeesOrders();
|
||||||
public void GenerateMaterialOrders();
|
public void GenerateMaterialOrders();
|
||||||
|
|
||||||
|
public void GenerateAdditionalMaterialOrders();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace ConstructionCompanyContracts.StorageContracts
|
|||||||
{
|
{
|
||||||
List<PositionViewModel> GetFullList();
|
List<PositionViewModel> GetFullList();
|
||||||
List<PositionViewModel> GetFilteredList(PositionSearchModel model);
|
List<PositionViewModel> GetFilteredList(PositionSearchModel model);
|
||||||
|
List<BrigadeReportViewModel> GetPositionsAverage(DateTime dateFrom, DateTime dateTo);
|
||||||
PositionViewModel? GetElement(PositionSearchModel model);
|
PositionViewModel? GetElement(PositionSearchModel model);
|
||||||
PositionViewModel? Insert(PositionBindingModel model);
|
PositionViewModel? Insert(PositionBindingModel model);
|
||||||
PositionViewModel? Update(PositionBindingModel model);
|
PositionViewModel? Update(PositionBindingModel model);
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ConstructionCompanyContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class BrigadeReportViewModel
|
||||||
|
{
|
||||||
|
public int PositionId { get; set; }
|
||||||
|
[DisplayName("Название должности")]
|
||||||
|
public string PositionName { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Среденее потребление материалров")]
|
||||||
|
public double materialAvg { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -95,7 +95,7 @@ namespace ConstructionCompanyPsqlImplement
|
|||||||
connection.Close();
|
connection.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<int> ExecuteReader(string commandString)
|
public List<List<string>> ExecuteReader(string commandString, int numOfFields)
|
||||||
{
|
{
|
||||||
using var connection = new NpgsqlConnection(connectionString);
|
using var connection = new NpgsqlConnection(connectionString);
|
||||||
connection.Open();
|
connection.Open();
|
||||||
@ -103,12 +103,17 @@ namespace ConstructionCompanyPsqlImplement
|
|||||||
using var commandMaterials = connection.CreateCommand();
|
using var commandMaterials = connection.CreateCommand();
|
||||||
commandMaterials.CommandText = commandString;
|
commandMaterials.CommandText = commandString;
|
||||||
using var reader = commandMaterials.ExecuteReader();
|
using var reader = commandMaterials.ExecuteReader();
|
||||||
List<int> ids = new List<int>();
|
List<List<string>> res = new List<List<string>>();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
ids.Add(reader.GetInt32(0));
|
List<string> item = new List<string>();
|
||||||
|
for (int i =0; i < numOfFields; i++)
|
||||||
|
{
|
||||||
|
item.Add(reader.GetValue(i).ToString());
|
||||||
|
}
|
||||||
|
res.Add(item);
|
||||||
}
|
}
|
||||||
return ids;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshDb()
|
private void refreshDb()
|
||||||
|
@ -104,11 +104,11 @@ namespace ConstructionCompanyPsqlImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var employeesId = _source.ExecuteReader(command);
|
var employeesId = _source.ExecuteReader(command, 1);
|
||||||
List<EmployeeViewModel> employees = new List<EmployeeViewModel>();
|
List<EmployeeViewModel> employees = new List<EmployeeViewModel>();
|
||||||
foreach (var id in employeesId)
|
foreach (var id in employeesId)
|
||||||
{
|
{
|
||||||
employees.Add(_source.Employees.First(x => x.Id == id).GetViewModel);
|
employees.Add(_source.Employees.First(x => x.Id == Convert.ToInt32(id[0])).GetViewModel);
|
||||||
}
|
}
|
||||||
return employees;
|
return employees;
|
||||||
}
|
}
|
||||||
|
@ -97,5 +97,18 @@ namespace ConstructionCompanyPsqlImplement.Implements
|
|||||||
_source.ExecuteSql(command);
|
_source.ExecuteSql(command);
|
||||||
return deletedPosition;
|
return deletedPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BrigadeReportViewModel> GetPositionsAverage(DateTime dateFrom, DateTime dateTo)
|
||||||
|
{
|
||||||
|
var command = Position.PositionsAVGCommnad(dateFrom, dateTo);
|
||||||
|
var result = _source.ExecuteReader(command, 2);
|
||||||
|
List<BrigadeReportViewModel> positionsAverages = new List<BrigadeReportViewModel>();
|
||||||
|
foreach (var posAvgPair in result)
|
||||||
|
{
|
||||||
|
string positionName = _source.Positions.First(x => x.Id == Convert.ToInt32(posAvgPair[0])).PositionName;
|
||||||
|
positionsAverages.Add(new BrigadeReportViewModel { PositionId = Convert.ToInt32(posAvgPair[0]), PositionName = positionName, materialAvg = Convert.ToDouble(posAvgPair[1]) });
|
||||||
|
}
|
||||||
|
return positionsAverages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,11 @@ namespace ConstructionCompanyPsqlImplement.Models
|
|||||||
return $"DELETE FROM postition WHERE id = {model.Id}";
|
return $"DELETE FROM postition WHERE id = {model.Id}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string PositionsAVGCommnad(DateTime dateFrom, DateTime dateTo)
|
||||||
|
{
|
||||||
|
return $"SELECT \"position\".id, AVG(material_order.quantiny) FROM \"position\"\r\nJOIN employee ON employee.position_id = \"position\".id\r\nJOIN employee_order ON employee_order.employee_id = employee.id\r\nJOIN \"order\" ON \"order\".id = employee_order.order_id\r\nJOIN material_order ON material_order.order_id = \"order\".id\r\nJOIN material ON material.id = material_order.material_id\r\nWHERE \"order\".date_begin >= '{dateFrom}' AND \"order\".date_begin <= '{dateTo}'\r\nGROUP BY \"position\".id";
|
||||||
|
}
|
||||||
|
|
||||||
public PositionViewModel GetViewModel => new()
|
public PositionViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
this.сотрудникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.сотрудникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.должностиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.должностиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.назначитьНаЗаказToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.назначитьНаЗаказToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.отчётПоДолжностямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -41,7 +42,8 @@
|
|||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.сотрудникиToolStripMenuItem,
|
this.сотрудникиToolStripMenuItem,
|
||||||
this.должностиToolStripMenuItem,
|
this.должностиToolStripMenuItem,
|
||||||
this.назначитьНаЗаказToolStripMenuItem});
|
this.назначитьНаЗаказToolStripMenuItem,
|
||||||
|
this.отчётПоДолжностямToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(645, 28);
|
this.menuStrip1.Size = new System.Drawing.Size(645, 28);
|
||||||
@ -69,6 +71,13 @@
|
|||||||
this.назначитьНаЗаказToolStripMenuItem.Text = "Назначить на заказ";
|
this.назначитьНаЗаказToolStripMenuItem.Text = "Назначить на заказ";
|
||||||
this.назначитьНаЗаказToolStripMenuItem.Click += new System.EventHandler(this.назначитьНаЗаказToolStripMenuItem_Click);
|
this.назначитьНаЗаказToolStripMenuItem.Click += new System.EventHandler(this.назначитьНаЗаказToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// отчётПоДолжностямToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.отчётПоДолжностямToolStripMenuItem.Name = "отчётПоДолжностямToolStripMenuItem";
|
||||||
|
this.отчётПоДолжностямToolStripMenuItem.Size = new System.Drawing.Size(174, 24);
|
||||||
|
this.отчётПоДолжностямToolStripMenuItem.Text = "Отчёт по должностям";
|
||||||
|
this.отчётПоДолжностямToolStripMenuItem.Click += new System.EventHandler(this.отчётПоДолжностямToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// FormBrigadeMenu
|
// FormBrigadeMenu
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
@ -94,5 +103,6 @@
|
|||||||
private ToolStripMenuItem сотрудникиToolStripMenuItem;
|
private ToolStripMenuItem сотрудникиToolStripMenuItem;
|
||||||
private ToolStripMenuItem должностиToolStripMenuItem;
|
private ToolStripMenuItem должностиToolStripMenuItem;
|
||||||
private ToolStripMenuItem назначитьНаЗаказToolStripMenuItem;
|
private ToolStripMenuItem назначитьНаЗаказToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem отчётПоДолжностямToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,5 +43,14 @@ namespace ConstructionCompanyView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void отчётПоДолжностямToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormBrigadeReport));
|
||||||
|
if (service is FormBrigadeReport form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
134
ConstructionCompany/ConstructionCompanyView/FormBrigadeReport.Designer.cs
generated
Normal file
134
ConstructionCompany/ConstructionCompanyView/FormBrigadeReport.Designer.cs
generated
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
namespace ConstructionCompanyView
|
||||||
|
{
|
||||||
|
partial class FormBrigadeReport
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.buttonShow = new System.Windows.Forms.Button();
|
||||||
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(0, 20);
|
||||||
|
this.label1.TabIndex = 19;
|
||||||
|
//
|
||||||
|
// buttonShow
|
||||||
|
//
|
||||||
|
this.buttonShow.Location = new System.Drawing.Point(12, 72);
|
||||||
|
this.buttonShow.Name = "buttonShow";
|
||||||
|
this.buttonShow.Size = new System.Drawing.Size(134, 29);
|
||||||
|
this.buttonShow.TabIndex = 18;
|
||||||
|
this.buttonShow.Text = "Посчитать";
|
||||||
|
this.buttonShow.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonShow.Click += new System.EventHandler(this.buttonShow_Click);
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
|
||||||
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView.Location = new System.Drawing.Point(12, 107);
|
||||||
|
this.dataGridView.MultiSelect = false;
|
||||||
|
this.dataGridView.Name = "dataGridView";
|
||||||
|
this.dataGridView.RowHeadersVisible = false;
|
||||||
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
|
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridView.Size = new System.Drawing.Size(680, 366);
|
||||||
|
this.dataGridView.TabIndex = 20;
|
||||||
|
//
|
||||||
|
// dateTimePickerFrom
|
||||||
|
//
|
||||||
|
this.dateTimePickerFrom.Location = new System.Drawing.Point(12, 39);
|
||||||
|
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||||
|
this.dateTimePickerFrom.Size = new System.Drawing.Size(218, 27);
|
||||||
|
this.dateTimePickerFrom.TabIndex = 21;
|
||||||
|
//
|
||||||
|
// dateTimePickerTo
|
||||||
|
//
|
||||||
|
this.dateTimePickerTo.Location = new System.Drawing.Point(263, 39);
|
||||||
|
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
||||||
|
this.dateTimePickerTo.Size = new System.Drawing.Size(222, 27);
|
||||||
|
this.dateTimePickerTo.TabIndex = 22;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(12, 9);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(18, 20);
|
||||||
|
this.label2.TabIndex = 23;
|
||||||
|
this.label2.Text = "C";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(263, 9);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(29, 20);
|
||||||
|
this.label3.TabIndex = 24;
|
||||||
|
this.label3.Text = "По";
|
||||||
|
//
|
||||||
|
// FormBrigadeReport
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(704, 485);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.dateTimePickerTo);
|
||||||
|
this.Controls.Add(this.dateTimePickerFrom);
|
||||||
|
this.Controls.Add(this.dataGridView);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.buttonShow);
|
||||||
|
this.Name = "FormBrigadeReport";
|
||||||
|
this.Text = "Отчёт по использованию материалов должностями с датой";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private Label label1;
|
||||||
|
private Button buttonShow;
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private DateTimePicker dateTimePickerFrom;
|
||||||
|
private DateTimePicker dateTimePickerTo;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
using ConstructionCompanyContracts.BusinessLogicContracts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ConstructionCompanyView
|
||||||
|
{
|
||||||
|
public partial class FormBrigadeReport : Form
|
||||||
|
{
|
||||||
|
public IPositionLogic _logic;
|
||||||
|
public FormBrigadeReport(IPositionLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonShow_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dateTimePickerFrom.Value > dateTimePickerTo.Value)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Неверно выбраны даты!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
var list = _logic.ReadPositionsAverage(dateTimePickerFrom.Value.Date, dateTimePickerTo.Value.Date).OrderBy(x => x.PositionId).ToList();
|
||||||
|
stopwatch.Stop();
|
||||||
|
MessageBox.Show(stopwatch.ElapsedMilliseconds.ToString(), "Результат среднего по должностям. Время:");
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["PositionId"].Visible = false;
|
||||||
|
dataGridView.Columns["PositionName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -78,9 +78,10 @@ namespace ConstructionCompanyView
|
|||||||
//_random.GenerateEmployeesOrders();
|
//_random.GenerateEmployeesOrders();
|
||||||
//long employeesOrders = stopwatch.ElapsedMilliseconds;
|
//long employeesOrders = stopwatch.ElapsedMilliseconds;
|
||||||
//stopwatch.Restart();
|
//stopwatch.Restart();
|
||||||
_random.GenerateMaterialOrders();
|
//_random.GenerateMaterialOrders();
|
||||||
//stopwatch.Stop();
|
//stopwatch.Stop();
|
||||||
//long materialOrders = stopwatch.ElapsedMilliseconds;
|
//long materialOrders = stopwatch.ElapsedMilliseconds;
|
||||||
|
_random.GenerateAdditionalMaterialOrders();
|
||||||
//MessageBox.Show($"materials={materials}, positions={positions}, employees={employees}, orders={orders}, materialOrders={materialOrders}, employeeOrders={employeesOrders}", "Результаты");
|
//MessageBox.Show($"materials={materials}, positions={positions}, employees={employees}, orders={orders}, materialOrders={materialOrders}, employeeOrders={employeesOrders}", "Результаты");
|
||||||
MessageBox.Show("Готово!");
|
MessageBox.Show("Готово!");
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@
|
|||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(3, 3);
|
this.label2.Location = new System.Drawing.Point(3, 3);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(68, 20);
|
this.label2.Size = new System.Drawing.Size(280, 20);
|
||||||
this.label2.TabIndex = 15;
|
this.label2.TabIndex = 15;
|
||||||
this.label2.Text = "Рабочие";
|
this.label2.Text = "Рабочие имеющие доступ к материалу";
|
||||||
//
|
//
|
||||||
// FormWarehouseReport
|
// FormWarehouseReport
|
||||||
//
|
//
|
||||||
@ -97,7 +97,7 @@
|
|||||||
this.Controls.Add(this.comboBoxMaterial);
|
this.Controls.Add(this.comboBoxMaterial);
|
||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Name = "FormWarehouseReport";
|
this.Name = "FormWarehouseReport";
|
||||||
this.Text = "FormWarehouseReport";
|
this.Text = "Отчёт использования материлов ";
|
||||||
this.Load += new System.EventHandler(this.FormWarehouseReport_Load);
|
this.Load += new System.EventHandler(this.FormWarehouseReport_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@ -39,7 +39,7 @@ namespace ConstructionCompanyView
|
|||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
var list = _logic.ReadEmployeesUsingMaterial(model);
|
var list = _logic.ReadEmployeesUsingMaterial(model);
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
MessageBox.Show(stopwatch.ElapsedMilliseconds.ToString(), "Готово. Время:");
|
MessageBox.Show(stopwatch.ElapsedMilliseconds.ToString(), "Отчёт по материалам. Время:");
|
||||||
if (list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
|
@ -66,6 +66,7 @@ namespace ConstructionCompanyView
|
|||||||
services.AddTransient<FormEmployeeOrders>();
|
services.AddTransient<FormEmployeeOrders>();
|
||||||
services.AddTransient<FormEmployeeOrder>();
|
services.AddTransient<FormEmployeeOrder>();
|
||||||
services.AddTransient<FormWarehouseReport>();
|
services.AddTransient<FormWarehouseReport>();
|
||||||
|
services.AddTransient<FormBrigadeReport>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user