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); }
public void GetPidData() { #region Local variables string lokation = Globals.theLocation; string placering = ""; string varenr = ""; string beskrivelse = ""; decimal antal = 0; DateTime mhd = DateTime.Now; string uom = ""; string vl = ""; MyToolbox mt = new MyToolbox(); #endregion BalanceWarehouse WareHouse = new BalanceWarehouse(); WareHouse.UseDefaultCredentials = true; ItemTool it = new ItemTool(); if (thepid.Equals("#")) { g_PID = WareHouse.WSReturnNewPID(); b_NewPID = true; lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv Placering. tbInputData.Text = ""; lbLocation.Text = Globals.theLocation; if (Globals.theShowMessage) { MessageBoxExample.MyMessageBox.ShowBox(g_PID.ToString()); } b_confirmPid = true; Globals.step++; } try { if (it.TypeOfItem(ref thepid, Globals.theLocation, ref placering, ref varenr, ref beskrivelse, ref antal, ref mhd, ref uom, ref vl, ref recountpid) == 1) { lbLocation.Text = lokation; if (lokation.Equals("")) { lokation = Globals.theLocation; } lbBin.Text = placering; lbItemNo.Text = varenr; lbDescription.Text = beskrivelse; lbQuantity.Text = antal.ToString(CultureInfo.GetCultureInfo(Globals.theLanguageCode).NumberFormat); lbUnitOfMesure.Text = uom; lbExpiredate.Text = mhd.ToShortDateString(); lbPID.Text = thepid; lbVendorLot.Text = vl; bool FirstInventory = false; if (recountpid) { if (Globals.thePhysCountMode) { lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv placering Globals.step++; } else { b_NewPID = true; b_confirmPid = false; lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv Placering. tbInputData.Text = ""; Globals.step++; } } else { if (Globals.thePhysCountMode) { lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv placering Globals.step++; } else { if (!FirstInventory) { lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText6"); // Angiv Antal. Globals.step = 5; } else { lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv placering Globals.step++; } } } } else { if (!WareHouse.WSPIDExists(tbInputData.Text)) { MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1")); tbInputData.SelectAll(); //break; } if (WareHouse.WSLotInfoUsed(tbInputData.Text)) { MessageBoxExample.MyMessageBox.ShowBox(mt.ReadResFile(this.Name.ToString() + "Message1")); // break; } else { b_NewPID = true; b_confirmPid = false; lblInputText.Text = mt.ReadResFile(this.Name.ToString() + "lblInputText3"); // Angiv Placering. tbInputData.Text = ""; lbLocation.Text = Globals.theLocation; Globals.step++; } } } catch (Exception ex) { MessageBoxExample.MyMessageBox.ShowBox(ex.Message.ToString()); } finally { WareHouse.Dispose(); } }