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.
81 lines
2.4 KiB
C#
81 lines
2.4 KiB
C#
using Mesnac.Action.ChemicalWeighing.Barrel;
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
using Mesnac.Action.ChemicalWeighing.Entity.Package;
|
|
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.Package
|
|
{
|
|
public partial class FrmPackage : Form
|
|
{
|
|
public Hw_Package _package = null;
|
|
ActionType _actionType;
|
|
public FrmPackage()
|
|
{
|
|
InitializeComponent();
|
|
_package = new Hw_Package();
|
|
}
|
|
public FrmPackage(ActionType type, Hw_Package package)
|
|
{
|
|
InitializeComponent();
|
|
_actionType = type;
|
|
_package = new Hw_Package();
|
|
_package = package;
|
|
|
|
this.txtName.Text = package.Name;
|
|
this.txtBarCode.Text = package.BarCode;
|
|
if (package.IsEnable == "是")
|
|
{
|
|
this.chcIsEnable.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
this.chcIsEnable.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(txtName.Text))
|
|
{
|
|
MessageBox.Show("名称不能为空!!");
|
|
this.txtName.Focus();
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txtBarCode.Text))
|
|
{
|
|
MessageBox.Show("桶条码不能为空!!");
|
|
this.txtBarCode.Focus();
|
|
return;
|
|
}
|
|
|
|
_package.Name = this.txtName.Text;
|
|
_package.BarCode = this.txtBarCode.Text;
|
|
_package.IsEnable = chcIsEnable.Checked == true ? "是" : "否";
|
|
|
|
|
|
|
|
//当修改桶时 条码唯一性都需要验证
|
|
if (_actionType == ActionType.Add || (_actionType == ActionType.Modify))
|
|
{
|
|
DataTable dt = PackageHelper.QueryIsExePackage(_package.BarCode, _package.ID);
|
|
//桶条码唯一性验证
|
|
if (dt != null)
|
|
{
|
|
MessageBox.Show("桶条码已存在!!请更换桶条码!!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
}
|
|
}
|
|
}
|