private Stock GetStockByFilters(string pStrWarehouse, string pStrItemCode, string pStrBatchNumber) { Stock lObjStock = null; ItemBatchDTO lObjItemBatch = null; lObjItemBatch = SapStockService.GetItemBatchByFilters(pStrWarehouse, pStrItemCode, pStrBatchNumber); if (lObjItemBatch != null) { lObjStock = new Stock() { ItemId = GetItemIdByCode(lObjItemBatch.ItemCode), CustomerId = GetCustomerIdByCode(lObjItemBatch.CardCode), InitialWarehouse = lObjItemBatch.InitialWarehouse, CurrentWarehouse = lObjItemBatch.CurrentWarehouse, ChargeFood = lObjItemBatch.ChargeFood, BatchNumber = lObjItemBatch.BatchNumber, Quantity = lObjItemBatch.Quantity, CreationDate = lObjItemBatch.CreateDate, ModificationDate = lObjItemBatch.UpdateDate > lObjItemBatch.CreateDate? lObjItemBatch.UpdateDate : lObjItemBatch.CreateDate, ExpirationDate = lObjItemBatch.ExpirationDate, Payment = lObjItemBatch.Payment, EntryFolio = lObjItemBatch.Folio }; } return lObjStock; }
public void UpdateStocks(string pStrWhsCode) { foreach (ItemBatchDTO lObjStock in SapStockService.GetUpdatedItemBatchesListByWarehouse(pStrWhsCode)) { if (StockHasChanges(lObjStock)) { UpdateStock(pStrWhsCode, lObjStock); } } }
private IList<ItemBatchDTO> GetStockToImport(string pStrWhsCode,DateTime pAuctionDate) { //Get Stock from SAP B1 IList<ItemBatchDTO> lLstObjSapStock = SapStockService.GetItemBatchesListByWarehouse(pStrWhsCode,pAuctionDate); //Get Local Stock IList<string> lLstStrLocalStock = LocalStockService.GetListByWhs() .Select(x => x.BatchNumber) .ToList(); //Get imported customers for valid that customer exists before then import his stock IList<string> lLstStrImportedCustomer = LocalBusinessPartnerService .GetList() .Select(x => x.Code) .ToList(); //Get imported items for valid that item exists before then import the customer's stock IList<string> lLstStrImportedItems = LocalItemService .GetList() .Select(x => x.Code) .ToList(); return lLstObjSapStock.Where(x => !lLstStrLocalStock.Contains(x.BatchNumber) && lLstStrImportedCustomer.Contains(x.CardCode) && lLstStrImportedItems.Contains(x.ItemCode)).ToList(); }