Beispiel #1
0
        private void btChangePrinter_Click(object sender, EventArgs e)
        {
            string             printer = "";
            fmTerminalPrinters tp      = new fmTerminalPrinters();

            tp.ShowDialog(ref printer);
            if ((!lbPrinterName.Text.Equals(printer)) && (!printer.Equals("")))
            {
                lbPrinterName.Text = printer;
                BalanceWarehouse Warehouse = new BalanceWarehouse();
                Warehouse.UseDefaultCredentials = true;

                try
                {
                    Warehouse.WSSetPrinter(Globals.theWinlogon, Globals.theLocation, printer);
                }
                catch (Exception ex)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                }

                Warehouse.Dispose();
            }

            tbInputData.Focus();
        }
Beispiel #2
0
        public void GetCustomers()
        {
            BalanceWarehouse Warehouse = new BalanceWarehouse();

            Warehouse.UseDefaultCredentials = true;

            try
            {
                Warehouse.WSFindCustomers(WhseShipNo);
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }

            WarehouseShipmentFright_Service whsefrightservice = new WarehouseShipmentFright_Service();

            whsefrightservice.UseDefaultCredentials = true;

            List <WarehouseShipmentFright_Filter> WarehouseShipmentFrightFilterArray = new List <WarehouseShipmentFright_Filter>();

            WarehouseShipmentFright_Filter WarehouseShipmentNoFilter = new WarehouseShipmentFright_Filter();

            WarehouseShipmentNoFilter.Field    = WarehouseShipmentFright_Fields.Warehouse_Shipment_Header_No;
            WarehouseShipmentNoFilter.Criteria = WhseShipNo;
            WarehouseShipmentFrightFilterArray.Add(WarehouseShipmentNoFilter);

            Result = whsefrightservice.ReadMultiple(WarehouseShipmentFrightFilterArray.ToArray(), "", 50);

            if (Result.Count() > 0)
            {
                dataGridView1.DataSource = Result;
                dataGridView1.Update();
            }
        }
Beispiel #3
0
        private void ExtractLineData()
        {
            WhaLine            = WarehouseActivityLineList.ElementAt(WhaLineIndex);
            lbLines.Text       = string.Format("{0} af {1}", (WhaLineIndex + 1), NoOfLines.ToString());
            lbSourceNo.Text    = WhaLine.theSourceNo;
            lbItemNo.Text      = WhaLine.theItemNo;
            lbDescription.Text = WhaLine.theDescription;
            lbLotNo.Text       = WhaLine.theLotNo;
            lbQty.Text         = WhaLine.theQtyToHandle.ToString();
            lbBincode.Text     = WhaLine.theBin;
            lbUnits.Text       = WhaLine.theUnitOfMesure;
            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;
            lbQuantity.Text = WareHouse.WSReturnRemaningQtyPickorder(WhaLine.theNo, WhaLine.theLineNo).ToString(CultureInfo.GetCultureInfo(Globals.theLanguageCode).NumberFormat);

            UseTracking = WareHouse.WSItemUsesTracking(WhaLine.theItemNo);
            WareHouse.Dispose();

            if (UseTracking)
            {
                lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "LabelInputText2");
                tbInputData.Text   = "";
                Globals.GlobalStep = 1;
            }
            else
            {
                lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "LabelInputText5");
                tbInputData.Text   = "";
                Globals.GlobalStep = 3;
            }
        }
Beispiel #4
0
        private void btPrint_Click(object sender, EventArgs e)
        {
            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

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

            try
            {
                WareHouse.WSPrintPid(tbInputData.Text, Globals.theWinlogon);
            }
            catch (Exception ex)
            {
                this.pbIndicator.Image   = null;
                this.pbIndicator.Visible = false;

                MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString());
            }
            WareHouse.Dispose();
            tbInputData.Focus();
            tbInputData.SelectAll();
            this.pbIndicator.Image   = null;
            this.pbIndicator.Visible = false;
        }
Beispiel #5
0
        public string GetDefaultExtDocNo()
        {
            var service = new BalanceWarehouse();

            service.UseDefaultCredentials = true;

            return(service.WSReturnSalespersonExtDocNo());
        }
