using Sunny.UI; using sunui.forms; 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 WMS.UI.Basic { public partial class addMaterial : Form { /// /// /// /// 1=新建,2=编辑 /// 编辑时物料ID /// 编辑时传物料编号 /// 编辑时传物料名称 /// 新建物料时 物料类型 0=缸盖,1=缸体 /// 新建物料时 机型 public addMaterial(int types, int ID, string materialCode, string materialName, int materialType, string version) { InitializeComponent(); if (types == 2) { label_Title.Text = "物料编辑"; label_ID.Text = ID.ToString(); textBox_Code.Text = materialCode; textBox_Name.Text = materialName; comboBox_type.SelectedIndex = materialType; textBox_version.Text = version.Trim(); } } private void button_cancel_Click(object sender, EventArgs e) { this.Close(); } /// 确认按钮 /// /// /// /// private void button_confirm_Click(object sender, EventArgs e) { try { #region 参数检查 if (string.IsNullOrEmpty(textBox_Name.Text.Trim())) { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "物料名称不能为空"); ms.Show(); // ShowWarningTip("物料名称不能为空- 警告"); return; } if (string.IsNullOrEmpty(textBox_Code.Text.Trim())) { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "物料编号不能为空"); ms.Show(); // ShowWarningTip("物料编号不能为空- 警告"); return; } if (string.IsNullOrEmpty((string)comboBox_type.SelectedItem)) { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "请选择物料类型"); ms.Show(); // ShowWarningTip("请选择物料类型- 警告"); return; } #endregion if (label_Title.Text == "物料编辑") { if (string.IsNullOrEmpty(label_ID.Text.Trim())) { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "物料id为空,请查看库存物料数据"); ms.Show(); // ShowWarningTip( " 物料id为空,请查看库存物料数据- 警告"); return; } string res = FLogin.wcsWcf.materialOP(2, Convert.ToInt32(label_ID.Text.Trim()), textBox_Code.Text.Trim(), textBox_Name.Text.Trim(), comboBox_type.SelectedIndex, textBox_version.Text.Trim()); if (res == "") { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(1, "修改成功"); ms.Show(); // ShowSuccessTip("修改成功 - 成功"); this.DialogResult = DialogResult.OK; this.Close(); } else { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, res); ms.Show(); // ShowWarningTip(res+" - 警告"); this.Close(); } } else { string res = FLogin.wcsWcf.materialOP(1, 0, textBox_Code.Text.Trim(), textBox_Name.Text.Trim(), comboBox_type.SelectedIndex, textBox_version.Text.Trim()); if (res == "") { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(1, "创建成功 - 成功"); ms.Show(); // ShowSuccessTip("创建成功 - 成功"); this.DialogResult = DialogResult.OK; } else { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, res); ms.Show(); // ShowWarningTip(res+" - 警告"); this.DialogResult = DialogResult.OK; } } } catch (Exception) { WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "异常了- 警告"); ms.Show(); // ShowWarningTip("异常了- 警告"); } } // ShowWarningTip("轻便消息提示框 - 警告"); // ShowSuccessTip("轻便消息提示框 - 成功"); } }