/// <summary> /// 点击提交按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { //验证数量是否已扫描完 if (backgsp.U8Details.Count == backgsp.OperateDetails.Count) { foreach (PurchaseBackDetail detail in backgsp.U8Details) { PurchaseBackDetail ddtmp = backgsp.OperateDetails.Find(delegate(PurchaseBackDetail tdd) { return(tdd.cInvcode.Equals(detail.cInvcode) && tdd.cBatch.Equals(detail.cBatch)); }); if (ddtmp == null) { MessageBox.Show("还有没扫描的货物:" + detail.cinvname); return; } if (ddtmp.iQuantity != -1 * ddtmp.ScanCount) { MessageBox.Show("货物:" + detail.cinvname + "的数量与单据数量不符"); return; } } } else { MessageBox.Show("还有没扫描的货物!"); return; } backgsp.cMaker = Common.CurrentUser.UserName; try { this.Enabled = false; Cursor.Current = Cursors.WaitCursor; string errMsg = ""; int rt = PurchaseBackBusiness.SavePurchaseBackGSP(backgsp, out errMsg); if (rt == 0) { MessageBox.Show("提交成功!"); } else { MessageBox.Show("提交失败!" + errMsg); } Close(); } catch (Exception ex) { MessageBox.Show("提交失败!" + ex.Message); } finally { this.Enabled = true; Cursor.Current = Cursors.Default; } }
/// <summary> /// 扫描来源单据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtSource_KeyPress(object sender, KeyPressEventArgs e) { //扫描采购入库单红字单号 if (e.KeyChar == 13 && txtSource.Text.Length > 0) { string errMsg = null; try { Cursor.Current = Cursors.WaitCursor; if (PurchaseBackBusiness.GetPurchaseBack(txtSource.Text, out backgsp, out errMsg)) { btnSource.Enabled = true; txtLable.Enabled = true; txtLable.Focus(); lblWarehouse.Text = backgsp.cWhName; //入库单(红)文本框不可再用 txtSource.Enabled = false; } else { MessageBox.Show("采购入库单红字单号错误:" + errMsg); btnSource.Enabled = false; txtLable.Enabled = false; txtSource.SelectAll(); txtSource.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message); btnSource.Enabled = false; txtLable.Enabled = false; txtSource.SelectAll(); txtSource.Focus(); } finally { Cursor.Current = Cursors.Default; } } }