天津投入产出系统后端
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.
 
 
 
 
 
 

113 lines
3.6 KiB

using System;
using System.Drawing;
using System.Windows.Forms;
using QMAPP.Entity;
using QMAPP.WinForm.Common;
namespace QMAPP.WinForm.Forms.ProductIn
{
public partial class ProductInSendCodeForm : Form
{
//配置表类型
private string _mainTypeCode = "INTTYPE";
public ProductInSendCodeForm()
{
InitializeComponent();
}
#region 回车事件
/// <summary>
/// 回车事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtCode_KeyDown(object sender, KeyEventArgs e)
{
//if (e.KeyCode == Keys.Enter)
//{
// this.tsbSave_Click(sender, e);
//}
if (e.KeyCode == Keys.Enter)//如果输入的是回车键
{
SetProductIn();
}
}
private void SetProductIn()
{
if (string.IsNullOrEmpty(txtCode.Text))
{
txtCode.Focus();
txtCode.SelectAll();
return;
}
var scode = txtCode.Text.Trim().ToUpper();
if (System.Text.RegularExpressions.Regex.IsMatch(scode, "^DP\\w+(-\\w+)?-DF[LR][FR]\\w+$"))//扫描输入为门板计划标签
{
//从计划标签中截取产品码
scode = scode.Substring(scode.LastIndexOf('-') + 1);
}
try
{
FJC.Entity.ProductIn.ProductIn pi = new FJC.Entity.ProductIn.ProductIn();
pi.PRODUCTCODE = scode;
if (comINTTYPE.SelectedItem!=null)
{
pi.INTTYPE = comINTTYPE.SelectedValue.ToString();//退返入库
}
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
var result =
agent.InvokeServiceFunction<DataResult<int>>
("ProductInBLL_Insert", pi);
//保存成功
txtCode.Text = "";
txtCode.Focus();
if (result.IsSuccess)
{
lblError.ForeColor = Color.Black;
lblError.Text = scode + ":入库成功。";
//MessageBox.Show(scode+":入库成功。");
//changeButten();
//BindGirdData();
}
else
{
//MessageBox.Show(scode+":不是出库状态无法入库。");
lblError.ForeColor = Color.Red;
lblError.Text = scode + ":不存在或不是出库状态,无法入库。";
}
}
catch(Exception ex)
{
lblError.Text = "系统异常:" + ex.Message;
}
}
#endregion
private void ProductInSendCodeForm_Load_1(object sender, EventArgs e)
{
lblError.Text = "";
BasicData basicData = new BasicData();
//返修类别
var callTypeList =
basicData.GetConfigDetailComboxSource(_mainTypeCode, false);
comINTTYPE.DataSource = callTypeList;
comINTTYPE.DisplayMember = "DetailTypeName";
comINTTYPE.ValueMember = "DetailTypeCode";
}
private void tsbClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnSubmit_Click(object sender, EventArgs e)
{
SetProductIn();
}
}
}