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

165 lines
4.9 KiB

3 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.FJC.Entity.Operation;
using QMAPP.FJC.Entity;
using QMAPP.ServicesAgent;
using QMAPP.Entity;
using QMAPP.WinForm.Common;
using QM.Common;
using QMAPP.MD.Entity;
3 years ago
using QMAPP.MD.Entity.TianJin;
3 years ago
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();
3 years ago
3 years ago
//加载物料类型分类
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();//落入光标
}
3 years ago
3 years ago
# region 扫码枪
/// <summary>
/// 扫码枪
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private bool ValidateAndAddCode(string proCode)
{
3 years ago
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
3 years ago
if (!string.IsNullOrEmpty(proCode))
{
//出库原因
if (this.comboBoxOutReason.Text.ToString() == "")
{
this.labelError.Text ="出库原因不能为空!";
return false;
}
3 years ago
var count = agent.InvokeServiceFunction<DataResult<int>>("StorageBLL_SelectCount", proCode);
if (count.Result > 0)
3 years ago
{
3 years ago
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;
3 years ago
else
{
3 years ago
this.labelError.Text = result.Msg;
3 years ago
return false;
}
}
3 years ago
else
3 years ago
{
3 years ago
this.labelError.Text = "条码未进行入库操作!";
3 years ago
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()))
{
3 years ago
//SaveInfo(productList);
3 years ago
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>
3 years ago
//private void tsb_close_Click(object sender, EventArgs e)
//{
// this.Close();
//}
3 years ago
/// <summary>
/// 点击右上角X关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
3 years ago
//private void SendCodeForm_FormClosing(object sender, EventArgs e)
//{
// this.Close();
//}
3 years ago
#endregion
//提交按钮
private void submit_Click(object sender, EventArgs e)
{
if (ValidateAndAddCode(this.txtCode.Text.Trim().ToUpper()))
{
3 years ago
//SaveInfo(productList);
3 years ago
this.txtCode.Text = "";
this.labelError.ForeColor = System.Drawing.Color.Green;
this.labelError.Text = "操作成功";
}
}
}
}