Commit d357fa51 authored by freecui's avatar freecui

提交新建加工单接口

parent 9ce3345a
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
35321F6D1B98C66400E5C670 /* GXFButtonAndLineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35321F6C1B98C66400E5C670 /* GXFButtonAndLineView.m */; }; 35321F6D1B98C66400E5C670 /* GXFButtonAndLineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35321F6C1B98C66400E5C670 /* GXFButtonAndLineView.m */; };
358432EE1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 358432ED1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m */; }; 358432EE1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 358432ED1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m */; };
358432F11B993BD8007E73ED /* GXFProcessProductTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 358432F01B993BD8007E73ED /* GXFProcessProductTableViewCell.m */; }; 358432F11B993BD8007E73ED /* GXFProcessProductTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 358432F01B993BD8007E73ED /* GXFProcessProductTableViewCell.m */; };
358432F41B994EDD007E73ED /* GXFSeeProcessViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 358432F31B994EDD007E73ED /* GXFSeeProcessViewController.m */; };
358432F71B998ED2007E73ED /* GXFProductUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 358432F61B998ED2007E73ED /* GXFProductUnit.m */; };
35A1C3551B8EFBBF004AC9F7 /* PermissionJson in Resources */ = {isa = PBXBuildFile; fileRef = 35A1C3541B8EFBBF004AC9F7 /* PermissionJson */; }; 35A1C3551B8EFBBF004AC9F7 /* PermissionJson in Resources */ = {isa = PBXBuildFile; fileRef = 35A1C3541B8EFBBF004AC9F7 /* PermissionJson */; };
35A1C3581B8F09D2004AC9F7 /* GXFFunctionDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */; }; 35A1C3581B8F09D2004AC9F7 /* GXFFunctionDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */; };
35B9B40E1B8FFB59009851CC /* GXFFunctionDBHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B9B40D1B8FFB59009851CC /* GXFFunctionDBHelper.m */; }; 35B9B40E1B8FFB59009851CC /* GXFFunctionDBHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B9B40D1B8FFB59009851CC /* GXFFunctionDBHelper.m */; };
...@@ -478,6 +480,10 @@ ...@@ -478,6 +480,10 @@
358432ED1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProcessMaterialTableViewCell.m; sourceTree = "<group>"; }; 358432ED1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProcessMaterialTableViewCell.m; sourceTree = "<group>"; };
358432EF1B993BD8007E73ED /* GXFProcessProductTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFProcessProductTableViewCell.h; sourceTree = "<group>"; }; 358432EF1B993BD8007E73ED /* GXFProcessProductTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFProcessProductTableViewCell.h; sourceTree = "<group>"; };
358432F01B993BD8007E73ED /* GXFProcessProductTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProcessProductTableViewCell.m; sourceTree = "<group>"; }; 358432F01B993BD8007E73ED /* GXFProcessProductTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProcessProductTableViewCell.m; sourceTree = "<group>"; };
358432F21B994EDD007E73ED /* GXFSeeProcessViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFSeeProcessViewController.h; sourceTree = "<group>"; };
358432F31B994EDD007E73ED /* GXFSeeProcessViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFSeeProcessViewController.m; sourceTree = "<group>"; };
358432F51B998ED2007E73ED /* GXFProductUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFProductUnit.h; sourceTree = "<group>"; };
358432F61B998ED2007E73ED /* GXFProductUnit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProductUnit.m; sourceTree = "<group>"; };
35A1C3541B8EFBBF004AC9F7 /* PermissionJson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PermissionJson; sourceTree = "<group>"; }; 35A1C3541B8EFBBF004AC9F7 /* PermissionJson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PermissionJson; sourceTree = "<group>"; };
35A1C3561B8F09D2004AC9F7 /* GXFFunctionDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFFunctionDB.h; sourceTree = "<group>"; }; 35A1C3561B8F09D2004AC9F7 /* GXFFunctionDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFFunctionDB.h; sourceTree = "<group>"; };
35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFFunctionDB.m; sourceTree = "<group>"; }; 35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFFunctionDB.m; sourceTree = "<group>"; };
...@@ -1014,6 +1020,8 @@ ...@@ -1014,6 +1020,8 @@
35321F691B97EF3600E5C670 /* GXFPopNewProductViewController.m */, 35321F691B97EF3600E5C670 /* GXFPopNewProductViewController.m */,
35CF337F1B9542BE001211EF /* GXFNewProcessViewController.h */, 35CF337F1B9542BE001211EF /* GXFNewProcessViewController.h */,
35CF33801B9542BE001211EF /* GXFNewProcessViewController.m */, 35CF33801B9542BE001211EF /* GXFNewProcessViewController.m */,
358432F21B994EDD007E73ED /* GXFSeeProcessViewController.h */,
358432F31B994EDD007E73ED /* GXFSeeProcessViewController.m */,
); );
path = Controllers; path = Controllers;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1053,6 +1061,8 @@ ...@@ -1053,6 +1061,8 @@
35CF33911B95B419001211EF /* GXFCommon */ = { 35CF33911B95B419001211EF /* GXFCommon */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
358432F51B998ED2007E73ED /* GXFProductUnit.h */,
358432F61B998ED2007E73ED /* GXFProductUnit.m */,
35CF33961B96BB02001211EF /* GXFPaging.h */, 35CF33961B96BB02001211EF /* GXFPaging.h */,
35CF33971B96BB02001211EF /* GXFPaging.m */, 35CF33971B96BB02001211EF /* GXFPaging.m */,
35CF33921B95B419001211EF /* GXFSelect(选择内容) */, 35CF33921B95B419001211EF /* GXFSelect(选择内容) */,
...@@ -2495,6 +2505,7 @@ ...@@ -2495,6 +2505,7 @@
C15918451AC062460013B391 /* IBTBadgeView.m in Sources */, C15918451AC062460013B391 /* IBTBadgeView.m in Sources */,
7281A0C81B89BFE60052B1AC /* Vendor.m in Sources */, 7281A0C81B89BFE60052B1AC /* Vendor.m in Sources */,
C15295C31B2451AC00DF60D1 /* ICRQReseachViewController.m in Sources */, C15295C31B2451AC00DF60D1 /* ICRQReseachViewController.m in Sources */,
358432F71B998ED2007E73ED /* GXFProductUnit.m in Sources */,
C15918531AC062460013B391 /* IBTUINavigationController.m in Sources */, C15918531AC062460013B391 /* IBTUINavigationController.m in Sources */,
C11A346F1B247BDB00079129 /* ICRAnswerDetail.m in Sources */, C11A346F1B247BDB00079129 /* ICRAnswerDetail.m in Sources */,
C1ADF7411ACE6EFD007258A8 /* UIViewController+LogicController.m in Sources */, C1ADF7411ACE6EFD007258A8 /* UIViewController+LogicController.m in Sources */,
...@@ -2515,6 +2526,7 @@ ...@@ -2515,6 +2526,7 @@
FE0C9B091B7C543D00335B39 /* User.m in Sources */, FE0C9B091B7C543D00335B39 /* User.m in Sources */,
C1E093041AC8E8E0003B7126 /* ICRCheckBox.m in Sources */, C1E093041AC8E8E0003B7126 /* ICRCheckBox.m in Sources */,
C1864A561B0B0D9D00D11C4E /* ICRPostTask.m in Sources */, C1864A561B0B0D9D00D11C4E /* ICRPostTask.m in Sources */,
358432F41B994EDD007E73ED /* GXFSeeProcessViewController.m in Sources */,
FE2FCC7F1B74511000BBC6FB /* ChooseProductViewController.m in Sources */, FE2FCC7F1B74511000BBC6FB /* ChooseProductViewController.m in Sources */,
351CFF5E1B90633700F30866 /* GXFNoticeFunctionTableViewCell.m in Sources */, 351CFF5E1B90633700F30866 /* GXFNoticeFunctionTableViewCell.m in Sources */,
FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */, FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */,
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#import "Survey.h" #import "Survey.h"
#import "Vendor.h" #import "Vendor.h"
#import "Warehouse.h" #import "Warehouse.h"
#import "GXFProductUnit.h"
#define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)" #define ICR_DB_ERROR_PARAMETER @"Parse Error: Bad Parameter(s)"
...@@ -96,7 +97,7 @@ static NSString *ICRDataBasePath = @""; ...@@ -96,7 +97,7 @@ static NSString *ICRDataBasePath = @"";
[_m_dbQueue inDatabase:^(FMDatabase *db) { [_m_dbQueue inDatabase:^(FMDatabase *db) {
NSArray *tableNameArr = NSArray *tableNameArr =
@[ [Product class],[User class],[Survey class],[Vendor class],[Warehouse class]]; @[ [Product class],[User class],[Survey class],[Vendor class],[Warehouse class],[GXFProductUnit class]];
NSMutableArray *sqlBatch = [NSMutableArray array]; NSMutableArray *sqlBatch = [NSMutableArray array];
NSString *sql = nil; NSString *sql = nil;
......
...@@ -231,6 +231,26 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -231,6 +231,26 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//1.7 商品单位
- (void)getProductunitWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//7.1 保存加工单(写)
- (void)saveProcessWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//7.2 获取加工单列表(读)
- (void)processQueryWithBillData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//7.3 加工单明细(读) [已实现]
- (void)getResultWithProcessUuid:(NSString *)processUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
......
...@@ -79,7 +79,12 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -79,7 +79,12 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//供应商 //供应商
XFFHttp_GetVendor, XFFHttp_GetVendor,
//仓库 //仓库
XFFHttp_GetWarehouse XFFHttp_GetWarehouse,
//商品单位
XFFHttp_GetProductunit,
//加工单
XFFHttp_QueryProcess,
XFFHttp_GetProcess
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -140,6 +145,11 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -140,6 +145,11 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_GetVendor] = @"data/vendor/download", [XFFHttp_GetVendor] = @"data/vendor/download",
//仓库 //仓库
[XFFHttp_GetWarehouse] = @"data/warehouse/download", [XFFHttp_GetWarehouse] = @"data/warehouse/download",
//商品单位
[XFFHttp_GetProductunit] = @"data/productunit",
//加工单
[XFFHttp_QueryProcess ] = @"process/query",
[XFFHttp_GetProcess ] = @"process/get",
}; };
...@@ -1620,46 +1630,6 @@ acceptTypeJson:YES ...@@ -1620,46 +1630,6 @@ acceptTypeJson:YES
failure:(void (^)(id))fail{ failure:(void (^)(id))fail{
[self p_getDownloadWithICRHTTPAction:XFFHttp_GetVendor ClassName:@"Vendor" Page_number:page_number page_size:page_size success:succ failure:fail]; [self p_getDownloadWithICRHTTPAction:XFFHttp_GetVendor ClassName:@"Vendor" Page_number:page_number page_size:page_size success:succ failure:fail];
// void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
// CLog(@"%@", responseObject);
// if (IsDictObject(responseObject)) {
// void (^complete)(void) = ^(void){
// if (succ) {
// [IBTCommon runOnMainThreadWithoutDeadlocking:^{
// succ( responseObject );
// }];
// }
// };
//
// ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
// [dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
// objectClass:NSClassFromString( @"Vendor" )
// deleteLocal:YES
// handleData:NULL
// complete:complete
// fail:fail];
// }
// else {
// if (fail) {
// fail( nil );
// }
// }
// };
// void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
// CLog(@"%@", error);
// if (fail) {
// fail( error );
// }
// };
// NSString *dateStr = @"2015-05-04";
// NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetVendor] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)];
// NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// [self GET:encodeUrlStr
// parameters:NULL
// needToken:NO
//acceptTypeJson:YES
// success:success
// failure:failure];
} }
//仓库 //仓库
-(void)getWarehouseWithPage_number:(NSUInteger)page_number -(void)getWarehouseWithPage_number:(NSUInteger)page_number
...@@ -1668,48 +1638,15 @@ acceptTypeJson:YES ...@@ -1668,48 +1638,15 @@ acceptTypeJson:YES
failure:(void (^)(id))fail{ failure:(void (^)(id))fail{
[self p_getDownloadWithICRHTTPAction:XFFHttp_GetWarehouse ClassName:@"Warehouse" Page_number:page_number page_size:page_size success:succ failure:fail]; [self p_getDownloadWithICRHTTPAction:XFFHttp_GetWarehouse ClassName:@"Warehouse" Page_number:page_number page_size:page_size success:succ failure:fail];
// void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
// CLog(@"%@", responseObject);
// if (IsDictObject(responseObject)) {
// void (^complete)(void) = ^(void){
// if (succ) {
// [IBTCommon runOnMainThreadWithoutDeadlocking:^{
// succ( responseObject );
// }];
// }
// };
//
// ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
// [dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
// objectClass:NSClassFromString( @"Warehouse" )
// deleteLocal:YES
// handleData:NULL
// complete:complete
// fail:fail];
// }
// else {
// if (fail) {
// fail( nil );
// }
// }
// };
// void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
// CLog(@"%@", error);
// if (fail) {
// fail( error );
// }
// };
// NSString *dateStr = @"2015-05-04";
// NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetWarehouse] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)];
// NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// [self GET:encodeUrlStr
// parameters:NULL
// needToken:NO
//acceptTypeJson:YES
// success:success
// failure:failure];
} }
- (void)getProductunitWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail {
[self p_postDownloadWithICRHTTPAction:XFFHttp_GetProductunit ClassName:@"GXFProductUnit" Page_number:page_number page_size:page_size success:succ failure:fail];
}
//私有方法
- (void)p_getDownloadWithICRHTTPAction: (NSUInteger)urlAction - (void)p_getDownloadWithICRHTTPAction: (NSUInteger)urlAction
ClassName: (NSString *)class_Name ClassName: (NSString *)class_Name
Page_number:(NSUInteger)page_number Page_number:(NSUInteger)page_number
...@@ -1766,7 +1703,7 @@ acceptTypeJson:YES ...@@ -1766,7 +1703,7 @@ acceptTypeJson:YES
fail( error ); fail( error );
} }
}; };
NSString *dateStr = @"2015-05-04"; NSString *dateStr = [[NSDate date] httpParameterString];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:urlAction] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:urlAction] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
...@@ -1788,4 +1725,106 @@ acceptTypeJson:YES ...@@ -1788,4 +1725,106 @@ acceptTypeJson:YES
} }
//7.1 保存加工单(写)
- (void)saveProcessWithAuthenticode:(id)data success:(void (^)(id))succ failure:(void (^)(id))fail
{
if (!data) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//7.2 获取加工单列表(读)
- (void)processQueryWithBillData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail {
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *urlStr = [[self class] UrlForPluginHTTPAction:XFFHttp_QueryProcess ];
[self GET:urlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//7.3 加工单明细(读) [已实现]
- (void)getResultWithProcessUuid:(NSString *)processUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail {
if (!processUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetProcess] stringByAppendingFormat:@"/%@",processUuid];
//CFURLCreateStringByAddingPercentEscapes stringByAddingPercentEscapesUsingEncoding 对url的编码问题
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end @end
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
#define GXF_LABLE_TINT_COLOR HexColor(@"444444") #define GXF_LABLE_TINT_COLOR HexColor(@"444444")
#define GXF_LABLE_BG_COLOR XXFBgColor #define GXF_LABLE_BG_COLOR XXFBgColor
#define GXF_GREEN_COLOR HexColor(@"50bd62") #define GXF_GREEN_COLOR HexColor(@"50bd62")
#define GXF_ORIGIN_COLOR HexColor(@"f69100") #define GXF_ORIGIN_COLOR HexColor(@"f69100")
#define GXF_GRAY_COLOR HexColor(@"444444")
//字体大小 //字体大小
#define GXF_LABLE_FONT FontSize(15) #define GXF_LABLE_FONT FontSize(15)
......
...@@ -10,4 +10,14 @@ ...@@ -10,4 +10,14 @@
#define XFFruit_ICRNotificationMacro_h #define XFFruit_ICRNotificationMacro_h
#define KNOTIFICATION_changeIsSelectedFunctions @"KNOTIFICATION_changeIsSelectedFunctions" #define KNOTIFICATION_changeIsSelectedFunctions @"KNOTIFICATION_changeIsSelectedFunctions"
//Avatar
#define KNOTIFICATION_saveMaterial @"KNOTIFICATION_saveMaterial"
#define KNOTIFICATION_editMaterial @"KNOTIFICATION_editMaterial"
#define KNOTIFICATION_saveProduct @"KNOTIFICATION_saveProduct"
#define KNOTIFICATION_editProduct @"KNOTIFICATION_editProduct"
#define KNOTIFICATION_deleteProduct @"KNOTIFICATION_deleteProduct"
#endif #endif
//
// ProductUnit.h
// XFFruit
//
// Created by freecui on 15/9/4.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface GXFProductUnit : IBTModel
@property (nonatomic, copy) NSString *uuid;//唯一标识
@property (nonatomic, copy) NSString *name;//名称
@property (nonatomic, assign) BOOL enabled;//是否启用
@property (nonatomic, strong) NSDate *create_time; //创建时间
@property (nonatomic, copy) NSString *create_id;//创建人代码
@property (nonatomic, copy) NSString *crete_operName;//创建人名称
@property (nonatomic, strong) NSDate *lastModified_time;//最后修改时间
@property (nonatomic, copy) NSString *lastModified_id;//最后修改人代码
@property (nonatomic, copy) NSString *lastModified_operName;//最后修改人名称
@end
//
// ProductUnit.m
// XFFruit
//
// Created by freecui on 15/9/4.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFProductUnit.h"
@implementation GXFProductUnit
+ (NSDictionary *)specialKeysAndReplaceKeys {
return @{ @"sID" : [[self class] PrimaryKey], };
}
+ (NSString *)PrimaryKey {
return @"uuid";
}
@end
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import "Vendor.h" #import "Vendor.h"
#import "Product.h" #import "Product.h"
#import "Warehouse.h" #import "Warehouse.h"
#import "GXFProductUnit.h"
@interface GXFSearchVendorViewController ()<UITableViewDataSource,UITableViewDelegate,GXFSearchViewDelegate> @interface GXFSearchVendorViewController ()<UITableViewDataSource,UITableViewDelegate,GXFSearchViewDelegate>
{ {
...@@ -81,21 +82,25 @@ ...@@ -81,21 +82,25 @@
NSInteger pageNumber = 0;
NSInteger pageSize = 100;
//判断选择 //判断选择
if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) { if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) {
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) {
[[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail]; [[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"WarehouseTitle"]]) { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"WarehouseTitle"]]) {
[[ICRHTTPController sharedController] getWarehouseWithPage_number:0 page_size:100 success:succ failure:fail]; [[ICRHTTPController sharedController] getWarehouseWithPage_number:0 page_size:100 success:succ failure:fail];
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductUnitTitle"]]) {
[[ICRHTTPController sharedController]getProductunitWithPage_number:pageNumber page_size:pageSize success:succ failure:fail];
} else { } else {
} }
[[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail]; // [[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
} }
/* /*
...@@ -129,6 +134,9 @@ ...@@ -129,6 +134,9 @@
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"WarehouseTitle"]]) { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"WarehouseTitle"]]) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Warehouse TableName], @"uuid"]; sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Warehouse TableName], @"uuid"];
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductUnitTitle"]]) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [GXFProductUnit TableName], @"uuid"];
} else { } else {
} }
...@@ -165,7 +173,11 @@ ...@@ -165,7 +173,11 @@
fetchBlock:fetchBlk fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk]; fetchResultsBlock:fetchResultsBlk];
} else { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductUnitTitle"]]) {
[dbCtrl runFetchForClass:[GXFProductUnit class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}else {
} }
...@@ -261,7 +273,8 @@ ...@@ -261,7 +273,8 @@
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
NSString *proStr; NSString *proStr;
if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) { if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) {
Product *product = _dataArr[indexPath.row];
proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) {
Vendor *vendor = self.dataArr[indexPath.row]; Vendor *vendor = self.dataArr[indexPath.row];
proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code]; proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
...@@ -308,14 +321,18 @@ ...@@ -308,14 +321,18 @@
NSString *textStr; NSString *textStr;
if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) { if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductTitle"]]) {
Product *product = self.dataArr[indexPath.row];
textStr = product.name;
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"VendorTitle"]]) {
Vendor *vendor = self.dataArr[indexPath.row]; Vendor *vendor = self.dataArr[indexPath.row];
textStr = vendor.name; textStr = vendor.name;
} else if ([self.title isEqualToString:[IBTCommon localizableString:@"WarehouseTitle"]]) { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"WarehouseTitle"]]) {
Warehouse *warehouse = self.dataArr[indexPath.row]; Warehouse *warehouse = self.dataArr[indexPath.row];
textStr = warehouse .name; textStr = warehouse .name;
} else { } else if ([self.title isEqualToString:[IBTCommon localizableString:@"ProductUnitTitle"]]) {
GXFProductUnit *productunit = self.dataArr[indexPath.row];
textStr = productunit.name;
}else {
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#import "GXFFunction.h" #import "GXFFunction.h"
#import "GXFNoticeFunctionTableViewCell.h" #import "GXFNoticeFunctionTableViewCell.h"
#import "GXFFunctionCollectionViewCell.h" #import "GXFFunctionCollectionViewCell.h"
#import "GXFSeeProcessViewController.h"
...@@ -276,9 +276,8 @@ static NSString *collectionCellID = @"collectionCell"; ...@@ -276,9 +276,8 @@ static NSString *collectionCellID = @"collectionCell";
} }
break; break;
case kFunctionSeeProcessing:{ case kFunctionSeeProcessing:{
// PurchaseViewController *pvc = [[PurchaseViewController alloc]init]; GXFSeeProcessViewController *seeProcessVC= [[GXFSeeProcessViewController alloc]init];
// pvc.title = @"采购单"; [self PushViewController:seeProcessVC animated:YES];
// [self PushViewController:pvc animated:YES];
} }
break; break;
default: default:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
@interface GXFNewProcessViewController : ICRBaseViewController @interface GXFNewProcessViewController : UIViewController
@end @end
//
// GXFSeeProcessViewController.h
// XFFruit
//
// Created by freecui on 15/9/4.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GXFSeeProcessViewController : UIViewController
@end
//
// GXFSeeProcessViewController.m
// XFFruit
//
// Created by freecui on 15/9/4.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFSeeProcessViewController.h"
@interface GXFSeeProcessViewController ()
@end
@implementation GXFSeeProcessViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated {
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
//[strongSelf fetchtSurveyList:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSDictionary *queryOrderDict = @{@"direction":@"desc",@"field":@"billNumber"};
NSDictionary *dict = @{
@"billNumberLike":@"",
@"state":@"",
@"titleLike":@"",
@"queryOrders":@[queryOrderDict],
@"pageNumber":@(0),
@"pageSize":@(20)};
[[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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
...@@ -22,8 +22,15 @@ typedef NS_ENUM(NSInteger, buttonTag){ ...@@ -22,8 +22,15 @@ typedef NS_ENUM(NSInteger, buttonTag){
}; };
@property (nonatomic, weak) id<GXFBottomViewDelegate>delegate; @property (nonatomic, weak) id<GXFBottomViewDelegate>delegate;
@property (nonatomic, strong) UIButton *f_leftBtn;
@property (nonatomic, strong) UIButton *f_rightBtn;
- (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithFrame:(CGRect)frame
LeftBtnTitle: (NSString *)leftTitle LeftBtnTitle: (NSString *)leftTitle
rightBtnTitle: (NSString *)rightTitle; rightBtnTitle: (NSString *)rightTitle;
- (instancetype)initWithFrame:(CGRect)frame
leftButtonColor: (UIColor *)leftBtnColor
rightButtonColor: (UIColor *)rightBtnColor
LeftBtnTitle: (NSString *)leftTitle
rightBtnTitle: (NSString *)rightTitle;
@end @end
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
#define LEFT_BUTTON_COLOR HexColor(@"50bd62") #define LEFT_BUTTON_COLOR HexColor(@"50bd62")
#define RIGHT_BUTTON_COLOR HexColor(@"f69100") #define RIGHT_BUTTON_COLOR HexColor(@"f69100")
@interface GXFBottomView () @interface GXFBottomView ()
@property (nonatomic, strong) UIButton *c_leftBtn;
@property (nonatomic, strong) UIButton *c_rightBtn;
@end @end
@implementation GXFBottomView @implementation GXFBottomView
...@@ -29,27 +28,49 @@ ...@@ -29,27 +28,49 @@
CGRect leftRect = CGRectMake(LEFT_PADDING, TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT); CGRect leftRect = CGRectMake(LEFT_PADDING, TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT);
UIButton *leftBtn = [IBTCustomButtom creatButtonWithFrame:leftRect target:self sel:@selector(leftBtnClicked) tag:leftTag image:nil title:leftTitle titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:LEFT_BUTTON_COLOR]; UIButton *leftBtn = [IBTCustomButtom creatButtonWithFrame:leftRect target:self sel:@selector(leftBtnClicked) tag:leftTag image:nil title:leftTitle titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:LEFT_BUTTON_COLOR];
self.c_leftBtn = leftBtn; self.f_leftBtn = leftBtn;
[self addSubview:_c_leftBtn]; [self addSubview:_f_leftBtn];
CGRect rightRect = CGRectMake(leftBtn.right + LEFT_PADDING, TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT); CGRect rightRect = CGRectMake(leftBtn.right + LEFT_PADDING, TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT);
UIButton *rightBtn = [IBTCustomButtom creatButtonWithFrame:rightRect target:self sel:@selector(rightBtnClicked) tag:rightTag image:nil title:rightTitle titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:RIGHT_BUTTON_COLOR]; UIButton *rightBtn = [IBTCustomButtom creatButtonWithFrame:rightRect target:self sel:@selector(rightBtnClicked) tag:rightTag image:nil title:rightTitle titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:RIGHT_BUTTON_COLOR];
self.c_rightBtn = rightBtn; self.f_rightBtn = rightBtn;
[self addSubview:_c_rightBtn]; [self addSubview:_f_rightBtn];
return self; return self;
} }
- (instancetype)initWithFrame:(CGRect)frame
leftButtonColor: (UIColor *)leftBtnColor
rightButtonColor: (UIColor *)rightBtnColor
LeftBtnTitle: (NSString *)leftTitle
rightBtnTitle: (NSString *)rightTitle {
self = [super initWithFrame:frame];
if (!self) {
return nil;
}
CGRect leftRect = CGRectMake(LEFT_PADDING, TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT);
UIButton *leftBtn = [IBTCustomButtom creatButtonWithFrame:leftRect target:self sel:@selector(leftBtnClicked) tag:leftTag image:nil title:leftTitle titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:leftBtnColor];
self.f_leftBtn = leftBtn;
[self addSubview:_f_leftBtn];
CGRect rightRect = CGRectMake(leftBtn.right + LEFT_PADDING, TOP_PADDING, BUTTON_WIDTH, BUTTON_HEIGHT);
UIButton *rightBtn = [IBTCustomButtom creatButtonWithFrame:rightRect target:self sel:@selector(rightBtnClicked) tag:rightTag image:nil title:rightTitle titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:rightBtnColor];
self.f_rightBtn = rightBtn;
[self addSubview:_f_rightBtn];
return self;
}
- (void)leftBtnClicked { - (void)leftBtnClicked {
if ([_delegate respondsToSelector:@selector(bottomViewleftButtonClicked:)]) { if ([_delegate respondsToSelector:@selector(bottomViewleftButtonClicked:)]) {
[_delegate bottomViewleftButtonClicked:_c_leftBtn]; [_delegate bottomViewleftButtonClicked:_f_leftBtn];
} }
} }
- (void)rightBtnClicked { - (void)rightBtnClicked {
if ([_delegate respondsToSelector:@selector(bottomViewRightButtonClicked:)]) { if ([_delegate respondsToSelector:@selector(bottomViewRightButtonClicked:)]) {
[_delegate bottomViewRightButtonClicked:_c_rightBtn]; [_delegate bottomViewRightButtonClicked:_f_rightBtn];
} }
} }
......
...@@ -17,8 +17,12 @@ ...@@ -17,8 +17,12 @@
#import "GXFTableViewCell.h" #import "GXFTableViewCell.h"
#import "StartTimeView.h" #import "StartTimeView.h"
#import "GXFProcessMaterial.h" #import "GXFProcessMaterial.h"
#import "GXFSearchVendorViewController.h"
#import "Product.h"
@interface GXFPopNewMaterialViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,StartTimeViewDelegate,GXFBottomViewDelegate> @interface GXFPopNewMaterialViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,StartTimeViewDelegate,GXFBottomViewDelegate>
{ {
StartTimeView *_startTimeView; StartTimeView *_startTimeView;
} }
@property (nonatomic, strong) UIView *c_bgView; @property (nonatomic, strong) UIView *c_bgView;
...@@ -28,6 +32,9 @@ ...@@ -28,6 +32,9 @@
@property (nonatomic, strong) NSArray *d_lableTextArr; @property (nonatomic, strong) NSArray *d_lableTextArr;
@property (nonatomic, strong) GXFProcessMaterial *d_processMaterial; @property (nonatomic, strong) GXFProcessMaterial *d_processMaterial;
@property (nonatomic, strong) NSIndexPath *d_dateIndexPath; @property (nonatomic, strong) NSIndexPath *d_dateIndexPath;
@property (nonatomic, assign) BOOL d_hasSaved;
@property (nonatomic, strong) GXFBottomView *c_bottomV;
@end @end
@implementation GXFPopNewMaterialViewController @implementation GXFPopNewMaterialViewController
...@@ -40,7 +47,6 @@ ...@@ -40,7 +47,6 @@
- (void)initData { - (void)initData {
self.d_leftArr = @[@"原料商品:",@"入库日期:",@"产地:",@"品质描述:",@"基础数量",@"基础单价:",@"总金额:",@"备注:",]; self.d_leftArr = @[@"原料商品:",@"入库日期:",@"产地:",@"品质描述:",@"基础数量",@"基础单价:",@"总金额:",@"备注:",];
self.d_rightArr = @[@"选择商品",@"",@"输入产地",@"输入品质描述",@"基础数量",@"基础单价",@"总金额",@"输入备注内容"]; self.d_rightArr = @[@"选择商品",@"",@"输入产地",@"输入品质描述",@"基础数量",@"基础单价",@"总金额",@"输入备注内容"];
...@@ -59,9 +65,10 @@ ...@@ -59,9 +65,10 @@
[self.view addSubview:_c_tableView]; [self.view addSubview:_c_tableView];
GXFBottomView *bottomV = [[GXFBottomView alloc]initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, BottomViewHeight) LeftBtnTitle:@"结束" rightBtnTitle:@"保存"]; GXFBottomView *bottomV = [[GXFBottomView alloc]initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, BottomViewHeight) leftButtonColor:GXF_ORIGIN_COLOR rightButtonColor:GXF_GREEN_COLOR LeftBtnTitle:@"删除" rightBtnTitle:@"保存"];// [[GXFBottomView alloc]initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, BottomViewHeight) LeftBtnTitle:@"删除" rightBtnTitle:@"保存"];
bottomV.delegate = self; bottomV.delegate = self;
[self.view addSubview:bottomV]; self.c_bottomV = bottomV;
[self.view addSubview:_c_bottomV];
...@@ -72,7 +79,7 @@ ...@@ -72,7 +79,7 @@
// [self registerForKeyboardNotifications]; // [self registerForKeyboardNotifications];
} }
- (void)viewWillDisappear:(BOOL)animated { - (void)viewWillDisappear:(BOOL)animated {
// [[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
#pragma UITableViewDataSource #pragma UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
...@@ -103,14 +110,14 @@ ...@@ -103,14 +110,14 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
GXFTableViewCell *xfCell ; GXFTableViewCell *xfCell ;
xfCell.width = _c_tableView.width; xfCell.width = _c_tableView.width;
if ( indexPath.row == 1) { if (indexPath.row == 0 || indexPath.row == 1) {
xfCell = [tableView dequeueReusableCellWithIdentifier:arrowCell]; xfCell = [tableView dequeueReusableCellWithIdentifier:arrowCell];
if (!xfCell) { if (!xfCell) {
xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:arrowCell textFieldPlaceholder:_d_rightArr[indexPath.row] isEdit:NO]; xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:arrowCell textFieldPlaceholder:_d_rightArr[indexPath.row] isEdit:NO];
xfCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; xfCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
} }
} else if (indexPath.row == 0 || indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 7) { } else if ( indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 7) {
xfCell = [tableView dequeueReusableCellWithIdentifier:noLblCell];//- xfCell = [tableView dequeueReusableCellWithIdentifier:noLblCell];//-
if (!xfCell) { if (!xfCell) {
xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:arrowCell textFieldPlaceholder:_d_rightArr[indexPath.row] isEdit:YES]; xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:arrowCell textFieldPlaceholder:_d_rightArr[indexPath.row] isEdit:YES];
...@@ -136,7 +143,20 @@ ...@@ -136,7 +143,20 @@
} }
#pragma UITableViewDelegate #pragma UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
GXFTableViewCell *xfCell = (GXFTableViewCell *)[_c_tableView cellForRowAtIndexPath:indexPath];
if (indexPath.row == 0) {
GXFSearchVendorViewController *vc = [[GXFSearchVendorViewController alloc]initWithTitle:[IBTCommon localizableString:@"ProductTitle"]];
vc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) {
Product *product = vendors[0];
xfCell.f_textField.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_d_processMaterial.productUuid = product.uuid;
_d_processMaterial.productCode = product.code;
_d_processMaterial.productName = product.name;
}
};
[self PushViewController:vc animated:YES];
}
if (indexPath.row == 1) { if (indexPath.row == 1) {
[self startDatePickView]; [self startDatePickView];
self.d_dateIndexPath = indexPath; self.d_dateIndexPath = indexPath;
...@@ -232,6 +252,21 @@ ...@@ -232,6 +252,21 @@
break; break;
} }
return YES; return YES;
}
#pragma GXFBottomViewDelegate
- (void)bottomViewleftButtonClicked:(UIButton *)leftBtn {
}
- (void)bottomViewRightButtonClicked:(UIButton *)rightBtn {
self.d_hasSaved = YES;
[self.c_bottomV.f_rightBtn setBackgroundColor:GXF_GRAY_COLOR];
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_saveMaterial object:_d_processMaterial];
} }
//- (void)setTableFrame: (CGFloat)tableOffset { //- (void)setTableFrame: (CGFloat)tableOffset {
// [UIView animateWithDuration:0.25 animations:^{ // [UIView animateWithDuration:0.25 animations:^{
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@class GXFProcessProduct;
@interface GXFPopNewProductViewController : UIViewController @interface GXFPopNewProductViewController : UIViewController
- (instancetype)initWithProcessProduct: (GXFProcessProduct *)processProduct
isEdit: (BOOL) isEdited;
@end @end
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#import "GXFTableViewCell.h" #import "GXFTableViewCell.h"
#import "StartTimeView.h" #import "StartTimeView.h"
#import "GXFProcessProduct.h" #import "GXFProcessProduct.h"
#import "GXFSearchVendorViewController.h"
#import "Product.h"
#import "GXFProductUnit.h"
@interface GXFPopNewProductViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,StartTimeViewDelegate,GXFBottomViewDelegate> @interface GXFPopNewProductViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,StartTimeViewDelegate,GXFBottomViewDelegate>
{ {
StartTimeView *_startTimeView; StartTimeView *_startTimeView;
...@@ -24,9 +27,22 @@ ...@@ -24,9 +27,22 @@
@property (nonatomic, strong) NSArray *d_lableTextArr; @property (nonatomic, strong) NSArray *d_lableTextArr;
@property (nonatomic, strong) GXFProcessProduct *d_processProduct; @property (nonatomic, strong) GXFProcessProduct *d_processProduct;
@property (nonatomic, strong) NSIndexPath *d_dateIndexPath; @property (nonatomic, strong) NSIndexPath *d_dateIndexPath;
@property (nonatomic, assign) BOOL d_hasSaved;
@property (nonatomic, strong) GXFBottomView *c_bottomV;
@property (nonatomic, assign) BOOL d_isEdited;
@end @end
@implementation GXFPopNewProductViewController @implementation GXFPopNewProductViewController
- (instancetype)initWithProcessProduct:(GXFProcessProduct *)processProduct isEdit: (BOOL) isEdited{
self = [super init];
if (!self) {
return nil;
}
self.d_processProduct = processProduct;
self.d_isEdited = isEdited;
return self;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"新增成品明细"; self.title = @"新增成品明细";
...@@ -39,9 +55,12 @@ ...@@ -39,9 +55,12 @@
- (void)initData { - (void)initData {
self.d_leftArr = @[@"商品:",@"出库时间:",@"包装单位:",@"包装规格:",@"包装数量",@"基础数量:",@"备注:",]; self.d_leftArr = @[@"商品:",@"出库时间:",@"包装单位:",@"包装规格:",@"包装数量",@"基础数量:",@"备注:",];
self.d_rightArr = @[@"选择商品",@"",@"出库时间",@"选择包装单位",@"",@"基础数量",@"输入备注内容"]; self.d_rightArr = @[@"选择商品",@"选择出库时间",@"选择包装单位",@"包装规格",@"包装数量",@"基础数量",@"输入备注内容"];
self.d_lableTextArr = @[@"斤",@"筐",@"斤"]; self.d_lableTextArr = @[@"斤",@"筐",@"斤"];
self.d_processProduct = [[GXFProcessProduct alloc]init]; if (!_d_processProduct) {
self.d_processProduct = [[GXFProcessProduct alloc]init];
}
} }
- (void)initSubViews { - (void)initSubViews {
...@@ -53,8 +72,9 @@ ...@@ -53,8 +72,9 @@
[self.view addSubview:_c_tableView]; [self.view addSubview:_c_tableView];
GXFBottomView *bottomV = [[GXFBottomView alloc]initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, BottomViewHeight) LeftBtnTitle:@"结束" rightBtnTitle:@"保存"]; GXFBottomView *bottomV = [[GXFBottomView alloc]initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, BottomViewHeight) leftButtonColor:GXF_ORIGIN_COLOR rightButtonColor:GXF_GREEN_COLOR LeftBtnTitle:@"删除" rightBtnTitle:@"保存"];;
bottomV.delegate = self; bottomV.delegate = self;
self.c_bottomV = bottomV;
[self.view addSubview:bottomV]; [self.view addSubview:bottomV];
...@@ -66,7 +86,7 @@ ...@@ -66,7 +86,7 @@
// [self registerForKeyboardNotifications]; // [self registerForKeyboardNotifications];
} }
- (void)viewWillDisappear:(BOOL)animated { - (void)viewWillDisappear:(BOOL)animated {
// [[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
#pragma UITableViewDataSource #pragma UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
...@@ -104,17 +124,75 @@ ...@@ -104,17 +124,75 @@
xfCell.selectionStyle = UITableViewCellAccessoryNone; xfCell.selectionStyle = UITableViewCellAccessoryNone;
xfCell.f_textField.tag = indexPath.row; xfCell.f_textField.tag = indexPath.row;
xfCell.textLabel.text = _d_leftArr[indexPath.row]; xfCell.textLabel.text = _d_leftArr[indexPath.row];
if (_d_isEdited) {
switch (indexPath.row) {
case 0:
xfCell.f_textField.text = _d_processProduct.productName;
break;
case 1:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.outstockDate];
break;
case 2:
xfCell.f_textField.text = _d_processProduct.unit;
break;
case 3:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.qpc];
break;
case 4:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.quantity];
break;
case 5:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.baseQty];
break;
case 6:
xfCell.f_textField.text = _d_processProduct.remark;
break;
default:
break;
}
}
return xfCell; return xfCell;
} }
#pragma UITableViewDelegate #pragma UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
GXFTableViewCell *xfCell = (GXFTableViewCell *)[_c_tableView cellForRowAtIndexPath:indexPath];
if (indexPath.row == 0) {
GXFSearchVendorViewController *vc = [[GXFSearchVendorViewController alloc]initWithTitle:[IBTCommon localizableString:@"ProductTitle"]];
vc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) {
Product *product = vendors[0];
xfCell.f_textField.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_d_processProduct.productUuid = product.uuid;
_d_processProduct.productCode = product.code;
_d_processProduct.productName = product.name;
}
};
[self PushViewController:vc animated:YES];
}
if (indexPath.row == 1) { if (indexPath.row == 1) {
[self startDatePickView]; [self startDatePickView];
self.d_dateIndexPath = indexPath; self.d_dateIndexPath = indexPath;
} }
if (indexPath.row == 2) {
GXFSearchVendorViewController *vc = [[GXFSearchVendorViewController alloc]initWithTitle:[IBTCommon localizableString:@"ProductUnitTitle"]];
vc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) {
GXFProductUnit *productUnit = vendors[0];
xfCell.f_textField.text = [NSString stringWithFormat:@"%@[%@]",productUnit.name,productUnit.uuid];
_d_processProduct.productUuid = productUnit.uuid;
_d_processProduct.productName = productUnit.name;
}
};
[self PushViewController:vc animated:YES];
}
} }
...@@ -192,35 +270,25 @@ ...@@ -192,35 +270,25 @@
} }
return YES; return YES;
} }
//- (void)setTableFrame: (CGFloat)tableOffset { #pragma GXFBottomViewDelegate
// [UIView animateWithDuration:0.25 animations:^{ - (void)bottomViewleftButtonClicked:(UIButton *)leftBtn {
// CGRect tableFrame = _c_tableView.frame; [self.c_bottomV.f_leftBtn setBackgroundColor:GXF_GRAY_COLOR];
// tableFrame.origin.y -= tableOffset; if (_d_isEdited) {
// self.c_tableView.frame = tableFrame; [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_deleteProduct object:_d_processProduct];
// }]; }
//} }
//- (void)recoverTableViewFrame { - (void)bottomViewRightButtonClicked:(UIButton *)rightBtn {
// [UIView animateWithDuration:0.25 animations:^{ self.d_hasSaved = YES;
// CGRect tableFrame = _c_tableView.frame; [self.c_bottomV.f_rightBtn setBackgroundColor:GXF_GRAY_COLOR];
// tableFrame.origin.y = 0;
// self.c_tableView.frame = tableFrame; if (_d_isEdited) {
// }]; [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_editProduct object:_d_processProduct];
//} } else {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_saveProduct object:_d_processProduct];
////注册通知观察者 }
//- (void)registerForKeyboardNotifications {
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];
//
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden:) name:UIKeyboardWillHideNotification object:nil]; }
//}
//
//- (void)keyboardWasShown: (NSNotification *)aNotification {
// NSDictionary *info = [aNotification userInfo];
// CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
//
// [UIView animateWithDuration:0.25 animations:^{
// CGRect tableFrame = _c_tableView.frame;
// tableFrame.origin.y = kbSize.height;
// }];
//}
@end @end
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
@property (nonatomic,copy)NSString *warehouse_name;//加工工厂姓名 @property (nonatomic,copy)NSString *warehouse_name;//加工工厂姓名
@property (nonatomic,copy)NSString *contact;//联系人 @property (nonatomic,copy)NSString *contact;//联系人
@property (nonatomic,copy)NSString *contactPhone;//联系人电话 @property (nonatomic,copy)NSString *contactPhone;//联系人电话
@property (nonatomic,copy)NSString *total;//总金额 @property (nonatomic,copy)NSNumber *total;//总金额
@property (nonatomic,copy)NSString *remark;//备注 @property (nonatomic,copy)NSString *remark;//备注
@property (nonatomic, strong) NSDate *create_time;//创建时间 @property (nonatomic, strong) NSDate *create_time;//创建时间
@property (nonatomic, copy) NSString *create_id;// 创建人代码 @property (nonatomic, copy) NSString *create_id;// 创建人代码
......
...@@ -192,3 +192,4 @@ ...@@ -192,3 +192,4 @@
"ProductTitle" = "商品选择"; "ProductTitle" = "商品选择";
"VendorTitle" = "供应商"; "VendorTitle" = "供应商";
"WarehouseTitle" = "加工工厂"; "WarehouseTitle" = "加工工厂";
"ProductUnitTitle" = "商品单位";
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