public async Task <IActionResult> PutStockTaking([FromRoute] int id, [FromBody] StockTaking stockTaking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != stockTaking.Id) { return(BadRequest()); } _context.Entry(stockTaking).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockTakingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void gridData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (gridData.SelectedRows.Count > 0) { STOCK_TAKING = (StockTaking)gridData.SelectedRows[0].Tag; this.Close(); } }
private void OKkryptonButton_Click(object sender, EventArgs e) { if (gridData.SelectedRows.Count > 0) { STOCK_TAKING = (StockTaking)gridData.SelectedRows[0].Tag; this.Close(); } }
private void pricemovkryptonButton1_Click(object sender, EventArgs e) { try { pricemovementkryptonDataGridView1.Rows.Clear(); if (m_part.ID == 0) { return; } IList movs = r_sir.GetSupplierInvoiceItem(m_part.ID); foreach (EventItem itm in movs) { int r = pricemovementkryptonDataGridView1.Rows.Add(); pricemovementkryptonDataGridView1[dateprcmovColumn1.Index, r].Value = itm.EVENT.TRANSACTION_DATE; pricemovementkryptonDataGridView1[codeprcmovColumn2.Index, r].Value = itm.EVENT.CODE; pricemovementkryptonDataGridView1[typeprcmovColumn1.Index, r].Value = itm.STOCK_CARD_ENTRY_TYPE.ToString(); pricemovementkryptonDataGridView1[qtyprcmovColumn1.Index, r].Value = itm.GetAmountInSmallestUnit(); pricemovementkryptonDataGridView1[unitprcmovColumn3.Index, r].Value = m_part.UNIT.CODE; switch (itm.STOCK_CARD_ENTRY_TYPE) { case StockCardEntryType.SupplierInvoice: SupplierInvoiceItem sii = (SupplierInvoiceItem)itm; SupplierInvoice si = (SupplierInvoice)sii.EVENT; si.SUPPLIER = (Supplier)r_sup.GetById(si.SUPPLIER); pricemovementkryptonDataGridView1[vendorprcmovColumn4.Index, r].Value = si.SUPPLIER.NAME; double c = sii.SUBTOTAL / sii.GetAmountInSmallestUnit(); c = r_ccy.ConvertToCurrency(si.CURRENCY, m_part.CURRENCY, c, si.TRANSACTION_DATE); pricemovementkryptonDataGridView1[priceprcmovColumn.Index, r].Value = c < 0 ? -c : c; break; case StockCardEntryType.StockTaking: StockTakingItems stk = (StockTakingItems)itm; StockTaking stkh = (StockTaking)itm.EVENT; double p = stk.TOTAL_AMOUNT / stk.GetAmountInSmallestUnit(); p = r_ccy.ConvertToCurrency(stkh.CURRENCY, m_part.CURRENCY, p, stkh.TRANSACTION_DATE); pricemovementkryptonDataGridView1[priceprcmovColumn.Index, r].Value = p < 0 ? -p : p; break; case StockCardEntryType.OpeningStock: OpeningStockItem opn = (OpeningStockItem)itm; OpeningStock opnh = (OpeningStock)itm.EVENT; double x = opn.TOTAL_AMOUNT / opn.GetAmountInSmallestUnit(); x = r_ccy.ConvertToCurrency(opnh.CURRENCY, m_part.CURRENCY, x, opnh.TRANSACTION_DATE); pricemovementkryptonDataGridView1[priceprcmovColumn.Index, r].Value = x < 0 ? -x : x; break; } pricemovementkryptonDataGridView1[statusMovementColumn.Index, r].Value = itm.EVENT.POSTED.ToString(); } UserSetting.AddNumberToGrid(pricemovementkryptonDataGridView1); updatePriceMovement(); } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static List <StockTaking> getMockedStocktaking() { List <StockTaking> stockList = new List <StockTaking>(); StockTaking s1 = new StockTaking(); s1.PackageId = 2; s1.PackageTypeId = 2; s1.PackageTypeDescription = "some type"; s1.BarCode = "3454534567567575"; s1.CostPerPackage = 45; s1.CurrentLocationCentreId = 1; s1.ExpirationDate = DateTime.Today.AddDays(34); StockTaking s2 = new StockTaking(); s2.PackageId = 3; s2.PackageTypeId = 6; s2.PackageTypeDescription = "some type"; s2.BarCode = "43634545345345345"; s2.CostPerPackage = 25; s2.CurrentLocationCentreId = 2; s2.ExpirationDate = DateTime.Today.AddDays(24); StockTaking s3 = new StockTaking(); s3.PackageId = 4; s3.PackageTypeId = 2; s3.PackageTypeDescription = "some type"; s3.BarCode = "345445344663466346"; s3.CostPerPackage = 85; s3.CurrentLocationCentreId = 1; s3.ExpirationDate = DateTime.Today.AddDays(12); StockTaking s4 = new StockTaking(); s4.PackageId = 5; s4.PackageTypeId = 7; s4.PackageTypeDescription = "some type"; s4.BarCode = "34534523423234"; s4.CostPerPackage = 15; s4.CurrentLocationCentreId = 2; s4.ExpirationDate = DateTime.Today.AddDays(2); StockTaking s5 = new StockTaking(); s5.PackageId = 6; s5.PackageTypeId = 3; s5.PackageTypeDescription = "some type"; s5.BarCode = "45345345234234"; s5.CostPerPackage = 15; s5.CurrentLocationCentreId = 2; s5.ExpirationDate = DateTime.Today.AddDays(-14); stockList.Add(s1); stockList.Add(s2); stockList.Add(s3); stockList.Add(s4); stockList.Add(s5); return(stockList); }
protected override void btnImport_Clicked(object o, EventArgs args) { int selectedRow = grid.FocusedRow; long?groupId = null; if (selectedRow >= 0) { selectedId = entities [selectedRow].Id; groupId = entities [selectedRow].GroupId; } // Added transaction to ensure that we are connected to the same server in case of // master-slave replication using (new DbMasterScope(BusinessDomain.DataAccessProvider)) { List <Item> imported = new List <Item> (); long? locationId = null; FormHelper.ImportData <Item> (null, (e, a) => { imported.Add((Item)e); locationId = a.LocationId; }, true); if (locationId != null && imported.Count > 0) { StockTaking stockTaking = new StockTaking { LocationId = (int)locationId, UserId = BusinessDomain.LoggedUser.Id, LoggedUserId = BusinessDomain.LoggedUser.Id, Date = BusinessDomain.Today }; bool allowNegativeAvail = BusinessDomain.AppConfiguration.AllowNegativeAvailability; foreach (Item item in imported) { // Skip items with no imported availability if (!item.Quantity.IsZero() && (item.Quantity > 0 || allowNegativeAvail)) { StockTakingDetail detail = stockTaking.AddNewDetail(); detail.ItemEvaluate(item, PriceGroup.RegularPrice, true); detail.ExpectedQuantity = 0; detail.EnteredQuantity = item.Quantity; detail.Note = Translator.GetString("Auto Stock-taking after items import"); } } if (stockTaking.Details.Count > 0) { stockTaking.Commit(PriceGroup.RegularPrice); } } OnEntitiesChanged(groupId); } }
/*Section="CustomCodeRegion"*/ #region Customized public override StockTaking Create(StockTaking dataObject) { try { return(base.Create(dataObject)); } catch (Exception ex) { _logger.Error($" ServiceName : StockTakingService, MethodName : Create, Input : {Newtonsoft.Json.JsonConvert.SerializeObject(dataObject)}, Exception : {ex.Message}"); throw ex; } }
public async Task <IActionResult> PostStockTaking([FromBody] StockTaking stockTaking) { this.ModelState.Remove("Id"); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.StockTakings.Add(stockTaking); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStockTaking", new { id = stockTaking.Id }, stockTaking)); }
public HttpResponseMessage UpdateRow(StockTaking viewModel) { HttpResponseMessage response = new HttpResponseMessage(); try { _dataService.Update(viewModel.Map <Overtech.DataModels.Warehouse.StockTaking, StockTaking>()); response.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { response.StatusCode = HttpStatusCode.BadRequest; response.Content = new StringContent(ex.Message); } return(response); }
public StockTakingProtocol(StockTaking stockTaking) : this() { ProtocolDate = BusinessDomain.GetFormattedDate(stockTaking.Date); ProtocolNumber = stockTaking.FormattedOperationNumber; Note = stockTaking.Note; CompanyRecord company = CompanyRecord.GetDefault(); CompanyName = company.Name; CompanyNumber = company.Bulstat; CompanyCity = company.City; CompanyAddress = company.Address; CompanyTelephone = company.Telephone; CompanyLiablePerson = company.LiablePerson; Location = stockTaking.Location2; double vat = stockTaking.VAT; if (BusinessDomain.AppConfiguration.VATIncluded) { Total = Currency.ToString(stockTaking.Total - vat); Vat = Currency.ToString(vat); TotalPlusVat = stockTaking.Total; } else { Total = Currency.ToString(stockTaking.Total); Vat = Currency.ToString(vat); TotalPlusVat = stockTaking.Total + vat; } int i = 1; foreach (StockTakingDetail detail in stockTaking.Details) { StockTakingProtocolDetail stockTakingProtocolDetail = new StockTakingProtocolDetail(i++, detail, false); stockTakingProtocolDetail.ExpectedQuantity = Quantity.ToString(detail.ExpectedQuantity); stockTakingProtocolDetail.EnteredQuantity = Quantity.ToString(detail.EnteredQuantity); StockTakingProtocolDetails.Add(stockTakingProtocolDetail); } TotalQuantity = Quantity.ToString(stockTaking.Details.Sum(d => d.EnteredQuantity)); }
public IHttpActionResult PostI_StockTaking(StockTaking sk) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.I_StockTaking.Add(sk.st); db.SaveChanges(); I_StockTakingItemCatalog StockTakingItemCatalog = new I_StockTakingItemCatalog(); for (int i = 0; i < sk.Items.Count; i++) { StockTakingItemCatalog.StockTakingId = sk.st.Id; StockTakingItemCatalog.ItemGroupId = sk.Items[i]; PostI_StockTakingItemCatalog(StockTakingItemCatalog); } return(Ok(sk)); }
public override void Update(StockTaking dataObject) { using (IDAL dal = this.DAL) { dal.BeginTransaction(); try { CountingOperations o = new CountingOperations(dal); o.UpdateStockTaking(dataObject); dal.CommitTransaction(); } catch (Exception ex) { dal.RollbackTransaction(); _logger.Error($" ServiceName : StockTakingService, MethodName : Update, Input : {Newtonsoft.Json.JsonConvert.SerializeObject(dataObject)}, Exception : {ex.Message}"); throw ex; } } }
public async Task <ActionResult> AddItems(string StoreId, string Date, string InventoryTime, string ClosingMethod, string Items) { StockTaking stk = new StockTaking(); I_StockTaking obj = new I_StockTaking(); obj.StoreId = Convert.ToInt32(StoreId); obj.Date = Convert.ToDateTime(Date); obj.InventoryTime = Convert.ToInt32(InventoryTime); obj.ClosingMethod = Convert.ToInt32(ClosingMethod); obj.CreatedBy = System.Web.HttpContext.Current.User.Identity.Name; obj.CreatedOn = System.DateTime.Now; List <int> list = new List <int>(); string[] arr = Items.Split(','); foreach (var item in arr) { if (item != "") { list.Add(Convert.ToInt32(item)); } } stk.st = obj; stk.Items = list; url = uri + "/api/StockTaking/PostI_StockTaking"; client.BaseAddress = new Uri(url); HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, stk); if (responseMessage.IsSuccessStatusCode) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); }
public void ClearForm() { try { textBoxCode.Text = ""; dateKryptonDateTimePicker.Value = DateTime.Today; employeeKryptonComboBox.SelectedIndex = 0; warehousekryptonComboBox.SelectedIndex = 0; currencyKryptonComboBox.SelectedIndex = 0; totalAmountkryptonNumericUpDown.Value = 0; stocktakingTypekryptonComboBox.SelectedIndex = 0; notesKryptonTextBox.Text = ""; dataItemskryptonDataGridView.Rows.Clear(); m_stocktaking = new StockTaking(); errorProvider1.Clear(); } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public List <StockTaking> GetStocktaking(int CentreId) { List <StockTaking> sList = new List <StockTaking>(); List <Package> pList = MockDataAccess.GetAllPackages(); foreach (Package p in pList) { if (p.CurrentLocation != null && p.CurrentLocation.CentreId == CentreId) { StockTaking sP = new StockTaking(); sP.PackageTypeId = p.PackageType.PackageTypeId; sP.PackageTypeDescription = p.PackageType.Description; sP.CostPerPackage = p.PackageType.Value; sP.BarCode = p.BarCode; sP.PackageId = p.PackageId; sP.ExpirationDate = p.ExpirationDate; sList.Add(sP); } } return(sList); }
public void FastEntryUpdate(StockTaking stockTaking) { using (IDAL dal = this.DAL) { dal.BeginTransaction(); try { IUniParameter prmStockTakingSchedule = dal.CreateParameter("StockTakingSchedule", stockTaking.StockTakingSchedule); IUniParameter prmProduct = dal.CreateParameter("Product", stockTaking.Product); IUniParameter prmZone = dal.CreateParameter("Zone ", stockTaking.Zone); IUniParameter prmCountingValue = dal.CreateParameter("CountingValue", stockTaking.CountingValue); dal.ExecuteNonQuery("WHS_UPD_FESTOCKTAKING_SP", prmStockTakingSchedule, prmProduct, prmZone, prmCountingValue); dal.CommitTransaction(); } catch (Exception ex) { dal.RollbackTransaction(); _logger.Error($"Error: FastEntryUpdate {ex.Message}"); throw ex; } } }
private void searchToolStripButton_Click(object sender, EventArgs e) { IList result = searchToolStripTextBox.Text == string.Empty?new ArrayList() : r_stocktaking.Search(searchToolStripTextBox.Text); if (result.Count == 1) { m_stocktaking = (StockTaking)result[0]; m_stocktaking = (StockTaking)r_stocktaking.Get(m_stocktaking.ID); m_stocktaking.EMPLOYEE = (Employee)r_employee.GetById(m_stocktaking.EMPLOYEE); m_stocktaking.WAREHOUSE = (Warehouse)r_warehouse.GetById(m_stocktaking.WAREHOUSE); m_stocktaking.CURRENCY = (Currency)r_ccy.GetById(m_stocktaking.CURRENCY); loadData(); setEnableForm(false); setEditMode(EditMode.View); } else { using (SearchStockTakingForm frm = new SearchStockTakingForm(searchToolStripTextBox.Text, result)) { frm.ShowDialog(); if (frm.STOCK_TAKING == null) { return; } else { m_stocktaking = frm.STOCK_TAKING; m_stocktaking = (StockTaking)r_stocktaking.Get(m_stocktaking.ID); m_stocktaking.EMPLOYEE = (Employee)r_employee.GetById(m_stocktaking.EMPLOYEE); m_stocktaking.WAREHOUSE = (Warehouse)r_warehouse.GetById(m_stocktaking.WAREHOUSE); m_stocktaking.CURRENCY = (Currency)r_ccy.GetById(m_stocktaking.CURRENCY); loadData(); setEnableForm(false); setEditMode(EditMode.View); } } } }
public void UpdateStockTakings(IEnumerable <StockTaking> stockTakingList) { using (IDAL dal = this.DAL) { dal.BeginTransaction(); StockTaking temps = null; try { _logger.Debug($"UpdateStockTakings RecordCount : {stockTakingList.Count()}"); foreach (StockTaking s in stockTakingList) { temps = s; if (s.StockTakingId != 0) { dal.Update(s); } else { s.Event = 1; s.Organization = 1; s.CountingDate = DateTime.Now.Date.AddHours(-6); //_logger.Debug($"UpdateStockTakings counting date: {s.CountingDate}"); dal.Create(s); } } dal.CommitTransaction(); } catch (Exception ex) { dal.RollbackTransaction(); _logger.Error($"Error: UpdateStockTakings {ex.Message}"); _logger.Error(temps.CountingDate); throw ex; } } }
public string StocktakingToString(StockTaking s) { return("P_Id:" + s.PackageId + " / T_Id:" + s.PackageTypeId + " / Descrip:" + s.PackageTypeDescription + " / Expiration:" + s.ExpirationDate + " / CostPerP:" + s.CostPerPackage); }
private void Get() { m_stockTaking = (StockTaking)m_stRep.Get(2); }
private void CANCELkryptonButton_Click(object sender, EventArgs e) { STOCK_TAKING = null; this.Close(); }
public static void EditOperation(OperationType type, long id) { string message; bool readOnlyView; if (!BusinessDomain.CanEditOperation(type, id, out message, out readOnlyView) && !readOnlyView) { if (!string.IsNullOrWhiteSpace(message)) { MessageError.ShowDialog(message); } return; } WbpOperationBase page = null; long invNum; bool allowView = false; switch (type) { case OperationType.Purchase: if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditDocsDelivery") != UserRestrictionState.Allowed) { break; } invNum = DocumentBase.GetLastDocumentNumber(id, OperationType.Purchase); if (invNum <= 0) { if (!PresentationDomain.CheckPurchasePricesDisabled()) { page = new WbpPurchase(id); } } else { ShowMessageHasInvoice(Purchase.GetById(id), invNum, "Icons.Purchase16.png", out allowView); if (allowView) { page = new WbpPurchase(id); } } break; case OperationType.Sale: if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditDocsSale") != UserRestrictionState.Allowed) { break; } invNum = DocumentBase.GetLastDocumentNumber(id, OperationType.Sale); if (invNum <= 0) { page = new WbpSale(id); } else { ShowMessageHasInvoice(Sale.GetById(id), invNum, "Icons.Sale16.png", out allowView); if (allowView) { page = new WbpSale(id); } } break; case OperationType.Waste: if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditDocsWaste") != UserRestrictionState.Allowed) { break; } page = new WbpWaste(id); break; case OperationType.StockTaking: if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditDocsRevision") != UserRestrictionState.Allowed) { break; } if (!StockTaking.GetById(id).CheckIsNewFormat()) { break; } page = new WbpStockTaking(id); break; case OperationType.TransferIn: case OperationType.TransferOut: if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditDocsTransfer") != UserRestrictionState.Allowed) { break; } page = new WbpTransfer(id); break; case OperationType.ComplexRecipeMaterial: case OperationType.ComplexRecipeProduct: if (BusinessDomain.RestrictionTree.GetRestriction("mnuOperProductionComplexRecipes") != UserRestrictionState.Allowed) { break; } if (!PresentationDomain.CheckPurchasePricesDisabled()) { using (EditNewComplexRecipe dlgRecipe = new EditNewComplexRecipe(ComplexRecipe.GetById(id))) dlgRecipe.Run(); } break; case OperationType.ComplexProductionMaterial: case OperationType.ComplexProductionProduct: if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditDocsComplexProduction") != UserRestrictionState.Allowed) { break; } if (!PresentationDomain.CheckPurchasePricesDisabled()) { page = new WbpProduction(id); } break; default: if (operationEditors == null) { operationEditors = new List <IOperationEditor> (); foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/OperationEditor")) { IOperationEditor editor = node.CreateInstance() as IOperationEditor; if (editor != null) { operationEditors.Add(editor); } } } foreach (IOperationEditor editor in operationEditors) { if (editor.SupportedType != type) { continue; } page = editor.GetEditorPage(id); break; } break; } if (page == null) { return; } if (readOnlyView || allowView) { page.SetReadOnly(); } PresentationDomain.MainForm.AddNewPage(page); }
public ActionResult ReSave(StockTaking stock) { var op = TakeStockService.ReSave(stock); return(Content(op.ToJson())); }