Beispiel #6
0
        private void GetReceiptliens(string OrderNo, int SourceType)
        {
            WarehouseReceiptLine_Service warehouserecieptlineservice = new WarehouseReceiptLine_Service();

            warehouserecieptlineservice.UseDefaultCredentials = true;

            List <WarehouseReceiptLine_Filter> WarehouseRecieptFilterArray = new List <WarehouseReceiptLine_Filter>();

            WarehouseReceiptLine_Filter SourceNoFilter = new WarehouseReceiptLine_Filter();

            SourceNoFilter.Field    = WarehouseReceiptLine_Fields.Source_No;
            SourceNoFilter.Criteria = OrderNo;
            WarehouseRecieptFilterArray.Add(SourceNoFilter);

            WarehouseReceiptLine_Filter SourceTypeFilter = new WarehouseReceiptLine_Filter();

            SourceTypeFilter.Field    = WarehouseReceiptLine_Fields.Source_Type;
            SourceTypeFilter.Criteria = SourceType.ToString();
            WarehouseRecieptFilterArray.Add(SourceTypeFilter);

            WarehouseReceiptLine [] RecieptLine = warehouserecieptlineservice.ReadMultiple(WarehouseRecieptFilterArray.ToArray(), "", 1000);

            if (RecieptLine.Count() > 0)
            {
                PurchaseLineList.Clear();
                POL = null;

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



                foreach (var POLl in RecieptLine)
                {
                    PurchaseLineList.Add(new PurchaseLine(POLl.No.ToString(), POLl.Description.ToString(), POLl.Qty_Outstanding, POLl.Unit_of_Measure_Code, 1, Warehouse.WSItemUsesMhdTracking(POLl.Item_No.ToString()), OrderNo, POLl.Item_No, POLl.Line_No));
                }

                lbNoOfLines.Text = (RecieptLine.Count() - ItemWithNoTracking).ToString();
                lbNoOfLines.Text = string.Format("{0} {1} {2}", (POLindex + 1), "af", PurchaseLineList.Count());
                Globals.step++;
                POL = PurchaseLineList.First();
                lbDescription.Text  = POL.TheDescription;
                lbNo.Text           = POL.TheItemNo;
                lbQuantity.Text     = POL.TheQuantity.ToString();
                lbUnitOfMesure.Text = POL.TheUnitOfMesure;

                lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText7");
            }
            else
            {
                tbInputData.Text = "";
                MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
            }
        }
Beispiel #7
0
        private void fmSetup_Load(object sender, EventArgs e)
        {
            if (Globals.theLanguageCode != "")
            {
                ChangeLanguage(Globals.theLanguageCode);
            }

            BalanceWarehouse Warehouse = new BalanceWarehouse();

            Warehouse.UseDefaultCredentials = true;

            string Sqlserver       = "";
            string SqlInstance     = "";
            string SqlDatabaseUser = "";
            string Company         = "";
            string WebUrl          = "";
            string Language        = "";
            string Printer         = "";

            try
            {
                Warehouse.WsReturnServerInfo(ref Sqlserver, ref SqlInstance, ref SqlDatabaseUser, ref Company, ref Language, ref WebUrl);
                tbSqlServer.Text    = Sqlserver;
                tbInstance.Text     = SqlInstance;
                tbDatabaseUser.Text = SqlDatabaseUser;
                tbCompany.Text      = Company;
                tbLanguage.Text     = Language;
                tbWebUrl.Text       = WebUrl;
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }

            try
            {
                Warehouse.WSReturnPrinterInfo(Globals.theWinlogon, Globals.theLocation, ref Printer);
                lbPrinterName.Text = Printer;
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }

            Warehouse.Dispose();
            tbInputData.Focus();
            tbInputData.SelectAll();

            Assembly asm = Assembly.GetExecutingAssembly();
            FileInfo fi  = new FileInfo(asm.Location);

            lbBuildDateTime.Text = fi.LastWriteTime.ToString();
            lbLocation.Text      = Globals.theLocation;
        }
Beispiel #8
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   = "";
            }
        }
Beispiel #9
0
        private void btPrint_Click(object sender, EventArgs e)
        {
            var service = new BalanceWarehouse();

            service.UseDefaultCredentials = true;

            switch (ReturnIndex)
            {
            case 1:
            {
                try
                {
                    service.WSPrintPid(data, Globals.theWinlogon);
                }
                catch (Exception ex)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                }
            }
            break;

            case 2:
            {
                try
                {
                    service.WSPrintItemLabel(data, (int)numericUpDown1.Value, Globals.theWinlogon);
                }
                catch (Exception ex)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                }
            }
            break;

            case 3:
            {
                try
                {
                    service.WSPrintBinLabel(data, (int)numericUpDown1.Value, Globals.theWinlogon);
                }
                catch (Exception ex)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                }
            }
            break;
            }
            numericUpDown1.Value = 1;
            tbInputData.Text     = "";
            lbDescription.Text   = "";
            tbInputData.Focus();
            btPrint.Enabled = false;
        }
