コード例 #1
0
        private void GetItemData(string input)
        {
            bool UseMhd = false;

            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

            if (input.Equals("#"))
            {
                lbLocation.Text = Globals.theLocation;
                CaptionItem();
                Globals.GlobalStep = 0;
            }
            else
            {
                try
                {
                    if (WareHouse.WSItemUsesTracking(input))
                    {
                        g_PID        = WareHouse.WSReturnNewPID();
                        b_NewPID     = true;
                        b_confirmPid = true;
                    }

                    UseMhd             = WareHouse.WSItemUsesMhdTracking(input);
                    lbDescription.Text = WareHouse.WSReturnItemDescription(input);
                    if (lbDescription.Text.Equals(""))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message8"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                    }
                    lbUnitOfMesure.Text = WareHouse.WSReturnItemUnitOfMesure(itemno, 2);
                    lbItemNo.Text       = input;
                }
                catch (Exception ex)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                }
                CaptionBin();
                Globals.GlobalStep = 1;
            }
        }
コード例 #2
0
ファイル: fmLotSplit.cs プロジェクト: FedderBJ/Akudim-Lager
        private void tbInputData_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.GlobalStep)
                {
                case 0:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    string   lokation    = "";
                    string   placering   = "";
                    string   varenr      = "";
                    string   beskrivelse = "";
                    decimal  antal       = 0;
                    DateTime mhd         = DateTime.UtcNow;
                    string   uof         = "";
                    string   vl          = "";
                    lot = tbInputData.Text;
                    try
                    {
                        if (!WareHouse.WSReturnLotInfo(tbInputData.Text.ToString(), Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uof, ref vl))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
                            break;
                        }
                        else
                        {
                            lokation            = Globals.theLocation;
                            lbLocation.Text     = lokation;
                            lbBin.Text          = placering;
                            lbItemNo.Text       = varenr;
                            lbDescription.Text  = beskrivelse;
                            lbQuantity.Text     = antal.ToString(CultureInfo.GetCultureInfo(Globals.theLanguageCode).NumberFormat);
                            lbExpiredate.Text   = mhd.ToShortDateString();
                            lbUnitOfMesure.Text = uof;
                            lblInputText.Text   = mt.ReadResFile(this.Name.ToString() + "lblInputText2");
                            tbInputData.Text    = "";
                            lbFromPID.Text      = lot;
                            lbVendorLot.Text    = vl;
                            Globals.step++;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        WareHouse.Dispose();
                        tbInputData.Text = "";
                    }
                }
                break;

                case 1:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }

                    if (decimal.Parse(tbInputData.Text) >= decimal.Parse(lbQuantity.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Message4"), (decimal.Parse(lbQuantity.Text)).ToString()));
                        break;
                    }

                    lbNewQty.Text     = tbInputData.Text;
                    tbInputData.Text  = "";
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3");

                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    g_NyPid = WareHouse.WSReturnNewPID();
                    WareHouse.WSPrintPidPrev(g_NyPid, Globals.theWinlogon, lbItemNo.Text, lbNewQty.Text, lbExpiredate.Text, lbVendorLot.Text, lbUnitOfMesure.Text);
                    // Print af ny label.
                    if (Globals.theShowMessage)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(g_NyPid.ToString());
                    }
                    WareHouse.Dispose();
                    Globals.step++;
                }
                break;

                case 2:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }
                    if (!g_NyPid.Equals(tbInputData.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                        break;
                    }

                    lbNewLot.Text     = tbInputData.Text;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText4");
                    tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                    Globals.step++;
                }
                break;

                case 3:
                {
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    this.pbIndicator.Image   = WindowsFormsApplication1.Properties.Resources.animatedCircle;
                    this.pbIndicator.Visible = true;

                    try
                    {
                        WareHouse.WSPostLotSplit(Globals.theTransferTemplateName, Globals.theTransferBatchName, lbItemNo.Text.ToString(), lbUnitOfMesure.Text, Globals.theWinlogon, lbLocation.Text.ToString(), lbBin.Text.ToString(), lot.ToString(), lbLocation.Text.ToString(), lbBin.Text.ToString(), lbNewLot.Text.ToString(), decimal.Parse(lbNewQty.Text.ToString()), false, DateTime.Parse(lbExpiredate.Text.ToString()), DateTime.Now, lbVendorLot.Text);
                        WareHouse.WSPrintPid(lbFromPID.Text, Globals.theWinlogon);
                    }
                    catch (Exception ex)
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

                        lblInputText.Text   = mt.ReadResFile(this.Name.ToString() + "lblInputText1");
                        tbInputData.Text    = "";
                        lbLocation.Text     = "";
                        lbBin.Text          = "";
                        lbItemNo.Text       = "";
                        lbDescription.Text  = "";
                        lbQuantity.Text     = "";
                        lbExpiredate.Text   = "";
                        lbNewQty.Text       = "";
                        lbNewLot.Text       = "";
                        lbUnitOfMesure.Text = "";
                        lbVendorLot.Text    = "";
                        lbFromPID.Text      = "";
                        WareHouse.Dispose();
                        Globals.step = 0;
                    }
                }
                break;
                }
            }

            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.step)
                {
                case 4:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText4");
                    tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                }
                break;

                case 3:
                {
                    Globals.step--;
                    tbInputData.Text  = "";
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3");
                }
                break;

                case 2:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText2");
                    tbInputData.Text  = "";
                }
                break;

                case 1:
                {
                    Globals.step--;
                    lblInputText.Text   = mt.ReadResFile(this.Name.ToString() + "lblInputText1");
                    tbInputData.Text    = "";
                    lbLocation.Text     = "";
                    lbBin.Text          = "";
                    lbItemNo.Text       = "";
                    lbDescription.Text  = "";
                    lbQuantity.Text     = "";
                    lbExpiredate.Text   = "";
                    lbNewQty.Text       = "";
                    lbNewLot.Text       = "";
                    lbUnitOfMesure.Text = "";
                    lbFromPID.Text      = "";
                }
                break;

                case 0: this.Close();
                    break;
                }
            }
        }
