|
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity.Barrel;
|
|
|
|
|
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 Mesnac.Action.ChemicalWeighing.Barrel
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmBarrel : Form
|
|
|
|
|
{
|
|
|
|
|
public Hw_Barrel bar = new Hw_Barrel();
|
|
|
|
|
ActionType _actionType;
|
|
|
|
|
public FrmBarrel()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
bar.BarrelID = Guid.NewGuid().ToString();
|
|
|
|
|
}
|
|
|
|
|
public FrmBarrel(ActionType type, Hw_Barrel _barrel)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_actionType = type;
|
|
|
|
|
bar = _barrel;
|
|
|
|
|
|
|
|
|
|
this.txtBarrelName.Text = bar.BarrelName;
|
|
|
|
|
this.txtBarCode.Text = bar.BarCode;
|
|
|
|
|
if (bar.IsEnable=="是")
|
|
|
|
|
{
|
|
|
|
|
this.chcIsEnable.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.chcIsEnable.Checked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(txtBarrelName.Text))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("桶名称不能为空!!");
|
|
|
|
|
this.txtBarrelName.Focus();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(txtBarCode.Text))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("桶条码不能为空!!");
|
|
|
|
|
this.txtBarCode.Focus();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bar.BarrelName = this.txtBarrelName.Text;
|
|
|
|
|
bar.BarCode = this.txtBarCode.Text;
|
|
|
|
|
bar.IsEnable = chcIsEnable.Checked == true ? "是" : "否";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当修改桶时 条码唯一性都需要验证
|
|
|
|
|
if (_actionType == ActionType.Add || (_actionType == ActionType.Modify))
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = BarrelHelper.QueryIsExeBarrel(bar.BarCode, bar.ID);
|
|
|
|
|
//桶条码唯一性验证
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("桶条码已存在!!请更换桶条码!!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|