public async Task <RouteData> DoInventoryBoxBack(long storeId, StockOperation mode, long inventoryBoxTaskId, InventoryDetailDto[] details, PLCPosition pos) { IWMSOperationApiAccessor wmsAccessor = WMSApiManager.GetOperationApiAccessor(storeId.ToString(), _client, this.UserDto); RouteData result = await wmsAccessor.DoInventoryBoxBack(mode, inventoryBoxTaskId, details, pos); return(result); }
protected void SaveLinkButton_OnClick(object sender, EventArgs e) { int importerStockID; int goodsID; int pseudoUnitID; decimal quantity; if (IsFormValid(out importerStockID, out goodsID, out pseudoUnitID, out quantity)) { var xml = Utilities.FormatXml(@"<data> <primary_stock_id>{0}</primary_stock_id> <secondary_stock_id>{1}</secondary_stock_id> <goods_id>{2}</goods_id> <pseudo_unit_id>{3}</pseudo_unit_id> <quantity>{4}</quantity> </data>", _exporterStockID, importerStockID, goodsID, pseudoUnitID, quantity < 0 ? quantity : -quantity); var stockOperation = new StockOperation(); stockOperation.TX_StockOperations(1, xml); if (stockOperation.IsError) { HeaderHF.Text = string.Format("<script>alert('{0}');</script>", stockOperation.ErrorMessage); } else { HeaderHF.Text = @"<script>Utilities.ClosePopup(0);</script>"; } } }
private SkuStockHistory CreateHistory(SkuStock skuStock, StockOperation stockOperation, int quantity) { return(new SkuStockHistory { OldAvailableQuantity = skuStock.AvailableQuantity, OldTotalQuantity = skuStock.TotalQuantity, OldReservedQuantity = skuStock.ReservedQuantity, Operation = stockOperation, Quanity = quantity, StockId = skuStock.Id, Number = _sequenceProvider.GetNext(SkuHistorySequenceName) }); }
public async Task <ActionResult> CropInsect(CropStockInsertDto cropStock) { int id = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var logineduser = await _auth.VerifyUser(id); var stock = await _context.Stocks.FirstOrDefaultAsync(s => s.Barcode == cropStock.barcode); if (stock == null) { Stock _newStock = new Stock() { Barcode = cropStock.barcode, Product = await _context.Products.FirstOrDefaultAsync(s => s.Id == cropStock.productId), Reproduction = await _context.Reproductions.FirstOrDefaultAsync(s => s.Id == cropStock.reproductionId), StockType = 2, WareHourse = await _context.WareHourses.FirstOrDefaultAsync(s => s.Id == cropStock.wareHouseId), Company = logineduser.Company, Quantity = cropStock.quantity, }; _context.Stocks.Add(_newStock); await _context.SaveChangesAsync(); StockOperation operation = new StockOperation() { Stock = _newStock, Quantity = cropStock.quantity, Accepter = logineduser, AcceptDate = DateTime.Now, Company = logineduser.Company, OperationNumber = 1, // operation type 1 medaxildir. HandingPerson = cropStock.handingPerson, HandingCarNumber = cropStock.handingCarNumber }; _context.StockOperations.Add(operation); await _context.SaveChangesAsync(); } return(Ok()); }
protected void SaveLinkButton_OnClick(object sender, EventArgs e) { int goodsID, pseudoUnitID; decimal quantity, unitPrice; string caption; bool hasVAT; if (IsFormValid(out goodsID, out quantity, out pseudoUnitID, out unitPrice, out caption, out hasVAT)) { var xml = Utilities.FormatXml(@"<data> <primary_stock_id>{0}</primary_stock_id> <goods_id>{1}</goods_id> <pseudo_unit_id>{2}</pseudo_unit_id> <unit_price>{3}</unit_price> <quantity>{4}</quantity> <caption>{5}</caption> <has_vat>{6}</has_vat> </data>", _exporterStockID, goodsID, pseudoUnitID, unitPrice, quantity, caption, hasVAT); var stockOperation = new StockOperation(); stockOperation.TX_StockOperations(0, xml); if (stockOperation.IsError) { HeaderHF.Text = string.Format("<script>alert('{0}');</script>", stockOperation.ErrorMessage); } else { HeaderHF.Text = @"<script>Utilities.ClosePopup(0);</script>"; } } }
public async Task <ActionResult> ImportToStock([FromBody] ImortStockDto importdata) { int id = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var logineduser = await _auth.VerifyUser(id); var purchaseProduct = await _context.PurchaseProducts .Include(s => s.Purchase).Include(s => s.Product). FirstOrDefaultAsync(s => s.Id == importdata.WaitingStockId); if (purchaseProduct == null) { return(BadRequest("Bele bir atinalma senedi yoxdur.")); } var totalquantity = importdata.CountByBarcode.Sum(s => s.Quantity); if (purchaseProduct.Quantity < totalquantity) { return(BadRequest("Daxil Etdiyiniz miqdar Satinalma senedinde ki miqdardan coxdur")); } foreach (var item in importdata.CountByBarcode) { var stock = await _context.Stocks .Where(s => s.Barcode == item.Barcode && s.Product.Id == purchaseProduct.Product.Id) .FirstOrDefaultAsync(); if (stock == null) { Stock _newStock = new Stock() { Purchase = purchaseProduct.Purchase, Barcode = item.Barcode, Product = purchaseProduct.Product, Quantity = item.Quantity, WareHourse = await _context.WareHourses.FirstOrDefaultAsync(s => s.Id == item.WareHourseId), ExpireDate = item.ExpireDate, Company = logineduser.Company, Price = purchaseProduct.LastPrice, UsedStatus = false, StockType = 1 // stock type 1 olanlar derman ve gubrelerdir }; _context.Stocks.Add(_newStock); await _context.SaveChangesAsync(); StockOperation operation = new StockOperation() { Stock = _newStock, Quantity = item.Quantity, Accepter = logineduser, AcceptDate = DateTime.Now, Company = logineduser.Company, OperationNumber = 1, // operation type 1 medaxildir. }; _context.StockOperations.Add(operation); await _context.SaveChangesAsync(); } else { stock.Quantity += item.Quantity; _context.Entry(stock).State = EntityState.Modified; await _context.SaveChangesAsync(); StockOperation operation = new StockOperation() { Stock = stock, Quantity = item.Quantity, Accepter = logineduser, AcceptDate = DateTime.Now, Company = logineduser.Company, OperationNumber = 1 }; _context.StockOperations.Add(operation); await _context.SaveChangesAsync(); } } purchaseProduct.ComingQuantity = totalquantity; _context.Entry(purchaseProduct).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok()); }