Beispiel #10
0
        private void fmTestForm_Load(object sender, EventArgs e)
        {
            if (Globals.theLanguageCode != "")
            {
                ChangeLanguage(Globals.theLanguageCode);
            }

            BalanceWarehouse wh = new BalanceWarehouse();

            wh.UseDefaultCredentials = true;
            wh.WSReturnGeneralSetup(ref Error, ref OK, ref Errormessage);;
            wh.Dispose();
        }
Beispiel #11
0
        private void fmMain_Load(object sender, EventArgs e)
        {
            Globals.theWinlogon = WindowsIdentity.GetCurrent().Name.ToUpper();
            Globals.theUserID   = Globals.theWinlogon.Substring(Globals.theWinlogon.IndexOf('\\') + 1).ToUpper();
            EmployeeTool et = new EmployeeTool();

            et.GetEmployeeSettings(Globals.theWinlogon);
            if (Globals.theLanguageCode != "")
            {
                ChangeLanguage(Globals.theLanguageCode);
            }

            string Sqlserver       = "";
            string SqlInstance     = "";
            string SqlDatabaseUser = "";
            string Company         = "";
            string WebUrl          = "";
            string Language        = "";

            BalanceWarehouse Warehouse = new BalanceWarehouse();

            Warehouse.UseDefaultCredentials = true;

            try
            {
                Warehouse.WsReturnServerInfo(ref Sqlserver, ref SqlInstance, ref SqlDatabaseUser, ref Company, ref Language, ref WebUrl);
                lbCompanyName.Text = Company;
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }

            try
            {
                string ErrorSound   = "";
                string OkSound      = "";
                bool   Errormessage = false;
                Warehouse.WSReturnGeneralSetup(ref ErrorSound, ref OkSound, ref Errormessage);
                Globals.theOkSoundPath = OkSound;
                Globals.theErrorSound  = ErrorSound;
                Globals.theShowMessage = Errormessage;
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
            Warehouse.Dispose();
        }
Beispiel #12
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);
        }
Beispiel #13
0
        private void btSearch_Click(object sender, EventArgs e)
        {
            string Searchfor = "";

            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

            fmItemSearch isf = new fmItemSearch();

            isf.ShowDialog(ref Searchfor);

            GetIndexOfItem(WareHouse.WSGetItemCrossRef(WareHouse.WSGetItemCrossRef(Searchfor)));

            tbInputData.Focus();
        }
Beispiel #14
0
        public string ReturnItemNo(string pid)
        {
            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

            try
            {
                return(WareHouse.WSReturnItemNo(pid));
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
            return("");
        }
Beispiel #15
0
        private void tbComment_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyData == Keys.Enter) && (tbComment.Focus()))
            {
                if (Line != null)
                {
                    var service = new SalesCommentLines_Service();
                    service.UseDefaultCredentials = true;

                    if (!tbComment.Text.Equals(""))
                    {
                        Line.Comment = tbComment.Text;
                        service.Update(ref Line);
                    }
                    else
                    {
                        if (MessageBox.Show("Vil du slette linjen?", "Slet bemærkningslinje", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            service.Delete(Line.Key);
                        }
                    }
                    tbComment.Text = "";
                    Line           = null;
                }
                else
                {
                    var service = new BalanceWarehouse();
                    service.UseDefaultCredentials = true;

                    try
                    {
                        service.WSCreateSalesCommentLine((int)Document_Type.Order, orderno, tbComment.Text);
                        tbComment.Text = "";
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                }
                GetComment();
            }

            if ((e.KeyData == Keys.Escape) && (tbComment.Focus()))
            {
                this.Close();
            }
        }
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Enter)
            {
                if (dataGridView1.CurrentRow == null)
                {
                    return(true);
                }

                int CurIndex = dataGridView1.CurrentRow.Index;

                fmWarehouseFright wf = new fmWarehouseFright(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                wf.ShowDialog();

                dataGridView1.CurrentCell = dataGridView1.Rows[CurIndex].Cells[0];

                return(true);
            }

            if (keyData == Keys.D0)
            {
                if (dataGridView1.CurrentRow == null)
                {
                    return(true);
                }

                BalanceWarehouse Warehouse = new BalanceWarehouse();
                Warehouse.UseDefaultCredentials = true;
                try
                {
                    Warehouse.WSPrintWarehouseShipment(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                }
                catch (Exception ex)
                {
                    MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                }
                return(true);
            }

            if (keyData == Keys.Escape)
            {
                this.Close();
            }
            return(true);
        }
Beispiel #17
0
        private void btnBlock_Click(object sender, EventArgs e)
        {
            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

            try
            {
                WareHouse.WSBlockLotNo(tbInputData.Text, Globals.theWinlogon, DateTime.Now, "Varen er ikke OK", true);
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
            WareHouse.Dispose();
            tbInputData.Focus();
            tbInputData.SelectAll();
        }
Beispiel #18
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;
            }
        }