コード例 #3
0
        private void maskedTextBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.GlobalStep)
                {
                case 0:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }

                    // Hent Købsordredata
                    GetPurchaseOrder(tbInputData.Text);
                    btnDecoder.Visible = true;
                }
                break;

                case 1:
                {
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText2");
                    if (Vendorlot != "")
                    {
                        tbInputData.Text = Vendorlot;
                        tbInputData.SelectAll();
                    }
                    else
                    if (Decoding.theCode10.Equals(""))
                    {
                        tbInputData.Text = "";
                    }
                    else
                    {
                        tbInputData.Text = Decoding.theCode10.ToString();
                    }
                    Globals.step++;
                    btnDecoder.Visible = false;
                    btSearch.Visible   = true;
                }
                break;

                case 2:
                {
                    btnNext.Enabled    = false;
                    btnPrevius.Enabled = false;
                    btnDecoder.Visible = false;
                    btSearch.Visible   = false;
                    Vendorlot          = tbInputData.Text;
                    Globals.step++;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText3");
                    tbInputData.Text  = "";

                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    POL = PurchaseLineList.ElementAt(POLindex);
                    try
                    {
                        if (Decoding.theCode37.Equals(""))
                        {
                            remaning = WareHouse.WSReturnRemaningQuantity(OrderType, POL.TheSourceNo.ToString(), POL.TheItemNo.ToString());
                        }
                        else
                        {
                            remaning = decimal.Parse(Decoding.theCode37.ToString());
                        }


                        tbInputData.Text = remaning.ToString();
                        lbQuantity.Text  = remaning.ToString();
                        tbInputData.SelectAll();
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        WareHouse.Dispose();
                    }
                }
                break;

                case 3:
                {
                    decimal d = 0;
                    if (!decimal.TryParse(tbInputData.Text, out d))
                    {
                        break;
                    }
                    lbQuantity.Text = tbInputData.Text;
                    #region Add Qty to purchaseorder
                    if (d > remaning)
                    {
                        if (MessageBox.Show(string.Format(mt.ReadResFile(this.Name.ToString() + "Message9"), remaning.ToString(), Environment.NewLine, tbInputData.Text), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            BalanceWarehouse WareHouse = new BalanceWarehouse();
                            WareHouse.UseDefaultCredentials = true;
                            try
                            {
                                WareHouse.WSAddQuantityToPurchaseOrder(POL.TheSourceNo, POL.TheItemNo, (d - remaning), POL.TheUnitOfMesure);
                            }
                            catch (Exception ex)
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                                break;
                            }
                            try
                            {
                                WareHouse.WSCreateWarehouseInboundDoc(OrderNo);
                            }
                            catch (Exception ex)
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                                break;
                            }
                            try
                            {
                                // Hent modtagelseslinjer på ny med de nye antal i.
                                GetReceiptliens(OrderNo, OrderType);
                                // GetReceiptlines tæller Globals.Step op med en så den skal sættes 1 ned.
                                Globals.GlobalStep--;
                                ExtractData();
                            }
                            catch (Exception ex)
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                                break;
                            }
                        }
                        else
                        {
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                    }
                    #endregion

                    POL.TheQuantity = d;
                    PurchaseLineList.Insert(POLindex, POL);
                    PurchaseLineList.RemoveAt(POLindex + 1);
                    tbInputData.Text = "";
                    tbInputData.Focus();
                    tbInputData.SelectAll();
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText4");
                    #region QaSample
                    decimal SQ  = 0;
                    string  UOM = "";

                    try
                    {
                        BalanceWarehouse WareHouse = new BalanceWarehouse();
                        WareHouse.UseDefaultCredentials = true;

                        if (WareHouse.WSItemQaSample(POL.TheItemNo, ref SQ, ref UOM))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Message6"), POL.TheItemNo.ToString(), SQ.ToString("F2"), UOM.ToString()),
                                                                   mt.ReadResFile(this.Name.ToString() + "Message6Caption"));
                        }
                        WareHouse.Dispose();
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    #endregion

                    if (POL.TheUseMHD)
                    {
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText5");
                        tbInputData.Mask  = mt.ReadResFile(this.Name.ToString() + "DateMask");
                        Globals.step++;
                    }
                    else
                    {
                        // Hent Lotnummer fra nummerserie og opret Lot Info  Start.

                        BalanceWarehouse WareHouse = new BalanceWarehouse();
                        WareHouse.UseDefaultCredentials = true;

                        if (WareHouse.WSItemUsesTracking(POL.TheItemNo))
                        {
                            #region Generate PID
                            try
                            {
                                GenereretPID = WareHouse.WSReturnNewPID();
                            }
                            catch (Exception ex)
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                            }
                            #endregion

                            #region Print PID Preview
                            try
                            {
                                WareHouse.WSPrintPidPrev(GenereretPID, Globals.theWinlogon, POL.TheItemNo, POL.TheQuantity.ToString(), POL.TheMHD.ToString(), Vendorlot, POL.TheUnitOfMesure.ToString());
                                if (Globals.theShowMessage)
                                {
                                    MessageBoxExample.MyMessageBox.ShowBox(GenereretPID.ToString());
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString());
                            }
                            #endregion

                            // Hent Lotnummer fra nummerserie og opret Lot Info  S**t.
                            Globals.step     += 2;
                            tbInputData.Text  = "";
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText4");
                        }
                        else
                        {
                            Globals.step     += 3;
                            tbInputData.Text  = "";
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText6");
                            tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                        }
                    }
                }
                break;

                case 4:
                {
                    bool     OK       = false;
                    DateTime TestDate = new DateTime(1, 1, 1);

                    try
                    {
                        if (Decoding.theCode15.Equals(""))
                        {
                            TestDate = Convert.ToDateTime(tbInputData.Text);
                        }
                        else
                        {
                            TestDate = Convert.ToDateTime(Decoding.theCode15.ToString());
                        }

                        if (TestDate.CompareTo(DateTime.Now) >= 1)
                        {
                            OK = true;
                        }
                        else
                        {
                            OK = false;
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Message8"), TestDate.ToShortDateString(), Environment.NewLine, Environment.NewLine, DateTime.Today.ToShortDateString()));
                        }
                    }
                    catch (Exception ex)
                    {
                        OK = false;
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString());
                    }

                    if (OK)
                    {
                        lbMHD.Text = tbInputData.Text;
                        POL.TheMHD = DateTime.Parse(lbMHD.Text);
                        PurchaseLineList.Insert(POLindex, POL);
                        PurchaseLineList.RemoveAt(POLindex + 1);
                        tbInputData.Mask  = "";
                        tbInputData.Text  = "";
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText4");
                        Globals.step++;
                        // Hent Lotnummer fra nummerserie og opret Lot Info  Start.
                        BalanceWarehouse WareHouse = new BalanceWarehouse();
                        WareHouse.UseDefaultCredentials = true;
                        GenereretPID = WareHouse.WSReturnNewPID();
                        WareHouse.WSPrintPidPrev(GenereretPID, Globals.theWinlogon, POL.TheItemNo, POL.TheQuantity.ToString(), POL.TheMHD.ToString(), Vendorlot, POL.TheUnitOfMesure.ToString());
                        if (Globals.theShowMessage)
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(GenereretPID.ToString());
                        }
                        WareHouse.Dispose();
                        // Hent Lotnummer fra nummerserie og opret Lot Info  S**t.
                    }
                    else
                    {
                        tbInputData.Text = "";
                    }
                }
                break;

                case 5:
                {
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    POL = PurchaseLineList.ElementAt(POLindex);

                    if (WareHouse.WSItemUsesTracking(POL.TheItemNo))
                    {
                        if (!GenereretPID.Equals(tbInputData.Text))
                        {
                            tbInputData.Text = "";
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message7"));
                            break;
                        }

                        try
                        {
                            if (WareHouse.WSLotInfoUsed(tbInputData.Text))
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message5"));
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                        }


                        try
                        {
                            if (!WareHouse.WSLotInfoExists(POL.TheItemNo, tbInputData.Text, Vendorlot))
                            {
                                MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message3"));
                                break;
                            }
                            lbLotNo.Text     = tbInputData.Text;
                            tbInputData.Text = "";
                            POL = PurchaseLineList.ElementAt(POLindex);
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText6");
                            tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                            Globals.step++;
                        }
                        catch (Exception ex)
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                        }
                        finally
                        {
                            WareHouse.Dispose();
                        }
                    }
                }
                break;

                case 6:
                {
                    Decoding.theCode00 = "";
                    Decoding.theCode01 = "";
                    Decoding.theCode02 = "";
                    Decoding.theCode10 = "";
                    Decoding.theCode15 = "";
                    Decoding.theCode37 = "";
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    POL = PurchaseLineList.ElementAt(POLindex);
                    try
                    {
                        DateTime d;
                        if (POL.TheMHD.ToString() != "")
                        {
                            DateTime.TryParse(POL.TheMHD.ToString(), out d);
                        }
                        else
                        {
                            d = DateTime.Now;
                        }
                        this.pbIndicator.Image   = WindowsFormsApplication1.Properties.Resources.animatedCircle;
                        this.pbIndicator.Visible = true;

                        WareHouse.WSWhsPostReceiptLine(OrderType, POL.TheSourceNo, POL.TheItemNo, POL.TheQuantity, d, lbLotNo.Text, Vendorlot, POL.TheLinje, Globals.theLocation);
                    }
                    catch (Exception ex)
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    lbQuantity.Text = WareHouse.WSReturnRemaningQuantity(OrderType, POL.TheSourceNo.ToString(), POL.TheItemNo.ToString()).ToString(CultureInfo.GetCultureInfo(Globals.theLanguageCode).NumberFormat);

                    this.pbIndicator.Image   = null;
                    this.pbIndicator.Visible = false;

                    if (lbQuantity.Text == "0")
                    {
                        PurchaseLineList.RemoveAt(POLindex);
                        if (POLindex > 0)
                        {
                            POLindex--;
                        }
                        tbInputData.Text   = "";
                        btnNext.Enabled    = true;
                        btnPrevius.Enabled = true;
                        if (PurchaseLineList.Count > 1)
                        {
                            //lbNoOfLines.Text = PurchaseLineList.Count.ToString();
                            lbNoOfLines.Text  = string.Format("{0} {1} {2}", (POLindex + 1), "af", PurchaseLineList.Count());
                            Globals.step      = 1;
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText7");

                            // Hent aktuel varelinje Start
                            POL = PurchaseLineList.ElementAt(POLindex);
                            lbDescription.Text = POL.TheDescription;
                            lbNo.Text          = POL.TheItemNo;
                            lbQuantity.Text    = POL.TheQuantity.ToString();
                            if (POL.TheQuantity <= 0)
                            {
                                tbInputData.Enabled = false;
                            }
                            else
                            {
                                tbInputData.Enabled = true;
                            }
                            lbUnitOfMesure.Text = POL.TheUnitOfMesure;
                            // Hent aktuel varelinje S**t
                            lbLotNo.Text    = "";
                            lbMHD.Text      = "";
                            lbQuantity.Text = "";
                        }

                        if (PurchaseLineList.Count == 1)
                        {
                            lbNoOfLines.Text = PurchaseLineList.Count.ToString();
                            lbNoOfLines.Text = string.Format("{0} {1} {2}", (POLindex + 1), "af", PurchaseLineList.Count());
                            // Hent aktuel varelinje Start
                            POL = PurchaseLineList.ElementAt(POLindex);
                            lbDescription.Text = POL.TheDescription;
                            lbNo.Text          = POL.TheItemNo;
                            lbQuantity.Text    = POL.TheQuantity.ToString();
                            if (POL.TheQuantity <= 0)
                            {
                                tbInputData.Enabled = false;
                            }
                            else
                            {
                                tbInputData.Enabled = true;
                            }
                            lbUnitOfMesure.Text = POL.TheUnitOfMesure;
                            lbLotNo.Text        = "";
                            lbMHD.Text          = "";

                            // Hent aktuel varelinje S**t

                            Globals.step       = 1;
                            lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "LabelInputText7");
                            btnDecoder.Visible = true;
                            btSearch.Visible   = true;
                        }
                        if (PurchaseLineList.Count == 0)
                        {
                            Globals.step = 0;
                        }
                    }
                    else
                    {
                        Globals.step       = 1;
                        lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "LabelInputText7");
                        btnDecoder.Visible = true;
                        btSearch.Visible   = true;
                        tbInputData.Text   = "";       // Globals.VendorLot;
                        tbInputData.SelectAll();
                        lbLotNo.Text       = "";
                        lbMHD.Text         = "";
                        btnNext.Enabled    = true;
                        btnPrevius.Enabled = true;
                    }
                    if (Globals.step == 0)
                    {
                        lblInputText.Text   = mt.ReadResFile(this.Name.ToString() + "LabelInputText1");
                        lbLotNo.Text        = "";
                        lbMHD.Text          = "";
                        lbName.Text         = "";
                        lbName2.Text        = "";
                        lbNo.Text           = "";
                        lbQuantity.Text     = "";
                        lbUnitOfMesure.Text = "";
                        lbAddress.Text      = "";
                        lbDescription.Text  = "";
                        tbInputData.Text    = "";
                        lbNoOfLines.Text    = "";
                        btnNext.Enabled     = true;
                        btnPrevius.Enabled  = true;
                        Vendorlot           = "";
                    }
                    WareHouse.Dispose();
                }
                break;
                }
            }
            #region ESC
            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.step)
                {
                case 7:
                {
                    tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText6");
                    Globals.step--;
                }
                break;

                case 6:
                {
                    Globals.step--;
                }
                break;

                case 5:
                {
                    POL = PurchaseLineList.ElementAt(POLindex);


                    if (POL.TheUseMHD)
                    {
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText5");
                        tbInputData.Text  = POL.TheMHD.ToString();
                        Globals.step     -= 2;
                    }
                    else
                    {
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText4");
                        tbInputData.Text  = POL.TheLotNr.ToString();
                        Globals.step     -= 2;
                    }
                }
                break;

                case 4:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText3");
                    POL = PurchaseLineList.ElementAt(POLindex);
                    tbInputData.Mask = "";
                    tbInputData.Text = POL.TheQuantity.ToString();
                }
                break;

                case 3:
                {
                    Globals.step--;
                    lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "LabelInputText2");
                    tbInputData.Text   = Vendorlot;
                    btnPrevius.Enabled = true;
                    btnNext.Enabled    = true;
                }
                break;

                case 2:
                {
                    Globals.step      = 0;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText1");
                    tbInputData.Text  = "";
                }
                break;

                case 1:
                {
                    Globals.step--;
                }
                break;

                case 0: this.Close();
                    break;
                }
            }
            #endregion
        }
