1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
6.3 KiB
C#

using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Winform.UserControlPages.RecipeConfigPages;
using HighWayIot.Winform.UserControlPages.SysConfigPages;
using Models;
using System;
using System.Collections;
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 HighWayIot.Winform.UserControlPages
{
public partial class RecipeConfigPage : UserControl
{
/// <summary>
/// 配方服务类实例
/// </summary>
ZxRecipeService zxRecipeService = ZxRecipeService.Instance;
/// <summary>
/// 称重服务类实例
/// </summary>
ZxWeightService zxWeightService = ZxWeightService.Instance;
/// <summary>
/// 配方字段服务类实例
/// </summary>
ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance;
/// <summary>
/// 称重DataGridView数据源
/// </summary>
List<WeightDataSourceEntity> weightDataSourceEntities;
/// <summary>
/// 配方列表
/// </summary>
List<ZxRecipeEntity> RecipeLists;
/// <summary>
/// 称量列表
/// </summary>
List<ZxWeightEntity> WeightLists;
public RecipeConfigPage()
{
InitializeComponent();
Init();
}
private void Init()
{
RecipeDataGridView.AutoGenerateColumns = false;
WeightDataGridView.AutoGenerateColumns = false;
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
}
/// <summary>
/// 添加配方信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AddRecipeButton_Click(object sender, EventArgs e)
{
AddRecipeForm form = new AddRecipeForm();
form.ShowDialog();
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
}
/// <summary>
/// 删除配方信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DeleteRecipeButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 修改配方信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateRecipeButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 刷新配方信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RefreshRecipeButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 添加称量信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AddWeightButton_Click(object sender, EventArgs e)
{
if(RecipeDataGridView.CurrentRow == null)
{
MessageBox.Show("请先选择一条配方!");
return;
}
int a = RecipeDataGridView.CurrentRow.Index;
string s = RecipeDataGridView.Rows[a].Cells["RecipeCode"].Value.ToString();
AddWeightForm form = new AddWeightForm(s);
form.ShowDialog();
WeightLists = zxWeightService.GetWeightInfos(s);
WeightDataGridView.DataSource = null;
WeightDataGridView.DataSource = WeightLists;
}
/// <summary>
/// 删除称量信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DeleteWeightButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 修改称量信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateWeightButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 刷新称量信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RefreshWeightButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 参数保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveParaButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 参数复制
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CopyParaButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 参数粘贴
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PasteParaButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 参数清空
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ClearCutBoradButton_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 所选配方内容更改事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RecipeDataGridView_SelectionChanged(object sender, EventArgs e)
{
int a = RecipeDataGridView.CurrentRow.Index;
string s = RecipeDataGridView.Rows[a].Cells["RecipeCode"].Value.ToString();
WeightLists = zxWeightService.GetWeightInfos(s);
WeightDataGridView.DataSource = null;
WeightDataGridView.DataSource = WeightLists;
}
/// <summary>
/// 称重和物料数据联查
/// </summary>
private void WeighCombineMaterialData()
{
}
}
}