using ButcherFactory.BO; using ButcherFactory.BO.LocalBL; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WinFormControl; namespace ButcherFactory.SegmentProductionAuto_ { public partial class GoodsNumberInputDialog : Form { ClientGoodsSet_Detail goodsInfo; int number = 0; public GoodsNumberInputDialog(ClientGoodsSet_Detail mGoods) { goodsInfo = mGoods; InitializeComponent(); goodsNameLbl.Text = goodsInfo.Goods_Name; } private void numberBox_Click(object sender, EventArgs e) { var keyBoard = new NumberPad(); if (keyBoard.ShowDialog() == true) { if (string.IsNullOrEmpty(keyBoard.Result)) numberBox.Text = null; else { int pics; if (int.TryParse(keyBoard.Result, out pics)) { numberBox.Text = pics.ToString(); number = pics; } else { numberBox.Text = null; } } } } private void okBtn_Click(object sender, EventArgs e) { if (number == 0) throw new Exception("请输入数量"); var log = new SegmentGoodsProductNumLog(); log.Goods_ID = goodsInfo.Goods_ID; log.Goods_Code = goodsInfo.Goods_Code; log.Goods_Name = goodsInfo.Goods_Name; log.Number = number; SegmentProductionBL.InsertProductNumLog(log); DialogResult = DialogResult.OK; } private void cancelBtn_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; } } }