コード例 #4
0
        private void tbInputData_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.GlobalStep)
                {
                case 0:
                {
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    try
                    {
                        tbInputData.Text = WareHouse.WSGetItemCrossRef(WareHouse.WSGetItemCrossRef(tbInputData.Text));

                        if (WareHouse.WSItemUsesTracking(tbInputData.Text))
                        {
                            g_PID        = WareHouse.WSReturnNewPID();
                            b_NewPID     = true;
                            b_confirmPid = true;

                            UseMhd = WareHouse.WSItemUsesMhdTracking(tbInputData.Text);
                        }
                        lbDescription.Text = WareHouse.WSReturnItemDescription(tbInputData.Text);
                        if (lbDescription.Text.Equals(""))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message8"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                        }
                        lbUnitOfMesure.Text = WareHouse.WSReturnItemUnitOfMesure(tbInputData.Text, 2);
                        lbItemNo.Text       = tbInputData.Text;
                        CaptionBin();
                        Globals.GlobalStep++;
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                        tbInputData.Text = "";
                        tbInputData.Focus();
                    }
                }
                break;

                case 1:
                {
                    // Placeringsfunktionalitet.
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    lbLocation.Text = Globals.theLocation;

                    if (!WareHouse.WSBinExists(Globals.theLocation, tbInputData.Text.ToUpper()))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message4"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                        break;
                    }
                    if (!WareHouse.WSInventoryAllowed(Globals.theLocation, tbInputData.Text.ToUpper()))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message10"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                        break;
                    }


                    lbBin.Text = tbInputData.Text.ToUpper();

                    #region GetBincontent
                    decimal        antal = 0;
                    string         uom   = "";
                    BinContentTool bct   = new BinContentTool();
                    if (bct.GetItemBincontent(lbLocation.Text, lbBin.Text, lbItemNo.Text, ref antal, ref uom))
                    {
                        lbQuantity.Text     = antal.ToString("N2");
                        lbUnitOfMesure.Text = uom;
                    }
                    else
                    {
                        lbQuantity.Text = "0";
                    }
                    #endregion
                    bool UseMhd = false;
                    UseMhd = WareHouse.WSItemUsesMhdTracking(lbItemNo.Text);

                    if (UseMhd)
                    {
                        CaptionExpiredate();
                        Globals.GlobalStep = 3;
                    }
                    else
                    {
                        CaptionQuantity();
                        Globals.GlobalStep = 5;
                    }
                }

                break;

                case 2:
                {
                }
                break;

                case 3:
                {
                    // Mhd
                    bool     OK       = false;
                    DateTime TestDate = new DateTime(1, 1, 1);
                    try
                    {
                        TestDate = Convert.ToDateTime(tbInputData.Text);
                        if (TestDate.CompareTo(DateTime.Now) >= 1)
                        {
                            OK = true;
                        }
                        else
                        {
                            OK = false;
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Message5"), TestDate.ToShortDateString(), Environment.NewLine, Environment.NewLine, DateTime.Today.ToShortDateString()));
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }

                    if (OK)
                    {
                        lbExpiredate.Text = tbInputData.Text;
                        tbInputData.Mask  = "";
                        tbInputData.Text  = "";
                        CaptionVendorlot();
                        Globals.GlobalStep++;
                    }
                    else
                    {
                        tbInputData.Text = "";
                    }
                }
                break;

                case 4:
                {
                    // Leverandørlot
                    Vendorlot();
                    CaptionQuantity();
                }
                break;

                case 5:
                {
                    // Antal
                    // Kontrol på, at der ikke tælles på en ikke tilladt placeringstype kode
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    if (!WareHouse.WSInventoryAllowed(Globals.theLocation, lbBin.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message10"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                        break;
                    }

                    decimal d = 0;
                    // Angivelse af antal.
                    if (!decimal.TryParse(tbInputData.Text, out d))
                    {
                        break;
                    }
                    if (d < 0)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message6"));
                        tbInputData.SelectAll();
                        break;
                    }

                    if (d > 1000000)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message9"));
                        tbInputData.SelectAll();
                        break;
                    }

                    lbPhysQty.Text = tbInputData.Text;
                    if (b_NewPID && b_confirmPid)
                    {
                        CaptionLot();
                        //Indsæt funktion til udskrivning af p-is label-
                        Globals.GlobalStep = 6;
                    }
                    else
                    {
                        CaptionPosting();
                        Globals.GlobalStep = 7;
                    }

                    if ((b_NewPID) && (decimal.Parse(lbPhysQty.Text) > 0))
                    {
                        WareHouse.WSPrintPidPrev(g_PID, Globals.theWinlogon, lbItemNo.Text, lbPhysQty.Text, lbExpiredate.Text, lbVendorLot.Text, lbUnitOfMesure.Text);
                    }
                    WareHouse.Dispose();
                }
                break;

                case 6:
                {
                    // Bekræft et evt P-ID
                    if (b_confirmPid)
                    {
                        if (g_PID != tbInputData.Text)
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                    }
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    try
                    {
                        if (WareHouse.WSLotInfoUsed(tbInputData.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }

                    try
                    {
                        if (!WareHouse.WSLotInfoExists(lbItemNo.Text, tbInputData.Text, lbVendorLot.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                        lot = tbInputData.Text;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText9");
                        tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                        Globals.step++;
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        WareHouse.Dispose();
                    }
                }
                break;

                case 7:
                {
                    // Bogføring
                    Posting();
                }
                break;
                }
            }
            #region ESC_KEY
            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.step)
                {
                case 6:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText8");
                    tbInputData.Text  = "";
                }
                break;

                case 5:
                {
                    if (!b_NewPID)
                    {
                        Globals.step       = 0;
                        lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "lblInputText1");
                        tbInputData.Text   = "";
                        b_NewPID           = false;
                        b_confirmPid       = false;
                        tbInputData.Text   = "";
                        lbLocation.Text    = "";
                        lbBin.Text         = "";
                        lbItemNo.Text      = "";
                        lbDescription.Text = "";
                        lbQuantity.Text    = "";
                        lbExpiredate.Text  = "";
                        lbPID.Text         = "";
                        lbVendorLot.Text   = "";
                    }
                    else
                    {
                        Globals.step--;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText7");
                        tbInputData.Text  = "";
                    }
                }
                break;

                case 4:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText5");
                    tbInputData.Mask  = mt.ReadResFile(this.Name.ToString() + "DataMask");
                }
                break;

                case 3:
                {
                    Globals.step--;
                    tbInputData.Mask  = "";
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText4");
                }
                break;

                case 2:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3");
                }
                break;

                case 1:
                {
                    this.Close();
                }
                break;

                case 0: this.Close();
                    break;
                }
            }
            #endregion
        }
