public IHttpActionResult PostBOMItem(BOMItem bOMItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BOMItems.Add(bOMItem); try { db.SaveChanges(); } catch (DbUpdateException) { if (BOMItemExists(bOMItem.BOMItemID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = bOMItem.BOMItemID }, bOMItem)); }
public IHttpActionResult PutBOMItem(string id, BOMItem bOMItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bOMItem.BOMItemID) { return(BadRequest()); } db.Entry(bOMItem).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BOMItemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void RowSelect(BOMItem selectedBOMItem) { var selectedPart = selectedBOMItem.PartItem; var motorService = IoC.Get <IMotorService>(); var windowManager = IoC.Get <IWindowManager>(); windowManager.ShowWindow(new WhereUsedViewModel(motorService.WhereUsed(selectedPart), $"Motors with {selectedPart}"), null, null); }
private async Task <bool> CheckItem() { Loading.IsVisible = true; try { BOMItem bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfScannedItem.Text); if (!await CheckQTY(bi.ItemCode, bi.Qty)) { return(false); } items.Add(new IBTItem { ScanBarcode = txfScannedItem.Text, ItemBarcode = bi.PackBarcode, ItemDesc = bi.ItemDesc, ItemCode = bi.ItemCode, ItemQtyOut = bi.Qty, ItemQtyIn = 0, PickDateTime = DateTime.Now }); return(true); } catch { try { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "FindDescAndCode"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string qry = $"ACCPRD|4|{txfScannedItem.Text}"; string str = $"GET?qrystr={qry}"; var Request = new RestSharp.RestRequest(str, RestSharp.Method.GET); var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful && res.Content != null) { if (!await CheckQTY(res.Content.Split('|')[2], 1)) { return(false); } items.Add(new IBTItem { ScanBarcode = txfScannedItem.Text, ItemBarcode = res.Content.Split('|')[4], ItemCode = res.Content.Split('|')[2], ItemDesc = res.Content.Split('|')[3], ItemQtyOut = 1, ItemQtyIn = 0, PickDateTime = DateTime.Now }); return(true); } } } catch { Loading.IsVisible = false; message.DisplayMessage("There was a error in getting this item", true); return(false); } } Loading.IsVisible = false; message.DisplayMessage("Invalid Item", false); return(false); }
public IHttpActionResult GetBOMItem(string id) { BOMItem bOMItem = db.BOMItems.Find(id); if (bOMItem == null) { return(NotFound()); } return(Ok(bOMItem)); }
public IHttpActionResult DeleteBOMItem(string id) { BOMItem bOMItem = db.BOMItems.Find(id); if (bOMItem == null) { return(NotFound()); } db.BOMItems.Remove(bOMItem); db.SaveChanges(); return(Ok(bOMItem)); }
private async void txfScanPack_Completed(object sender, EventArgs e) { if (txfScanPack.Text.Length > 1) { try { BOMItem bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfScanPack.Text); string result = await DisplayActionSheet($"Pack {bi.Qty} : {bi.ItemDesc} into one pack", "YES", "NO"); if (result == "YES") { // sending pack code to print queue RestClient client = new RestClient(); string path = "DocumentSQLConnection"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"POST?qry=INSERT INTO tblPrintQue (Barcode,Qty)VALUES('" + txfScanPack.Text + "',1)"; var Request = new RestSharp.RestRequest(str, Method.POST); CancellationTokenSource ct = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, ct.Token); if (!res.IsSuccessful) { Vibration.Vibrate(); message.DisplayMessage("Could not send the codes", false); } } message.DisplayMessage("COMPLETE!", false); await Navigation.PopAsync(); } else { txfScanPack.Text = ""; txfScanPack.Focus(); } } catch { Vibration.Vibrate(); message.DisplayMessage("No pack code found", true); txfScanPack.Text = ""; txfScanPack.Focus(); } } }
private async void TxfBarcode_TextChanged(object sender, TextChangedEventArgs e) { if (txfBarcode.Text != "") { Loader.IsVisible = true; try { BOMItem bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfBarcode.Text); Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("You can only add single items", true); } catch { try { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "FindDescAndCode"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"GET?qrystr=ACCPRD|4|" + txfBarcode.Text; var Request = new RestSharp.RestRequest(); Request.Resource = str; Request.Method = RestSharp.Method.GET; var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful && res.Content.Split('|')[0].Contains("0")) { if (res.Content.Split('|')[2] == MainPage.docLines.Find(x => x.ItemDesc == "1ItemFromMain").ItemCode) { lblItemDesc.Text = res.Content.Split('|')[3]; ItemBarcode = res.Content.Split('|')[4]; ItemCode = res.Content.Split('|')[2]; Loader.IsVisible = false; } else { Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("This is not the same product", true); txfBarcode.Text = ""; txfBarcode.Focus(); return; } } } } catch { lblItemDesc.Text = "No Item With This Code"; Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("We could not find this item code", true); txfBarcode.Text = ""; txfBarcode.Focus(); return; } } txfQTY.Focus(); } }
private async void txfItemCode_Completed(object sender, EventArgs e) { LoadingIndicator.IsVisible = true; if (txfItemCode.Text.Length > 10) { if (items.Where(x => x.BarCode == txfItemCode.Text && x.Complete == false).FirstOrDefault() != null) { int CUSTQTY = 1; if (InvLandingPage.CustQty) { string result = await DisplayPromptAsync("Custom QTY", "Enter QTY of SINGLE units", "OK", "Cancel", keyboard : Keyboard.Numeric); switch (result) { case "Cancel": Vibration.Vibrate(); message.DisplayMessage("You have to enter a QTY", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; default: try { CUSTQTY = Convert.ToInt32(result); } catch { Vibration.Vibrate(); message.DisplayMessage("Please enter a valid QTY", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; } break; } } SameItemCheck(items.Where(x => x.BarCode == txfItemCode.Text).First().ItemCode); CurrentQTYCounted += CUSTQTY; Setlbl(items.Where(x => x.BarCode == txfItemCode.Text).First().ItemDesc); if (!RefreshList()) { Vibration.Vibrate(); message.DisplayMessage("Could Not Refresh The List", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; } } else { Vibration.Vibrate(); message.DisplayMessage("No item found or scanning complete for this item", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; } } else if (txfItemCode.Text.Length > 7 && !InvLandingPage.CustQty) { BOMItem bi = new BOMItem(); try { bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfItemCode.Text); } catch { Vibration.Vibrate(); message.DisplayMessage("Error! No Item with this code", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; } if (items.Where(x => x.ItemCode == bi.ItemCode && x.Complete == false).FirstOrDefault() != null) { SameItemCheck(bi.ItemCode); CurrentQTYCounted += bi.Qty; Setlbl(items.Where(x => x.ItemCode == bi.ItemCode).First().ItemDesc); if (!RefreshList()) { Vibration.Vibrate(); message.DisplayMessage("Could Not Refresh The List", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; } } else { Vibration.Vibrate(); message.DisplayMessage("No item found or scanning complete for this item", true); txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); return; } } else if (InvLandingPage.CustQty && (txfItemCode.Text.Length == 8 || txfItemCode.Text.Length == 9)) { Vibration.Vibrate(); message.DisplayMessage("You cannot add a pack to a custom Qty scan", true); } txfItemCode.Text = ""; LoadingIndicator.IsVisible = false; txfItemCode.Focus(); }
private async void TxfPackbarcode_TextChanged(object sender, TextChangedEventArgs e) { if (txfPackbarcode.Text.Length > 1) { docLines.Clear(); isLoading.IsVisible = true; if (MustMakePack) { try { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "FindDescAndCode"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string qry = $"ACCPRD|4|{txfPackbarcode.Text}"; string str = $"GET?qrystr={qry}"; var Request = new RestSharp.RestRequest(str, RestSharp.Method.GET); var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful && res.Content != null) { docLines.Add(new DocLine { ItemBarcode = txfPackbarcode.Text, ItemCode = res.Content.Split('|')[2], ItemDesc = res.Content.Split('|')[3], ItemQty = 1 }); lblDesc.Text = "Item: " + res.Content.Split('|')[3]; lblDesc.IsVisible = true; btnGoToRepack.IsVisible = true; return; } } } catch { Vibration.Vibrate(); btnGoToRepack.IsVisible = false; message.DisplayMessage("No item code found", true); txfPackbarcode.Text = ""; txfPackbarcode.Focus(); } } else { try { BOMItem bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfPackbarcode.Text); lblDesc.IsVisible = true; lblQTY.IsVisible = false; lblDesc.Text = "Item: " + bi.ItemDesc; lblQTY.Text = "Qty: " + bi.Qty; docLines.Add(new DocLine { ItemBarcode = bi.PackBarcode, ItemCode = bi.ItemCode, ItemDesc = "1ItemFromMain", ItemQty = bi.Qty }); btnGoToRepack.IsVisible = true; } catch { Vibration.Vibrate(); btnGoToRepack.IsVisible = false; message.DisplayMessage("No pack code found", true); txfPackbarcode.Text = ""; txfPackbarcode.Focus(); } } isLoading.IsVisible = false; } }
public async Task <bool> FindItem() { lblBarcode.Text = txfBarcode.Text; try { BOMItem bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfBarcode.Text); Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("You can't add a pack as a single item", true); } catch { try { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "FindDescAndCode"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"GET?qrystr=ACCPRD|4|" + txfBarcode.Text; var Request = new RestSharp.RestRequest(); Request.Resource = str; Request.Method = RestSharp.Method.GET; var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful && res.Content.Split('|')[0].Contains("0")) { if (res.Content.Split('|')[2] == MainPage.docLines.Find(x => x.ItemDesc == "1ItemFromMain").ItemCode) { lblItemDesc.Text = res.Content.Split('|')[3]; if (MainPage.docLines.Where(x => x.ItemDesc == "1ItemFromMain").Select(x => x.ItemQty).FirstOrDefault() >= 1 + MainPage.docLines.Where(x => x.ItemDesc != "1ItemFromMain").Sum(x => x.ItemQty)) { MainPage.docLines.Add(new DocLine { ItemBarcode = txfBarcode.Text, ItemDesc = lblItemDesc.Text, isRejected = false, ItemQty = 1 }); setQTY(txfBarcode.Text); Loader.IsVisible = false; return(true); } else { Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("Too many items have been scanned", true); return(false); } } else { Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("This is not the same product", true); lblItemDesc.Text = ""; lblItemQTY.Text = ""; return(false); } } } } catch { lblItemDesc.Text = "No Item With This Code"; Loader.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("This code could not be found", true); } } return(false); }
private async void txfNumberOfItem_Completed(object sender, EventArgs e) { if (txfNumberOfItem.Text.Length > 0) { try { int i = Convert.ToInt32(txfNumberOfItem.Text); if (!await CheckExists(i + "")) { PackCode = "F"; if (i > 9) { PackCode += txfNumberOfItem.Text; } else { PackCode += "0" + txfNumberOfItem.Text; } PackCode += "" + MainPage.docLines.First().ItemBarcode.Substring(7, 5); } try { BOMItem boi = await GoodsRecieveingApp.App.Database.GetBOMItem(PackCode); if (PackCode != null) { // sending pack code to print queue RestClient client = new RestClient(); string path = "DocumentSQLConnection"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"POST?qry=INSERT INTO tblPrintQue (Barcode,Qty)VALUES('" + PackCode + "',1)"; var Request = new RestSharp.RestRequest(str, Method.POST); CancellationTokenSource ct = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, ct.Token); if (!res.IsSuccessful) { Vibration.Vibrate(); message.DisplayMessage("Could not send codes to printing", false); } } } message.DisplayMessage("Complete!", true); await Navigation.PopAsync(); } catch { RestClient client; string path; string result = await DisplayActionSheet("No Pack Code found would you like to create a new packcode?", "YES", "NO"); if (result == "YES") { message.DisplayMessage("Linking Codes .....", false); if (PackCode != null) { // sending pack code to print queue client = new RestClient(); path = "DocumentSQLConnection"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"POST?qry=INSERT INTO tblPrintQue (Barcode,Qty)VALUES('" + PackCode + "',1)"; var Request = new RestSharp.RestRequest(str, Method.POST); CancellationTokenSource ct = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, ct.Token); if (!res.IsSuccessful) { Vibration.Vibrate(); message.DisplayMessage("Could not send the codes to printing", false); } } } linkCodesInPastel(MainPage.docLines.FirstOrDefault().ItemCode, PackCode); BOMItem itemB = new BOMItem(); itemB.PackBarcode = PackCode; itemB.ItemCode = MainPage.docLines.FirstOrDefault().ItemCode; itemB.Qty = Convert.ToInt16(txfNumberOfItem.Text); itemB.ItemDesc = MainPage.docLines.FirstOrDefault().ItemDesc; await GoodsRecieveingApp.App.Database.Insert(itemB); message.DisplayMessage("Complete!", true); await Navigation.PopAsync(); } } } catch { message.DisplayMessage("No BOM created!", true); } } }
public Task <int> Insert(BOMItem data) { return(database.InsertAsync(data)); }
private async void Button_Clicked(object sender, EventArgs e) { var sug = await GoodsRecieveingApp.App.Database.GetBOMITEMSAsync(); LodingIndiactor.IsVisible = true; if (Connectivity.NetworkAccess == NetworkAccess.Internet) { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "Find"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"GET?qrystr=ACCBOML|0|0&posInString=0&searchValue=0"; var Request = new RestSharp.RestRequest(); Request.Resource = str; Request.Method = RestSharp.Method.GET; var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful) { await GoodsRecieveingApp.App.Database.DeleteBOMData(); foreach (string s in res.Content.Split('#')) { if (s.Contains("0")) { BOMItem item = new BOMItem(); item.PackBarcode = s.Split('|')[1]; item.ItemCode = s.Split('|')[3]; item.Qty = Convert.ToInt32(s.Split('|')[4]); RestSharp.RestClient client1 = new RestSharp.RestClient(); string path1 = "GetField"; client1.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path1); { string str1 = $"GET?qrystr=ACCPRD|0|{ s.Split('|')[3] }|3"; var Request1 = new RestSharp.RestRequest(); Request1.Resource = str1; Request1.Method = RestSharp.Method.GET; var cancellationTokenSource1 = new CancellationTokenSource(); var res1 = await client1.ExecuteAsync(Request1, cancellationTokenSource1.Token); if (res1.IsSuccessful) { item.ItemDesc = res1.Content.Split('|')[1].Substring(0, (res1.Content.Split('|')[1].Length - 1)); } } var sugs = await GoodsRecieveingApp.App.Database.GetBOMITEMSAsync(); await GoodsRecieveingApp.App.Database.Insert(item); var sdg = await GoodsRecieveingApp.App.Database.GetBOMITEMSAsync(); } } LodingIndiactor.IsVisible = false; await DisplayAlert("Complete", "All items successfully updated", "OK"); } } } else { LodingIndiactor.IsVisible = false; await DisplayAlert("Error!!", "Please Reconnect to the internet", "OK"); } }
private async void txfItemCode_Completed(object sender, EventArgs e) { if (txfItemCode.Text.Length != 0) { // txfItemCode.Text = GoodsRecieveingApp.MainPage.CalculateCheckDigit(txfItemCode.Text); if (txfItemCode.Text.Length == 8) { BOMItem bi = new BOMItem(); try { bi = await GoodsRecieveingApp.App.Database.GetBOMItem(txfItemCode.Text); } catch { Vibration.Vibrate(); message.DisplayMessage("Error! No Item with this code", true); txfItemCode.Text = ""; txfItemCode.Focus(); return; } if (await CheckOrderItemCode(bi.ItemCode)) { List <DocLine> docs = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).Where(x => x.ItemCode == bi.ItemCode).ToList(); int i = docs.Sum(x => x.ScanAccQty); if (i + bi.Qty <= docs.First().ItemQty) { DocLine docline = new DocLine { Balacnce = 0, Complete = "No", DocNum = txfSOCode.Text, isRejected = false, ItemBarcode = docs.First().ItemBarcode, ItemDesc = docs.First().ItemDesc, ItemCode = docs.First().ItemCode, ItemQty = docs.First().ItemQty, PalletNum = currentPallet, ScanAccQty = bi.Qty }; await GoodsRecieveingApp.App.Database.Insert(docline); await RefreshList(); } else { Vibration.Vibrate(); message.DisplayMessage("All of this item have been scanned for this order", true); } } else { Vibration.Vibrate(); message.DisplayMessage("This Item is not on this order", true); } } else { if (await CheckOrderBarcode(txfItemCode.Text)) { List <DocLine> docs = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).Where(x => x.ItemBarcode == txfItemCode.Text).ToList(); int i = docs.Sum(x => x.ScanAccQty); if (i + 1 <= docs.First().ItemQty) { DocLine docline = new DocLine { Balacnce = 0, Complete = "No", DocNum = txfSOCode.Text, isRejected = false, ItemBarcode = txfItemCode.Text, ItemDesc = docs.First().ItemDesc, ItemCode = docs.First().ItemCode, ItemQty = docs.First().ItemQty, PalletNum = currentPallet, ScanAccQty = 1 }; await GoodsRecieveingApp.App.Database.Insert(docline); await RefreshList(); } else { Vibration.Vibrate(); message.DisplayMessage("All of this item have been scanned for this order", true); } } else { Vibration.Vibrate(); message.DisplayMessage("This Item is not on this order", true); } } if (await CompleteCheck()) { btnComplete.IsVisible = true; } else { btnComplete.IsVisible = false; } txfItemCode.Text = ""; txfItemCode.Focus(); } }