Commit d0a4b325 authored by zhu's avatar zhu

no message

parent ebaef158
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
0414FF1A1B94959700C7B00E /* SelectCompanyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0414FF141B94959700C7B00E /* SelectCompanyViewController.m */; }; 0414FF1A1B94959700C7B00E /* SelectCompanyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0414FF141B94959700C7B00E /* SelectCompanyViewController.m */; };
0414FF1B1B94959700C7B00E /* ShopDetaileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0414FF161B94959700C7B00E /* ShopDetaileViewController.m */; }; 0414FF1B1B94959700C7B00E /* ShopDetaileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0414FF161B94959700C7B00E /* ShopDetaileViewController.m */; };
04B4A3871B9CAAD700D88D68 /* ShopDetail.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B4A3861B9CAAD700D88D68 /* ShopDetail.m */; }; 04B4A3871B9CAAD700D88D68 /* ShopDetail.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B4A3861B9CAAD700D88D68 /* ShopDetail.m */; };
04E721E01BA73CE2008F9158 /* ChooseProductUnitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E721DF1BA73CE2008F9158 /* ChooseProductUnitViewController.m */; };
04F6E70A1B9B08A500550849 /* PurchaseNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F6E7091B9B08A500550849 /* PurchaseNoticeViewController.m */; }; 04F6E70A1B9B08A500550849 /* PurchaseNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F6E7091B9B08A500550849 /* PurchaseNoticeViewController.m */; };
300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; }; 300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; };
300DD94B1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; }; 300DD94B1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; };
...@@ -462,6 +463,8 @@ ...@@ -462,6 +463,8 @@
0414FF161B94959700C7B00E /* ShopDetaileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopDetaileViewController.m; sourceTree = "<group>"; }; 0414FF161B94959700C7B00E /* ShopDetaileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopDetaileViewController.m; sourceTree = "<group>"; };
04B4A3851B9CAAD700D88D68 /* ShopDetail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopDetail.h; sourceTree = "<group>"; }; 04B4A3851B9CAAD700D88D68 /* ShopDetail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopDetail.h; sourceTree = "<group>"; };
04B4A3861B9CAAD700D88D68 /* ShopDetail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopDetail.m; sourceTree = "<group>"; }; 04B4A3861B9CAAD700D88D68 /* ShopDetail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopDetail.m; sourceTree = "<group>"; };
04E721DE1BA73CE2008F9158 /* ChooseProductUnitViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseProductUnitViewController.h; sourceTree = "<group>"; };
04E721DF1BA73CE2008F9158 /* ChooseProductUnitViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseProductUnitViewController.m; sourceTree = "<group>"; };
04F6E7081B9B08A500550849 /* PurchaseNoticeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseNoticeViewController.h; sourceTree = "<group>"; }; 04F6E7081B9B08A500550849 /* PurchaseNoticeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseNoticeViewController.h; sourceTree = "<group>"; };
04F6E7091B9B08A500550849 /* PurchaseNoticeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseNoticeViewController.m; sourceTree = "<group>"; }; 04F6E7091B9B08A500550849 /* PurchaseNoticeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseNoticeViewController.m; sourceTree = "<group>"; };
1B0B22845F5CD40B5CF655F2 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; }; 1B0B22845F5CD40B5CF655F2 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
...@@ -1059,6 +1062,8 @@ ...@@ -1059,6 +1062,8 @@
0414FF121B94959700C7B00E /* PurchaseNoticeCell.m */, 0414FF121B94959700C7B00E /* PurchaseNoticeCell.m */,
0414FF131B94959700C7B00E /* SelectCompanyViewController.h */, 0414FF131B94959700C7B00E /* SelectCompanyViewController.h */,
0414FF141B94959700C7B00E /* SelectCompanyViewController.m */, 0414FF141B94959700C7B00E /* SelectCompanyViewController.m */,
04E721DE1BA73CE2008F9158 /* ChooseProductUnitViewController.h */,
04E721DF1BA73CE2008F9158 /* ChooseProductUnitViewController.m */,
0414FF151B94959700C7B00E /* ShopDetaileViewController.h */, 0414FF151B94959700C7B00E /* ShopDetaileViewController.h */,
0414FF161B94959700C7B00E /* ShopDetaileViewController.m */, 0414FF161B94959700C7B00E /* ShopDetaileViewController.m */,
); );
...@@ -2526,6 +2531,7 @@ ...@@ -2526,6 +2531,7 @@
C159184B1AC062460013B391 /* IBTTabBarController.m in Sources */, C159184B1AC062460013B391 /* IBTTabBarController.m in Sources */,
C142D2BE1AC3A155000109A7 /* UIView+FindUIViewController.m in Sources */, C142D2BE1AC3A155000109A7 /* UIView+FindUIViewController.m in Sources */,
35C3C0BF1AE95F1D0035AC8A /* UIImage+Rotate.m in Sources */, 35C3C0BF1AE95F1D0035AC8A /* UIImage+Rotate.m in Sources */,
04E721E01BA73CE2008F9158 /* ChooseProductUnitViewController.m in Sources */,
04F6E70A1B9B08A500550849 /* PurchaseNoticeViewController.m in Sources */, 04F6E70A1B9B08A500550849 /* PurchaseNoticeViewController.m in Sources */,
35CF337E1B953FFF001211EF /* GXFProcessProduct.m in Sources */, 35CF337E1B953FFF001211EF /* GXFProcessProduct.m in Sources */,
C11A344D1B1BE27200079129 /* ICRPatrolAllStoreViewController.m in Sources */, C11A344D1B1BE27200079129 /* ICRPatrolAllStoreViewController.m in Sources */,
......
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
#define GXF_BASECLASS_WAREHOUSE @"Warehouse" #define GXF_BASECLASS_WAREHOUSE @"Warehouse"
#define GXF_BASECLASS_VENDOR @"Vendor" #define GXF_BASECLASS_VENDOR @"Vendor"
#define GXF_BASECLASS_PRODUCT @"Product" #define GXF_BASECLASS_PRODUCT @"Product"
#define GXF_BASECLASS_PRODUCTUNIT @"ProductUnit"
#define GXF_BASECLASS_USER @"User" #define GXF_BASECLASS_USER @"User"
......
//
// ChooseProductUnitViewController.h
// XFFruit
//
// Created by mac on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseParentViewController.h"
#import "Product.h"
@interface ChooseProductUnitViewController : ChooseParentViewController
@end
//
// ChooseProductUnitViewController.m
// XFFruit
//
// Created by mac on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseProductUnitViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseProductUnitViewController ()
@end
@implementation ChooseProductUnitViewController
- (void)viewDidLoad {
[super viewDidLoad];
//记录更新时间
self.tableView.header.lastUpdatedTimeKey = ChooseProductUpdateDate;
self.title = @"选择包装单位";
[self fetchDataList:@"" tableStr:GXF_BASECLASS_PRODUCTUNIT];
}
- (void)getBaseDataFromServer{
__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_PRODUCTUNIT];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
}
#pragma mark -成功
- (void)fetchProductList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Product TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Product TableName], @"uuid"];
}
return [db executeQuery:sql];
};
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseProductUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseProductUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[Product class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID totalWidth:ScreenSize.width totalHeight:TableHeight];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.Commitbtn.hidden = YES;
}
if (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}else{
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}else{
cell.Commitbtn.hidden = YES;
}
}
if (self.dataArr.count > 0) {
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Product *product = self.dataArr[indexPath.row];
cell.titleLabel.textColor = GXF_LEFTSIX_COLOR;
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
}
}
return cell;
}
- (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_PRODUCTUNIT];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// ChooseShopUnitViewController.h
// XFFruit
//
// Created by mac on 15/9/14.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseParentViewController.h"
#import "Product.h"
@interface ChooseShopUnitViewController : ChooseParentViewController
@end
//
// ChooseShopUnitViewController.m
// XFFruit
//
// Created by mac on 15/9/14.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseShopUnitViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseShopUnitViewController ()
@end
@implementation ChooseShopUnitViewController
- (void)viewDidLoad {
[super viewDidLoad];
//记录更新时间
self.tableView.header.lastUpdatedTimeKey = ChooseShopUnitDate;
self.title = @"选择包装单位";
[self fetchDataList:@"" tableStr:GXF_BASECLASS_SHOPUNIT];
}
- (void)getBaseDataFromServer{
__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_SHOPUNIT];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
}
#pragma mark -成功
- (void)fetchProductList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Product TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Product TableName], @"uuid"];
}
return [db executeQuery:sql];
};
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseProductUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseProductUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[Product class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID totalWidth:ScreenSize.width totalHeight:TableHeight];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.Commitbtn.hidden = YES;
}
if (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}else{
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}else{
cell.Commitbtn.hidden = YES;
}
}
if (self.dataArr.count > 0) {
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Product *product = self.dataArr[indexPath.row];
cell.titleLabel.textColor = GXF_LEFTSIX_COLOR;
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
}
}
return cell;
}
- (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_PRODUCT];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import "ChosePersonViewController.h" #import "ChosePersonViewController.h"
#import "ChooseProductViewController.h" #import "ChooseProductViewController.h"
#import "SelectCompanyViewController.h" #import "SelectCompanyViewController.h"
#import "ChooseProductUnitViewController.h"
#import "SurveyUser.h" #import "SurveyUser.h"
#import "Survey.h" #import "Survey.h"
#import "Product.h" #import "Product.h"
...@@ -441,17 +442,30 @@ typedef enum : NSUInteger { ...@@ -441,17 +442,30 @@ typedef enum : NSUInteger {
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
}else if (indexPath.row ==3) }else if (indexPath.row ==3)
{ {
SelectCompanyViewController *vc=[SelectCompanyViewController new];
vc.chosePackaging = ^(NSString *Packaging){ ChooseProductUnitViewController *cvc = [ChooseProductUnitViewController new];
cvc.choseBaseInfo = ^(NSArray *products){
_PackagingLable.text = [NSString stringWithFormat:@"%@",Packaging]; Product *product=products [0];
packageUnit.text=[NSString stringWithFormat:@"%@",Packaging]; _productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_PackagingLable.textColor = GXF_CONTENT_COLOR; merchandise.text=product.name;
_productLabel.textColor = GXF_CONTENT_COLOR;
self.productNameStr = product.name;
self.productUuidStr = product.uuid;
self.productCodeStr = product.code;
}; };
cvc.isMoreChose = NO;//是否多选
[self PushViewController:cvc animated:YES];
// SelectCompanyViewController *vc=[SelectCompanyViewController new];
// vc.chosePackaging = ^(NSString *Packaging){
//
// _PackagingLable.text = [NSString stringWithFormat:@"%@",Packaging];
// packageUnit.text=[NSString stringWithFormat:@"%@",Packaging];
// _PackagingLable.textColor = GXF_CONTENT_COLOR;
//
// };
[self PushViewController:vc animated:YES]; // [self PushViewController:vc animated:YES];
} }
} }
......
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