Beispiel #19
0
        private void button4_Click(object sender, EventArgs e)
        {
            BalanceWarehouse wh = new BalanceWarehouse();

            wh.UseDefaultCredentials = true;

            try
            {
                //MessageBoxExample.MyMessageBox.ShowBox( wh.WSEncodeCode128(textBox1.Text));
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
            finally
            {
                wh.Dispose();
            }
        }
Beispiel #20
0
        public int GetWhseActivityLines()
        {
            PickLines_Service picklineservice = new PickLines_Service();

            picklineservice.UseDefaultCredentials = true;

            List <PickLines_Filter> PickLinesFilterArray = new List <PickLines_Filter>();

            PickLines_Filter NoFilter = new PickLines_Filter();

            NoFilter.Field    = PickLines_Fields.No;
            NoFilter.Criteria = pickorder;
            PickLinesFilterArray.Add(NoFilter);

            PickLines_Filter ActionTypeFilter = new PickLines_Filter();

            ActionTypeFilter.Field    = PickLines_Fields.Action_Type;
            ActionTypeFilter.Criteria = Action_Type.Take.ToString();
            PickLinesFilterArray.Add(ActionTypeFilter);

            PickLines[] Details = picklineservice.ReadMultiple(PickLinesFilterArray.ToArray(), "", 1000);

            BalanceWarehouse Warehouse = new BalanceWarehouse();

            Warehouse.UseDefaultCredentials = true;

            if (Details.Count() > 0)
            {
                foreach (var item in Details)
                {
                    WarehouseActivityLineList.Add(new WarehouseActivityLine(2, item.No, item.Line_No, item.Source_Line_No, item.Source_Type, 1, item.Source_No,
                                                                            item.Item_No, item.Description, item.Unit_of_Measure_Code, item.Quantity, item.Qty_to_Handle,
                                                                            item.Qty_Handled, item.Qty_Outstanding, item.Lot_No, item.Expiration_Date.ToString(), item.Whse_Document_No, item.Bin_Code, item.Pick_Route));
                }
                Warehouseshipmentno = Details.FirstOrDefault().Whse_Document_No;
            }

            IComparer <WarehouseActivityLine> comparer = new MyOrderingClass();

            WarehouseActivityLineList.Sort(comparer);

            return(WarehouseActivityLineList.Count() - 1);
        }
Beispiel #21
0
        private void GetData()
        {
            BalanceWarehouse WareHouse = new BalanceWarehouse();

            WareHouse.UseDefaultCredentials = true;

            try
            {
                lbLocation.Text    = Globals.theLocation;
                lbItemNo.Text      = itemno;
                lbQuantity.Text    = "0";
                lblInputText.Text  = mt.ReadResFile(this.Name.ToString() + "lblInputText1");
                lbNewLocation.Text = Globals.theLocation;
                tbInputData.Text   = "";
                Globals.step       = 0;

                lbDescription.Text = WareHouse.WSReturnItemDescription(itemno);
                if (lbDescription.Text.Equals(""))
                {
                    MessageBoxExample.MyMessageBox.ShowBox(string.Format("Varen {0} findes ikke", itemno));
                    tbInputData.Focus();
                    tbInputData.SelectAll();
                }
                lbUnitOfMesure.Text = WareHouse.WSReturnItemUnitOfMesure(itemno, 2);
                BinContentTool btool = new BinContentTool();
                lbStdBin.Text = btool.GetDefaultBin(Globals.theLocation, itemno);
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
            finally
            {
                WareHouse.Dispose();
                lbNewLocation.Text = Globals.theLocation;
                tbInputData.Text   = "";
            }
        }
Beispiel #22
0
        private void btlLogout_Click(object sender, EventArgs e)
        {
            BalanceWarehouse Warehouse = new BalanceWarehouse();

            Warehouse.UseDefaultCredentials = true;

            try
            {
                if (Warehouse.WSEndProgramCode(tbInputData.Text))
                {
                    Application.ExitThread();
                }
                else
                {
                    MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Error1"));
                }
                tbInputData.Text = "";
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
        }
Beispiel #23
0
        private void btPost_Click(object sender, EventArgs e)
        {
            UpdateWarehouseFright();
            BalanceWarehouse Warehouse = new BalanceWarehouse();

            Warehouse.UseDefaultCredentials = true;

            try
            {
                if (Warehouse.WSPostWarehouseShipment(WhseShipNo))
                {
                    MessageBoxExample.MyMessageBox.ShowBox("Fragt er registreret og leverancen bogført");
                }
                else
                {
                    MessageBoxExample.MyMessageBox.ShowBox("Fejl ved bogføring. Tjek ved en PC!");
                }
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
            }
        }
Beispiel #24
0
        private void button6_Click(object sender, EventArgs e)
        {
            BalanceWarehouse Warehouse = new BalanceWarehouse();

            if (checkBox1.Checked)
            {
                Warehouse.UseDefaultCredentials = true;
            }
            else
            {
                Warehouse.Credentials = new System.Net.NetworkCredential("JEWO", "Vinter2015", "FROESLEV");
            }

            try
            {
            }
            catch (Exception ecx)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ecx.Message);
            }


            Warehouse.Dispose();
        }
Beispiel #25
0
        private void tbInputData_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                switch (Globals.GlobalStep)
                {
                case 0:
                {
                    // Placeringsfunktionalitet.
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    try
                    {
                        if (!WareHouse.WSBinExists(Globals.theLocation, tbInputData.Text))
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1"));
                            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;
                        }
                        #endregion
                        if (antal == 0)
                        {
                            MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Error5"), lbItemNo.Text, lbBin.Text));
                            tbInputData.Focus();
                            tbInputData.SelectAll();
                            break;
                        }
                        Globals.GlobalStep++;
                    }
                    catch (Exception ex)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                        tbInputData.SelectAll();
                        break;
                    }
                    tbInputData.Text  = "";
                    lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText2");
                }
                break;

                case 1:
                {
                    if (tbInputData.Text.Equals(""))
                    {
                        break;
                    }
                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;

                    if (!WareHouse.WSBinExists(lbNewLocation.Text, tbInputData.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
                        tbInputData.SelectAll();
                        break;
                    }

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

                    BinContentTool btool = new BinContentTool();

                    if (!btool.BinIsDefault(Globals.theLocation, lbNewBinCode.Text, lbItemNo.Text, "") && (lbStdBin.Text != lbNewBinCode.Text))
                    {
                        if (MessageBox.Show(string.Format("Skal standard placering skiftes fra {0} til {1}?", lbStdBin.Text, lbNewBinCode.Text), "Skift standard placering", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            if (MessageBox.Show(string.Format("Er du sikker på at du vil skiftes fra {0} til {1}?", lbStdBin.Text, lbNewBinCode.Text), "Advarsel! Skifter standard placering", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                            {
                                changedefaultbin = true;
                            }
                        }
                    }

                    tbInputData.SelectAll();
                    Globals.step++;
                }
                break;

                case 2:
                {
                    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 > decimal.Parse(lbQuantity.Text))
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(string.Format(mt.ReadResFile(this.Name.ToString() + "Error4"), lbQuantity.Text, lbUnitOfMesure.Text));
                        tbInputData.SelectAll();
                        break;
                    }

                    lbMoveQty.Text    = tbInputData.Text;
                    lbNewUom.Text     = lbUnitOfMesure.Text;
                    lblInputText.Text = lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText4");
                    tbInputData.Text  = mt.ReadResFile(this.Name.ToString() + "lblInputText5");
                    Globals.step++;
                }
                break;

                case 3:
                {
                    this.pbIndicator.Image   = WindowsFormsApplication1.Properties.Resources.animatedCircle;
                    this.pbIndicator.Visible = true;

                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    try
                    {
                        if (changedefaultbin)
                        {
                            WareHouse.WSSetDefaultBin(Globals.theLocation, lbStdBin.Text, lbItemNo.Text, lbUnitOfMesure.Text, false);
                        }

                        WareHouse.WSPostTransfer(Globals.theTransferTemplateName, Globals.theTransferBatchName, lbItemNo.Text.ToString(), lbUnitOfMesure.Text, Globals.theWinlogon, lbLocation.Text.ToString(), lbBin.Text.ToString(), "", lbNewLocation.Text.ToString(), lbNewBinCode.Text.ToString(), itemno.ToString(), decimal.Parse(lbMoveQty.Text.ToString()), false, DateTime.Parse(DateTime.Now.ToString()), DateTime.Now, 0);

                        if (changedefaultbin)
                        {
                            WareHouse.WSSetDefaultBin(Globals.theLocation, lbNewBinCode.Text, lbItemNo.Text, lbUnitOfMesure.Text, true);
                        }
                    }
                    catch (Exception ex)
                    {
                        this.pbIndicator.Image   = null;
                        this.pbIndicator.Visible = false;

                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    this.Close();
                    Globals.GlobalStep = 0;
                }
                break;
                }
            }

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

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

                case 0: this.Close();
                    break;
                }
            }
        }
