Exemple #1
0
        private bool RecordNum()
        {
            string _qty = txtCount.Text.Trim();

            try
            {
                if (txtOrder.Tag != null)
                {
                    decimal       qty   = Convert.ToDecimal(_qty) * scanCount;
                    decimal       inQty = 0;
                    StockInDetail sdl;
                    sdl = tempSIO.U8Details.Find(delegate(StockInDetail sdd) { return(sdd.cInvCode.ToUpper() == txtLabel.Text.Trim().ToUpper() && sdd.Nquantity > 0); });

                    if (sdl == null)
                    {
                        MessageBox.Show("该批次货物已全部扫描!");
                        return(false);
                    }

                    //if (sdl.Nquantity <= 0)
                    //{
                    //    DialogResult res = MessageBox.Show("该货物已全部扫描,仍需要扫描吗?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    //    if (res == DialogResult.No)
                    //    {
                    //        return false;
                    //    }
                    //}
                    inQty = sdl.fShallInQuan - sdl.Nquantity;

                    if (sdl.bInvBatch && string.IsNullOrEmpty(lblBatch.Text))
                    {
                        MessageBox.Show("该货物有批次管理,请输入批次后重试!");
                        return(false);
                    }
                    else if (!sdl.bInvBatch && !string.IsNullOrEmpty(lblBatch.Text))
                    {
                        MessageBox.Show("该货物没有批次管理,请勿输入批次!");
                        return(false);
                    }

                    if (qty + inQty > sdl.fShallInQuan)
                    {
                        MessageBox.Show("扫描数量大于最大出库数量!" + Environment.NewLine + "应不大于" + sdl.Nquantity.ToString("F4") + sdl.Inva_unit);
                        Clear();
                        return(false);
                    }

                    if (!string.IsNullOrEmpty(txtPosition.Text))
                    {
                        if (qty + inQty > StockInBusiness.GetPTQuan(txtLabel.Text, "", tempSIO.Whcode, txtPosition.Text))
                        {
                            MessageBox.Show("扫描数量大于货位现有数量!");
                            Clear();
                            return(false);
                        }
                    }

                    if (qty + inQty > StockInBusiness.GetWHQuan(txtLabel.Text, "", tempSIO.Whcode))
                    {
                        MessageBox.Show("扫描数量大于库存现有数量!");
                        Clear();
                        return(false);
                    }

                    if (batchList != null && batchList.Count > 0)
                    {
                        if (inQty > 0)
                        {
                            StockInDetail sid;
                            sid = tempSIO.OperateDetails.Find(delegate(StockInDetail sdd) { return(sdd.cInvCode.ToUpper() == txtLabel.Text.Trim().ToUpper() && sdd.Batch == lblBatch.Text && sdd.Quantity > 0); });
                            if (sid != null)
                            {
                                inQty = sid.Quantity;
                            }
                            else
                            {
                                inQty = 0;
                            }
                        }
                        if (qty + inQty > batchList[cbxBatch.SelectedIndex].Quantity)
                        {
                            MessageBox.Show("扫描数量大于该批次现有数量!");
                            Clear();
                            return(false);
                        }
                    }

                    StockInDetail tempSDL = sdl.getNewDetail();
                    if (!addData(qty, tempSDL))
                    {
                        return(false);
                    }
                    AddPosition(qty);
                    sdl.Nquantity -= qty;

                    Clear();
                    txtLabel.Focus();
                }
                return(true);
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
                txtCount.Focus();
                return(false);
            }
        }