コード例 #5
0
        public void GetPidData()
        {
            #region Local variables
            string   lokation    = Globals.theLocation;
            string   placering   = "";
            string   varenr      = "";
            string   beskrivelse = "";
            decimal  antal       = 0;
            DateTime mhd         = DateTime.Now;
            string   uom         = "";
            string   vl          = "";

            MyToolbox mt = new MyToolbox();
            #endregion

            BalanceWarehouse WareHouse = new BalanceWarehouse();
            WareHouse.UseDefaultCredentials = true;

            ItemTool it = new ItemTool();

            if (thepid.Equals("#"))
            {
                g_PID             = WareHouse.WSReturnNewPID();
                b_NewPID          = true;
                lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv Placering.
                tbInputData.Text  = "";
                lbLocation.Text   = Globals.theLocation;
                if (Globals.theShowMessage)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(g_PID.ToString());
                }
                b_confirmPid = true;
                Globals.step++;
            }

            try
            {
                if (it.TypeOfItem(ref thepid, Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uom, ref vl, ref recountpid) == 1)
                {
                    lbLocation.Text = lokation;
                    if (lokation.Equals(""))
                    {
                        lokation = Globals.theLocation;
                    }
                    lbBin.Text          = placering;
                    lbItemNo.Text       = varenr;
                    lbDescription.Text  = beskrivelse;
                    lbQuantity.Text     = antal.ToString(CultureInfo.GetCultureInfo(Globals.theLanguageCode).NumberFormat);
                    lbUnitOfMesure.Text = uom;
                    lbExpiredate.Text   = mhd.ToShortDateString();
                    lbPID.Text          = thepid;
                    lbVendorLot.Text    = vl;

                    bool FirstInventory = false;

                    if (recountpid)
                    {
                        if (Globals.thePhysCountMode)
                        {
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv placering
                            Globals.step++;
                        }
                        else
                        {
                            b_NewPID          = true;
                            b_confirmPid      = false;
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv Placering.
                            tbInputData.Text  = "";
                            Globals.step++;
                        }
                    }
                    else
                    {
                        if (Globals.thePhysCountMode)
                        {
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv placering
                            Globals.step++;
                        }
                        else
                        {
                            if (!FirstInventory)
                            {
                                lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText6"); // Angiv Antal.
                                Globals.step      = 5;
                            }
                            else
                            {
                                lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv placering
                                Globals.step++;
                            }
                        }
                    }
                }
                else
                {
                    if (!WareHouse.WSPIDExists(tbInputData.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
                        tbInputData.SelectAll();
                        //break;
                    }
                    if (WareHouse.WSLotInfoUsed(tbInputData.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
                        // break;
                    }
                    else
                    {
                        b_NewPID          = true;
                        b_confirmPid      = false;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv Placering.
                        tbInputData.Text  = "";
                        lbLocation.Text   = Globals.theLocation;
                        Globals.step++;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString());
            }
            finally
            {
                WareHouse.Dispose();
            }
        }
コード例 #6
0
        private void tbInputData_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.GlobalStep)
                {
                case 0:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }
                }
                break;

                case 1:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }

                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;


                    if (!WareHouse.WSBinExists(Globals.theLocation, tbInputData.Text.ToUpper()))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message4"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                        break;
                    }
                    if (!WareHouse.WSInventoryAllowed(Globals.theLocation, tbInputData.Text.ToUpper()))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message10"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                        break;
                    }