Beispiel #26
0
        public void GetPidData(string Data)
        {
            #region Local variables
            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();

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

            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:
                {
                    lbDescription.Text = string.Format("{0} {1}", varenr, beskrivelse);
                    ReturnIndex        = 1;
                    //P-ID
                }
                break;

                case 2:
                {
                    lbDescription.Text = string.Format("{0} {1}", varenr, beskrivelse);
                    ReturnIndex        = 2;
                    //Vareinfo
                }
                break;

                case 3:
                {
                    lbDescription.Text = string.Format("{0} {1}", Data, "");
                    ReturnIndex        = 3;
                    //Placering
                }
                break;
                }
            }
            catch (Exception ex)
            {
                MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString());
                tbInputData.Text = "";
            }
            finally
            {
                WareHouse.Dispose();
            }
            if (ReturnIndex > 0)
            {
                btPrint.Enabled = true;
            }
            else
            {
                btPrint.Enabled = false;
            }
        }
Beispiel #27
0
        private void GetPurchaseOrder(string OrderNo)
        {
            PurchaseOrderCard_Service purchaseorderservice = new PurchaseOrderCard_Service();

            purchaseorderservice.UseDefaultCredentials = true;

            List <PurchaseOrderCard_Filter> PurchaseOrderFilterArray = new List <PurchaseOrderCard_Filter>();

            PurchaseOrderCard_Filter PurchaseOrderNoFilter = new PurchaseOrderCard_Filter();

            PurchaseOrderNoFilter.Field    = PurchaseOrderCard_Fields.No;
            PurchaseOrderNoFilter.Criteria = OrderNo;
            PurchaseOrderFilterArray.Add(PurchaseOrderNoFilter);

            PurchaseOrderCard [] PurchaseOrder = purchaseorderservice.ReadMultiple(PurchaseOrderFilterArray.ToArray(), "", 1000);

            if (PurchaseOrder.Count() > 0)
            {
                foreach (var PO in PurchaseOrder)
                {
                    if (PO.Status == 0)
                    {
                        MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message4"));
                        break;
                    }
                    lbName.Text = PO.Buy_from_Vendor_Name.ToString();
                    if (!string.IsNullOrEmpty(PO.Buy_from_Vendor_Name_2))
                    {
                        lbName2.Text = PO.Buy_from_Vendor_Name_2.ToString();
                    }
                    if (!string.IsNullOrEmpty(PO.Buy_from_Address))
                    {
                        lbAddress.Text = PO.Buy_from_Address.ToString();
                    }

                    BalanceWarehouse WareHouse = new BalanceWarehouse();
                    WareHouse.UseDefaultCredentials = true;
                    try
                    {
                        if (WareHouse.WSCreateWarehouseInboundDoc(OrderNo))
                        {
                            // Hent købsmodtagelseslinjer
                            GetReceiptliens(OrderNo, OrderType);
                        }
                    }
                    catch (Exception ex)
                    {
                        Globals.step      = 0;
                        lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "LabelInputText1");
                        MessageBoxExample.MyMessageBox.ShowBox(ex.Message);
                    }
                    finally
                    {
                        WareHouse.Dispose();
                        tbInputData.Text   = "";
                        btnDecoder.Visible = true;
                    }
                }
            }
            else
            {
                tbInputData.Text = "";
                MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message2"));
            }
        }
Beispiel #28
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
        }
Beispiel #29
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;
                }
            }
        }
Beispiel #30
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();
                }
            }
        }