Exemple #2
0
        private bool RecordNum()
        {
            string _qty = txtCount.Text.Trim();

            try
            {
                if (txtOrder.Tag != null)
                {
                    decimal       qty   = Convert.ToDecimal(_qty) * scanCount;
                    decimal       inQty = 0;
                    StockInDetail sdl;
                    sdl = tempSIO.U8Details.Find(delegate(StockInDetail sdd) { return(sdd.cInvCode.ToUpper() == txtLabel.Text.Trim().ToUpper() && sdd.Batch.ToUpper() == lblBatch.Text.Trim().ToUpper() && sdd.Nquantity > 0); });

                    if (sdl == null)
                    {
                        MessageBox.Show("该批次货物已全部扫描!");
                        return(false);
                    }
                    inQty = sdl.fShallInQuan - sdl.Nquantity;

                    if (sdl.bInvBatch && string.IsNullOrEmpty(sdl.Batch))
                    {
                        MessageBox.Show("该货物有批次管理,请输入批次后重试!");
                        return(false);
                    }
                    else if (!sdl.bInvBatch && !string.IsNullOrEmpty(lblBatch.Text))
                    {
                        MessageBox.Show("该货物没有批次管理,请勿输入批次!");
                        return(false);
                    }

                    if (qty + inQty > sdl.fShallInQuan)
                    {
                        MessageBox.Show("扫描数量大于应出库数量!" + Environment.NewLine + "应不大于" + sdl.Nquantity.ToString("F4") + sdl.Inva_unit);
                        return(false);
                    }

                    if (!string.IsNullOrEmpty(txtPosition.Text))
                    {
                        if (qty + inQty > StockInBusiness.GetPTQuan(txtLabel.Text, lblBatch.Text, tempSIO.Whcode, txtPosition.Text))
                        {
                            MessageBox.Show("扫描数量大于货位现有数量!");
                            Clear();
                            return(false);
                        }
                    }

                    if (qty + inQty > StockInBusiness.GetWHQuan(txtLabel.Text, lblBatch.Text, tempSIO.Whcode))
                    {
                        MessageBox.Show("扫描数量大于库存现有数量!");
                        Clear();
                        return(false);
                    }

                    StockInDetail tempSDL = sdl.getNewDetail();
                    if (!addData(qty, tempSDL))
                    {
                        return(false);
                    }
                    AddPosition(qty);
                    sdl.Nquantity -= qty;

                    Clear();
                    txtLabel.Focus();
                }
                return(true);
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
                txtCount.Focus();
                return(false);
            }
        }
Exemple #3
0
        private bool RecordNum()
        {
            string _qty = txtCount.Text.Trim();

            try
            {
                if (txtOrder.Tag != null)
                {
                    //ln.Write("qty:", _qty);
                    if (_qty == "")
                    {
                        MessageBox.Show("未输入数量!");
                        return(false);
                    }
                    if (!isNumeric(_qty))
                    {
                        MessageBox.Show("请输入数字!");
                        return(false);
                    }
                    decimal       qty   = Convert.ToDecimal(_qty) * scanCount;
                    decimal       inQty = 0;
                    StockInDetail sdl;
                    sdl = tempSIO.U8Details.Find(delegate(StockInDetail sdd) { return(sdd.cInvCode.ToUpper() == txtLabel.Text.Trim().ToUpper() && sdd.Batch.ToUpper() == lblBatch.Text.Trim().ToUpper() && sdd.Nquantity > 0); });

                    if (sdl == null)
                    {
                        MessageBox.Show("该批次货物已全部扫描!");
                        return(false);
                    }
                    inQty = sdl.fShallInQuan - sdl.Nquantity;

                    if (sdl.bInvBatch && string.IsNullOrEmpty(lblBatch.Text))
                    {
                        MessageBox.Show("该货物有批次管理,请输入批次后重试!");
                        return(false);
                    }

                    if (qty + inQty > sdl.Nquantity)
                    {
                        MessageBox.Show("扫描数量大于应出库数量!");
                        return(false);
                    }

                    if (qty + inQty > StockInBusiness.GetPTQuan(txtLabel.Text, lblBatch.Text, tempSIO.Whcode, txtPosition.Text))
                    {
                        MessageBox.Show("扫描数量大于货位现有数量!");
                        return(false);
                    }

                    StockInDetail tempSDL = sdl.getNewDetail();
                    if (!addData(qty, tempSDL))
                    {
                        return(false);
                    }
                    AddPosition(qty);

                    Clear();
                    txtLabel.Focus();
                }
                return(true);
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
                txtCount.Focus();
                return(false);
            }
        }