using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using QMAPP.KB.Entity; using QMAPP.ServicesAgent; using QMAPP.FJC.Entity.Operation; namespace QMAPP.WinForm.Forms.Injection { public partial class SlushScarpForm : Form { public SlushScarpForm() { InitializeComponent(); } public SlushScarpForm(string productCode) { InitializeComponent(); txtProductCode.Text = productCode.Trim().ToUpper(); } private void toolStripButton1_Click(object sender, EventArgs e) { this.Close(); } private void btnScarp_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtProductCode.Text)) { lblError.Text = string.Format("请输入要作废的条码!"); this.lblError.ForeColor = Color.Red; return; } if (txtProductCode.Text.IndexOf("B9A") == 0 || txtProductCode.Text.IndexOf("B9B") == 0 || txtProductCode.Text.IndexOf("B9C") == 0 || txtProductCode.Text.IndexOf("FJC") == 0 || txtProductCode.Text.IndexOf("B9G") == 0 || txtProductCode.Text.IndexOf("B9H") == 0 || txtProductCode.Text.IndexOf("B9I") == 0 || txtProductCode.Text.IndexOf("B9J") == 0 || txtProductCode.Text.IndexOf("B9K") == 0 ) { lblError.Text = "请输入表皮条码!"; this.lblError.ForeColor = Color.Red; txtProductCode.Text = ""; txtProductCode.Focus(); return; } QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent(); DataResult result = agent.InvokeServiceFunction(B9BasicService.ProductBLL_ScarpProduct.ToString(), new Product() { PRODUCTCODE = txtProductCode.Text }); if (result.IsSuccess == true) { lblError.Text = string.Format("{0}作废成功!",txtProductCode.Text); this.lblError.ForeColor = Color.Green; txtProductCode.Text = ""; txtProductCode.Focus(); } else { lblError.Text = result.Msg; this.lblError.ForeColor = Color.Red; txtProductCode.Text = ""; txtProductCode.Focus(); } } private void txtProductCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter)//如果输入的是回车键 { return; } if (string.IsNullOrEmpty(txtProductCode.Text)) { lblError.Text = string.Format("请输入要作废的条码!"); this.lblError.ForeColor = Color.Red; return; } if (txtProductCode.Text.IndexOf("B9A") == 0 || txtProductCode.Text.IndexOf("B9B") == 0 || txtProductCode.Text.IndexOf("B9C") == 0 || txtProductCode.Text.IndexOf("FJC") == 0 || txtProductCode.Text.IndexOf("B9G") == 0 || txtProductCode.Text.IndexOf("B9H") == 0 || txtProductCode.Text.IndexOf("B9I") == 0 || txtProductCode.Text.IndexOf("B9J") == 0 || txtProductCode.Text.IndexOf("B9K") == 0 ) { lblError.Text = "请输入表皮条码!"; this.lblError.ForeColor = Color.Red; txtProductCode.Text = ""; txtProductCode.Focus(); return; } QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent(); DataResult result = agent.InvokeServiceFunction(B9BasicService.ProductBLL_ScarpProduct.ToString(), new Product() { PRODUCTCODE = txtProductCode.Text }); if (result.IsSuccess == true) { lblError.Text = string.Format("{0}作废成功!", txtProductCode.Text); this.lblError.ForeColor = Color.Green; txtProductCode.Text = ""; txtProductCode.Focus(); } else { lblError.Text = result.Msg; this.lblError.ForeColor = Color.Red; txtProductCode.Text = ""; txtProductCode.Focus(); } } } }