//  Cykliskoptælling i kld begynd
                    if (Globals.thePhysCountMode)
                    {
                        if (tbInputData.Text.ToUpper() != lbBin.Text)
                        {
                            if (MessageBox.Show(string.Format("Placeringen {0} er forskellig fra {1}{2}Der er registreret på P-ID {3}. Er placeringen {4} rigtig?{5}Hvis ja, så flyttes P-ID {6} til den scannede placering",
                                                              tbInputData.Text, lbBin.Text, Environment.NewLine, lbPID.Text, tbInputData.Text, Environment.NewLine, lbPID.Text), "Placering", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                try
                                {
                                    var service = new BalanceWarehouse();
                                    service.UseDefaultCredentials = true;

                                    service.WSPostTransfer(Globals.theTransferTemplateName, Globals.theTransferBatchName, lbItemNo.Text, lbUnitOfMesure.Text, Globals.theWinlogon, Globals.theLocation, lbBin.Text, lbPID.Text, Globals.theLocation, tbInputData.Text, lbPID.Text, decimal.Parse(lbQuantity.Text), false, DateTime.Parse(lbExpiredate.Text.ToString()), DateTime.Now, 0);
                                    lbBin.Text = tbInputData.Text.ToUpper();
                                }
                                catch (Exception ex)
                                {
                                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                                }
                                tbInputData.Text  = "";
                                lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText6");         // Angiv antal
                                Globals.step      = 5;
                                break;
                            }
                            else
                            {
                                tbInputData.Text = "";
                                tbInputData.Focus();
                                break;
                            }
                        }
                        tbInputData.Text  = "";
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText6");         // Angiv antal
                        Globals.step      = 5;
                        break;
                    }
//  Cykliskoptælling i kld s**t

                    lbBin.Text        = tbInputData.Text;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText4");
                    tbInputData.Text  = "";

                    bool FirstInventory = false;
                    if (!FirstInventory)
                    {
                        Globals.step++;
                    }
                    else
                    {
                        if (!WareHouse.WSItemUsesTracking(lbItemNo.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format("Varen {0} kan ikke tælles op på et lotnummer,{1}da der ikke er en varesporringskode på varen", lbItemNo.Text, Environment.NewLine));
                            tbInputData.Text = "";
                            tbInputData.Focus();
                            break;
                        }
                        bool UseMhd = false;
                        UseMhd = WareHouse.WSItemUsesMhdTracking(lbItemNo.Text);

                        if (UseMhd)
                        {
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText5");
                            tbInputData.Mask  = mt.ReadResFile(this.Name.ToString() + "DataMask");
                            tbInputData.Text  = "";
                            Globals.step++;
                        }
                        else
                        {
                            tbInputData.Text  = "";
                            lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText6");         // Angiv antal
                            Globals.step      = 5;
                        }
                    }
                }
                break;

                case 2:
                {
                    bool UseMhd = false;

                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    try
                    {
                        if (!WareHouse.WSItemUsesTracking(tbInputData.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format("Varen {0} kan ikke tælles op på et lotnummer,{1}da der ikke er en varesporringskode på varen", lbItemNo.Text, Environment.NewLine));
                            break;
                        }

                        if (WareHouse.WSItemUsesTracking(tbInputData.Text) && (!recountpid))
                        {
                            g_PID    = WareHouse.WSReturnNewPID();
                            b_NewPID = true;
                        }

                        UseMhd             = WareHouse.WSItemUsesMhdTracking(tbInputData.Text);
                        lbDescription.Text = WareHouse.WSReturnItemDescription(tbInputData.Text);
                        if (lbDescription.Text.Equals(""))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message8"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                        }
                        lbUnitOfMesure.Text = WareHouse.WSReturnItemUnitOfMesure(tbInputData.Text, 2);
                        lbItemNo.Text       = tbInputData.Text;
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                        tbInputData.Text = "";
                        tbInputData.Focus();
                        break;
                    }
                    if (UseMhd)
                    {
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText5");
                        tbInputData.Mask  = mt.ReadResFile(this.Name.ToString() + "DataMask");
                        tbInputData.Text  = "";
                        Globals.step++;
                    }
                    else
                    {
                        tbInputData.Text  = "";
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText7");
                        Globals.step      = 4;
                    }
                }
                break;

                case 3:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }

                    bool     OK       = false;
                    DateTime TestDate = new DateTime(1, 1, 1);
                    try
                    {
                        TestDate = Convert.ToDateTime(tbInputData.Text);
                        if (TestDate.CompareTo(DateTime.Now) >= 1)
                        {
                            OK = true;
                        }
                        else
                        {
                            OK = false;
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Message5"), TestDate.ToShortDateString(), Environment.NewLine, Environment.NewLine, DateTime.Today.ToShortDateString()));
                        }
                    }
                    catch (Exception ex)
                    {
                        OK = false;
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }

                    if (OK)
                    {
                        lbExpiredate.Text = tbInputData.Text;
                        tbInputData.Mask  = "";
                        tbInputData.Text  = "";
                        Globals.step++;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText7");;
                        tbInputData.Text  = "";
                    }
                    else
                    {
                        tbInputData.Text = "";
                    }
                }
                break;

                case 4:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }

                    lbVendorLot.Text  = tbInputData.Text;
                    tbInputData.Text  = "";
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText6");
                    Globals.step++;
                }
                break;

                case 5:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }


                    // Kontrol på, at der ikke tælles på en ikke tilladt placeringstype kode
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    if (!WareHouse.WSInventoryAllowed(Globals.theLocation, lbBin.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message10"));
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                        break;
                    }


                    decimal d = 0;
                    // Angivelse af antal.
                    if (!decimal.TryParse(tbInputData.Text, out d))
                    {
                        break;
                    }
                    if (d < 0)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message6"));
                        tbInputData.SelectAll();
                        break;
                    }

                    if (d > 1000000)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message9"));
                        tbInputData.SelectAll();
                        break;
                    }

                    lbPhysQty.Text = tbInputData.Text;
                    if (b_NewPID && b_confirmPid)
                    {
                        Globals.step++;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText8");
                        tbInputData.Text  = "";
                    }
                    else
                    {
                        Globals.step      = 7;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText9");
                        tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                    }

                    if ((b_NewPID) && (decimal.Parse(lbPhysQty.Text) > 0))
                    {
                        WareHouse.WSPrintPidPrev(g_PID, Globals.theWinlogon, lbItemNo.Text, lbPhysQty.Text, lbExpiredate.Text, lbVendorLot.Text, lbUnitOfMesure.Text);
                    }
                    WareHouse.Dispose();
                }
                break;

                case 6:
                {
                    if (b_confirmPid)
                    {
                        if (g_PID != tbInputData.Text)
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                    }
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    try
                    {
                        if (WareHouse.WSLotInfoUsed(tbInputData.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }

                    try
                    {
                        if (!WareHouse.WSLotInfoExists(lbItemNo.Text, tbInputData.Text, lbVendorLot.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                        thepid            = tbInputData.Text;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText9");
                        tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "TextBox1");
                        Globals.step++;
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        WareHouse.Dispose();
                    }
                }
                break;

                case 7:
                {
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    try
                    {
                        DateTime d;
                        if (lbExpiredate.Text != "")
                        {
                            DateTime.TryParse(lbExpiredate.Text, out d);
                        }
                        else
                        {
                            d = DateTime.Now;
                        }

                        this.pbIndicator.Image   = WindowsFormsApplication1.Properties.Resources.animatedCircle;
                        this.pbIndicator.Visible = true;

                        WareHouse.WSPostPhysicalInventory(Globals.thePhysInvTemplateName, Globals.thePhysInvBatchName, lbItemNo.Text.ToString(), Globals.theWinlogon, lbLocation.Text, lbBin.Text, thepid, decimal.Parse(lbPhysQty.Text), lbUnitOfMesure.Text, false, true, d, lbVendorLot.Text, DateTime.Now);
                        if ((!b_NewPID) && (decimal.Parse(lbQuantity.Text) != decimal.Parse(lbPhysQty.Text)))
                        {
                            //WareHouse.WSPrintPID(lot);
                        }

                        if ((Globals.thePrintInvPid) && (!b_NewPID))
                        {
                            WareHouse.WSPrintPid(thepid, Globals.theWinlogon);
                        }
                    }
                    catch (Exception ex)
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

                        //lblInputText3
                        lblInputText.Text   = mt.ReadResFile(this.Name.ToString() + "lblInputText1");
                        tbInputData.Text    = "";
                        lbLocation.Text     = "";
                        lbBin.Text          = "";
                        lbItemNo.Text       = "";
                        lbDescription.Text  = "";
                        lbQuantity.Text     = "";
                        lbExpiredate.Text   = "";
                        lbUnitOfMesure.Text = "";
                        lbPhysQty.Text      = "";
                        lbVendorLot.Text    = "";
                        lbPID.Text          = "";
                        WareHouse.Dispose();
                        thepid       = "";
                        g_PID        = "";
                        b_NewPID     = false;
                        b_confirmPid = false;
                        Globals.step = 0;
                        this.Close();
                    }
                }
                break;
                }
            }

            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.step)
                {
                case 6:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText8");
                    tbInputData.Text  = "";
                }
                break;

                case 5:
                {
                    if (!b_NewPID)
                    {
                        this.Close();
                        Globals.step       = 0;
                        lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "lblInputText1");
                        tbInputData.Text   = "";
                        b_NewPID           = false;
                        b_confirmPid       = false;
                        tbInputData.Text   = "";
                        lbLocation.Text    = "";
                        lbBin.Text         = "";
                        lbItemNo.Text      = "";
                        lbDescription.Text = "";
                        lbQuantity.Text    = "";
                        lbExpiredate.Text  = "";
                        lbPID.Text         = "";
                        lbVendorLot.Text   = "";
                    }
                    else
                    {
                        Globals.step--;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText7");
                        tbInputData.Text  = "";
                    }
                }
                break;

                case 4:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText5");
                    tbInputData.Mask  = mt.ReadResFile(this.Name.ToString() + "DataMask");
                }
                break;

                case 3:
                {
                    Globals.step--;
                    tbInputData.Mask  = "";
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText4");
                }
                break;

                case 2:
                {
                    Globals.step--;
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3");
                }
                break;

                case 1:
                {
                    Globals.step = 0;
                    this.Close();
                }
                break;

                case 0:
                {
                    Globals.step = 0;
                    this.Close();
                }
                break;
                }
            }
        }