|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using HighWayIot.Repository.domain;
|
|
|
|
|
using HighWayIot.Repository.service;
|
|
|
|
|
using HighWayIot.Winform.Business;
|
|
|
|
|
using HighWayIot.Winform.UserControlPages.RecipeConfigPages;
|
|
|
|
|
using HighWayIot.Winform.UserControlPages.SysConfigPages;
|
|
|
|
|
using Models;
|
|
|
|
@ -38,6 +39,16 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方字段实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeParaEntity zxRecipeParaEntity = new ZxRecipeParaEntity();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方字段实例剪切板
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeParaEntity zxRecipeParaEntityCut;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 称重DataGridView数据源
|
|
|
|
|
/// </summary>
|
|
|
|
@ -99,7 +110,7 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
{
|
|
|
|
|
id = int.Parse(RecipeDataGridView.Rows[a].Cells["RId"].Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("ID转换发生错误");
|
|
|
|
|
return;
|
|
|
|
@ -149,7 +160,7 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
{
|
|
|
|
|
DataGridViewRow nowRow = RecipeDataGridView.CurrentRow;
|
|
|
|
|
|
|
|
|
|
if(MessageBox.Show($"确认要更改编号为 [{nowRow.Cells["RecipeCode"].Value.ToString()}] 配方的数据吗", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
|
|
|
|
if (MessageBox.Show($"确认要更改编号为 [{nowRow.Cells["RecipeCode"].Value.ToString()}] 配方的数据吗", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -355,7 +366,52 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void SaveParaButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string s = RecipeDataGridView.CurrentRow.Cells["RecipeCode"].Value.ToString();
|
|
|
|
|
|
|
|
|
|
if (MessageBox.Show($"确定要保存配方编号为 [{s}] 的配方的参数?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZxRecipeParaEntity entity = GetParaValue();
|
|
|
|
|
|
|
|
|
|
entity.IsDeleted = false;
|
|
|
|
|
entity.RecipeCode = s;
|
|
|
|
|
|
|
|
|
|
zxRecipeParaEntity = entity;
|
|
|
|
|
|
|
|
|
|
var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(zxRecipeParaEntity.RecipeCode);
|
|
|
|
|
|
|
|
|
|
//没有就插入
|
|
|
|
|
if (paraData.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
if (zxRecipeParaService.InsertRecipeParaInfo(zxRecipeParaEntity))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("保存成功!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("保存失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//有就更改
|
|
|
|
|
else if (paraData.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
zxRecipeParaEntity.Id = paraData[0].Id;
|
|
|
|
|
if (zxRecipeParaService.UpdateRecipeParaInfo(zxRecipeParaEntity))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("保存成功!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("保存失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("存在多条未删除的相同配方参数!请检查数据库。");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -365,7 +421,8 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void CopyParaButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
zxRecipeParaEntityCut = GetParaValue();
|
|
|
|
|
NowCopyLabel.Text = RecipeDataGridView.CurrentRow.Cells["RecipeCode"].Value.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -375,7 +432,11 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void PasteParaButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (zxRecipeParaEntityCut == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("剪切板为空!");
|
|
|
|
|
}
|
|
|
|
|
SetParaValue(zxRecipeParaEntityCut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -385,7 +446,8 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void ClearCutBoradButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
zxRecipeParaEntityCut = null;
|
|
|
|
|
NowCopyLabel.Text = "N/A";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -404,6 +466,24 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
|
|
|
|
|
WeightDataGridView.DataSource = null;
|
|
|
|
|
WeightDataGridView.DataSource = weightDataSourceEntities;
|
|
|
|
|
|
|
|
|
|
var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(s);
|
|
|
|
|
//没有就全0
|
|
|
|
|
if (paraData.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
SetParaValue(new ZxRecipeParaEntity());
|
|
|
|
|
}
|
|
|
|
|
//有就显示
|
|
|
|
|
else if (paraData.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
SetParaValue(paraData[0]);
|
|
|
|
|
}
|
|
|
|
|
//有多条设为第一条
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("存在多条未删除的相同配方字段信息!将设置为第一条,请检查数据库。");
|
|
|
|
|
SetParaValue(paraData[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -448,12 +528,71 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 所选单条Weight dataSource转为实体类
|
|
|
|
|
/// 设置配方字段值
|
|
|
|
|
/// </summary>
|
|
|
|
|
//private ZxWeightEntity DataSourceToWeight()
|
|
|
|
|
//{
|
|
|
|
|
// int a = WeightDataGridView.CurrentRow.Index;
|
|
|
|
|
// foreach
|
|
|
|
|
//}
|
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
|
private void SetParaValue(ZxRecipeParaEntity entity)
|
|
|
|
|
{
|
|
|
|
|
zxRecipeParaEntity = entity;
|
|
|
|
|
E1P1TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E1P1);
|
|
|
|
|
E1P2TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E1P2);
|
|
|
|
|
E1P3TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E1P3);
|
|
|
|
|
E1P4TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E1P4);
|
|
|
|
|
E2P1TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E2P1);
|
|
|
|
|
E2P2TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E2P2);
|
|
|
|
|
E2P3TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E2P3);
|
|
|
|
|
E2P4TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E2P4);
|
|
|
|
|
E3P1TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P1);
|
|
|
|
|
E3P2TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P2);
|
|
|
|
|
E3P3TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P3);
|
|
|
|
|
E3P4TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P4);
|
|
|
|
|
E3P5CheckBox.Checked = zxRecipeParaEntity.E3P5 == 1;
|
|
|
|
|
E3P6TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P6);
|
|
|
|
|
E3P7TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P7);
|
|
|
|
|
E3P8TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P8);
|
|
|
|
|
E3P9TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P9);
|
|
|
|
|
E3P10TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P10);
|
|
|
|
|
E3P11TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P11);
|
|
|
|
|
E3P12TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P12);
|
|
|
|
|
E3P13TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P13);
|
|
|
|
|
E3P14TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P14);
|
|
|
|
|
E3P15TextBox.Text = GeneralUtils.IntEmptyOrToString(zxRecipeParaEntity.E3P15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取界面上的配方参数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>获取到的配方参数值</returns>
|
|
|
|
|
private ZxRecipeParaEntity GetParaValue()
|
|
|
|
|
{
|
|
|
|
|
ZxRecipeParaEntity entity = new ZxRecipeParaEntity()
|
|
|
|
|
{
|
|
|
|
|
E1P1 = GeneralUtils.StringNullOrToInt(E1P1TextBox.Text),
|
|
|
|
|
E1P2 = GeneralUtils.StringNullOrToInt(E1P2TextBox.Text),
|
|
|
|
|
E1P3 = GeneralUtils.StringNullOrToInt(E1P3TextBox.Text),
|
|
|
|
|
E1P4 = GeneralUtils.StringNullOrToInt(E1P4TextBox.Text),
|
|
|
|
|
E2P1 = GeneralUtils.StringNullOrToInt(E2P1TextBox.Text),
|
|
|
|
|
E2P2 = GeneralUtils.StringNullOrToInt(E2P2TextBox.Text),
|
|
|
|
|
E2P3 = GeneralUtils.StringNullOrToInt(E2P3TextBox.Text),
|
|
|
|
|
E2P4 = GeneralUtils.StringNullOrToInt(E2P4TextBox.Text),
|
|
|
|
|
E3P1 = GeneralUtils.StringNullOrToInt(E3P1TextBox.Text),
|
|
|
|
|
E3P2 = GeneralUtils.StringNullOrToInt(E3P2TextBox.Text),
|
|
|
|
|
E3P3 = GeneralUtils.StringNullOrToInt(E3P3TextBox.Text),
|
|
|
|
|
E3P4 = GeneralUtils.StringNullOrToInt(E3P4TextBox.Text),
|
|
|
|
|
E3P5 = E3P5CheckBox.Checked ? 1 : 0,
|
|
|
|
|
E3P6 = GeneralUtils.StringNullOrToInt(E3P6TextBox.Text),
|
|
|
|
|
E3P7 = GeneralUtils.StringNullOrToInt(E3P7TextBox.Text),
|
|
|
|
|
E3P8 = GeneralUtils.StringNullOrToInt(E3P8TextBox.Text),
|
|
|
|
|
E3P9 = GeneralUtils.StringNullOrToInt(E3P9TextBox.Text),
|
|
|
|
|
E3P10 = GeneralUtils.StringNullOrToInt(E3P10TextBox.Text),
|
|
|
|
|
E3P11 = GeneralUtils.StringNullOrToInt(E3P11TextBox.Text),
|
|
|
|
|
E3P12 = GeneralUtils.StringNullOrToInt(E3P12TextBox.Text),
|
|
|
|
|
E3P13 = GeneralUtils.StringNullOrToInt(E3P13TextBox.Text),
|
|
|
|
|
E3P14 = GeneralUtils.StringNullOrToInt(E3P14TextBox.Text),
|
|
|
|
|
E3P15 = GeneralUtils.StringNullOrToInt(E3P15TextBox.Text),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|