Лаба 3, готовая.
This commit is contained in:
parent
3b3ab7ab9e
commit
76db4ba2e3
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace TradeAndProcurementEnterprice.Entities.Enums;
|
||||
|
||||
public enum Unit
|
||||
public enum Units
|
||||
{
|
||||
None = 0,
|
||||
Kilogram = 1,
|
@ -15,13 +15,13 @@ public class Product
|
||||
|
||||
public decimal SellingPrice { get; private set; }
|
||||
|
||||
public Unit Unit { get; private set; }
|
||||
public Units Unit { get; private set; }
|
||||
|
||||
public Category Category { get; private set; }
|
||||
|
||||
public int InventoryQuantity { get; private set; }
|
||||
|
||||
public static Product CreateEntity(int article, string name, decimal sellingPrice, Unit unit,
|
||||
public static Product CreateEntity(int article, string name, decimal sellingPrice, Units unit,
|
||||
Category category, int inventoryQuantity)
|
||||
{
|
||||
return new Product
|
||||
|
@ -39,6 +39,7 @@
|
||||
reportToolStripMenuItem = new ToolStripMenuItem();
|
||||
directoryReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
productReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
productAgentsToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -48,7 +49,8 @@
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { catalogToolStripMenuItem, operationToolStripMenuItem, reportToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1207, 42);
|
||||
menuStrip1.Padding = new Padding(3, 1, 0, 1);
|
||||
menuStrip1.Size = new Size(650, 24);
|
||||
menuStrip1.TabIndex = 0;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
@ -56,27 +58,27 @@
|
||||
//
|
||||
catalogToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { agentsToolStripMenuItem, nomenclatureToolStripMenuItem, purchasingCompanyToolStripMenuItem });
|
||||
catalogToolStripMenuItem.Name = "catalogToolStripMenuItem";
|
||||
catalogToolStripMenuItem.Size = new Size(184, 38);
|
||||
catalogToolStripMenuItem.Size = new Size(94, 22);
|
||||
catalogToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// agentsToolStripMenuItem
|
||||
//
|
||||
agentsToolStripMenuItem.Name = "agentsToolStripMenuItem";
|
||||
agentsToolStripMenuItem.Size = new Size(388, 44);
|
||||
agentsToolStripMenuItem.Size = new Size(195, 22);
|
||||
agentsToolStripMenuItem.Text = "Агенты-реализаторы";
|
||||
agentsToolStripMenuItem.Click += AgentsToolStripMenuItem_Click;
|
||||
//
|
||||
// nomenclatureToolStripMenuItem
|
||||
//
|
||||
nomenclatureToolStripMenuItem.Name = "nomenclatureToolStripMenuItem";
|
||||
nomenclatureToolStripMenuItem.Size = new Size(388, 44);
|
||||
nomenclatureToolStripMenuItem.Size = new Size(195, 22);
|
||||
nomenclatureToolStripMenuItem.Text = "Номенклатура";
|
||||
nomenclatureToolStripMenuItem.Click += NomenclatureToolStripMenuItem_Click;
|
||||
//
|
||||
// purchasingCompanyToolStripMenuItem
|
||||
//
|
||||
purchasingCompanyToolStripMenuItem.Name = "purchasingCompanyToolStripMenuItem";
|
||||
purchasingCompanyToolStripMenuItem.Size = new Size(388, 44);
|
||||
purchasingCompanyToolStripMenuItem.Size = new Size(195, 22);
|
||||
purchasingCompanyToolStripMenuItem.Text = "Компании закупщики";
|
||||
purchasingCompanyToolStripMenuItem.Click += PurchasingCompanyToolStripMenuItem_Click;
|
||||
//
|
||||
@ -84,35 +86,35 @@
|
||||
//
|
||||
operationToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { contractsToolStripMenuItem1, delegateToAgentsToolStripMenuItem });
|
||||
operationToolStripMenuItem.Name = "operationToolStripMenuItem";
|
||||
operationToolStripMenuItem.Size = new Size(147, 38);
|
||||
operationToolStripMenuItem.Size = new Size(75, 22);
|
||||
operationToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// contractsToolStripMenuItem1
|
||||
//
|
||||
contractsToolStripMenuItem1.Name = "contractsToolStripMenuItem1";
|
||||
contractsToolStripMenuItem1.Size = new Size(349, 44);
|
||||
contractsToolStripMenuItem1.Size = new Size(174, 22);
|
||||
contractsToolStripMenuItem1.Text = "Продажи";
|
||||
contractsToolStripMenuItem1.Click += ContractsToolStripMenuItem1_Click;
|
||||
//
|
||||
// delegateToAgentsToolStripMenuItem
|
||||
//
|
||||
delegateToAgentsToolStripMenuItem.Name = "delegateToAgentsToolStripMenuItem";
|
||||
delegateToAgentsToolStripMenuItem.Size = new Size(349, 44);
|
||||
delegateToAgentsToolStripMenuItem.Size = new Size(174, 22);
|
||||
delegateToAgentsToolStripMenuItem.Text = "Передача агентам";
|
||||
delegateToAgentsToolStripMenuItem.Click += DelegateToAgentsToolStripMenuItem_Click;
|
||||
//
|
||||
// reportToolStripMenuItem
|
||||
//
|
||||
reportToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { directoryReportToolStripMenuItem, productReportToolStripMenuItem });
|
||||
reportToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { directoryReportToolStripMenuItem, productReportToolStripMenuItem, productAgentsToolStripMenuItem });
|
||||
reportToolStripMenuItem.Name = "reportToolStripMenuItem";
|
||||
reportToolStripMenuItem.Size = new Size(116, 38);
|
||||
reportToolStripMenuItem.Size = new Size(60, 22);
|
||||
reportToolStripMenuItem.Text = "Отчёты";
|
||||
//
|
||||
// directoryReportToolStripMenuItem
|
||||
//
|
||||
directoryReportToolStripMenuItem.Name = "directoryReportToolStripMenuItem";
|
||||
directoryReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.W;
|
||||
directoryReportToolStripMenuItem.Size = new Size(559, 44);
|
||||
directoryReportToolStripMenuItem.Size = new Size(280, 22);
|
||||
directoryReportToolStripMenuItem.Text = "Документ со справочниками";
|
||||
directoryReportToolStripMenuItem.Click += DirectoryReportToolStripMenuItem_Click;
|
||||
//
|
||||
@ -120,20 +122,28 @@
|
||||
//
|
||||
productReportToolStripMenuItem.Name = "productReportToolStripMenuItem";
|
||||
productReportToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.E;
|
||||
productReportToolStripMenuItem.Size = new Size(559, 44);
|
||||
productReportToolStripMenuItem.Size = new Size(280, 22);
|
||||
productReportToolStripMenuItem.Text = "Движение номенклатуры";
|
||||
productReportToolStripMenuItem.Click += ProductReportToolStripMenuItem_Click;
|
||||
//
|
||||
// productAgentsToolStripMenuItem
|
||||
//
|
||||
productAgentsToolStripMenuItem.Name = "productAgentsToolStripMenuItem";
|
||||
productAgentsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.P;
|
||||
productAgentsToolStripMenuItem.Size = new Size(280, 22);
|
||||
productAgentsToolStripMenuItem.Text = "Распределение товара";
|
||||
productAgentsToolStripMenuItem.Click += ProductAgentsToolStripMenuItem_Click;
|
||||
//
|
||||
// FormEnterprice
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.photo_2024_12_03_21_34_38;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(1207, 723);
|
||||
ClientSize = new Size(650, 339);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Margin = new Padding(4, 2, 4, 2);
|
||||
Margin = new Padding(2, 1, 2, 1);
|
||||
Name = "FormEnterprice";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Торгово закупочное предприятие";
|
||||
@ -156,5 +166,6 @@
|
||||
private ToolStripMenuItem delegateToAgentsToolStripMenuItem;
|
||||
private ToolStripMenuItem directoryReportToolStripMenuItem;
|
||||
private ToolStripMenuItem productReportToolStripMenuItem;
|
||||
private ToolStripMenuItem productAgentsToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -97,5 +97,17 @@ namespace TradeAndProcurementEnterprice
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProductAgentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProductAgentReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -42,8 +42,8 @@ namespace TradeAndProcurementEnterprice.Forms
|
||||
}
|
||||
|
||||
_delegateToAgentRepository.CreateDelegatesToAgent(DelegateToAgents.CreateOperation(0,
|
||||
(int)comboBoxProduct.SelectedValue!, Convert.ToInt32(numericUpDownQuantity.Value),
|
||||
(int)comboBoxAgent.SelectedValue!));
|
||||
(int)comboBoxProduct.SelectedValue!,
|
||||
(int)comboBoxAgent.SelectedValue!, Convert.ToInt32(numericUpDownQuantity.Value)));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -52,7 +52,7 @@ namespace TradeAndProcurementEnterprice.Forms
|
||||
_productRepository = productRepository ??
|
||||
throw new ArgumentNullException(nameof(productRepository));
|
||||
|
||||
comboBoxUnit.DataSource = Enum.GetValues(typeof(Unit));
|
||||
comboBoxUnit.DataSource = Enum.GetValues(typeof(Units));
|
||||
comboBoxCategory.DataSource = Enum.GetValues(typeof(Category));
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ namespace TradeAndProcurementEnterprice.Forms
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private Product CreateProduct(int article) => Product.CreateEntity(article, textBoxName.Text,
|
||||
numericUpDownPrice.Value, (Unit)comboBoxUnit.SelectedItem, (Category)comboBoxCategory.SelectedItem,
|
||||
numericUpDownPrice.Value, (Units)comboBoxUnit.SelectedItem, (Category)comboBoxCategory.SelectedItem,
|
||||
Convert.ToInt32(numericUpDownQuantity.Value));
|
||||
}
|
||||
}
|
||||
|
111
TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Forms/FormProductAgentReport.Designer.cs
generated
Normal file
111
TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Forms/FormProductAgentReport.Designer.cs
generated
Normal file
@ -0,0 +1,111 @@
|
||||
namespace TradeAndProcurementEnterprice.Forms
|
||||
{
|
||||
partial class FormProductAgentReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
buttonChoose = new Button();
|
||||
labelFile = new Label();
|
||||
labelDate = new Label();
|
||||
dateTimePickerData = new DateTimePicker();
|
||||
buttonBuild = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonChoose
|
||||
//
|
||||
buttonChoose.Location = new Point(12, 12);
|
||||
buttonChoose.Name = "buttonChoose";
|
||||
buttonChoose.Size = new Size(81, 23);
|
||||
buttonChoose.TabIndex = 0;
|
||||
buttonChoose.Text = "Выбрать";
|
||||
buttonChoose.UseVisualStyleBackColor = true;
|
||||
buttonChoose.Click += ButtonChoose_Click;
|
||||
//
|
||||
// labelFile
|
||||
//
|
||||
labelFile.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelFile.AutoSize = true;
|
||||
labelFile.Location = new Point(108, 16);
|
||||
labelFile.Name = "labelFile";
|
||||
labelFile.Size = new Size(36, 15);
|
||||
labelFile.TabIndex = 1;
|
||||
labelFile.Text = "Файл";
|
||||
//
|
||||
// labelDate
|
||||
//
|
||||
labelDate.AutoSize = true;
|
||||
labelDate.Location = new Point(12, 50);
|
||||
labelDate.Name = "labelDate";
|
||||
labelDate.Size = new Size(32, 15);
|
||||
labelDate.TabIndex = 1;
|
||||
labelDate.Text = "Дата";
|
||||
//
|
||||
// dateTimePickerData
|
||||
//
|
||||
dateTimePickerData.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
dateTimePickerData.Location = new Point(57, 44);
|
||||
dateTimePickerData.Name = "dateTimePickerData";
|
||||
dateTimePickerData.Size = new Size(200, 23);
|
||||
dateTimePickerData.TabIndex = 2;
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonBuild.Location = new Point(66, 86);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(154, 23);
|
||||
buttonBuild.TabIndex = 3;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
buttonBuild.Click += ButtonBuild_Click;
|
||||
//
|
||||
// FormProductAgentReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(284, 121);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(dateTimePickerData);
|
||||
Controls.Add(labelDate);
|
||||
Controls.Add(labelFile);
|
||||
Controls.Add(buttonChoose);
|
||||
MinimumSize = new Size(300, 160);
|
||||
Name = "FormProductAgentReport";
|
||||
Text = "Распределение товара";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonChoose;
|
||||
private Label labelFile;
|
||||
private Label labelDate;
|
||||
private DateTimePicker dateTimePickerData;
|
||||
private Button buttonBuild;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TradeAndProcurementEnterprice.Reports;
|
||||
using Unity;
|
||||
|
||||
namespace TradeAndProcurementEnterprice.Forms
|
||||
{
|
||||
public partial class FormProductAgentReport : Form
|
||||
{
|
||||
private string _fileName = string.Empty;
|
||||
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormProductAgentReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ButtonChoose_Click(object sender, EventArgs e)
|
||||
{
|
||||
var saveFileDialog = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Pdf Files | *.pdf"
|
||||
};
|
||||
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_fileName = saveFileDialog.FileName;
|
||||
labelFile.Text = Path.GetFileName(_fileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_fileName))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета!");
|
||||
}
|
||||
|
||||
if (_container.Resolve<ChartReport>().CreateChart(_fileName, dateTimePickerData.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован.", "Формирование документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа! Подробности в логах.",
|
||||
"Формирование документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании очета!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
@ -43,26 +43,29 @@
|
||||
// dateTimePickerStart
|
||||
//
|
||||
dateTimePickerStart.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerStart.Location = new Point(241, 189);
|
||||
dateTimePickerStart.Location = new Point(130, 89);
|
||||
dateTimePickerStart.Margin = new Padding(2, 1, 2, 1);
|
||||
dateTimePickerStart.Name = "dateTimePickerStart";
|
||||
dateTimePickerStart.Size = new Size(496, 39);
|
||||
dateTimePickerStart.Size = new Size(269, 23);
|
||||
dateTimePickerStart.TabIndex = 0;
|
||||
//
|
||||
// labelPath
|
||||
//
|
||||
labelPath.AutoSize = true;
|
||||
labelPath.Location = new Point(40, 41);
|
||||
labelPath.Location = new Point(22, 19);
|
||||
labelPath.Margin = new Padding(2, 0, 2, 0);
|
||||
labelPath.Name = "labelPath";
|
||||
labelPath.Size = new Size(173, 32);
|
||||
labelPath.Size = new Size(87, 15);
|
||||
labelPath.TabIndex = 1;
|
||||
labelPath.Text = "Путь до файла";
|
||||
//
|
||||
// buttonSelectFilePath
|
||||
//
|
||||
buttonSelectFilePath.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSelectFilePath.Location = new Point(692, 41);
|
||||
buttonSelectFilePath.Location = new Point(373, 19);
|
||||
buttonSelectFilePath.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonSelectFilePath.Name = "buttonSelectFilePath";
|
||||
buttonSelectFilePath.Size = new Size(45, 39);
|
||||
buttonSelectFilePath.Size = new Size(24, 18);
|
||||
buttonSelectFilePath.TabIndex = 2;
|
||||
buttonSelectFilePath.Text = "..";
|
||||
buttonSelectFilePath.UseVisualStyleBackColor = true;
|
||||
@ -71,62 +74,69 @@
|
||||
// textBoxFilePath
|
||||
//
|
||||
textBoxFilePath.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBoxFilePath.Location = new Point(241, 41);
|
||||
textBoxFilePath.Location = new Point(130, 19);
|
||||
textBoxFilePath.Margin = new Padding(2, 1, 2, 1);
|
||||
textBoxFilePath.Name = "textBoxFilePath";
|
||||
textBoxFilePath.ReadOnly = true;
|
||||
textBoxFilePath.Size = new Size(445, 39);
|
||||
textBoxFilePath.Size = new Size(241, 23);
|
||||
textBoxFilePath.TabIndex = 3;
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(241, 113);
|
||||
comboBoxProduct.Location = new Point(130, 53);
|
||||
comboBoxProduct.Margin = new Padding(2, 1, 2, 1);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(496, 40);
|
||||
comboBoxProduct.Size = new Size(269, 23);
|
||||
comboBoxProduct.TabIndex = 4;
|
||||
//
|
||||
// labelProduct
|
||||
//
|
||||
labelProduct.AutoSize = true;
|
||||
labelProduct.Location = new Point(40, 116);
|
||||
labelProduct.Location = new Point(22, 54);
|
||||
labelProduct.Margin = new Padding(2, 0, 2, 0);
|
||||
labelProduct.Name = "labelProduct";
|
||||
labelProduct.Size = new Size(174, 32);
|
||||
labelProduct.Size = new Size(88, 15);
|
||||
labelProduct.TabIndex = 1;
|
||||
labelProduct.Text = "Номенклатура";
|
||||
//
|
||||
// dateTimePickerEnd
|
||||
//
|
||||
dateTimePickerEnd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
dateTimePickerEnd.Location = new Point(241, 262);
|
||||
dateTimePickerEnd.Location = new Point(130, 123);
|
||||
dateTimePickerEnd.Margin = new Padding(2, 1, 2, 1);
|
||||
dateTimePickerEnd.Name = "dateTimePickerEnd";
|
||||
dateTimePickerEnd.Size = new Size(496, 39);
|
||||
dateTimePickerEnd.Size = new Size(269, 23);
|
||||
dateTimePickerEnd.TabIndex = 0;
|
||||
//
|
||||
// labelDateStart
|
||||
//
|
||||
labelDateStart.AutoSize = true;
|
||||
labelDateStart.Location = new Point(40, 194);
|
||||
labelDateStart.Location = new Point(22, 91);
|
||||
labelDateStart.Margin = new Padding(2, 0, 2, 0);
|
||||
labelDateStart.Name = "labelDateStart";
|
||||
labelDateStart.Size = new Size(149, 32);
|
||||
labelDateStart.Size = new Size(74, 15);
|
||||
labelDateStart.TabIndex = 1;
|
||||
labelDateStart.Text = "Дата начала";
|
||||
//
|
||||
// labelDateEnd
|
||||
//
|
||||
labelDateEnd.AutoSize = true;
|
||||
labelDateEnd.Location = new Point(40, 267);
|
||||
labelDateEnd.Location = new Point(22, 125);
|
||||
labelDateEnd.Margin = new Padding(2, 0, 2, 0);
|
||||
labelDateEnd.Name = "labelDateEnd";
|
||||
labelDateEnd.Size = new Size(199, 32);
|
||||
labelDateEnd.Size = new Size(98, 15);
|
||||
labelDateEnd.TabIndex = 1;
|
||||
labelDateEnd.Text = "Дата окончания ";
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonBuild.Location = new Point(229, 343);
|
||||
buttonBuild.Location = new Point(123, 161);
|
||||
buttonBuild.Margin = new Padding(2, 1, 2, 1);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(306, 46);
|
||||
buttonBuild.Size = new Size(165, 22);
|
||||
buttonBuild.TabIndex = 5;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
@ -134,9 +144,9 @@
|
||||
//
|
||||
// FormProductReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(769, 414);
|
||||
ClientSize = new Size(419, 209);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(textBoxFilePath);
|
||||
@ -147,9 +157,10 @@
|
||||
Controls.Add(labelPath);
|
||||
Controls.Add(dateTimePickerEnd);
|
||||
Controls.Add(dateTimePickerStart);
|
||||
MinimumSize = new Size(795, 485);
|
||||
Margin = new Padding(2, 1, 2, 1);
|
||||
MinimumSize = new Size(435, 248);
|
||||
Name = "FormProductReport";
|
||||
Text = "FormProductReport";
|
||||
Text = "Движение номенклатуры";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TradeAndProcurementEnterprice.Repositories;
|
||||
|
||||
namespace TradeAndProcurementEnterprice.Reports;
|
||||
|
||||
internal class ChartReport
|
||||
{
|
||||
private readonly IDelegateToAgentRepository _delegateToAgentRepository;
|
||||
|
||||
private readonly ILogger<ChartReport> _logger;
|
||||
|
||||
public ChartReport(IDelegateToAgentRepository delegateToAgentRepository, ILogger<ChartReport> logger)
|
||||
{
|
||||
_delegateToAgentRepository = delegateToAgentRepository ??
|
||||
throw new ArgumentNullException(nameof(delegateToAgentRepository));
|
||||
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateChart(string filePath, DateTime dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
new PdfBuilder(filePath)
|
||||
.AddHeader("Передача товара агентам-реализаторам")
|
||||
.AddPieChart("Выдача товара", GetData(dateTime))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
||||
{
|
||||
return _delegateToAgentRepository
|
||||
.ReadDelegatesToAgent()
|
||||
.Where(x => x.Date.Date == dateTime.Date)
|
||||
.GroupBy(x => x.ProductArticle, (key, group) => new
|
||||
{
|
||||
Id = key,
|
||||
Quantity = group.Sum(x => x.Quantity)
|
||||
})
|
||||
.Select(x => (x.Id.ToString(), (double)x.Quantity))
|
||||
.ToList();
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ internal class ExcelBuilder
|
||||
|
||||
public ExcelBuilder AddHeader(string header, int startIndex, int cnt)
|
||||
{
|
||||
CreateCell(startIndex, _rowIndex, header, StyleIndex.SimpleTextWithoutBorder);
|
||||
CreateCell(startIndex, _rowIndex, header, StyleIndex.BoldTextWithoutBorder);
|
||||
for (int i = startIndex + 1; i < startIndex + cnt; ++i)
|
||||
{
|
||||
CreateCell(i, _rowIndex, "", StyleIndex.SimpleTextWithoutBorder);
|
||||
@ -90,7 +90,7 @@ internal class ExcelBuilder
|
||||
|
||||
for (var j = 0; j < data.First().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.First()[j], StyleIndex.SimpleTextWithoutBorder);
|
||||
CreateCell(j, _rowIndex, data.First()[j], StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
|
||||
_rowIndex++;
|
||||
@ -98,7 +98,7 @@ internal class ExcelBuilder
|
||||
{
|
||||
for (var j = 0; j < data[i].Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data[i][j], StyleIndex.SimpleTextWithoutBorder);
|
||||
CreateCell(j, _rowIndex, data[i][j], StyleIndex.SimpleTextWithBorder);
|
||||
}
|
||||
|
||||
_rowIndex++;
|
||||
@ -106,7 +106,7 @@ internal class ExcelBuilder
|
||||
|
||||
for (var j = 0; j < data.Last().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.Last()[j], StyleIndex.SimpleTextWithoutBorder);
|
||||
CreateCell(j, _rowIndex, data.Last()[j], StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
|
||||
_rowIndex++;
|
||||
@ -163,7 +163,18 @@ internal class ExcelBuilder
|
||||
FontScheme = new FontScheme() { Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor) }
|
||||
});
|
||||
|
||||
// TODO добавить шрифт с жирным.
|
||||
// Жирный шрифт.
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
},
|
||||
Bold = new Bold() { Val = true }
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fonts);
|
||||
|
||||
// Default Fill.
|
||||
@ -184,8 +195,16 @@ internal class ExcelBuilder
|
||||
BottomBorder = new BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
|
||||
// TODO добавить настройку с границами.
|
||||
|
||||
// Настройка с границами.
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin },
|
||||
RightBorder = new RightBorder() { Style = BorderStyleValues.Thin },
|
||||
TopBorder = new TopBorder() { Style = BorderStyleValues.Thin },
|
||||
BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin },
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(borders);
|
||||
|
||||
// Default cell format and a date cell format.
|
||||
@ -204,14 +223,58 @@ internal class ExcelBuilder
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
|
||||
// TODO дополнить форматы.
|
||||
|
||||
// Форматы.
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Right,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
private enum StyleIndex
|
||||
{
|
||||
SimpleTextWithoutBorder = 0,
|
||||
// TODO дополнить стили.
|
||||
SimpleTextWithoutBorder = 0,
|
||||
SimpleTextWithBorder = 1,
|
||||
BoldTextWithoutBorder = 2,
|
||||
BoldTextWithBorder = 3,
|
||||
}
|
||||
|
||||
private void CreateCell(int columnIndex, uint rowIndex, string text, StyleIndex styleIndex)
|
||||
|
@ -0,0 +1,98 @@
|
||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TradeAndProcurementEnterprice.Entities.Enums;
|
||||
|
||||
namespace TradeAndProcurementEnterprice.Reports;
|
||||
|
||||
internal class PdfBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
|
||||
private readonly Document _document;
|
||||
|
||||
public PdfBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
DefineStyles();
|
||||
}
|
||||
|
||||
public PdfBuilder AddHeader(string header)
|
||||
{
|
||||
_document.AddSection().AddParagraph(header, "NormalBold");
|
||||
return this;
|
||||
}
|
||||
|
||||
public PdfBuilder AddPieChart(string title, List<(string Caption, double Value)> data)
|
||||
{
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
var chart = new Chart(ChartType.Pie2D);
|
||||
var series = chart.SeriesCollection.AddSeries();
|
||||
series.Add(data.Select(x => x.Value).ToArray());
|
||||
|
||||
var xseries = chart.XValues.AddXSeries();
|
||||
xseries.Add(data.Select(x => x.Caption).ToArray());
|
||||
|
||||
chart.DataLabel.Type = DataLabelType.Percent;
|
||||
chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
|
||||
|
||||
chart.Width = Unit.FromCentimeter(16);
|
||||
chart.Height = Unit.FromCentimeter(12);
|
||||
|
||||
chart.TopArea.AddParagraph(title);
|
||||
|
||||
chart.XAxis.MajorTickMark = TickMarkType.Outside;
|
||||
|
||||
chart.YAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.HasMajorGridlines = true;
|
||||
|
||||
chart.PlotArea.LineFormat.Width = 1;
|
||||
chart.PlotArea.LineFormat.Visible = true;
|
||||
|
||||
chart.TopArea.AddLegend();
|
||||
|
||||
_document.LastSection.Add(chart);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(_filePath);
|
||||
}
|
||||
|
||||
private void DefineStyles()
|
||||
{
|
||||
// Стиль для заголовка (жирный).
|
||||
var headerStyle = _document.Styles.AddStyle("NormalBold", "Normal");
|
||||
headerStyle.Font.Bold = true;
|
||||
headerStyle.Font.Size = 20;
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ internal class TableReport
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
internal static readonly string[] item = ["Агент-реализатор", "Дата", "Продано", "Получено"];
|
||||
internal static readonly string[] item = ["Агент-реализатор", "Дата", "Передано агенту", "Продано агентом"];
|
||||
|
||||
public TableReport(IContractRepository contractRepository, IDelegateToAgentRepository
|
||||
delegateToAgentRepository, ILogger<TableReport> logger)
|
||||
@ -64,7 +64,13 @@ internal class TableReport
|
||||
_delegateToAgentRepository
|
||||
.ReadDelegatesToAgent()
|
||||
.Where(x => x.Date >= startDate && x.Date <= endDate && x.ProductArticle == productArticle)
|
||||
.Select(x => new { x.AgentsID, CurrentDate = x.Date, CountIn = (int?)x.Quantity, CountOut = (int?)null }))
|
||||
.Select(x => new
|
||||
{
|
||||
x.AgentsID,
|
||||
CurrentDate = x.Date,
|
||||
CountIn = (int?)x.Quantity,
|
||||
CountOut = (int?)null
|
||||
}))
|
||||
.OrderBy(x => x.CurrentDate);
|
||||
|
||||
return
|
||||
|
@ -40,7 +40,9 @@ internal class WordBuilder
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
// TODO прописать настройки под жирный текст.
|
||||
// Настройки под жирный текст.
|
||||
//var runProperties = run.AppendChild(new RunProperties());
|
||||
//runProperties.AppendChild(new Bold());
|
||||
run.AppendChild(new Text(header));
|
||||
|
||||
return this;
|
||||
@ -49,7 +51,9 @@ internal class WordBuilder
|
||||
public WordBuilder AddParagraph(string text)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
var runProperties = run.AppendChild(new RunProperties());
|
||||
runProperties.AppendChild(new Bold());
|
||||
run.AppendChild(new Text(text));
|
||||
|
||||
return this;
|
||||
|
@ -65,16 +65,16 @@ VALUES (@ID, @ProductArticle, @ProductQuantity)";
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"
|
||||
SELECT c.*, ps.ProductArticle, ps.ProductQuantity FROM Contracts c
|
||||
INNER JOIN ProductSales ps ON ps.ID = c.ID";
|
||||
var contracts = connection.Query<TempProductSales>(querySelect);
|
||||
INNER JOIN ProductSales ps ON ps.ID = c.ID";
|
||||
var contracts = connection.Query<TempProductSales>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(contracts));
|
||||
return contracts.GroupBy(x => x.ID, y => y,
|
||||
(key, value) => Contract.CreateOperation(value.First(),
|
||||
value.Select(z => ProductSales.CreateElement(0, z.ProductArticle, z.ProductQuantity))));
|
||||
value.Select(z => ProductSales.CreateElement(0, z.ProductArticle, z.ProductQuantity)))).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов!");
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов!");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.2" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
<PackageReference Include="Serilog" Version="4.0.2" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
||||
|
Loading…
Reference in New Issue
Block a user