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

164 lines
4.9 KiB

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.FJC.Entity.Operation;
using QMAPP.FJC.Entity;
using QMAPP.ServicesAgent;
using QMAPP.Entity;
using QMAPP.WinForm.Common;
using QM.Common;
using QMAPP.MD.Entity;
using QMAPP.MD.Entity.TianJin;
namespace QMAPP.WinForm.Forms.TianJin
{
/// <summary>
/// 日 期:2022年3月7日
/// 模 块:天津出库
/// 作 者:张松男
/// </summary>
public partial class TJSendCodeForm : Form
{
public TJSendCodeForm()
{
InitializeComponent();
}
#region 窗体载入
private void Form_Load(object sender, EventArgs e)
{
new KeyEvent().SetKeyToTxt(this);
//出库原因下拉
BasicData basicData = new BasicData();
//加载物料类型分类
OutReason searchModelType = new OutReason();
this.comboBoxOutReason.DataSource = basicData.GetOutReasonList(true);
this.comboBoxOutReason.DisplayMember = "OUTREASON_NAME";
this.comboBoxOutReason.ValueMember = "OUTREASON_CODE";
}
#endregion
/// <summary>
/// 出库原因下拉改变
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void comboBoxOutReason_SelectedIndexChanged(object sender, EventArgs e)
{
this.ActiveControl = this.txtCode;
this.txtCode.Focus();//落入光标
}
# region 扫码枪
/// <summary>
/// 扫码枪
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private bool ValidateAndAddCode(string proCode)
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
if (!string.IsNullOrEmpty(proCode))
{
//出库原因
if (this.comboBoxOutReason.Text.ToString() == "")
{
this.labelError.Text ="出库原因不能为空!";
return false;
}
var count = agent.InvokeServiceFunction<DataResult<int>>("StorageBLL_SelectCount", proCode);
if (count.Result > 0)
{
var storage = new Storage();
storage.ProductCode = proCode;
storage.OutStorageType = this.comboBoxOutReason.Text.ToString();
var result = agent.InvokeServiceFunction<DataResult>("StorageBLL_Update", storage);
if (result.IsSuccess)
return true;
else
{
this.labelError.Text = result.Msg;
return false;
}
}
else
{
this.labelError.Text = "条码未进行入库操作!";
return false;
}
}
this.labelError.Text = "请选择相应信息!";
return false;
}
#endregion
#region 回车事件
/// <summary>
/// 回车事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtCode_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (ValidateAndAddCode(this.txtCode.Text.Trim()))
{
//SaveInfo(productList);
this.txtCode.Text = "";
this.labelError.ForeColor = System.Drawing.Color.Green;
this.labelError.Text = "操作成功";
}
}
}
#endregion
#region 窗体关闭
/// <summary>
/// 点击关闭按钮关闭窗体
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//private void tsb_close_Click(object sender, EventArgs e)
//{
// this.Close();
//}
/// <summary>
/// 点击右上角X关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//private void SendCodeForm_FormClosing(object sender, EventArgs e)
//{
// this.Close();
//}
#endregion
//提交按钮
private void submit_Click(object sender, EventArgs e)
{
if (ValidateAndAddCode(this.txtCode.Text.Trim().ToUpper()))
{
//SaveInfo(productList);
this.txtCode.Text = "";
this.labelError.ForeColor = System.Drawing.Color.Green;
this.labelError.Text = "操作成功";
}
}
}
}