Beispiel #1
0
        private void EnrichTextbox(string receivedData)
        {
            using (var context = new Model())
            {
                var baseDataDictionaryDetail = context.Base_DataDictionaryDetail.FirstOrDefault(s => s.DataDictionaryDetailId == receivedData);
                if (baseDataDictionaryDetail != null)
                {
                    BeginInvoke(new Action((() =>
                    {
                        ShelvesIdTxt.Clear();
                        ShelvesNameTxt.Clear();
                    })));

                    BeginInvoke(new Action((() =>
                    {
                        ShelvesIdTxt.Text = _baseDataDictionaryDetail.Code;
                        ShelvesNameTxt.Text = _baseDataDictionaryDetail.FullName;
                    })));
                    _baseDataDictionaryDetail = baseDataDictionaryDetail;
                }


                var aPlanProductInfomation =
                    context.A_PlanProductInfomation.FirstOrDefault(s =>
                                                                   s.IsAvailable == true && s.ProductBornCode == receivedData);
                if (aPlanProductInfomation != null)
                {
                    BeginInvoke(new Action((() =>
                    {
                        ProductNameTxt.Clear();
                        ProductBornCodeTxt.Clear();
                    })));

                    _aPlanProductInfomation = aPlanProductInfomation;
                    BeginInvoke(new Action((() =>
                    {
                        ProductNameTxt.Text = aPlanProductInfomation.ProductName;
                        ProductBornCodeTxt.Text = aPlanProductInfomation.ProductBornCode;
                    })));
                }
            }
        }
Beispiel #2
0
        protected override void DoEnter()
        {
            if (string.IsNullOrEmpty(ProductNameTxt.Text) || string.IsNullOrEmpty(ProductBornCodeTxt.Text))
            {
                FrmDialog.ShowDialog(this, "产品信息不准确,请重新扫码");
                return;
            }
            if (string.IsNullOrEmpty(ShelvesNameTxt.Text) || string.IsNullOrEmpty(ShelvesIdTxt.Text))
            {
                FrmDialog.ShowDialog(this, "货架信息不准确,请重新扫码");
                return;
            }

            if (AlreadyInJudge())
            {
                BeginInvoke(new Action((() =>
                {
                    ProductBornCodeTxt.Clear();
                    ProductNameTxt.Clear();
                    ShelvesNameTxt.Clear();
                    ShelvesIdTxt.Clear();
                })));
                return;
            }

            var dialogResult = FrmDialog.ShowDialog(this, "是否确认入库?", "确认", true);

            if (dialogResult == DialogResult.OK)
            {
                PutIn();
            }

            FrmDialog.ShowDialog(this, "入库成功!");
            Close();
            serialPort1.Close();
        }