Пример #1
0
        private void GetData()
        {
            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 uom = "";
            string vl  = "";

            try
            {
                if (!WareHouse.WSReturnLotInfo(lot, Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uom, ref vl))
                {
                    MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
                }
                else
                {
                    lokation            = Globals.theLocation;
                    lbPID.Text          = lot;
                    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;
                    lblInputText.Text   = mt.ReadResFile(this.Name.ToString() + "lblInputText2");
                    lbNewLocation.Text  = lokation;
                    BinContentTool btool = new BinContentTool();
                    lbStdBin.Text    = btool.GetDefaultBin(Globals.theLocation, varenr);
                    tbInputData.Text = "";
                    Globals.step     = 1;
                }
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
            finally
            {
                WareHouse.Dispose();
                lbNewLocation.Text = lokation;
                tbInputData.Text   = "";
            }
        }
Пример #2
0
        public int TypeOfItem(ref string ItemData, string location, ref string placering, ref string varenr, ref string beskrivelse, ref decimal antal, ref DateTime mhd, ref string uom, ref string vl, ref bool b_recount)
        {
            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

            try
            {
                if (!WareHouse.WSReturnLotInfo(ItemData, Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uom, ref vl))
                {
                    if (WareHouse.WSBinExists(Globals.theLocation, ItemData.ToUpper()))
                    {
                        placering = ItemData;
                        return(3);
                    }

                    if (WareHouse.WSItemExists(WareHouse.WSGetItemCrossRef(WareHouse.WSGetItemCrossRef(ItemData))))
                    {
                        ItemData    = WareHouse.WSGetItemCrossRef(ItemData);
                        varenr      = ItemData;
                        beskrivelse = ReturnItemDescription(ItemData);

                        return(2);
                    }
                    if (WareHouse.WSLotInfoUsed(ItemData))
                    {
                        return(0);
                    }
                    else
                    {
                        if (WareHouse.WSPIDExists(ItemData))
                        {
                            b_recount = true;
                            return(1);
                        }
                    }
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString());
            }
            return(0);
        }
Пример #3
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;
                    }
                    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;
                }
            }
        }