You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.0 KiB
125 lines
4.0 KiB
4 years ago
|
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 InjectionScarpForm : Form
|
||
|
{
|
||
|
public InjectionScarpForm()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
|
||
|
}
|
||
|
|
||
|
public InjectionScarpForm(string barcode)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
txtProductCode.Text = barcode.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
|
||
|
)
|
||
|
{
|
||
|
|
||
|
lblError.Text = "请输入注塑产品条码!";
|
||
|
this.lblError.ForeColor = Color.Red;
|
||
|
txtProductCode.Text = "";
|
||
|
txtProductCode.Focus();
|
||
|
return;
|
||
|
}
|
||
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
||
|
DataResult result = agent.InvokeServiceFunction<DataResult>(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
|
||
|
)
|
||
|
{
|
||
|
|
||
|
lblError.Text = "请输入注塑产品条码!";
|
||
|
this.lblError.ForeColor = Color.Red;
|
||
|
txtProductCode.Text = "";
|
||
|
txtProductCode.Focus();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
|
||
|
DataResult result = agent.InvokeServiceFunction<DataResult>(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();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|