|
|
|
|
@ -22,47 +22,57 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方服务类实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeService zxRecipeService = ZxRecipeService.Instance;
|
|
|
|
|
private ZxRecipeService zxRecipeService = ZxRecipeService.Instance;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 称重服务类实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxWeightService zxWeightService = ZxWeightService.Instance;
|
|
|
|
|
private ZxWeightService zxWeightService = ZxWeightService.Instance;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方服务类实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxMaterialService zxMaterialService = ZxMaterialService.Instance;
|
|
|
|
|
private ZxMaterialService zxMaterialService = ZxMaterialService.Instance;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方字段服务类实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance;
|
|
|
|
|
private ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工位配方字段服务类实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ZxRecipePositionParaService zxRecipePositionParaService = ZxRecipePositionParaService.Instance;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方字段实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeParaEntity zxRecipeParaEntity = new ZxRecipeParaEntity();
|
|
|
|
|
private ZxRecipeParaEntity zxRecipeParaEntity = new ZxRecipeParaEntity();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工位配方字段实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ZxRecipePositionParaEntity zxRecipePositionParaEntity = new ZxRecipePositionParaEntity();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方字段实例剪切板
|
|
|
|
|
/// </summary>
|
|
|
|
|
ZxRecipeParaEntity zxRecipeParaEntityCut;
|
|
|
|
|
private ZxRecipeParaEntity zxRecipeParaEntityCut;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 称重DataGridView数据源
|
|
|
|
|
/// </summary>
|
|
|
|
|
List<WeightDataSourceEntity> weightDataSourceEntities;
|
|
|
|
|
private List<WeightDataSourceEntity> weightDataSourceEntities;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配方列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
List<ZxRecipeEntity> RecipeLists;
|
|
|
|
|
private List<ZxRecipeEntity> RecipeLists;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 称量列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
List<ZxWeightEntity> WeightLists;
|
|
|
|
|
private List<ZxWeightEntity> WeightLists;
|
|
|
|
|
|
|
|
|
|
public RecipeConfigPage()
|
|
|
|
|
{
|
|
|
|
|
@ -368,20 +378,17 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
{
|
|
|
|
|
string s = RecipeDataGridView.CurrentRow.Cells["RecipeCode"].Value.ToString();
|
|
|
|
|
|
|
|
|
|
if (MessageBox.Show($"确定要保存配方编号为 [{s}] 的配方的参数?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//if (MessageBox.Show($"确定要保存配方编号为 [{s}] 的配方的参数?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
ZxRecipeParaEntity entity = GetParaValue();
|
|
|
|
|
|
|
|
|
|
entity.IsDeleted = false;
|
|
|
|
|
entity.RecipeCode = s;
|
|
|
|
|
|
|
|
|
|
zxRecipeParaEntity = entity;
|
|
|
|
|
ZxRecipePositionParaEntity entity = GetParaValue();
|
|
|
|
|
|
|
|
|
|
var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(zxRecipeParaEntity.RecipeCode);
|
|
|
|
|
|
|
|
|
|
int flag = GetSelectIndex();
|
|
|
|
|
|
|
|
|
|
//没有就插入
|
|
|
|
|
if (paraData.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
@ -421,7 +428,7 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void CopyParaButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
zxRecipeParaEntityCut = GetParaValue();
|
|
|
|
|
//zxRecipeParaEntityCut = GetParaValue();
|
|
|
|
|
NowCopyLabel.Text = RecipeDataGridView.CurrentRow.Cells["RecipeCode"].Value.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -437,7 +444,7 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
MessageBox.Show("剪切板为空!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
SetParaValue(zxRecipeParaEntityCut);
|
|
|
|
|
//SetParaValue(zxRecipeParaEntityCut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -452,7 +459,7 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
|
|
|
|
|
if (MessageBox.Show("是否要清空前端数据", "", MessageBoxButtons.YesNo) == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
SetParaValue(new ZxRecipeParaEntity());
|
|
|
|
|
//SetParaValue(new ZxRecipeParaEntity());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -473,22 +480,23 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
WeightDataGridView.DataSource = null;
|
|
|
|
|
WeightDataGridView.DataSource = weightDataSourceEntities;
|
|
|
|
|
|
|
|
|
|
//设置参数
|
|
|
|
|
var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(s);
|
|
|
|
|
//没有就全0
|
|
|
|
|
if (paraData.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
SetParaValue(new ZxRecipeParaEntity());
|
|
|
|
|
//SetParaValue(new ZxRecipeParaEntity());
|
|
|
|
|
}
|
|
|
|
|
//有就显示
|
|
|
|
|
else if (paraData.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
SetParaValue(paraData[0]);
|
|
|
|
|
//SetParaValue(paraData[0]);
|
|
|
|
|
}
|
|
|
|
|
//有多条设为第一条
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("存在多条未删除的相同配方字段信息!将设置为第一条,请检查数据库。");
|
|
|
|
|
SetParaValue(paraData[0]);
|
|
|
|
|
//SetParaValue(paraData[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -534,71 +542,155 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置配方字段值
|
|
|
|
|
/// 设置显示的配方字段值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
|
private void SetParaValue(ZxRecipeParaEntity entity)
|
|
|
|
|
private void SetParaValue(ZxRecipePositionParaEntity 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);
|
|
|
|
|
E1TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E1);
|
|
|
|
|
E2TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E2);
|
|
|
|
|
E3TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E3);
|
|
|
|
|
E4TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E4);
|
|
|
|
|
E5TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E5);
|
|
|
|
|
E6TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E6);
|
|
|
|
|
E7TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E7);
|
|
|
|
|
E8TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E8);
|
|
|
|
|
E9TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E9);
|
|
|
|
|
E10TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取界面上的配方参数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>获取到的配方参数值</returns>
|
|
|
|
|
private ZxRecipeParaEntity GetParaValue()
|
|
|
|
|
private ZxRecipePositionParaEntity GetParaValue()
|
|
|
|
|
{
|
|
|
|
|
ZxRecipeParaEntity entity = new ZxRecipeParaEntity()
|
|
|
|
|
ZxRecipePositionParaEntity entity = new ZxRecipePositionParaEntity()
|
|
|
|
|
{
|
|
|
|
|
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),
|
|
|
|
|
E1 = GeneralUtils.StringNullOrToInt(E1TextBox.Text),
|
|
|
|
|
E2 = GeneralUtils.StringNullOrToInt(E2TextBox.Text),
|
|
|
|
|
E3 = GeneralUtils.StringNullOrToInt(E3TextBox.Text),
|
|
|
|
|
E4 = GeneralUtils.StringNullOrToInt(E4TextBox.Text),
|
|
|
|
|
E5 = GeneralUtils.StringNullOrToInt(E5TextBox.Text),
|
|
|
|
|
E6 = GeneralUtils.StringNullOrToInt(E6TextBox.Text),
|
|
|
|
|
E7 = GeneralUtils.StringNullOrToInt(E7TextBox.Text),
|
|
|
|
|
E8 = GeneralUtils.StringNullOrToInt(E8TextBox.Text),
|
|
|
|
|
E9 = GeneralUtils.StringNullOrToInt(E9TextBox.Text),
|
|
|
|
|
E10 = GeneralUtils.StringNullOrToInt(E10TextBox.Text)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工位改变
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void PositionRadioBoxChange(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RadioButton s = sender as RadioButton;
|
|
|
|
|
|
|
|
|
|
if (s.Checked)
|
|
|
|
|
{
|
|
|
|
|
int flag = GetSelectIndex();
|
|
|
|
|
switch (flag)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P1);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P2);
|
|
|
|
|
break;
|
|
|
|
|
case 31:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P31);
|
|
|
|
|
break;
|
|
|
|
|
case 32:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P32);
|
|
|
|
|
break;
|
|
|
|
|
case 41:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P41);
|
|
|
|
|
break;
|
|
|
|
|
case 42:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P42);
|
|
|
|
|
break;
|
|
|
|
|
case 51:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P51);
|
|
|
|
|
break;
|
|
|
|
|
case 52:
|
|
|
|
|
SetParaViewById(zxRecipeParaEntity.P52);
|
|
|
|
|
break;
|
|
|
|
|
case 0:
|
|
|
|
|
SetParaViewById(0);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
SetParaViewById(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetParaViewById(int? id)
|
|
|
|
|
{
|
|
|
|
|
zxRecipePositionParaEntity = zxRecipePositionParaService.GetRecipePositionParaInfoById(id ?? 0);
|
|
|
|
|
SetParaValue(zxRecipePositionParaEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取选择的工位包边
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>选的不对劲就返回0</returns>
|
|
|
|
|
private int GetSelectIndex()
|
|
|
|
|
{
|
|
|
|
|
if (Position1RadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Position2RadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Position3RadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
if (BodyRadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 31;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SideRadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 32;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Position4RadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
if (BodyRadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 41;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SideRadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 42;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Position5RadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
if (BodyRadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 51;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SideRadioButton.Checked)
|
|
|
|
|
{
|
|
|
|
|
return 52;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|