Exemple #1
0
        private void PrepareToPreview()
        {
            StockTakingModel tempItemData = scannedItemData[currentCursor - 1];

            tbLocation.Text = tempItemData.LocationCode;
            tbBarcode.Text  = tempItemData.Barcode;
            tbQuantity.Text = ((int)tempItemData.Quantity).ToString();

            tbLocation.Enabled   = false;
            tbLocation.BackColor = Color.FromArgb(223, 223, 223);
            tbBarcode.Enabled    = false;
            tbBarcode.BackColor  = Color.FromArgb(223, 223, 223);
            tbQuantity.Enabled   = true;
            tbQuantity.BackColor = Color.FromArgb(255, 255, 255);

            ddlUnit.SelectedIndex = FindDDLIndex(tempItemData.UnitCode);

            btnNext.Text      = "Next >>";
            btnDelete.Enabled = true;
            btnClear.Enabled  = false;

            FocusOnSuitableTextBox();
        }
Exemple #2
0
        private void AddAuditData()
        {
            try
            {
                StockTakingModel itemData = new StockTakingModel();
                itemData.StocktakingID  = DatabaseModule.Instance.GetLastStocktakingID();
                itemData.Barcode        = tempSKUModel.Barcode;
                itemData.BrandCode      = tempLocationModel.BrandCode;
                itemData.Description    = tempSKUModel.Description;
                itemData.ExBarcode      = tempSKUModel.ExBarcode;
                itemData.Flag           = tempSKUModel.Flag;
                itemData.InBarcode      = tempSKUModel.InBarcode;
                itemData.LocationCode   = tempLocationModel.LocationCode;
                itemData.Quantity       = Math.Round(Convert.ToDecimal(Convert.ToDecimal(tbQuantity.Text).ToString("F3")));
                itemData.ScanMode       = tempLocationModel.ScanMode;
                itemData.SKUCode        = tempSKUModel.SKUCode;
                itemData.UnitCode       = Convert.ToInt32(ddlUnit.SelectedValue);
                itemData.SKUMode        = isHaveSKUData;
                itemData.DepartmentCode = tempSKUModel.DepartmentCode;

                if (!Program.isNonRealtime)
                {
                    APIModule.Instance.SendRequestThread(itemData, 1);
                    scannedItemData.Add(itemData);

                    if (scannedItemData.Count == 101)
                    {
                        scannedItemData.RemoveAt(0);
                        currentCursor--;
                    }

                    UpdateSummaryQty(itemData.Quantity, Convert.ToInt32(ddlUnit.SelectedValue), 1);
                    this.Show();
                }
                else
                {
                    itemData.SendFlag = false;

                    StockTakingModel lastInsertedStocktaking = DatabaseModule.Instance.GetLastInsertedStocktaking();
                    if (lastInsertedStocktaking != null && DatabaseModule.Instance.QueryUpdateLastStocktaking(lastInsertedStocktaking, itemData, 1))
                    {
                        scannedItemData[scannedItemData.Count - 1].Quantity = lastInsertedStocktaking.Quantity + itemData.Quantity;
                        currentCursor--;
                    }
                    else
                    {
                        DatabaseModule.Instance.QueryInsertFromScan(itemData, 1);
                        scannedItemData.Add(itemData);

                        if (scannedItemData.Count == 101)
                        {
                            scannedItemData.RemoveAt(0);
                            currentCursor--;
                        }
                    }

                    UpdateSummaryQty(itemData.Quantity, Convert.ToInt32(ddlUnit.SelectedValue), 1);
                }
            }
            catch (InvalidCastException ex)
            {
                MessageBox.Show("The application encountered some problem about network, please try again.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                throw ex;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Insert Error : " + ex.Message, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                throw ex;
            }
        }