public IHttpActionResult GetPalletDispatches(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } reqDate = TerminalServices.GetTerminalSyncDate(reqDate, terminal.TenantId); var result = new PalletsDispatchSyncCollection(); var allPallets = _palletService.GetAllPalletsDispatch(null, reqDate); result.PalletDispatchSync = AutoMapper.Mapper.Map <List <PalletsDispatch>, List <PalletDispatchSync> >(allPallets); result.Count = allPallets.Count; result.TerminalLogId = TerminalServices .CreateTerminalLog(reqDate, terminal.TenantId, allPallets.Count, terminal.TerminalId, TerminalLogTypeEnum.PalletingSync).TerminalLogId; return(Ok(AutoMapper.Mapper.Map(result, new PalletsDispatchSyncCollection()))); }
public async Task <IHttpActionResult> AcceptMarketJobRequest(MarketJobSync request) { request.SerialNumber = request.SerialNumber.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(request.SerialNumber); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(request.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } var marketJob = _marketServices.GetMarketJobById(request.MarketJobId); if (marketJob.Id == 0) { return(NotFound()); } var result = await _marketServices.AcceptMarketJob(request.MarketJobId, request.UserId, terminal.TenantId, terminal.TermainlSerial, request.Latitude, request.Longitude); return(Ok(result)); }
// GET http://localhost:8005/api/sync/vehicles/{reqDate}/{serialNo} public IHttpActionResult GetAllVehicles(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new MarketVehiclesSyncCollection(); var allVehicles = _marketServices.GetAllValidMarketVehicles(terminal.TenantId, reqDate, true).MarketVehicles; var results = new List <MarketVehiclesSync>(); foreach (var p in allVehicles) { var sync = new MarketVehiclesSync(); var mapped = AutoMapper.Mapper.Map(p, sync); results.Add(mapped); } result.Count = results.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, results.Count, terminal.TerminalId, TerminalLogTypeEnum.MarketVehiclesSync).TerminalLogId; result.Vehicles = results; return(Ok(result)); }
public IHttpActionResult GetAccounts(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new AccountSyncCollection(); var allAccounts = _accountServices.GetAllValidAccounts(terminal.TenantId, EnumAccountType.All, null, reqDate, true); var accounts = new List <AccountSync>(); foreach (var p in allAccounts) { var account = new AccountSync(); var mappedAccount = AutoMapper.Mapper.Map(p, account); mappedAccount.CountryName = p.GlobalCountry.CountryName; mappedAccount.CurrencyName = p.GlobalCurrency.CurrencyName; mappedAccount.PriceGroupName = p.TenantPriceGroups.Name; mappedAccount.PriceGroupID = p.PriceGroupID; mappedAccount.FullAddress = p.FullAddress; accounts.Add(mappedAccount); } result.Count = accounts.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, accounts.Count(), terminal.TerminalId, TerminalLogTypeEnum.AccountsSync).TerminalLogId; result.Accounts = accounts; return(Ok(result)); }
// GET http://ganetest.qsrtime.net/api/sync/orders/{reqDate}/{serialNo} // GET http://ganetest.qsrtime.net/api/sync/orders/2014-11-23/920013c000814 public IHttpActionResult GetOrders(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } reqDate = TerminalServices.GetTerminalSyncDate(reqDate, terminal.TenantId); var result = new OrdersSyncCollection(); var allOrders = OrderService.GetAllOrders(terminal.TenantId, terminal.WarehouseId, true, reqDate, true).ToList(); var warehouses = _lookupService.GetAllWarehousesForTenant(terminal.TenantId); var orders = new List <OrdersSync>(); foreach (var p in allOrders) { var order = new OrdersSync(); var mapped = AutoMapper.Mapper.Map(p, order); mapped.TransferWarehouseName = warehouses.FirstOrDefault(x => x.WarehouseId == mapped.TransferWarehouseId)?.WarehouseName; orders.Add(mapped); } result.Count = orders.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, orders.Count, terminal.TerminalId, TerminalLogTypeEnum.OrdersSync).TerminalLogId; result.Orders = orders; return(Ok(AutoMapper.Mapper.Map(result, new OrdersSyncCollection()))); }
// GET http://localhost:8005/api/sync/productserials/{reqDate}/{serialNo} // GET http://localhost:8005/api/sync/productserials/2014-11-23/920013c000814 public IHttpActionResult GetSerials(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new ProductSerialSyncCollection(); var allSerials = ProductServices.GetAllProductSerialsByTenantId(terminal.TenantId, reqDate); var serials = new List <ProductSerialSync>(); foreach (var p in allSerials) { var serial = new ProductSerialSync(); var mappedSerial = AutoMapper.Mapper.Map(p, serial); serials.Add(mappedSerial); } result.Count = serials.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, serials.Count, terminal.TerminalId, TerminalLogTypeEnum.ProductSerialSync).TerminalLogId; result.ProductSerials = serials; return(Ok(result)); }
public async Task <IHttpActionResult> RecordScannedProducts(StockTakeProductCodeScanRequest request) { if (!string.IsNullOrEmpty(request.SerialNo)) { var terminal = TerminalServices.GetTerminalBySerial(request.SerialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(request.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } } if (request.ScannedQuantity == 0) { request.ScannedQuantity = 1; } var result = await StockTakeApiService.RecordScannedProducts(request); return(Ok(result)); }
public IHttpActionResult GetTenantPriceGroupDetails(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new TenantPriceGroupDetailSyncCollection(); var allGroupDetails = _productPriceService.GetAllTenantPriceGroupDetails(terminal.TenantId, true).Where(x => (x.DateUpdated ?? x.DateCreated) >= reqDate).ToList(); var groupDetails = new List <TenantPriceGroupDetailSync>(); foreach (var p in allGroupDetails) { var detail = new TenantPriceGroupDetailSync(); AutoMapper.Mapper.Map(p, detail); groupDetails.Add(detail); } result.Count = groupDetails.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, groupDetails.Count(), terminal.TerminalId, TerminalLogTypeEnum.TenantPriceGroupDetailsSync).TerminalLogId; result.TenantPriceGroupDetailSync = groupDetails; return(Ok(result)); }
// GET http://localhost:8005/api/sync/product-stock/{serialNo}/{productId} public IHttpActionResult GetInventoryStockForProduct(string serialNo, int productId, int warehouseId) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new InventoryStockSync(); var inventoryStock = ProductServices.GetInventoryStocksByProductAndTenantLocation(productId, warehouseId); result = AutoMapper.Mapper.Map(inventoryStock, result); if (result != null) { result.LocationDetails = _commonDbServices.LocationsByProductDetails(productId, warehouseId); result.Count = result.LocationDetails.ProductDetails.Count; result.TerminalLogId = TerminalServices .CreateTerminalLog(DateTime.UtcNow, terminal.TenantId, 1, terminal.TerminalId, TerminalLogTypeEnum.InventoryStockSync).TerminalLogId; return(Ok(result)); } return(BadRequest("No stock information available for the requested product in the warehouse.")); }
// call example through URI http://localhost:8005/api/sync/get-order-receive-count?ReqDate=2014-11-23&SerialNo=920013c000814 public IHttpActionResult GetOrderReceiveCount(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } reqDate = TerminalServices.GetTerminalSyncDate(reqDate, terminal.TenantId); var result = new OrderReceiveCountSyncCollection(); var orderReceiveCountsSync = new List <OrderReceiveCountSync>(); var allOrderReceiveCounts = OrderService.GetAllOrderReceiveCounts(terminal.TenantId, terminal.WarehouseId, reqDate).ToList(); AutoMapper.Mapper.Map(allOrderReceiveCounts, orderReceiveCountsSync); result.Count = orderReceiveCountsSync.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, orderReceiveCountsSync.Count(), terminal.TerminalId, TerminalLogTypeEnum.OrderReceiveCountSync).TerminalLogId; result.OrderReceiveCountSync = orderReceiveCountsSync; return(Ok(result)); }
// call example through URI http://localhost:8005/api/sync/get-pallet-tracking?ReqDate=2014-11-23&SerialNo=920013c000814 public IHttpActionResult GetPallettracking(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new PalletTrackingSyncCollection(); var allPallets = ProductServices.GetAllPalletTrackings(terminal.TenantId, terminal.WarehouseId, reqDate).ToList(); var pallets = new List <PalletTrackingSync>(); foreach (var p in allPallets) { var pallet = new PalletTrackingSync(); var mappedPallet = AutoMapper.Mapper.Map(p, pallet); pallets.Add(mappedPallet); } result.Count = pallets.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, pallets.Count(), terminal.TerminalId, TerminalLogTypeEnum.PalletTrackingSync).TerminalLogId; result.PalletTrackingSync = pallets; return(Ok(result)); }
// GET http://localhost:8005/api/sync/stocktakes/{reqDate}/{serialNo} // GET http://localhost:8005/api/sync/stocktakes/2014-11-23/920013c000814 public IHttpActionResult GetStockTakes(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new StockTakeSyncCollection(); var allstockTakes = _stockTakeApiService.GetAllStockTakes(terminal.TenantId, terminal.WarehouseId, reqDate, true); var stockTakes = new List <StockTakeSync>(); foreach (var p in allstockTakes) { var stockTake = new StockTakeSync(); var mapped = AutoMapper.Mapper.Map(p, stockTake); mapped.StockTakeStatusId = p.Status; mapped.WarehouseName = p.TenantWarehouse.WarehouseName; stockTakes.Add(mapped); } result.Count = stockTakes.Count; result.TerminalLogId = TerminalServices .CreateTerminalLog(reqDate, terminal.TenantId, stockTakes.Count, terminal.TerminalId, TerminalLogTypeEnum.StockTakeSync).TerminalLogId; result.StockTakes = stockTakes; return(Ok(result)); }
public IHttpActionResult VerifyAcknowlegement(Guid id, int count, string serialNo) { serialNo = serialNo.Trim().ToLower(); Terminals terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } TerminalsLog log = TerminalServices.GetTerminalLogByLogId(id); if (log == null) { return(BadRequest()); } log.Ack = true; log.RecievedCount = count; TerminalServices.UpdateTerminalLog(log); if (log.SentCount != count) { return(BadRequest()); } return(Ok("Success")); }
public IHttpActionResult SaveInspectionReport(string serialNo, VehicleInspectionReportSync model) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(model.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } var inspection = Mapper.Map(model, new VehicleInspection()); inspection.TenantId = terminal.TenantId; inspection = _inspectionService.SaveInspection(inspection, model.CurrentUserId, model.CheckedInspectionIds, true); var result = Mapper.Map(inspection, model); return(Ok(result)); }
public IHttpActionResult VanSalesDailyReport(VanSalesDailyCashSync model) { var serialNumber = model.SerialNumber.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNumber); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(model.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } model.TenantId = terminal.TenantId; var result = _vanSalesService.SaveVanSalesDailyReport(model); var terminalLog = TerminalServices.CreateTerminalLog(DateTime.UtcNow, terminal.TenantId, 0, terminal.TerminalId, TerminalLogTypeEnum.VanSalesDailyReport).TerminalLogId; var report = Mapper.Map <VanSalesDailyCash, VanSalesDailyCashSync>(result); report.UserId = model.UserId; report.SerialNumber = model.SerialNumber; report.TerminalId = model.TerminalId; return(Ok(report)); }
// GET http://localhost:8005/api/sync/vehicles/{serialNo} public IHttpActionResult GetAllMarketSchedules(string serialNo, DateTime reqDate) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new MarketRouteScheduleSyncCollection(); var allRouteSchedules = _vanSalesService.GetAllMarketRouteSchedules(terminal.TenantId, reqDate); var results = new List <MarketRouteScheduleSync>(); foreach (var p in allRouteSchedules) { var sync = new MarketRouteScheduleSync(); var mapped = Mapper.Map(p, sync); results.Add(mapped); } result.Count = results.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, results.Count, terminal.TerminalId, TerminalLogTypeEnum.MarketRouteScheduleSync).TerminalLogId; result.MarketRouteSchedules = results; return(Ok(result)); }
// GET: api/HandheldUserSync // call example through URI http://localhost:8005/api/GetProducts?ReqDate=2014-11-23&SerialNo=920013c000814 public IHttpActionResult GetProducts(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new ProductMasterSyncCollection(); var allProducts = ProductServices.GetAllValidProductMasters(terminal.TenantId, reqDate, true); var products = new List <ProductMasterSync>(); foreach (var p in allProducts) { var product = new ProductMasterSync(); var mappedProduct = AutoMapper.Mapper.Map(p, product); mappedProduct.ProductGroupName = p.Name; mappedProduct.DepartmentName = p.TenantDepartment.DepartmentName; mappedProduct.TaxPercent = p.GlobalTax.PercentageOfAmount; products.Add(mappedProduct); } result.Count = products.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, products.Count(), terminal.TerminalId, TerminalLogTypeEnum.ProductsSync).TerminalLogId; result.Products = products; return(Ok(result)); }
public IHttpActionResult UpdatePalletProducts(PalletProductsSyncCollection palletProductCollection) { var terminal = TerminalServices.GetTerminalBySerial(palletProductCollection.SerialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(palletProductCollection.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } foreach (var item in palletProductCollection.PalletProducts) { var result = _palletService.AddFulFillmentPalletProduct(AutoMapper.Mapper.Map <PalletProductsSync, PalletProductAddViewModel>(item)); if (result != null && result.PalletProductID > 0) { item.PalletProductID = result.PalletProductID; item.PostedSuccess = true; } } return(Ok(palletProductCollection)); }
// GET http://localhost:8005/api/sync/inventorystocks/{reqDate}/{serialNo} // GET http://localhost:8005/api/sync/inventorystocks/2014-11-23/920013c000814 public IHttpActionResult GetInventorystocks(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = new InventoryStockSyncCollection(); var allInventoryStocks = ProductServices.GetAllInventoryStocks(terminal.TenantId, terminal.WarehouseId, reqDate); var inventoryStocks = new List <InventoryStockSync>(); foreach (var p in allInventoryStocks) { var inventory = new InventoryStockSync(); var mapped = AutoMapper.Mapper.Map(p, inventory); inventoryStocks.Add(mapped); } result.Count = inventoryStocks.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, inventoryStocks.Count, terminal.TerminalId, TerminalLogTypeEnum.InventoryStockSync).TerminalLogId; result.InventoryStocks = inventoryStocks; return(Ok(result)); }
public IHttpActionResult PostTerminalGeoLocation(TerminalGeoLocationViewModel geoLocation) { string serialNo = geoLocation.SerialNo.Trim().ToLower(); Terminals terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } else { geoLocation.TerminalId = terminal.TerminalId; geoLocation.TenantId = terminal.TenantId; } int res = TerminalServices.SaveTerminalGeoLocation(geoLocation); if (res > 0) { return(Ok("Success")); } else { return(BadRequest("Unable to save records")); } }
// POST http://ganetest.qsrtime.net/api/sync/post-order-processes public async Task <IHttpActionResult> PostOrderProcesses(OrderProcessesSyncCollection data) { data.SerialNo = data.SerialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(data.SerialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(data.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } var mobileLocation = TerminalServices.GetMobileLocationByTerminalId(terminal.TerminalId); if (mobileLocation != null) { terminal.WarehouseId = mobileLocation.WarehouseId; } var results = new List <OrdersSync>(); if (data.OrderProcesses != null && data.OrderProcesses.Any()) { var groupedOrderProcesses = data.OrderProcesses.GroupBy(p => p.OrderToken, (key, g) => new { OrderToken = key, OrderProcesses = g.ToList() }); foreach (var processGroup in groupedOrderProcesses) { var orderProcesses = processGroup.OrderProcesses; foreach (var item in orderProcesses) { var order = OrderService.SaveOrderProcessSync(item, terminal); results.Add(order); if (order.OrderStatusID == (int)OrderStatusEnum.AwaitingAuthorisation) { OrderViewModel orderViewModel = new OrderViewModel(); orderViewModel.OrderID = order.OrderID; orderViewModel.TenentId = order.TenentId; orderViewModel.AccountID = order.AccountID; await _configHelper.CreateTenantEmailNotificationQueue($"#{order.OrderNumber} - Order Requires Authorisation", orderViewModel, null, shipmentAndRecipientInfo : null, worksOrderNotificationType : WorksOrderNotificationTypeEnum.AwaitingOrderTemplate); } } } } TerminalServices.CreateTerminalLog(DateTime.UtcNow, terminal.TenantId, data.OrderProcesses.Count, terminal.TerminalId, TerminalLogTypeEnum.OrderProcessesPost); return(Ok(results)); }
public IHttpActionResult GetInventoryStock(string SkuCode, string serialNo) { // trim the serial no and convert all into lower case serialNo = serialNo.Trim().ToLower(); // check if this terminal exists in the system and get warehouse id Terminals terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } // get tenant for that warehouse id int tenantId = TenantLocationServices.GetTenantIdByTenantLocationId(terminal.WarehouseId); //get the product detail against SKU code ProductMaster Product = ProductServices.GetProductMasterByProductCode(SkuCode, tenantId); if (Product == null) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NoContent); return(ResponseMessage(response)); } // get the stock level in strip down object to return to Web API StockEnquiry NewEnquiry = new StockEnquiry(); // get the inventory stock level for this InventoryStock InventoryStock = ProductServices.GetInventoryStocksByProductAndTenantLocation(Product.ProductId, terminal.WarehouseId); if (InventoryStock == null) { NewEnquiry.SkuCode = Product.SKUCode; NewEnquiry.ShortDesc = Product.Name; NewEnquiry.InStock = 0; NewEnquiry.Allocated = 0; NewEnquiry.Available = 0; } else { NewEnquiry.SkuCode = Product.SKUCode; NewEnquiry.ShortDesc = Product.Name; NewEnquiry.InStock = InventoryStock.InStock; NewEnquiry.Allocated = InventoryStock.Allocated; NewEnquiry.Available = InventoryStock.Available; } return(Ok(NewEnquiry)); }
// GET http://localhost:8005/api/sync/stocktake-status/{reqDate}/{serialNo} // GET http://localhost:8005/api/sync/stocktake-status//2014-11-23/920013c000814 public IHttpActionResult UpdateStocktakeStatus(string serialNo, int stockTakeId, int statusId) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = _stockTakeApiService.UpdateStockTakeStatus(stockTakeId, 0, statusId); return(Ok(result)); }
//http://ganetest.qsrtime.net/api/sync/add-transaction-file public IHttpActionResult AddAccountTransactionFileSync(AccountTransactionFileSync model) { var serialNumber = model.SerialNumber.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNumber); if (terminal == null) { return(Unauthorized()); } var result = _accountServices.AddAccountTransactionFile(model, terminal.TenantId); return(Ok(result)); }
public IHttpActionResult UpdateOrderStatus(string serialNo, int orderId, int statusId) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = OrderService.UpdateOrderStatus(orderId, statusId, 0); return(Ok(AutoMapper.Mapper.Map(result, new OrdersSync()))); }
public IHttpActionResult UpdatePalletStatus(string serialNo, int palletId, int statusId, Guid?palletnumber) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } var result = _palletService.UpdatePalletStatus(palletId, statusId == 3, palletnumber); return(Ok(AutoMapper.Mapper.Map(result, new PalletSync()))); }
// GET http://ganetest.qsrtime.net/api/sync/order-processes/{reqDate}/{serialNo} // GET http://ganetest.qsrtime.net/api/sync/order-processes/2014-11-23/920013c000814 public IHttpActionResult GetOrderProcesses(DateTime reqDate, string serialNo) { serialNo = serialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } reqDate = TerminalServices.GetTerminalSyncDate(reqDate, terminal.TenantId); var accounts = _accountServices.GetAllAccountsSelectList(terminal.TenantId); var result = new OrderProcessesSyncCollection(); var allorderProcess = OrderService.GetAllOrderProcesses(reqDate, 0, null, null, true); var orderProcesses = new List <OrderProcessesSync>(); foreach (var item in allorderProcess) { var pSync = new OrderProcessesSync(); AutoMapper.Mapper.Map(item, pSync); var orderProcessDetails = new List <OrderProcessDetailSync>(); foreach (var p in item.OrderProcessDetail) { var order = new OrderProcessDetailSync(); var pd = AutoMapper.Mapper.Map(p, order); orderProcessDetails.Add(pd); } pSync.OrderProcessDetails = orderProcessDetails; orderProcesses.Add(pSync); } result.Count = orderProcesses.Count; result.TerminalLogId = TerminalServices .CreateTerminalLog(reqDate, terminal.TenantId, orderProcesses.Count, terminal.TerminalId, TerminalLogTypeEnum.OrderProcessSync).TerminalLogId; result.OrderProcesses = orderProcesses; return(Ok(AutoMapper.Mapper.Map(result, new OrderProcessesSyncCollection()))); }
public IHttpActionResult GetConnectionCheck(string serialNo) { if (serialNo == null) { return(Unauthorized()); } serialNo = serialNo.Trim().ToLower(); Terminals terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } return(Ok()); }
// POST http://localhost:8005/api/sync/post-pallet-tracking public IHttpActionResult PostPallettracking(PalletTrackingSyncCollection data) { data.SerialNo = data.SerialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(data.SerialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(data.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } var mobileLocation = TerminalServices.GetMobileLocationByTerminalId(terminal.TerminalId); if (mobileLocation != null) { terminal.WarehouseId = mobileLocation.WarehouseId; } var results = new PalletTrackingSyncCollection(); if (data.PalletTrackingSync != null && data.PalletTrackingSync.Any()) { foreach (var item in data.PalletTrackingSync) { item.DateUpdated = DateTime.UtcNow; var pallet = ProductServices.SavePalletTrackings(item, terminal.TenantId); results.PalletTrackingSync.Add(pallet); results.Count += 1; } } TerminalServices.CreateTerminalLog(DateTime.UtcNow, terminal.TenantId, data.PalletTrackingSync.Count, terminal.TerminalId, TerminalLogTypeEnum.PostPalletTracking); return(Ok(results)); }
// POST http://localhost:8005/api/sync/post-order-receive-count public IHttpActionResult PostOrderReceiveCount(OrderReceiveCountSyncCollection data) { data.SerialNo = data.SerialNo.Trim().ToLower(); var terminal = TerminalServices.GetTerminalBySerial(data.SerialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(data.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } var mobileLocation = TerminalServices.GetMobileLocationByTerminalId(terminal.TerminalId); if (mobileLocation != null) { terminal.WarehouseId = mobileLocation.WarehouseId; } var results = new OrderReceiveCountSyncCollection(); if (data.OrderReceiveCountSync != null && data.OrderReceiveCountSync.Any()) { foreach (var item in data.OrderReceiveCountSync) { var countRecord = OrderService.SaveOrderReceiveCount(item, terminal); results.OrderReceiveCountSync.Add(countRecord); results.Count += 1; } } TerminalServices.CreateTerminalLog(DateTime.UtcNow, terminal.TenantId, data.OrderReceiveCountSync.Count, terminal.TerminalId, TerminalLogTypeEnum.PostOrderReceiveCount); return(Ok(results)); }
void b_OnTerminalServerStateDiscovery(FavoriteConfigurationElement Favorite, bool IsTerminalServer, TerminalServices.TerminalServer Server) { }