Commit f8f1d4dc authored by 陈俊俊's avatar 陈俊俊

获取数据

parent 5e8b2a95
......@@ -124,9 +124,9 @@
if (comResult == NSOrderedAscending) {
if (self.severForceUpdate) {
//强制更新
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"新版本告知" message: @"有新版本发布请您下载最新版本" delegate:self cancelButtonTitle:nil otherButtonTitles: @"去下载", nil];
alertV.tag = 1001;
[alertV show];
// UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"新版本告知" message: @"有新版本发布请您下载最新版本" delegate:self cancelButtonTitle:nil otherButtonTitles: @"去下载", nil];
// alertV.tag = 1001;
// [alertV show];
}else
{
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"新版本告知" message: @"有新版本发布请您下载最新版本" delegate:self cancelButtonTitle:@"下次再说"otherButtonTitles: @"去下载", nil];//
......
......@@ -177,7 +177,7 @@ static NSString *ICRDataBasePath = @"";
}
CLog(@"%@", sql);
[db executeUpdate:sql withArgumentsInArray:arrIDs];
// [db executeUpdate:sql withArgumentsInArray:arrIDs];
}
@autoreleasepool {
......
......@@ -217,7 +217,8 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
//1.下载商品信息
- (void)getProductWithPage_number:(NSUInteger)page_number
- (void)getProductWithStartDate:(NSString *)startDate
Page_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
......
......@@ -1518,7 +1518,8 @@ acceptTypeJson:YES
}
//商品
-(void)getProductWithPage_number:(NSUInteger)page_number
-(void)getProductWithStartDate:(NSString *)startDate
Page_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail{
......@@ -1555,7 +1556,7 @@ acceptTypeJson:YES
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetProduct] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", @"2015-05-04",@(page_number),@(page_size)];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetProduct] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", startDate,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:NULL
......
......@@ -27,6 +27,8 @@ typedef void(^ChoseBaseInfo)(NSArray *baseInfos);
@property (nonatomic,copy)ChoseBaseInfo choseBaseInfo;
@property (nonatomic,assign)BOOL isFirst;
@property (nonatomic,strong)NSString *selectStr;
@property (nonatomic,assign)NSInteger currentPage;
- (void)endRefreshing;
- (void)getBaseDataFromServer;
......
......@@ -72,10 +72,15 @@
return ;
}
self.isRefresh = YES;
[self getBaseDataFromServer];
self.currentPage = 0;
[self getLastModifiedTime];
}];
}
- (void)getLastModifiedTime{
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
......@@ -142,8 +147,7 @@
}
#pragma mark - 按钮事件
- (void)boxValueChanged:(NSNotification *)fication{
// NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
// [self fetchDataList:tilkeStr];
}
- (void)tableViewRefresh:(NSString *)titltstr{
self.currentIndexPath = nil;
......@@ -197,7 +201,12 @@
self.isFirst = NO;
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:self.tableView.header.lastUpdatedTimeKey];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
if ([tableStr isEqualToString:GXF_BASECLASS_PRODUCT]) {
NSString *befortDate = @"2014-01-01";
[self getBaseDataFromServerWithStartDate:befortDate];
}else{
[self getBaseDataFromServer];
}
}else{
[strongSelf.dataArr removeAllObjects];
if (!self.tableView.header.lastUpdatedTime) {
......@@ -241,6 +250,9 @@
-(void)getBaseDataFromServer
{
}
-(void)getBaseDataFromServerWithStartDate:(NSString *)startDate
{
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -23,13 +23,13 @@
#define ICR_IMAGE_BG_COLOR [UIColor colorWithW:242 a:1]
//阿里云内部测试环境
//#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:7580/cruiser-server/rest"
#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:7580/cruiser-server/rest"
//现场测试环境
#define HTTP_REST_API_BASE_URL @"http://122.224.171.126:7280/cruiser-server/rest"
//#define HTTP_REST_API_BASE_URL @"http://122.224.171.126:7280/cruiser-server/rest"
/*********现场正式环境**********/
//#define HTTP_REST_API_BASE_URL @"http://122.224.171.126:7380/cruiser-server/rest"
// #define HTTP_REST_API_BASE_URL @"http://122.224.171.126:7380/cruiser-server/rest"
// HTTP
......
......@@ -10,33 +10,76 @@
#define TopMargin 50
#define TableHeight 50
@interface ChooseProductViewController ()
{
}
@property (nonatomic,strong)NSString *startDate;
@end
@implementation ChooseProductViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.currentPage = 0;
self.tableStr = GXF_BASECLASS_PRODUCT;
//记录更新时间
self.tableView.header.lastUpdatedTimeKey = ChooseProductUpdateDate;
self.title = @"选择商品";
[self fetchDataList:@"" tableStr:GXF_BASECLASS_PRODUCT];
}
- (void)getBaseDataFromServer{
-(void)getBaseDataFromServerWithStartDate:(NSString *)startDate
{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf endRefreshing];
[strongSelf fetchDataList:@"" tableStr:GXF_BASECLASS_PRODUCT];
//请求成功之后
strongSelf.startDate = startDate;
[strongSelf getLastDateFromServer:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
[self endRefreshing];
};
if (self.currentPage == 0) {
[IBTLoadingView showProgressLabel:@"正在加载..."];
}
[[ICRHTTPController sharedController] getProductWithStartDate:startDate Page_number:self.currentPage page_size:100 success:succ failure:fail];
}
- (void)getLastDateFromServer:(id)data
{
if (data) {
NSDictionary *pageDict = data[ @"data" ][ @"paging" ];
NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
if (pageCount <= self.currentPage) {
[self endRefreshing];
[IBTLoadingView hideHUDWithText:nil];
[self fetchDataList:@"" tableStr:GXF_BASECLASS_PRODUCT];
}else{
self.currentPage++;
[self getBaseDataFromServerWithStartDate:self.startDate];
}
}
}
- (void)getLastModifiedTime{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"select * from %@ order by lastModify_time desc limit 1",GXF_BASECLASS_PRODUCT];
return [db executeQuery:sql];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:1000 success:succ failure:fail];
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (fetchedObjects.count > 0) {
Product *product = fetchedObjects[0];
[strongSelf getBaseDataFromServerWithStartDate:product.lastModify_time];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:NSClassFromString(GXF_BASECLASS_PRODUCT)
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
......
......@@ -12,10 +12,10 @@
@property (nonatomic, copy) NSString *uuid;//唯一标识
@property (nonatomic, copy) NSString *name;//名称
@property (nonatomic, assign) BOOL enabled;//是否启用
@property (nonatomic, strong) NSDate *create_time; //创建时间
@property (nonatomic, strong) NSString *create_time; //创建时间
@property (nonatomic, copy) NSString *create_id;//创建人代码
@property (nonatomic, copy) NSString *crete_operName;//创建人名称
@property (nonatomic, strong) NSDate *lastModified_time;//最后修改时间
@property (nonatomic, strong) NSString *lastModified_time;//最后修改时间
@property (nonatomic, copy) NSString *lastModified_id;//最后修改人代码
@property (nonatomic, copy) NSString *lastModified_operName;//最后修改人名称
@property (nonatomic, assign) NSInteger priority;//新增字段优先级
......
......@@ -86,7 +86,7 @@
NSInteger pageSize = 100;
//判断选择
if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) {
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
[[ICRHTTPController sharedController] getProductWithStartDate:@"2014-01-01" Page_number:0 page_size:100 success:succ failure:fail];
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) {
[[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
......
......@@ -100,18 +100,22 @@
// self.m_containerView.m_passwordTextF.text = @"aaa";
//@"http://218.244.151.129:7580/cruiser-server/rest"
// self.m_containerView.m_cCodeTextF.text = @"211534962";
// self.m_containerView.m_userNameTextF.text = @"admin";
// self.m_containerView.m_passwordTextF.text = @"thoradmin";
self.m_containerView.m_cCodeTextF.text = @"211534962";
self.m_containerView.m_userNameTextF.text = @"admin";
self.m_containerView.m_passwordTextF.text = @"thoradmin";
//@"http://122.224.171.126:7280/cruiser-server/rest"
self.m_containerView.m_cCodeTextF.text = @"923";
self.m_containerView.m_userNameTextF.text = @"admin";
self.m_containerView.m_passwordTextF.text = @"thoradmin";
// self.m_containerView.m_cCodeTextF.text = @"923";
// self.m_containerView.m_userNameTextF.text = @"admin";
// self.m_containerView.m_passwordTextF.text = @"thoradmin";
// self.m_containerView.m_cCodeTextF.text = @"211534968";
// self.m_containerView.m_userNameTextF.text = @"admin";
// self.m_containerView.m_passwordTextF.text = @"thoradmin";
[self.m_containerView checkLoginEnable];
#else
......
......@@ -161,7 +161,7 @@ typedef enum : NSUInteger {
for (PurchaseBillProduct *billProduct in purchaseProduct) {
totalPrice += [billProduct.total floatValue];
}
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice];
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.4f",totalPrice + otherPrice];
_purchaseView.chargePurchase = [NSNumber numberWithFloat:otherPrice];
_purchaseView.total = [NSNumber numberWithFloat:totalPrice+otherPrice];
}
......
......@@ -13,6 +13,12 @@
@property (nonatomic,strong)NSString *code;//代码
@property (nonatomic,strong)NSString *name;//名称
@property (nonatomic,assign)BOOL enabled;//状态
@property (nonatomic,strong)NSString *create_id;
@property (nonatomic,strong)NSString *create_operName;
@property (nonatomic,strong)NSString *create_time;
@property (nonatomic,strong)NSString *lastModify_id;
@property (nonatomic,strong)NSString *lastModify_operName;
@property (nonatomic,strong)NSString *lastModify_time;
@end
......@@ -13,4 +13,10 @@
@property (nonatomic,strong)NSString *code;//代码
@property (nonatomic,strong)NSString *name;//名称
@property (nonatomic,assign)BOOL enabled;//状态
@property (nonatomic,strong)NSString *create_id;
@property (nonatomic,strong)NSString *create_operName;
@property (nonatomic,strong)NSString *create_time;
@property (nonatomic,strong)NSString *lastModify_id;
@property (nonatomic,strong)NSString *lastModify_operName;
@property (nonatomic,strong)NSString *lastModify_time;
@end
......@@ -47,18 +47,15 @@
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.text = @"苹果桃子";
self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.priceLabel.textAlignment = NSTextAlignmentCenter;
self.priceLabel.textColor = GXF_CONTENT_COLOR;
self.priceLabel.text = @"80";
self.priceLabel.font = GXF_SIXTEENTEH_SIZE;
self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.countLabel.textAlignment = NSTextAlignmentCenter;
self.countLabel.text = @"200";
self.countLabel.textColor = GXF_CONTENT_COLOR;
self.countLabel.font = GXF_SIXTEENTEH_SIZE;
......@@ -79,43 +76,36 @@
self.showStandLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.seqLabel.frame), CGRectGetMaxY(self.showNameLabel.frame), ShowWidth, ShowHeight))];
self.showStandLabel.textAlignment = NSTextAlignmentLeft;
self.showStandLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showStandLabel.text = @"包装规格:1*12斤";
self.showStandLabel.font = GXF_THREETEENTH_SIZE;
self.showCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showStandLabel.frame), CGRectGetMaxY(self.showNameLabel.frame), ShowWidth, ShowHeight))];
self.showCountLabel.textAlignment = NSTextAlignmentLeft;
self.showCountLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showCountLabel.text = @"包装数量:10000";
self.showCountLabel.font = GXF_THREETEENTH_SIZE;
self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showStandLabel.frame), ShowWidth, ShowHeight))];
self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
self.showBaseCountLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showBaseCountLabel.text = @"基础数量:300";
self.showBaseCountLabel.font = GXF_THREETEENTH_SIZE;
self.showPriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showCountLabel.frame), CGRectGetMaxY(self.showStandLabel.frame), ShowWidth, ShowHeight))];
self.showPriceLabel.textAlignment = NSTextAlignmentLeft;
self.showPriceLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showPriceLabel.text = @"包装单价:11元";
self.showPriceLabel.font = GXF_THREETEENTH_SIZE;
self.showBasePriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showBaseCountLabel.frame), ShowWidth, ShowHeight))];
self.showBasePriceLabel.textAlignment = NSTextAlignmentLeft;
self.showBasePriceLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showBasePriceLabel.text = @"基础单价:1000";
self.showBasePriceLabel.font = GXF_THREETEENTH_SIZE;
self.showTotalLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showCountLabel.frame), CGRectGetMaxY(self.showBaseCountLabel.frame), ShowWidth, ShowHeight))];
self.showTotalLabel.textAlignment = NSTextAlignmentLeft;
self.showTotalLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showTotalLabel.text = @"总金额:100";
self.showTotalLabel.font = GXF_THREETEENTH_SIZE;
self.showNoteLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showBasePriceLabel.frame), ShowWidth, ShowHeight))];
self.showNoteLabel.textAlignment = NSTextAlignmentLeft;
self.showNoteLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showNoteLabel.text = @"备注:1000";
self.showNoteLabel.font = GXF_THREETEENTH_SIZE;
......
......@@ -134,7 +134,7 @@ typedef enum : NSUInteger {
}
//总金额
if ([self.shopDetail.totalMoney floatValue] <= 0) {
totalMoney.text=@"0.00";
totalMoney.text=@"0.0000";
}else{
totalMoney.text=self.shopDetail.totalMoney;
}
......@@ -481,10 +481,10 @@ typedef enum : NSUInteger {
if (foundationUnitPrice.text.length > 0) {
if (foundationQuantity.text.length > 0) {
float totalPrice = [foundationUnitPrice.text floatValue] * [foundationQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.2f",totalPrice];
totalMoney.text = [NSString stringWithFormat:@"%.4f",totalPrice];
if (packageQuantity.text.length > 0 && [packageQuantity.text integerValue] > 0) {
float packagePrice = totalPrice / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
packageUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
}
}
}
......@@ -494,10 +494,10 @@ typedef enum : NSUInteger {
if (packageUnitPrice.text.length > 0) {
if (packageQuantity.text.length > 0) {
float totalPrice = [packageUnitPrice.text floatValue] * [packageQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.2f",totalPrice];
totalMoney.text = [NSString stringWithFormat:@"%.4f",totalPrice];
if (foundationQuantity.text.length > 0 && [foundationQuantity.text integerValue] > 0) {
float packagePrice = totalPrice / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
}
}
}
......@@ -507,11 +507,11 @@ typedef enum : NSUInteger {
if (totalMoney.text.length > 0) {
if (packageQuantity.text.length > 0 && [packageQuantity.text floatValue] > 0) {
float packagePrice = [totalMoney.text floatValue] / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
packageUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
}
if (foundationQuantity.text.length > 0 && [foundationQuantity.text floatValue] > 0) {
float packagePrice = [totalMoney.text floatValue] / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
}
}
}
......
......@@ -11,10 +11,10 @@
@interface User : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *version;//版本号
@property (nonatomic,strong)NSDate *create_time;//创建时间
@property (nonatomic,strong)NSString *create_time;//创建时间
@property (nonatomic,strong)NSString *create_id;//创建人代码
@property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSDate *lastModify_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModify_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModify_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModify_operName;//最后修改人名称
@property (nonatomic,strong)NSArray *company;//所属公司
......
......@@ -21,10 +21,10 @@
@property (nonatomic,strong)NSString *isNew;//是否新品
@property (nonatomic,strong)NSString *categoryUuid;//所属商品类别
@property (nonatomic,strong)NSString *image;//图片相对路径
@property (nonatomic,strong)NSDate *create_time;//创建时间
@property (nonatomic,strong)NSString *create_time;//创建时间
@property (nonatomic,strong)NSString *create_id;//创建人代码
@property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSDate *lastModify_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModify_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModify_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModify_operName;//最后修改人名称
@property (nonatomic,assign)NSInteger enabled;//是否启用
......
......@@ -12,4 +12,10 @@
@property (nonatomic, strong) NSString *uuid;//唯一标识
@property (nonatomic, strong) NSString *name;//名称
@property (nonatomic, assign) BOOL enabled;//是否启用
@property (nonatomic,strong)NSString *create_id;
@property (nonatomic,strong)NSString *create_operName;
@property (nonatomic,strong)NSString *create_time;
@property (nonatomic,strong)NSString *lastModify_id;
@property (nonatomic,strong)NSString *lastModify_operName;
@property (nonatomic,strong)NSString *lastModify_time;
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment