예제 #1
0
        public void GetPidData(string Data)
        {
            #region Local variables
            string   lokation    = Globals.theLocation;
            string   placering   = "";
            string   varenr      = "";
            string   beskrivelse = "";
            decimal  antal       = 0;
            DateTime mhd         = DateTime.Now;
            string   uom         = "";
            string   vl          = "";
            bool     b_recount   = false;

            MyToolbox mt = new MyToolbox();
            #endregion

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

            ItemTool it = new ItemTool();

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

            if (tbInputData.Text.Equals("#"))
            {
                if (Selector == 0)
                {
                    // Kald formen til optælling uden P-ID, hvis det er en holdbarhedsvare tilføjes data og et P-ID.
                    fmInventory inv = new fmInventory(tbInputData.Text);
                    inv.ShowDialog();
                    tbInputData.Text = "";
                }
                if (Selector == 1)
                {
                    // Bruges pt ikke
                    tbInputData.Text = "";
                }
            }
            else
            {
                try
                {
                    switch (it.TypeOfItem(ref Data, Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uom, ref vl, ref b_recount))
                    {
                    case 0:
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Error1"), Data));
                        tbInputData.Text = "";
                    }
                    break;

                    case 1:
                    {
                        if (Selector == 0)
                        {
                            fmPidInventory pi = new fmPidInventory(Data);
                            pi.ShowDialog();
                            tbInputData.Text = "";
                        }
                        if (Selector == 1)
                        {
                            // Kalde form til at afvikle flytning af varer med P-ID
                            fmPidItemTransfer pit = new fmPidItemTransfer(Data);
                            pit.ShowDialog();
                            tbInputData.Text = "";
                        }
                    }
                    break;

                    case 2:
                    {
                        #region GetBincontent
                        BinContentTool bct = new BinContentTool();
                        if (bct.GetItemBincontent(Globals.theLocation, "", Data.ToUpper(), ref antal, ref uom))
                        {
                            if (Selector == 0)
                            {
                                // Kalde form til at afvikle optælling af varer uden P-ID
                                fmInventory inv = new fmInventory(Data);
                                inv.ShowDialog();
                                tbInputData.Text = "";
                            }

                            if (Selector == 1)
                            {
                                // Kalde form til at afvikle flytning af varer uden P-ID
                                fmItemTransfer itf = new fmItemTransfer(Data);
                                itf.ShowDialog();
                                tbInputData.Text = "";
                            }
                        }
                        #endregion

/*
 *                              if (WareHouse.WSGetItemBinInformation(Globals.theWinlogon, Globals.theLocation, Data.ToUpper()) > 0)
 *                              {
 *                                  if (Selector == 0)
 *                                  {
 *                                      // Kalde form til at afvikle optælling af varer uden P-ID
 *                                      fmInventory inv = new fmInventory(Data);
 *                                      inv.ShowDialog();
 *                                      tbInputData.Text = "";
 *                                  }
 *
 *                                  if (Selector == 1)
 *                                  {
 *                                      // Kalde form til at afvikle flytning af varer uden P-ID
 *                                      fmItemTransfer itf = new fmItemTransfer(Data);
 *                                      itf.ShowDialog();
 *                                      tbInputData.Text = "";
 *                                  }
 *                              }
 */
                    }
                    break;

                    case 3:
                    {
                        if (WareHouse.WSGetBinContentInformation(Globals.theWinlogon, Globals.theLocation, Data.ToUpper()) > 0)
                        {
                            fmBinContent fm = new fmBinContent(1, Data.ToUpper());
                            fm.ShowDialog();
                            tbInputData.Text = "";
                        }
                    }
                    break;
                    }
                }
                catch (Exception ex)
                {
                    this.pbIndicator.Image   = null;
                    this.pbIndicator.Visible = false;

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

                    WareHouse.Dispose();
                }
            }
        }
예제 #2
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;
                    }
                    lbLocation.Text     = "";
                    lbBin.Text          = "";
                    lbItemNo.Text       = "";
                    lbDescription.Text  = "";
                    lbQuantity.Text     = "";
                    lbUnitOfMesure.Text = "";
                    lbExpiredate.Text   = "";
                    lbVendorLot.Text    = "";

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

                    string   lokation    = "";
                    string   placering   = "";
                    string   varenr      = "";
                    string   beskrivelse = "";
                    decimal  antal       = 0;
                    DateTime mhd         = DateTime.UtcNow;
                    lot = tbInputData.Text;
                    string vl        = "";
                    string uom       = "";
                    bool   b_recount = false;

                    string refNo = tbInputData.Text.ToUpper();

                    ItemTool it = new ItemTool();

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

                    try
                    {
                        refNo = WareHouse.WSGetItemCrossRef(refNo);
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }

                    try
                    {
                        switch (it.TypeOfItem(ref refNo, Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uom, ref vl, ref b_recount))
                        {
                        case 0:
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
                        }
                        break;

                        case 1:
                        {
                            if (lokation.Equals(""))
                            {
                                lokation = Globals.theLocation;
                            }
                            if (b_recount)
                            {
                                break;
                            }
                            lbLocation.Text     = lokation;
                            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();
                            lbVendorLot.Text    = vl;
                        }
                        break;

                        case 2:
                        {
                            if (WareHouse.WSGetItemBinInformation(Globals.theWinlogon, Globals.theLocation, refNo) > 0)
                            {
                                fmBinContent fm = new fmBinContent(2, refNo);
                                fm.ShowDialog();
                                this.Close();
                            }
                        }
                        break;

                        case 3:
                        {
                            if (WareHouse.WSGetBinContentInformation(Globals.theWinlogon, Globals.theLocation, refNo) > 0)
                            {
                                fmBinContent fm = new fmBinContent(1, tbInputData.Text.ToUpper());
                                fm.ShowDialog();
                                this.Close();
                            }
                        }
                        break;
                        }
                    }
                    catch (Exception ex)
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

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

                        WareHouse.Dispose();
                        tbInputData.Focus();
                        tbInputData.SelectAll();
                    }
                }
                break;
                }
            }

            if ((e.KeyChar == (char)Keys.Escape) || (e.KeyChar == (char)Keys.Tab))
            {
                switch (Globals.step)
                {
                case 3:
                {
                    Globals.step = 0;
                    this.Close();
                }
                break;

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

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

                case 0: this.Close();
                    break;
                }
            }
        }