2024-05-16 21:48:52 +04:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2024-03-22 20:10:17 +04:00
|
|
|
|
using PrecastConcretePlantContracts.BindingModels;
|
|
|
|
|
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
namespace PrecastConcretePlantView
|
|
|
|
|
{
|
|
|
|
|
public partial class FormMain : Form
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
private readonly IOrderLogic _orderLogic;
|
|
|
|
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_orderLogic = orderLogic;
|
|
|
|
|
}
|
|
|
|
|
private void FormMain_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
private void LoadData()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var list = _orderLogic.ReadList(null);
|
|
|
|
|
if (list != null)
|
|
|
|
|
{
|
|
|
|
|
dataGridView.DataSource = list;
|
|
|
|
|
dataGridView.Columns["ReinforcedId"].Visible = false;
|
2024-05-16 21:48:52 +04:00
|
|
|
|
dataGridView.Columns["reinforcedName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
_logger.LogInformation("青沭箸赅 玎赅珙<E8B585>");
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
_logger.LogError(ex, "硒栳赅 玎沭箸觇 玎赅珙<E8B585>");
|
|
|
|
|
MessageBox.Show(ex.Message, "硒栳赅", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
private void 暑祜铐屙螓ToolStripMenuItem_Click(object sender, EventArgs e)
|
2024-03-22 20:10:17 +04:00
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
var service =
|
|
|
|
|
Program.ServiceProvider?.GetService(typeof(FormComponentS));
|
2024-03-22 20:10:17 +04:00
|
|
|
|
if (service is FormComponentS form)
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
private void 如溴腓<EFBFBD>ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
|
2024-03-22 20:10:17 +04:00
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormReinforcedS));
|
|
|
|
|
if (service is FormReinforcedS form)
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
private void 锑汔玷睇ToolStripMenuItem_Click(object sender, EventArgs e)
|
2024-04-18 23:41:30 +04:00
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
|
|
|
|
if (service is FormShops form)
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
private void 项镱腠屙桢锑汔玷磬ToolStripMenuItem_Click(object sender, EventArgs e)
|
2024-04-18 23:41:30 +04:00
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormShopReplenishment));
|
|
|
|
|
if (service is FormShopReplenishment form)
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void 橡钿噫嗳玟咫栝ToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(FormReinforcedSale));
|
|
|
|
|
if (service is FormReinforcedSale form)
|
2024-04-18 23:41:30 +04:00
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-22 20:10:17 +04:00
|
|
|
|
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
var service =
|
|
|
|
|
Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
2024-03-22 20:10:17 +04:00
|
|
|
|
if (service is FormCreateOrder form)
|
|
|
|
|
{
|
|
|
|
|
form.ShowDialog();
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (dataGridView.SelectedRows.Count == 1)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
int id =
|
|
|
|
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
|
|
|
_logger.LogInformation("青赅<E99D92> 箋id}. 体<><E4BD93>弪<EFBFBD><E5BCAA> 耱囹篑 磬 '<27> 疣犷蝈'", id);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
2024-03-22 20:10:17 +04:00
|
|
|
|
if (!operationResult)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
throw new Exception("硒栳赅 镳<> 耦躔囗屙梃.念镱腠栩咫<E6A0A9><E592AB><EFBFBD> 桧纛痨圉<E797A8><E59C89> <20> 腩汔<E885A9>.");
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
_logger.LogError(ex, "硒栳赅 镥疱溧麒 玎赅玎 <20> 疣犷蝮");
|
|
|
|
|
MessageBox.Show(ex.Message, "硒栳赅", MessageBoxButtons.OK,
|
|
|
|
|
MessageBoxIcon.Error);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (dataGridView.SelectedRows.Count == 1)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
int id =
|
|
|
|
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
|
|
|
_logger.LogInformation("青赅<E99D92> 箋id}. 体<><E4BD93>弪<EFBFBD><E5BCAA> 耱囹篑 磬 '妙蝾<E5A699>'",
|
|
|
|
|
id);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
var operationResult = _orderLogic.FinishOrder(new
|
|
|
|
|
OrderBindingModel
|
|
|
|
|
{ Id = id });
|
2024-03-22 20:10:17 +04:00
|
|
|
|
if (!operationResult)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
throw new Exception("硒栳赅 镳<> 耦躔囗屙梃. 念镱腠栩咫<E6A0A9><E592AB><EFBFBD> 桧纛痨圉<E797A8><E59C89> <20> 腩汔<E885A9>.");
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
_logger.LogError(ex, "硒栳赅 铗戾蜿<E688BE> <20> 泐蝾忭铖蜩 玎赅玎");
|
|
|
|
|
MessageBox.Show(ex.Message, "硒栳赅", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (dataGridView.SelectedRows.Count == 1)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
int id =
|
|
|
|
|
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
|
|
|
_logger.LogInformation("青赅<E99D92> 箋id}. 体<><E4BD93>弪<EFBFBD><E5BCAA> 耱囹篑 磬 '蔓溧<E89493>'", id);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
2024-03-22 20:10:17 +04:00
|
|
|
|
if (!operationResult)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
throw new Exception("硒栳赅");
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
_logger.LogInformation("青赅<E99D92> 箋id} 恹溧<E681B9>", id);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2024-05-16 21:48:52 +04:00
|
|
|
|
_logger.LogError(ex, "硒栳赅 铗戾蜿<E688BE> <20> 恹溧麒 玎赅玎");
|
|
|
|
|
MessageBox.Show(ex.Message, "硒栳赅", MessageBoxButtons.OK,
|
|
|
|
|
MessageBoxIcon.Error);
|
2024-03-22 20:10:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-16 21:48:52 +04:00
|
|
|
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
2024-03-22 20:10:17 +04:00
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|