ScanHistoryViewController.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // ScanHistoryViewController.m
  3. // HMLG Scan Order
  4. //
  5. // Created by Rui Zhang on 3/29/22.
  6. // Copyright © 2022 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "ScanHistoryViewController.h"
  9. #import "ScanListCell.h"
  10. #import "RASingleton.h"
  11. #import "RADataProvider.h"
  12. @interface ScanHistoryViewController ()
  13. @end
  14. @implementation ScanHistoryViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. // Do any additional setup after loading the view.
  18. // [self refreshStock];
  19. }
  20. - (IBAction)onUpdateStock:(id)sender {
  21. [RADataProvider updateStock:self];
  22. }
  23. - (void)viewWillAppear:(BOOL)animated
  24. {
  25. [super viewWillAppear:animated];
  26. self.labelStock.text = [RADataProvider queryStockUpdateTime];
  27. }
  28. -(void) refreshStock
  29. {
  30. // NSDictionary *addressDic1 = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanStock"];
  31. // if (addressDic1) {
  32. // NSString* updatetime=addressDic1[@"updatetime"];
  33. // self.labelStock.text = updatetime;
  34. // }
  35. //
  36. self.labelStock.text = [RADataProvider queryStockUpdateTime];
  37. [self.tableview reloadData];
  38. }
  39. /*
  40. #pragma mark - Navigation
  41. // In a storyboard-based application, you will often want to do a little preparation before navigation
  42. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  43. // Get the new view controller using [segue destinationViewController].
  44. // Pass the selected object to the new view controller.
  45. }
  46. */
  47. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  48. return RASingleton.sharedInstance.scan_list.count;
  49. }
  50. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  51. return 166.0f;
  52. }
  53. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  54. {
  55. ScanListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ScanListCell"];
  56. if (!cell) {
  57. cell = [[ScanListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ScanListCell"];
  58. }
  59. NSMutableArray* arr = RASingleton.sharedInstance.scan_list;
  60. [cell setModelJson:arr[indexPath.row]];
  61. cell.labelStock.text = [RADataProvider queryStock:cell.labelModel.text];
  62. return cell;
  63. }
  64. //#pragma mark - TableView Delegate
  65. /*
  66. #pragma mark - Navigation
  67. // In a storyboard-based application, you will often want to do a little preparation before navigation
  68. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  69. // Get the new view controller using [segue destinationViewController].
  70. // Pass the selected object to the new view controller.
  71. }
  72. */
  73. //- (IBAction)onAddToCart:(id)sender {
  74. //
  75. // [self dismissViewControllerAnimated:true completion:^{
  76. // if(self.returnValue)
  77. // self.returnValue(self.modellist);
  78. // }];
  79. //
  80. //
  81. //}
  82. #pragma mark - RA_NOTIFICAITON
  83. -(void) refresh_ui
  84. {
  85. [self.tableview reloadData];
  86. }
  87. -(void) reload_data {
  88. [self.tableview reloadData];
  89. }
  90. @end