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 { /// /// 日 期:2022年3月7日 /// 模 块:天津出库 /// 作 者:张松男 /// 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 /// /// 出库原因下拉改变 /// /// /// private void comboBoxOutReason_SelectedIndexChanged(object sender, EventArgs e) { this.ActiveControl = this.txtCode; this.txtCode.Focus();//落入光标 } # region 扫码枪 /// /// 扫码枪 /// /// /// 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>("StorageBLL_SelectCount", proCode); if (count.Result > 0) { var storage = new Storage(); storage.ProductCode = proCode; storage.OutStorageType = this.comboBoxOutReason.Text.ToString(); var result = agent.InvokeServiceFunction("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 回车事件 /// /// 回车事件 /// /// /// 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 窗体关闭 /// /// 点击关闭按钮关闭窗体 /// /// /// //private void tsb_close_Click(object sender, EventArgs e) //{ // this.Close(); //} /// /// 点击右上角X关闭窗口 /// /// /// //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 = "操作成功"; } } } }