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
{
///
/// 配方服务类实例
///
ZxRecipeService zxRecipeService = ZxRecipeService.Instance;
///
/// 称重服务类实例
///
ZxWeightService zxWeightService = ZxWeightService.Instance;
///
/// 配方字段服务类实例
///
ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance;
///
/// 称重DataGridView数据源
///
List weightDataSourceEntities;
///
/// 配方列表
///
List RecipeLists;
///
/// 称量列表
///
List WeightLists;
public RecipeConfigPage()
{
InitializeComponent();
Init();
}
private void Init()
{
RecipeDataGridView.AutoGenerateColumns = false;
WeightDataGridView.AutoGenerateColumns = false;
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
}
///
/// 添加配方信息
///
///
///
private void AddRecipeButton_Click(object sender, EventArgs e)
{
AddRecipeForm form = new AddRecipeForm();
form.ShowDialog();
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
}
///
/// 删除配方信息
///
///
///
private void DeleteRecipeButton_Click(object sender, EventArgs e)
{
}
///
/// 修改配方信息
///
///
///
private void UpdateRecipeButton_Click(object sender, EventArgs e)
{
}
///
/// 刷新配方信息
///
///
///
private void RefreshRecipeButton_Click(object sender, EventArgs e)
{
}
///
/// 添加称量信息
///
///
///
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;
}
///
/// 删除称量信息
///
///
///
private void DeleteWeightButton_Click(object sender, EventArgs e)
{
}
///
/// 修改称量信息
///
///
///
private void UpdateWeightButton_Click(object sender, EventArgs e)
{
}
///
/// 刷新称量信息
///
///
///
private void RefreshWeightButton_Click(object sender, EventArgs e)
{
}
///
/// 参数保存
///
///
///
private void SaveParaButton_Click(object sender, EventArgs e)
{
}
///
/// 参数复制
///
///
///
private void CopyParaButton_Click(object sender, EventArgs e)
{
}
///
/// 参数粘贴
///
///
///
private void PasteParaButton_Click(object sender, EventArgs e)
{
}
///
/// 参数清空
///
///
///
private void ClearCutBoradButton_Click(object sender, EventArgs e)
{
}
///
/// 所选配方内容更改事件
///
///
///
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;
}
///
/// 称重和物料数据联查
///
private void WeighCombineMaterialData()
{
}
}
}