Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
0c02d72c
Commit
0c02d72c
authored
9 years ago
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购单
parent
31915bb2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
894 additions
and
428 deletions
+894
-428
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+12
-12
ICRHTTPController.h
XFFruit/Controllers/HTTPController/ICRHTTPController.h
+15
-2
ICRHTTPController.m
XFFruit/Controllers/HTTPController/ICRHTTPController.m
+108
-4
ChooseParentViewController.h
...l/Classes/BaseViewController/ChooseParentViewController.h
+2
-3
ChooseParentViewController.m
...l/Classes/BaseViewController/ChooseParentViewController.m
+4
-3
IBTConstants.h
XFFruit/Utilities/IBTUIKit/IBTConstants.h
+12
-4
ChooseTypeViewController.h
...ntrollers/Purchase/Controllers/ChooseTypeViewController.h
+2
-3
ChooseTypeViewController.m
...ntrollers/Purchase/Controllers/ChooseTypeViewController.m
+6
-59
ChooseVendorViewController.h
...rollers/Purchase/Controllers/ChooseVendorViewController.h
+2
-3
ChooseVendorViewController.m
...rollers/Purchase/Controllers/ChooseVendorViewController.m
+56
-105
ChooseWarehouseViewController.h
...lers/Purchase/Controllers/ChooseWarehouseViewController.h
+2
-2
ChooseWarehouseViewController.m
...lers/Purchase/Controllers/ChooseWarehouseViewController.m
+52
-74
NewPurchaseViewController.h
...trollers/Purchase/Controllers/NewPurchaseViewController.h
+2
-2
NewPurchaseViewController.m
...trollers/Purchase/Controllers/NewPurchaseViewController.m
+103
-30
ProductBillViewController.h
...trollers/Purchase/Controllers/ProductBillViewController.h
+2
-5
ProductBillViewController.m
...trollers/Purchase/Controllers/ProductBillViewController.m
+40
-45
PurchaseDetailViewController.m
...llers/Purchase/Controllers/PurchaseDetailViewController.m
+97
-23
PurchaseViewController.m
...Controllers/Purchase/Controllers/PurchaseViewController.m
+161
-8
PurchaseBill.h
XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
+10
-4
ProductBillCell.h
XFFruit/ViewControllers/Purchase/Views/ProductBillCell.h
+11
-12
ProductBillCell.m
XFFruit/ViewControllers/Purchase/Views/ProductBillCell.m
+160
-0
TopPurchaseView.h
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
+3
-0
TopPurchaseView.m
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
+23
-18
ChooseProductViewController.m
...trollers/Survey/controllers/ChooseProductViewController.m
+4
-3
ChosePersonViewController.m
...ontrollers/Survey/controllers/ChosePersonViewController.m
+4
-3
NewSurveyViewController.m
...wControllers/Survey/controllers/NewSurveyViewController.m
+1
-1
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
0c02d72c
...
...
@@ -75,8 +75,8 @@
7217E9F41B72364300FE5C1D
/* SurveyListCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7217E9E31B72364300FE5C1D
/* SurveyListCell.m */
;
};
7217E9F61B724A7600FE5C1D
/* mask.png in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7217E9F51B724A7600FE5C1D
/* mask.png */
;
};
7281A0B31B8974120052B1AC
/* NewPurchaseViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0AA1B8974120052B1AC
/* NewPurchaseViewController.m */
;
};
7281A0B41B8974120052B1AC
/* Product
ViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0AC1B8974120052B1AC
/* Product
ViewController.m */
;
};
7281A0B51B8974120052B1AC
/* Product
Cell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0B01B8974120052B1AC
/* Product
Cell.m */
;
};
7281A0B41B8974120052B1AC
/* Product
BillViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0AC1B8974120052B1AC
/* ProductBill
ViewController.m */
;
};
7281A0B51B8974120052B1AC
/* Product
BillCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0B01B8974120052B1AC
/* ProductBill
Cell.m */
;
};
7281A0B61B8974120052B1AC
/* TopPurchaseView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0B21B8974120052B1AC
/* TopPurchaseView.m */
;
};
7281A0B91B897BB20052B1AC
/* PurchaseViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0B81B897BB20052B1AC
/* PurchaseViewController.m */
;
};
7281A0BC1B897EAB0052B1AC
/* PurchaseCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
7281A0BB1B897EAB0052B1AC
/* PurchaseCell.m */
;
};
...
...
@@ -499,10 +499,10 @@
7217E9F51B724A7600FE5C1D
/* mask.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
path
=
mask.png
;
sourceTree
=
"<group>"
;
};
7281A0A91B8974120052B1AC
/* NewPurchaseViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
NewPurchaseViewController.h
;
sourceTree
=
"<group>"
;
};
7281A0AA1B8974120052B1AC
/* NewPurchaseViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
NewPurchaseViewController.m
;
sourceTree
=
"<group>"
;
};
7281A0AB1B8974120052B1AC
/* Product
ViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
Product
ViewController.h
;
sourceTree
=
"<group>"
;
};
7281A0AC1B8974120052B1AC
/* Product
ViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
Product
ViewController.m
;
sourceTree
=
"<group>"
;
};
7281A0AF1B8974120052B1AC
/* Product
Cell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
Product
Cell.h
;
sourceTree
=
"<group>"
;
};
7281A0B01B8974120052B1AC
/* Product
Cell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
Product
Cell.m
;
sourceTree
=
"<group>"
;
};
7281A0AB1B8974120052B1AC
/* Product
BillViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ProductBill
ViewController.h
;
sourceTree
=
"<group>"
;
};
7281A0AC1B8974120052B1AC
/* Product
BillViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ProductBill
ViewController.m
;
sourceTree
=
"<group>"
;
};
7281A0AF1B8974120052B1AC
/* Product
BillCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ProductBill
Cell.h
;
sourceTree
=
"<group>"
;
};
7281A0B01B8974120052B1AC
/* Product
BillCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ProductBill
Cell.m
;
sourceTree
=
"<group>"
;
};
7281A0B11B8974120052B1AC
/* TopPurchaseView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
TopPurchaseView.h
;
sourceTree
=
"<group>"
;
};
7281A0B21B8974120052B1AC
/* TopPurchaseView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TopPurchaseView.m
;
sourceTree
=
"<group>"
;
};
7281A0B71B897BB20052B1AC
/* PurchaseViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
PurchaseViewController.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1057,8 +1057,8 @@
children
=
(
7281A0A91B8974120052B1AC
/* NewPurchaseViewController.h */
,
7281A0AA1B8974120052B1AC
/* NewPurchaseViewController.m */
,
7281A0AB1B8974120052B1AC
/* ProductViewController.h */
,
7281A0AC1B8974120052B1AC
/* ProductViewController.m */
,
7281A0AB1B8974120052B1AC
/* Product
Bill
ViewController.h */
,
7281A0AC1B8974120052B1AC
/* Product
Bill
ViewController.m */
,
7281A0B71B897BB20052B1AC
/* PurchaseViewController.h */
,
7281A0B81B897BB20052B1AC
/* PurchaseViewController.m */
,
7281A0C01B898A040052B1AC
/* PurchaseDetailViewController.h */
,
...
...
@@ -1093,8 +1093,8 @@
7281A0AE1B8974120052B1AC
/* Views */
=
{
isa
=
PBXGroup
;
children
=
(
7281A0AF1B8974120052B1AC
/* ProductCell.h */
,
7281A0B01B8974120052B1AC
/* ProductCell.m */
,
7281A0AF1B8974120052B1AC
/* Product
Bill
Cell.h */
,
7281A0B01B8974120052B1AC
/* Product
Bill
Cell.m */
,
7281A0B11B8974120052B1AC
/* TopPurchaseView.h */
,
7281A0B21B8974120052B1AC
/* TopPurchaseView.m */
,
7281A0BA1B897EAB0052B1AC
/* PurchaseCell.h */
,
...
...
@@ -2329,7 +2329,7 @@
7217E9E81B72364300FE5C1D
/* Survey.m in Sources */
,
FEAE16EC1B79CAA0009D9E01
/* TPCustomImageVIew.m in Sources */
,
FE4678AD1B8D636300B5EDA3
/* ChooseWarehouseViewController.m in Sources */
,
7281A0B51B8974120052B1AC
/* ProductCell.m in Sources */
,
7281A0B51B8974120052B1AC
/* Product
Bill
Cell.m in Sources */
,
C1FE50561AE3587F00C18080
/* ICRAttachmentUnit.m in Sources */
,
30D7494C1ACE340D00C63BA1
/* ICRModifyPwdViewController.m in Sources */
,
C10214CD1AD8FE200024637E
/* ICRStoreDetailViewController.m in Sources */
,
...
...
@@ -2377,7 +2377,7 @@
FE2FCC7F1B74511000BBC6FB
/* ChooseProductViewController.m in Sources */
,
351CFF5E1B90633700F30866
/* GXFNoticeFunctionTableViewCell.m in Sources */
,
FE2FCC881B7492C500BBC6FB
/* ResultDetailViewController.m in Sources */
,
7281A0B41B8974120052B1AC
/* ProductViewController.m in Sources */
,
7281A0B41B8974120052B1AC
/* Product
Bill
ViewController.m in Sources */
,
72EDD86E1B96E11700964115
/* ChooseParentViewController.m in Sources */
,
C159183D1AC062460013B391
/* IBTTableViewCellInfo.m in Sources */
,
C1FE504E1AE024FA00C18080
/* RIButtonItem.m in Sources */
,
...
...
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/HTTPController/ICRHTTPController.h
View file @
0c02d72c
...
...
@@ -235,8 +235,21 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
-
(
void
)
savePurchaseWithData
:(
id
)
data
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
//获取采购单列表
-
(
void
)
queryPurchaseWithData
:(
id
)
data
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
//获取采购单详情
-
(
void
)
getPurchaseResultWithPurchaseUuid
:(
NSString
*
)
purchaseUuid
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
//审核/拒绝/供应商确认/结束/作废采购单
-
(
void
)
dealByActionWithPurchaseUuid
:(
NSString
*
)
purchaseUuid
action
:(
NSString
*
)
action
remark
:(
NSString
*
)
remark
version
:(
NSNumber
*
)
version
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/HTTPController/ICRHTTPController.m
View file @
0c02d72c
...
...
@@ -79,7 +79,12 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//供应商
XFFHttp_GetVendor
,
//仓库
XFFHttp_GetWarehouse
XFFHttp_GetWarehouse
,
//采购单
XFFHttp_PurchaseSave
,
XFFHttp_QueryPurchase
,
XFFHttp_GetPurchaseDetail
,
XFFHttp_DealByActionPurchase
};
static
NSString
*
const
ICRHTTPInterface
[]
=
{
...
...
@@ -140,7 +145,11 @@ static NSString * const ICRHTTPInterface[] = {
[
XFFHttp_GetVendor
]
=
@"data/vendor/download"
,
//仓库
[
XFFHttp_GetWarehouse
]
=
@"data/warehouse/download"
,
//采购单
[
XFFHttp_PurchaseSave
]
=
@"purchase/bill/save"
,
[
XFFHttp_QueryPurchase
]
=
@"purchase/bill/query"
,
[
XFFHttp_GetPurchaseDetail
]
=
@"purchase/bill/get"
,
[
XFFHttp_DealByActionPurchase
]
=
@"purchase/bill/action"
};
static
NSString
*
const
ICRAttachmentTypeValue
[]
=
{
...
...
@@ -1736,7 +1745,7 @@ acceptTypeJson:YES
NSDictionary
*
dict
=
data
;
NSString
*
currentTime
=
[[
NSDate
date
]
httpParameterString
];
ICRUserUtil
*
userUtil
=
[
ICRUserUtil
sharedInstance
];
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_
Survey
Save
]
stringByAppendingFormat
:
@"?time=%@&operId=%@&operName=%@"
,
currentTime
,
userUtil
.
userCode
,
userUtil
.
displayName
];
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_
Purchase
Save
]
stringByAppendingFormat
:
@"?time=%@&operId=%@&operName=%@"
,
currentTime
,
userUtil
.
userCode
,
userUtil
.
displayName
];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
POST
:
encodeUrlStr
parameters
:
dict
...
...
@@ -1745,6 +1754,101 @@ acceptTypeJson:YES
success
:
success
failure
:
failure
];
}
//获取行情调研单列表
-
(
void
)
queryPurchaseWithData
:
(
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_QueryPurchase
];
[
self
POST
:
urlStr
parameters
:
dict
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
//获取采购单详情
-
(
void
)
getPurchaseResultWithPurchaseUuid
:
(
NSString
*
)
purchaseUuid
success
:
(
void
(
^
)(
id
))
succ
failure
:
(
void
(
^
)(
id
))
fail
{
if
(
!
purchaseUuid
)
{
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_GetPurchaseDetail
]
stringByAppendingFormat
:
@"/%@"
,
purchaseUuid
];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
GET
:
encodeUrlStr
parameters
:
nil
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
-
(
void
)
dealByActionWithPurchaseUuid
:
(
NSString
*
)
purchaseUuid
action
:
(
NSString
*
)
action
remark
:
(
NSString
*
)
remark
version
:
(
NSNumber
*
)
version
success
:
(
void
(
^
)(
id
))
succ
failure
:
(
void
(
^
)(
id
))
fail
{
if
(
!
purchaseUuid
)
{
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
);
}
};
ICRUserUtil
*
userUtil
=
[
ICRUserUtil
sharedInstance
];
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_GetPurchaseDetail
]
stringByAppendingFormat
:
@"/%@?action=%@&remark=%@&version=%@&time=%@&operId=%@&operName=%@"
,
purchaseUuid
,
action
,
remark
,
version
,[[
NSDate
date
]
httpParameterString
],
userUtil
.
userCode
,
userUtil
.
displayName
];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
GET
:
encodeUrlStr
parameters
:
nil
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
@end
This diff is collapsed.
Click to expand it.
XFFruit/General/Classes/BaseViewController/ChooseParentViewController.h
View file @
0c02d72c
...
...
@@ -10,8 +10,7 @@
#import "MaskCell.h"
#import "MJRefresh.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseParentViewController
:
ICRBaseViewController
...
...
@@ -23,7 +22,7 @@
@property
(
nonatomic
,
assign
)
BOOL
isRefresh
;
-
(
void
)
endRefreshing
;
-
(
void
)
getBaseDataFrom
Local
;
-
(
void
)
getBaseDataFrom
Server
;
-
(
BOOL
)
isHaveIndexPath
:(
NSIndexPath
*
)
indexPath
;
-
(
void
)
deleteTextFieldStr
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/General/Classes/BaseViewController/ChooseParentViewController.m
View file @
0c02d72c
...
...
@@ -7,7 +7,8 @@
//
#import "ChooseParentViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseParentViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
@end
...
...
@@ -69,7 +70,7 @@
return
;
}
self
.
isRefresh
=
YES
;
[
self
getBaseDataFrom
Local
];
[
self
getBaseDataFrom
Server
];
}];
}
...
...
@@ -111,7 +112,7 @@
}
#pragma mark -childFunction
-
(
void
)
getBaseDataFrom
Local
-
(
void
)
getBaseDataFrom
Server
{
}
-
(
void
)
sureClick
...
...
This diff is collapsed.
Click to expand it.
XFFruit/Utilities/IBTUIKit/IBTConstants.h
View file @
0c02d72c
...
...
@@ -104,15 +104,21 @@
#define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_LEFTSIX_COLOR HexColor(@"666666")
#define GXF_THREETEENTH_SIZE FontSize(13)
#define GXF_FOURTEENTH_SIZE FontSize(14)
#define GXF_FIFTEENTEN_SIZE FontSize(15)
#define GXF_SIXTEENTEH_SIZE FontSize(16)
#define GXF_SEVENTEENTH_SIZE FontSize(17)
//refreshUpdateDate
#define SurveyUpdateDate @"surveyUpdateDate"
#define ChooseProductUpdateDate @"chooseProductUpdateDate"
#define ChoosePersonUpdateDate @"choosePersonUpdateDate"
#define SurveyUpdateDate @"surveyUpdateDate"
#define ChooseProductUpdateDate @"chooseProductUpdateDate"
#define ChoosePersonUpdateDate @"choosePersonUpdateDate"
#define ChooseVendorUpdateDate @"chooseVendorUpdateDate"
#define ChooseWarehouseUpdateDate @"chooseWarehouseUpdateDate"
#define PurchaseUpdateDate @"purchaseUpdateDate"
//行情调研状态
//initial(未提交),submitted(已提交),insurvey(调研中),finished(已完成)
#define SURVEY_STATE_INITIAL @"initial"
...
...
@@ -132,6 +138,8 @@
#define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]
//类型
#define GXF_Critical @"critical"//紧急
#define GXF_Normal @"normal"//普通
#endif
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseTypeViewController.h
View file @
0c02d72c
...
...
@@ -6,10 +6,9 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "
ICRBase
ViewController.h"
#import "
ChooseParent
ViewController.h"
typedef
void
(
^
ChoseType
)(
NSString
*
type
);
@interface
ChooseTypeViewController
:
ICRBase
ViewController
@interface
ChooseTypeViewController
:
ChooseParent
ViewController
@property
(
nonatomic
,
copy
)
ChoseType
choseType
;
@property
(
nonatomic
,
copy
)
NSArray
*
dataArr
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseTypeViewController.m
View file @
0c02d72c
...
...
@@ -7,82 +7,37 @@
//
#import "ChooseTypeViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseTypeViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
@interface
ChooseTypeViewController
()
{
UITextField
*
_selectTextFiled
;
NSIndexPath
*
_currentIndexPath
;
}
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@end
@implementation
ChooseTypeViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
bulidLayout
];
self
.
title
=
@"类型"
;
[
self
.
dataArr
addObject
:
@"紧急"
];
[
self
.
dataArr
addObject
:
@"普通"
];
}
-
(
void
)
bulidLayout
{
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
createRefresh
{}
-
(
void
)
sureClick
{
if
(
self
.
dataArr
.
count
>
0
)
{
if
(
_currentIndexPath
)
{
NSString
*
type
=
self
.
dataArr
[
_currentIndexPath
.
row
];
self
.
choseType
(
type
);
}
}
[
self
PopViewControllerAnimated
:
YES
];
}
-
(
void
)
deletePerson
{
_selectTextFiled
.
text
=
@""
;
_currentIndexPath
=
nil
;
[
self
.
tableView
reloadData
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
...
...
@@ -105,7 +60,6 @@
if
(
self
.
dataArr
.
count
>
0
)
{
NSString
*
type
=
self
.
dataArr
[
indexPath
.
row
];
[
cell
setTitleStr
:
type
];
}
return
cell
;
}
...
...
@@ -118,15 +72,8 @@
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
NSString
*
type
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
type
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.h
View file @
0c02d72c
...
...
@@ -6,10 +6,9 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "
ICRBase
ViewController.h"
#import "
ChooseParent
ViewController.h"
typedef
void
(
^
ChoseVendor
)(
NSArray
*
vendor
);
@interface
ChooseVendorViewController
:
ICRBaseViewController
@property
(
nonatomic
,
assign
)
BOOL
isMoreChose
;
//是否是多选
@interface
ChooseVendorViewController
:
ChooseParentViewController
@property
(
nonatomic
,
copy
)
ChoseVendor
choseVendor
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.m
View file @
0c02d72c
...
...
@@ -7,44 +7,40 @@
//
#import "ChooseVendorViewController.h"
#import "MaskCell.h"
#import "Vendor.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseVendorViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
@interface
ChooseVendorViewController
()
{
UITextField
*
_selectTextFiled
;
NSIndexPath
*
_currentIndexPath
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
indexArr
;
@end
@implementation
ChooseVendorViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
initData
];
[
self
bulidLayout
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
self
.
indexArr
=
[
NSMutableArray
array
];
[
self
fetchVendorList
];
//记录更新时间
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
ChooseVendorUpdateDate
;
self
.
title
=
@"选择供应商"
;
[
self
fetchVendorList
:
@""
];
}
-
(
void
)
getBaseDataFromServer
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchVendorList
];
[
strongSelf
endRefreshing
];
[
strongSelf
fetchVendorList
:
@""
];
}
else
{
[
IBTLoadingView
showTips
:
data
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
...
...
@@ -54,63 +50,38 @@
}
#pragma mark -成功
-
(
void
)
fetchVendorList
{
-
(
void
)
fetchVendorList
:
(
NSString
*
)
titleStr
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Vendor
TableName
],
@"uuid"
];
NSString
*
sql
=
@""
;
if
(
titleStr
.
length
>
0
)
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@"
,
[
Vendor
TableName
],
titleStr
,
@"uuid"
];
}
else
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Vendor
TableName
],
@"uuid"
];
}
return
[
db
executeQuery
:
sql
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
strongSelf
.
tableView
reloadData
];
if
(
!
[
GXF_NSUSERFEFTAULTS
objectForKey
:
ChooseVendorUpdateDate
])
{
[
GXF_NSUSERFEFTAULTS
setObject
:[
NSDate
date
]
forKey
:
ChooseVendorUpdateDate
];
[
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
:[
Vendor
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
#pragma mark - 插入数据
-
(
void
)
bulidLayout
{
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
sureClick
{
if
(
self
.
isMoreChose
)
{
NSMutableArray
*
arr
=
[[
NSMutableArray
alloc
]
init
];
...
...
@@ -132,24 +103,12 @@
}
-
(
void
)
deletePerson
{
if
(
self
.
isMoreChose
)
{
[
self
.
indexArr
removeAllObjects
];
}
else
{
_currentIndexPath
=
nil
;
}
_selectTextFiled
.
text
=
@""
;
[
self
.
tableView
reloadData
];
-
(
void
)
deleteTextFieldStr
{
[
super
deleteTextFieldStr
];
[
self
boxValueChanged
:
nil
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
...
...
@@ -177,15 +136,24 @@
}
}
if
(
self
.
dataArr
.
count
>
0
)
{
Vendor
*
vendor
=
self
.
dataArr
[
indexPath
.
row
];
NSString
*
proStr
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
vendor
.
name
,
vendor
.
code
];
[
cell
setTitleStr
:
proStr
];
if
(
indexPath
.
row
==
0
)
{
NSString
*
dateStr
=
[
self
.
dataArr
[
indexPath
.
row
]
httpParameterString
];
cell
.
titleLabel
.
textColor
=
GXF_CONTENT_COLOR
;
[
cell
setTitleStr
:[
NSString
stringWithFormat
:
@"上次更新时间:%@"
,
dateStr
]];
}
else
{
Vendor
*
vendor
=
self
.
dataArr
[
indexPath
.
row
];
NSString
*
proStr
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
vendor
.
name
,
vendor
.
code
];
[
cell
setTitleStr
:
proStr
];
}
}
return
cell
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
)
{
return
;
}
if
(
self
.
isMoreChose
==
YES
)
{
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
...
...
@@ -193,45 +161,28 @@
[
self
.
indexArr
addObject
:
indexPath
];
}
NSString
*
personStr
=
@""
;
for
(
NSIndexPath
*
index
in
self
.
indexArr
)
{
Vendor
*
vendor
=
self
.
dataArr
[
index
.
row
];
if
(
personStr
.
length
==
0
)
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@"
,
vendor
.
name
];
}
else
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"、%@"
,
vendor
.
name
];
}
}
_selectTextFiled
.
text
=
personStr
;
}
else
{
}
else
{
MaskCell
*
currentCell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
_currentIndexPath
];
currentCell
.
Commitbtn
.
hidden
=
YES
;
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
Vendor
*
vendor
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
vendor
.
name
;
}
}
-
(
BOOL
)
isHaveIndexPath
:
(
NSIndexPath
*
)
indexPath
{
for
(
NSIndexPath
*
path
in
self
.
indexArr
)
{
if
(
path
.
row
==
indexPath
.
row
)
{
return
YES
;
}
}
return
NO
;
#pragma mark - 按钮事件
-
(
void
)
boxValueChanged
:
(
NSNotification
*
)
fication
{
NSString
*
tilkeStr
=
[
IBTCommon
trimmingCharacters
:
self
.
selectTextFiled
.
text
];
[
self
fetchVendorList
:
tilkeStr
];
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
-
(
void
)
tableViewRefresh
{
_currentIndexPath
=
nil
;
if
(
self
.
indexArr
.
count
>
0
)
{
[
self
.
indexArr
removeAllObjects
];
}
[
self
.
tableView
reloadData
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseWarehouseViewController.h
View file @
0c02d72c
...
...
@@ -6,10 +6,10 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "
ICRBase
ViewController.h"
#import "
ChooseParent
ViewController.h"
#import "Warehouse.h"
typedef
void
(
^
ChoseWarehouse
)(
Warehouse
*
warehouse
);
@interface
ChooseWarehouseViewController
:
ICRBase
ViewController
@interface
ChooseWarehouseViewController
:
ChooseParent
ViewController
@property
(
nonatomic
,
copy
)
ChoseWarehouse
choseWarehouse
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ChooseWarehouseViewController.m
View file @
0c02d72c
...
...
@@ -7,42 +7,37 @@
//
#import "ChooseWarehouseViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseWarehouseViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
@interface
ChooseWarehouseViewController
()
{
UITextField
*
_selectTextFiled
;
NSIndexPath
*
_currentIndexPath
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@end
@implementation
ChooseWarehouseViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
initData
];
[
self
bulidLayout
];
//记录更新时间
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
ChooseWarehouseUpdateDate
;
self
.
title
=
@"选择仓库"
;
[
self
fetchWarehouseList
:
@""
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
[
self
fetchWarehouseList
];
-
(
void
)
getBaseDataFromServer
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchWarehouseList
];
[
self
endRefreshing
];
[
strongSelf
fetchWarehouseList
:
@""
];
}
else
{
[
IBTLoadingView
showTips
:
data
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
...
...
@@ -53,18 +48,31 @@
}
#pragma mark -成功
-
(
void
)
fetchWarehouseList
{
-
(
void
)
fetchWarehouseList
:
(
NSString
*
)
titleStr
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Warehouse
TableName
],
@"uuid"
];
NSString
*
sql
=
@""
;
if
(
titleStr
.
length
>
0
)
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@"
,
[
Warehouse
TableName
],
titleStr
,
@"uuid"
];
}
else
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
Warehouse
TableName
],
@"uuid"
];
}
return
[
db
executeQuery
:
sql
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
strongSelf
.
tableView
reloadData
];
if
(
!
[
GXF_NSUSERFEFTAULTS
objectForKey
:
ChooseWarehouseUpdateDate
])
{
[
GXF_NSUSERFEFTAULTS
setObject
:[
NSDate
date
]
forKey
:
ChooseWarehouseUpdateDate
];
[
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
];
...
...
@@ -72,40 +80,6 @@
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
-
(
void
)
bulidLayout
{
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
sureClick
{
if
(
self
.
dataArr
.
count
>
0
)
{
...
...
@@ -118,19 +92,12 @@
}
-
(
void
)
deletePerson
{
_selectTextFiled
.
text
=
@""
;
_currentIndexPath
=
nil
;
[
self
.
tableView
reloadData
];
-
(
void
)
deleteTextFieldStr
{
[
super
deleteTextFieldStr
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
...
...
@@ -151,11 +118,16 @@
cell
.
Commitbtn
.
hidden
=
YES
;
}
if
(
self
.
dataArr
.
count
>
0
)
{
Warehouse
*
warehouse
=
self
.
dataArr
[
indexPath
.
row
];
NSString
*
proStr
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
warehouse
.
name
,
warehouse
.
code
];
[
cell
setTitleStr
:
proStr
];
if
(
indexPath
.
row
==
0
)
{
NSString
*
dateStr
=
[
self
.
dataArr
[
indexPath
.
row
]
httpParameterString
];
cell
.
titleLabel
.
textColor
=
GXF_CONTENT_COLOR
;
[
cell
setTitleStr
:[
NSString
stringWithFormat
:
@"上次更新时间:%@"
,
dateStr
]];
}
else
{
Warehouse
*
warehouse
=
self
.
dataArr
[
indexPath
.
row
];
NSString
*
proStr
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
warehouse
.
name
,
warehouse
.
code
];
[
cell
setTitleStr
:
proStr
];
}
}
return
cell
;
}
...
...
@@ -168,15 +140,21 @@
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
Warehouse
*
warehouse
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
warehouse
.
name
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
#pragma mark - 按钮事件
-
(
void
)
boxValueChanged
:
(
NSNotification
*
)
fication
{
NSString
*
tilkeStr
=
[
IBTCommon
trimmingCharacters
:
self
.
selectTextFiled
.
text
];
[
self
fetchWarehouseList
:
tilkeStr
];
}
-
(
void
)
tableViewRefresh
{
_currentIndexPath
=
nil
;
if
(
self
.
indexArr
.
count
>
0
)
{
[
self
.
indexArr
removeAllObjects
];
}
[
self
.
tableView
reloadData
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.h
View file @
0c02d72c
...
...
@@ -7,7 +7,7 @@
//
#import "ICRBaseViewController.h"
#import "PurchaseBill.h"
@interface
NewPurchaseViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
PurchaseBill
*
purchaseBill
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.m
View file @
0c02d72c
...
...
@@ -8,31 +8,29 @@
#import "NewPurchaseViewController.h"
#import "TopPurchaseView.h"
#import "ProductViewController.h"
#import "Product
Bill
ViewController.h"
#import "AddProductViewController.h"
#import "PurchaseBillProduct.h"
#import "PurchaseViewController.h"
#define TopHeight 328
#define BottomHeight 300
#define SpaceHeight 20
#define BottomViewHeight 60
typedef
enum
:
NSUInteger
{
SaveTag
=
8000
,
CommitTag
,
}
BtnTag
;
@interface
NewPurchaseViewController
()
<
TopPurchaseViewDelegate
,
ProductViewDelegate
>
@interface
NewPurchaseViewController
()
<
TopPurchaseViewDelegate
>
{
UIScrollView
*
_scrollView
;
TopPurchaseView
*
_purchaseView
;
UIView
*
_bottomView
;
ProductViewController
*
_pvc
;
AddProductViewController
*
_avc
;
ProductBillViewController
*
_pvc
;
id
uuidObject
;
id
billNumberObject
;
NSNumber
*
versionObject
;
}
@property
(
nonatomic
,
strong
)
NSNumber
*
total
;
@property
(
nonatomic
,
strong
)
NSNumber
*
charge
;
@property
(
nonatomic
,
strong
)
NSString
*
remark
;
@property
(
nonatomic
,
strong
)
NSString
*
state
;
@end
...
...
@@ -52,6 +50,10 @@ typedef enum : NSUInteger {
[
super
viewDidLoad
];
//布局
[
self
bulidLayout
];
//数据默认值
uuidObject
=
[
NSNull
null
];
billNumberObject
=
[
NSNull
null
];
versionObject
=
[
NSNumber
numberWithInteger
:
0
];
}
...
...
@@ -83,8 +85,7 @@ typedef enum : NSUInteger {
_bottomView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_bottomView
];
_pvc
=
[[
ProductViewController
alloc
]
init
];
_pvc
.
delegate
=
self
;
_pvc
=
[[
ProductBillViewController
alloc
]
init
];
_pvc
.
viewFrame
=
_bottomView
.
bounds
;
[
_bottomView
addSubview
:
_pvc
.
view
];
...
...
@@ -100,8 +101,8 @@ typedef enum : NSUInteger {
totalPrice
+=
[
billProduct
.
total
floatValue
];
}
_purchaseView
.
purchasePriceLabel
.
text
=
[
NSString
stringWithFormat
:
@"%.2f"
,
totalPrice
+
otherPrice
];
self
.
charg
e
=
[
NSNumber
numberWithFloat
:
otherPrice
];
self
.
total
=
[
NSNumber
numberWithFloat
:
total
Price
];
_purchaseView
.
chargePurchas
e
=
[
NSNumber
numberWithFloat
:
otherPrice
];
_purchaseView
.
total
=
[
NSNumber
numberWithFloat
:
totalPrice
+
other
Price
];
}
-
(
void
)
btnClick
:
(
UIButton
*
)
btn
{
...
...
@@ -109,12 +110,15 @@ typedef enum : NSUInteger {
case
SaveTag
:
{
if
([
self
checkPurchase
])
{
[
self
getDataFromServer
:
PURCHASE_STATE_INITIAL
msg
:
@"正在保存..."
];
}
}
break
;
case
CommitTag
:{
if
([
self
checkPurchase
])
{
[
self
getDataFromServer
:
PURCHASE_STATE_SUBMITTED
msg
:
@"正在提交..."
];
}
}
break
;
default
:
...
...
@@ -122,12 +126,92 @@ typedef enum : NSUInteger {
}
}
-
(
void
)
getDataFromServer
:
(
NSString
*
)
state
msg
:
(
NSString
*
)
msg
{
//保存
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
];
if
(
success
==
1
)
{
//成功
if
([
state
isEqualToString
:
PURCHASE_STATE_INITIAL
])
{
//保存成功
NSString
*
uuidS
=
data
[
@"data"
][
@"uuid"
];
NSString
*
billNumberS
=
data
[
@"data"
][
@"billNumber"
];
NSNumber
*
versionN
=
data
[
@"data"
][
@"version"
];
uuidObject
=
uuidS
;
billNumberObject
=
billNumberS
;
versionObject
=
versionN
;
[
IBTLoadingView
showTips
:[
NSString
stringWithFormat
:
@"当前单据%@已保存成功"
,
billNumberS
]];
}
else
{
//提交成功
PurchaseViewController
*
svc
=
[
PurchaseViewController
new
];
[
self
PushViewController
:
svc
animated
:
YES
];
}
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
if
(
self
.
purchaseBill
.
uuid
.
length
>
0
&&
uuidObject
==
[
NSNull
null
]){
uuidObject
=
self
.
purchaseBill
.
uuid
;
}
if
(
self
.
purchaseBill
.
billNumber
>
0
&&
billNumberObject
==
[
NSNull
null
])
{
billNumberObject
=
self
.
purchaseBill
.
billNumber
;
}
if
(
self
.
purchaseBill
&&
[
versionObject
integerValue
]
==
0
)
{
versionObject
=
self
.
purchaseBill
.
version
;
}
NSMutableArray
*
billProducts
=
[
NSMutableArray
array
];
for
(
PurchaseBillProduct
*
billProduct
in
_pvc
.
productArr
)
{
[
billProducts
addObject
:[
billProduct
dictForCommit
]];
}
NSDictionary
*
dict
=
@{
@"uuid"
:
uuidObject
,
@"version"
:
versionObject
,
@"billnumber"
:
billNumberObject
,
@"state"
:
state
,
@"type"
:
[
IBTCommon
checkString
:
_purchaseView
.
type
],
@"noticeUuid"
:
[
IBTCommon
checkString
:
_purchaseView
.
noticeUuid
],
@"noticeNumber"
:
[
IBTCommon
checkString
:
_purchaseView
.
noticeNumber
],
@"vendor_uuid"
:
[
IBTCommon
checkString
:
_purchaseView
.
vendor_uuid
],
@"vendor_code"
:
[
IBTCommon
checkString
:
_purchaseView
.
vendor_code
],
@"vendor_name"
:
[
IBTCommon
checkString
:
_purchaseView
.
vendor_name
],
@"receiveWrh_uuid"
:
[
IBTCommon
checkString
:
_purchaseView
.
receiveWrh_uuid
],
@"receiveWrh_code"
:
[
IBTCommon
checkString
:
_purchaseView
.
receiveWrh_code
],
@"receiveWrh_name"
:
[
IBTCommon
checkString
:
_purchaseView
.
receiveWrh_name
],
@"total"
:
_purchaseView
.
total
,
@"charge"
:
_purchaseView
.
chargePurchase
,
@"remark"
:
_purchaseView
.
remark
,
@"products"
:
billProducts
};
[
IBTLoadingView
showProgressLabel
:
msg
];
[[
ICRHTTPController
sharedController
]
savePurchaseWithData
:
dict
success
:
succ
failure
:
fail
];
}
#pragma mark - checkNull
-
(
BOOL
)
checkPurchase
{
self
.
remark
=
_purchaseView
.
remarkTextView
.
text
;
if
(
_purchaseView
.
vendor_uuid
.
length
==
0
||
_purchaseView
.
receiveWrh_uuid
.
length
==
0
||
_purchaseView
.
type
.
length
==
0
||
[
self
.
total
floatValue
]
<
0
||
!
self
.
total
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示信息"
message
:
@"信息不完整"
delegate
:
nil
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
[
alert
show
];
_purchaseView
.
remark
=
_purchaseView
.
remarkTextView
.
text
;
if
(
_purchaseView
.
type
.
length
==
0
)
{
ShowMessage
(
@"采购类型不能为空"
);
return
NO
;
}
if
(
_purchaseView
.
vendor_uuid
.
length
==
0
)
{
ShowMessage
(
@"供应商不能为空"
);
return
NO
;
}
if
(
_purchaseView
.
receiveWrh_uuid
.
length
==
0
)
{
ShowMessage
(
@"收货仓库不能为空"
);
return
NO
;
}
if
(
_pvc
.
productArr
.
count
==
0
)
{
ShowMessage
(
@"采购商品不能为空"
);
return
NO
;
}
if
([
_purchaseView
.
total
floatValue
]
<
0
||
!
_purchaseView
.
total
)
{
ShowMessage
(
@"金额不能为空"
);
return
NO
;
}
return
YES
;
...
...
@@ -140,17 +224,6 @@ typedef enum : NSUInteger {
[
self
PushViewController
:
vc
animated
:
YES
];
}
#pragma mark - ProductViewDelegate
-
(
void
)
pushViewController
:
(
id
)
cvc
selfController
:
(
id
)
avc
{
_avc
=
avc
;
[
self
PushViewController
:
cvc
animated
:
YES
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
if
(
_avc
)
{
[
AppWindow
addSubview
:
_avc
.
view
];
}
}
#pragma mark - 协议方法
-
(
void
)
hiddenKeyBoard
{
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.h
→
XFFruit/ViewControllers/Purchase/Controllers/Product
Bill
ViewController.h
View file @
0c02d72c
...
...
@@ -7,15 +7,12 @@
//
#import "ICRBaseViewController.h"
@protocol
ProductViewDelegate
<
NSObject
>
-
(
void
)
pushViewController
:
(
id
)
cvc
selfController
:
(
id
)
avc
;
@end
@interface
ProductViewController
:
ICRBaseViewController
@interface
ProductBillViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
NSMutableArray
*
productArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
assign
)
CGRect
viewFrame
;
@property
(
nonatomic
,
assign
)
BOOL
isHiddenEdit
;
@property
(
nonatomic
,
weak
)
id
<
ProductViewDelegate
>
delegate
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.m
→
XFFruit/ViewControllers/Purchase/Controllers/Product
Bill
ViewController.m
View file @
0c02d72c
...
...
@@ -6,23 +6,22 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ProductViewController.h"
#import "Product
Bill
ViewController.h"
#import "FooterCell.h"
#import "HeaderCell.h"
#import "ProductCell.h"
#import "AddProductViewController.h"
#import "ProductBillCell.h"
#import "PurchaseBillProduct.h"
#define TableHeight 44
#define ShowHeight 100
@interface
Product
ViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
FooterCellDelegate
,
AddProductView
Delegate
>
@interface
Product
BillViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
FooterCell
Delegate
>
{
CGRect
_tableFrame
;
NSMutableArray
*
_selectRowArr
;
//记录当前选中的cell
AddProductViewController
*
_avc
;
}
@end
@implementation
ProductViewController
@implementation
Product
Bill
ViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
...
...
@@ -36,12 +35,25 @@
if
(
!
self
.
productArr
)
{
self
.
productArr
=
[
NSMutableArray
array
];
}
PurchaseBillProduct
*
billProduct
=
[
PurchaseBillProduct
new
];
billProduct
.
total
=
[
NSNumber
numberWithFloat
:
25
];
[
self
.
productArr
addObject
:
billProduct
];
[
self
.
productArr
addObject
:
billProduct
];
// PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
//
// billProduct.product_name = @"dd";
// billProduct.product_uuid = @"402880e64e287fe2014e28895b8a0032";
// billProduct.product_code = @"农夫山泉";
// billProduct.qpc = [NSNumber numberWithFloat:22];
// billProduct.unit = @"筐";
// billProduct.qty = [NSNumber numberWithFloat:23];
// billProduct.price = [NSNumber numberWithFloat:333];
// billProduct.baseQty = [NSNumber numberWithFloat:333];
// billProduct.basePrice = [NSNumber numberWithFloat:33];
// billProduct.total = [NSNumber numberWithFloat:25];
// billProduct.remark = @"hshshshsh";
// billProduct.qpcStr = @"fdsfdsfdsa";
// [self.productArr addObject:billProduct];
// [self.productArr addObject:billProduct];
if
(
self
.
productArr
.
count
>
0
)
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
SetProductTotalPrice
object
:
nil
];
}
}
-
(
void
)
setViewFrame
:
(
CGRect
)
viewFrame
{
...
...
@@ -69,33 +81,9 @@
}
#pragma mark - footerDelegate
-
(
void
)
addClick
{
// [self.productArr addObject:@"dddd"];
// [self.tableView reloadData];
if
(
_avc
==
nil
)
{
_avc
=
[[
AddProductViewController
alloc
]
init
];
_avc
.
delegate
=
self
;
_avc
.
view
.
backgroundColor
=
RGBA
(
0
,
0
,
0
,
0
.
5
);
[
AppWindow
addSubview
:
_avc
.
view
];
}
}
#pragma mark - addProductViewDelegate
-
(
void
)
dissmiss
{
if
(
_avc
)
{
[
_avc
.
view
removeFromSuperview
];
_avc
=
nil
;
}
}
-
(
void
)
pushViewController
:
(
id
)
cvc
{
if
(
_avc
)
{
[
_avc
.
view
removeFromSuperview
];
}
if
([
self
.
delegate
respondsToSelector
:
@selector
(
pushViewController
:
selfController
:
)])
{
[
self
.
delegate
pushViewController
:
cvc
selfController
:
_avc
];
}
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
...
...
@@ -105,10 +93,10 @@
return
self
.
productArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"ProductCell"
;
ProductCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
static
NSString
*
cellID
=
@"Product
Bill
Cell"
;
Product
Bill
Cell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
cell
==
nil
)
{
cell
=
[[
ProductCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
cell
=
[[
Product
Bill
Cell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
if
(
self
.
isHiddenEdit
)
{
cell
.
editBtn
.
hidden
=
YES
;
...
...
@@ -117,10 +105,10 @@
if
([
self
isHaveIndexPath
:
indexPath
])
{
cell
.
smallImageView
.
image
=
[
UIImage
imageNamed
:
@"arrowdown"
];
CGRect
Linefrmame
=
cell
.
lineLabel
.
frame
;
Linefrmame
.
origin
.
y
=
200
-
1
;
Linefrmame
.
origin
.
y
=
ShowHeight
+
TableHeight
-
1
;
cell
.
lineLabel
.
frame
=
Linefrmame
;
CGRect
showfrmame
=
cell
.
showView
.
frame
;
showfrmame
.
size
.
height
=
150
;
showfrmame
.
size
.
height
=
ShowHeight
;
cell
.
showView
.
frame
=
showfrmame
;
cell
.
backgroundColor
=
XXFBgColor
;
}
else
{
...
...
@@ -135,6 +123,13 @@
}
cell
.
editBtn
.
tag
=
indexPath
.
row
;
[
cell
.
editBtn
addTarget
:
self
action
:
@selector
(
editClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
if
(
self
.
productArr
.
count
>
0
)
{
PurchaseBillProduct
*
billP
=
self
.
productArr
[
indexPath
.
row
];
[
cell
setBillProduct
:
billP
row
:
indexPath
.
row
];
}
return
cell
;
}
-
(
BOOL
)
isHaveIndexPath
:
(
NSIndexPath
*
)
indexPath
{
...
...
@@ -147,14 +142,14 @@
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
Product
Cell
*
cell
=
(
Product
Cell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
Product
BillCell
*
cell
=
(
ProductBill
Cell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
CGRect
Linefrmame
=
cell
.
lineLabel
.
frame
;
CGRect
showfrmame
=
cell
.
showView
.
frame
;
if
(
Linefrmame
.
origin
.
y
==
TableHeight
-
1
)
{
cell
.
smallImageView
.
image
=
[
UIImage
imageNamed
:
@"arrowdown"
];
Linefrmame
.
origin
.
y
=
200
-
1
;
showfrmame
.
size
.
height
=
150
;
Linefrmame
.
origin
.
y
=
ShowHeight
+
TableHeight
-
1
;
showfrmame
.
size
.
height
=
ShowHeight
;
cell
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_selectRowArr
addObject
:
indexPath
];
}
else
{
...
...
@@ -170,7 +165,7 @@
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
([
self
isHaveIndexPath
:
indexPath
])
{
return
200
;
return
ShowHeight
+
TableHeight
;
}
return
TableHeight
;
}
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.m
View file @
0c02d72c
...
...
@@ -7,8 +7,8 @@
//
#import "PurchaseDetailViewController.h"
#import "ProductViewController.h"
#import "Product
Bill
ViewController.h"
#import "PurchaseBillProduct.h"
#define BottomHeight 50
#define LeftMargin 15
#define LeftWidth 100
...
...
@@ -17,6 +17,7 @@
typedef
enum
:
NSUInteger
{
CancleTag
=
3500
,
EndTag
,
RejectTag
,
PassTag
,
SureTag
...
...
@@ -28,7 +29,7 @@ typedef enum : NSUInteger {
UIScrollView
*
_scrollView
;
UIView
*
_purchaseView
;
UIView
*
_bottomView
;
ProductViewController
*
_pvc
;
Product
Bill
ViewController
*
_pvc
;
NSArray
*
_leftArr
;
UIButton
*
_endBtn
;
UIButton
*
_rejectBtn
;
...
...
@@ -57,10 +58,37 @@ typedef enum : NSUInteger {
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
[
self
bulidLayout
];
[
self
getDataFromServer
];
}
-
(
void
)
getDataFromServer
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
NSDictionary
*
dictData
=
data
[
@"data"
];
PurchaseBill
*
bill
=
[[
PurchaseBill
alloc
]
init
];
[
bill
setValuesForKeysWithDictionary
:
dictData
];
self
.
bill
=
bill
;
[
strongSelf
fetchtPurchaseDetail
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@" 无记录 "
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getPurchaseResultWithPurchaseUuid
:
@"5a7417014f926eb5014f93b18fbc000f"
success
:
succ
failure
:
fail
];
}
#pragma mark - 视图初始化
...
...
@@ -80,31 +108,69 @@ typedef enum : NSUInteger {
scrollViewFrame
.
size
.
height
=
ScreenSize
.
height
-
64
;
_scrollView
.
frame
=
scrollViewFrame
;
}
[
self
fetchtPurchaseDetail
];
}
-
(
void
)
createBtn
{
_rejectBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
RejectTag
image
:
nil
title
:
@""
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
5
bgColor
:
GXF_SAVE_COLOR
];
[
self
.
view
addSubview
:
_rejectBtn
];
_endBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
ScreenSize
.
width
-
LeftMargin
*
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
0
image
:
nil
title
:
@"作废"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
5
bgColor
:
GXF_COMMIT_COLOR
];
_endBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
_rejectBtn
.
frame
)
+
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
0
image
:
nil
title
:
@""
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
5
bgColor
:
GXF_COMMIT_COLOR
];
[
self
.
view
addSubview
:
_endBtn
];
if
(
self
.
indexPerson
==
0
)
{
_endBtn
.
tag
=
CancleTag
;
[
_endBtn
setTitle
:
@"作废"
forState
:
UIControlStateNormal
];
_rejectBtn
.
hidden
=
NO
;
_rejectBtn
.
tag
=
CancleTag
;
[
_rejectBtn
setTitle
:
@"作废"
forState
:
UIControlStateNormal
];
_endBtn
.
tag
=
EndTag
;
[
_endBtn
setTitle
:
@"结束"
forState
:
UIControlStateNormal
];
}
else
if
(
self
.
indexPerson
==
1
){
_rejectBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
RejectTag
image
:
nil
title
:
@"拒绝"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
5
bgColor
:
GXF_SAVE_COLOR
];
[
self
.
view
addSubview
:
_rejectBtn
];
_rejectBtn
.
hidden
=
NO
;
_rejectBtn
.
tag
=
RejectTag
;
[
_rejectBtn
setTitle
:
@"拒绝"
forState
:
UIControlStateNormal
];
_endBtn
.
frame
=
CGRectMake
(
CGRectGetMaxX
(
_rejectBtn
.
frame
)
+
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
40
);
[
_endBtn
setTitle
:
@"审核通过"
forState
:
UIControlStateNormal
];
_endBtn
.
tag
=
PassTag
;
}
else
{
_rejectBtn
.
hidden
=
YES
;
_endBtn
.
frame
=
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
ScreenSize
.
width
-
LeftMargin
*
2
,
40
);
_endBtn
.
tag
=
SureTag
;
[
_endBtn
setTitle
:
@"确认"
forState
:
UIControlStateNormal
];
}
}
-
(
void
)
btnClick
:
(
UIButton
*
)
btn
{
NSLog
(
@"%ld"
,(
long
)
btn
.
tag
);
switch
(
btn
.
tag
)
{
case
CancleTag
:
{
NSLog
(
@"作废"
);
}
break
;
case
EndTag
:
{
NSLog
(
@"结束"
);
}
break
;
case
RejectTag
:
{
NSLog
(
@"拒绝"
);
}
break
;
case
PassTag
:
{
NSLog
(
@"审核通过"
);
}
break
;
case
SureTag
:
{
NSLog
(
@"确定"
);
}
break
;
default
:
break
;
}
}
-
(
void
)
createBottomView
{
...
...
@@ -112,7 +178,7 @@ typedef enum : NSUInteger {
_bottomView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_bottomView
];
_pvc
=
[[
ProductViewController
alloc
]
init
];
_pvc
=
[[
Product
Bill
ViewController
alloc
]
init
];
[
self
addChildViewController
:
_pvc
];
_pvc
.
viewFrame
=
_bottomView
.
bounds
;
...
...
@@ -212,18 +278,26 @@ typedef enum : NSUInteger {
self
.
stateLabel
.
textColor
=
[
UIColor
blackColor
];
self
.
stateLabel
.
text
=
@"已完成"
;
}
self
.
noticeNumberLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
noticeNumber
]
;
self
.
noticeNumberLabel
.
text
=
(
self
.
bill
.
noticeNumber
.
length
==
0
)
?
@"无"
:(
self
.
bill
.
noticeNumber
)
;
self
.
createOperNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
create_operName
];
self
.
checkNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
vendor_name
];
self
.
vendorNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
vendor_name
];
self
.
totalPriceLabel
.
text
=
[
IBTCommon
checkString
:[
self
.
bill
.
total
stringValue
]];
self
.
noteLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
remark
];
self
.
lastModifyNameLabel
.
text
=
@"最后修改人"
;
self
.
typeLabel
.
text
=
@"类型"
;
self
.
vendorIsSureLabel
.
text
=
@"是否确认"
;
self
.
warehouseLabel
.
text
=
@"仓库"
;
self
.
otherPriceLabel
.
text
=
@"其他费用"
;
self
.
lastModifyNameLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
lastModify_operName
];
NSString
*
type
=
[
self
.
bill
.
type
isEqualToString
:
GXF_Critical
]
?
@"紧急"
:
@"普通"
;
self
.
typeLabel
.
text
=
type
;
self
.
vendorIsSureLabel
.
text
=
self
.
bill
.
vendorConfirmTime
.
length
>
0
?
@"是"
:
@"否"
;
self
.
warehouseLabel
.
text
=
[
IBTCommon
checkString
:
self
.
bill
.
receiveWrh_name
];
self
.
otherPriceLabel
.
text
=
[
self
.
bill
.
charge
stringValue
];
NSMutableArray
*
productArr
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
billDict
in
self
.
bill
.
products
)
{
PurchaseBillProduct
*
billProbuct
=
[
PurchaseBillProduct
new
];
[
billProbuct
setValuesForKeysWithDictionary
:
billDict
];
[
productArr
addObject
:
billProbuct
];
}
_pvc
.
productArr
=
productArr
;
[
_pvc
.
tableView
reloadData
];
[
self
setNoteHeight
];
}
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.m
View file @
0c02d72c
...
...
@@ -10,9 +10,10 @@
#import "PurchaseCell.h"
#import "PurchaseBill.h"
#import "PurchaseDetailViewController.h"
#import "QueryOrder.h"
#import "SortMaskView.h"
#import "PurchaseBoltView.h"
#import "MJRefresh.h"
#define TopMargin 44
#define TableHeight 120
...
...
@@ -35,11 +36,14 @@ typedef enum : NSUInteger {
UIBarButtonItem
*
_sureBtn
;
UIButton
*
_sortBtn
;
UIButton
*
_boltBtn
;
BOOL
_isRefresh
;
BOOL
_isLoadMore
;
NSInteger
_currentPage
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSString
*
noticeLike
;
@property
(
nonatomic
,
strong
)
NSString
*
state
;
//未提交=initial已提交=submitted调研中=insurvey已完成=finished
@property
(
nonatomic
,
strong
)
NSString
*
state
;
@property
(
nonatomic
,
strong
)
NSString
*
billLike
;
@property
(
nonatomic
,
strong
)
NSString
*
orderDirection
;
//asc(升序),desc(降序)
@end
...
...
@@ -51,6 +55,9 @@ typedef enum : NSUInteger {
self
.
view
.
backgroundColor
=
XXFBgColor
;
[
self
initData
];
[
self
createTableView
];
[
self
createRefresh
];
[
self
getData
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
...
...
@@ -63,7 +70,7 @@ typedef enum : NSUInteger {
bill
.
vendor_name
=
@"供应商"
;
bill
.
total
=
[
NSNumber
numberWithFloat
:
22
];
bill
.
remark
=
@"备注"
;
bill
.
lastModif
ied
_operName
=
@"最后修改人"
;
bill
.
lastModif
y
_operName
=
@"最后修改人"
;
bill
.
vendorConfirmTime
=
@"否"
;
if
(
i
==
0
)
{
bill
.
state
=
@"initial"
;
...
...
@@ -80,12 +87,145 @@ typedef enum : NSUInteger {
}
[
self
.
dataArr
addObject
:
bill
];
}
}
-
(
void
)
getData
{
[
ICRUserUtil
sharedInstance
].
needFresh
=
NO
;
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchtPuchaseList
:
data
];
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
ICRUserUtil
*
userUtil
=
[
ICRUserUtil
sharedInstance
];
NSMutableArray
*
orderArr
=
[
NSMutableArray
array
];
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
])
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"lastModified"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
id
billObject
=
[
NSNull
null
];
if
(
self
.
billLike
.
length
>
0
)
{
billObject
=
self
.
billLike
;
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
])
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"billNumber"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
id
stateObject
=
[
NSNull
null
];
if
(
self
.
state
.
length
>
0
&&
!
[
self
.
state
isEqualToString
:
@"none"
])
{
stateObject
=
self
.
state
;
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
])
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"state"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
id
noticeObject
=
[
NSNull
null
];
if
(
self
.
noticeLike
.
length
>
0
)
{
noticeObject
=
self
.
noticeLike
;
if
(
self
.
orderDirection
.
length
>
0
&&
!
[
self
.
orderDirection
isEqualToString
:
@"none"
])
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"noticeNumber"
;
order
.
direction
=
self
.
orderDirection
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
}
if
(
orderArr
.
count
==
0
)
{
QueryOrder
*
order
=
[
QueryOrder
new
];
order
.
field
=
@"billNumber"
;
order
.
direction
=
@"desc"
;
[
orderArr
addObject
:[
order
dictForCommit
]];
}
NSDictionary
*
dict
=
@{
@"billNumberLike"
:
billObject
,
@"state"
:
stateObject
,
@"noticeNumberLike"
:
noticeObject
,
@"titleLike"
:
[
NSNull
null
],
@"vendorUuid"
:
[
NSNull
null
],
@"queryOrders"
:
orderArr
,
@"userUuid"
:
userUtil
.
userId
,
@"pageNumber"
:
@
(
_currentPage
),
@"pageSize"
:
@
(
20
)};
[[
ICRHTTPController
sharedController
]
queryPurchaseWithData
:
dict
success
:
succ
failure
:
fail
];
}
-
(
void
)
fetchtPuchaseList
:
(
id
)
data
{
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
if
(
_currentPage
==
0
)
{
// if (self.dataArr.count > 0) {
// [self.dataArr removeAllObjects];
// }
}
NSArray
*
recodesArr
=
data
[
@"data"
][
@"records"
];
for
(
NSDictionary
*
purchaseBillDict
in
recodesArr
)
{
PurchaseBill
*
purchaseBill
=
[[
PurchaseBill
alloc
]
init
];
[
purchaseBill
setValuesForKeysWithDictionary
:
purchaseBillDict
];
[
self
.
dataArr
addObject
:
purchaseBill
];
}
NSDictionary
*
pageDict
=
data
[
@"data"
][
@"paging"
];
NSInteger
pageCount
=
[
pageDict
[
@"pageCount"
]
integerValue
];
[
self
.
tableView
reloadData
];
[
self
endRefreshing
];
if
(
pageCount
<=
_currentPage
)
{
[
self
.
tableView
.
footer
noticeNoMoreData
];
}
if
(
_currentPage
==
0
&&
self
.
dataArr
.
count
>
0
)
{
[
self
.
tableView
scrollToRowAtIndexPath
:[
NSIndexPath
indexPathForRow
:
0
inSection
:
0
]
atScrollPosition
:
UITableViewScrollPositionTop
animated
:
YES
];
}
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@" 无记录 "
];
}
}
-
(
void
)
createRefresh
{
self
.
tableView
.
header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
if
(
_isRefresh
)
{
return
;
}
_isRefresh
=
YES
;
_currentPage
=
0
;
[
self
getData
];
}];
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
PurchaseUpdateDate
;
self
.
tableView
.
footer
=
[
MJRefreshAutoNormalFooter
footerWithRefreshingBlock
:
^
{
if
(
_isLoadMore
)
{
return
;
}
_isLoadMore
=
YES
;
_currentPage
++
;
[
self
getData
];
}
];
}
#pragma mark - 结束刷新
-
(
void
)
endRefreshing
{
_isLoadMore
=
NO
;
_isRefresh
=
NO
;
[
self
.
tableView
.
header
endRefreshing
];
[
self
.
tableView
.
footer
endRefreshing
];
}
-
(
void
)
createTableView
{
_sureBtn
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
_sortBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
10
,
BtnWidth
,
BtnHeight
)
target
:
self
sel
:
@selector
(
sortClick
:
)
tag
:
SortTag
image
:
@"black_arrow_down_with_text"
title
:
nil
titleColor
:
GXF_DETAIL_COLOR
isCorner
:
NO
corner
:
0
bgColor
:
nil
];
_sortBtn
.
titleLabel
.
font
=
FontSize
(
BtnSize
);
[
self
.
view
addSubview
:
_sortBtn
];
...
...
@@ -118,7 +258,6 @@ typedef enum : NSUInteger {
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenSortMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
if
(
_sortView
==
nil
)
{
...
...
@@ -132,7 +271,6 @@ typedef enum : NSUInteger {
_sortView
.
frame
=
sortFrame
;
}];
}
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
currentBtn
=
btn
;
}
}
else
if
(
btn
.
tag
==
BoltTag
){
...
...
@@ -143,7 +281,6 @@ typedef enum : NSUInteger {
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenBoltMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
...
...
@@ -161,7 +298,6 @@ typedef enum : NSUInteger {
_boltView
.
frame
=
sortFrame
;
}];
currentBtn
=
btn
;
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
}
}
}
...
...
@@ -225,6 +361,23 @@ typedef enum : NSUInteger {
}
#pragma mark - 确定
-
(
void
)
sureClick
{
if
(
self
.
state
.
length
>
0
||
self
.
billLike
.
length
>
0
||
self
.
noticeLike
.
length
>
0
||
self
.
orderDirection
.
length
>
0
)
{
[
_boltView
.
noticeFiled
resignFirstResponder
];
[
_boltView
.
billFiled
resignFirstResponder
];
_currentPage
=
0
;
//请求
[
self
getData
];
//还原数据
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
YES
];
}
if
(
_boltView
)
{
[
self
hiddenBoltMaskView
:
YES
];
}
}
}
#pragma mark - sortDelegate
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
View file @
0c02d72c
...
...
@@ -17,17 +17,23 @@
@property
(
nonatomic
,
strong
)
NSString
*
vendor_uuid
;
//供应商uuid
@property
(
nonatomic
,
strong
)
NSString
*
vendor_code
;
//供应商代码
@property
(
nonatomic
,
strong
)
NSString
*
vendor_name
;
//供应商姓名
@property
(
nonatomic
,
strong
)
NSString
*
receiveWrh_uuid
;
//收货uuid
@property
(
nonatomic
,
strong
)
NSString
*
receiveWrh_code
;
//收货代码
@property
(
nonatomic
,
strong
)
NSString
*
receiveWrh_name
;
//收货姓名
@property
(
nonatomic
,
strong
)
NSString
*
rejectCause
;
//拒绝原因
@property
(
nonatomic
,
strong
)
NSNumber
*
total
;
//总金额
@property
(
nonatomic
,
strong
)
NSNumber
*
charge
;
//费用
@property
(
nonatomic
,
strong
)
NSString
*
endDate
;
//调研结束时间
@property
(
nonatomic
,
strong
)
NSString
*
remark
;
//备注
@property
(
nonatomic
,
strong
)
NSString
*
state
;
// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
@property
(
nonatomic
,
strong
)
NSString
*
vendorConfirmTime
;
//供应商确认时间
@property
(
nonatomic
,
strong
)
NSString
*
create_time
;
//创建时间
@property
(
nonatomic
,
strong
)
NSString
*
create_id
;
//创建人代码
@property
(
nonatomic
,
strong
)
NSString
*
create_operName
;
//创建人名称
@property
(
nonatomic
,
strong
)
NSString
*
lastModified_time
;
//最后修改时间
@property
(
nonatomic
,
strong
)
NSString
*
lastModified_id
;
//最后修改人代码
@property
(
nonatomic
,
strong
)
NSString
*
lastModified_operName
;
//最后修改人名称
@property
(
nonatomic
,
strong
)
NSString
*
lastModify_time
;
//最后修改时间
@property
(
nonatomic
,
strong
)
NSString
*
lastModify_id
;
//最后修改人代码
@property
(
nonatomic
,
strong
)
NSString
*
lastModify_operName
;
//最后修改人名称
@property
(
nonatomic
,
strong
)
NSString
*
type
;
//类型
@property
(
nonatomic
,
strong
)
NSArray
*
products
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Views/ProductCell.h
→
XFFruit/ViewControllers/Purchase/Views/Product
Bill
Cell.h
View file @
0c02d72c
...
...
@@ -7,26 +7,25 @@
//
#import <UIKit/UIKit.h>
@interface
ProductCell
:
UITableViewCell
#import "PurchaseBillProduct.h"
@interface
Product
Bill
Cell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
UIImageView
*
smallImageView
;
@property
(
nonatomic
,
strong
)
UIButton
*
editBtn
;
@property
(
nonatomic
,
strong
)
UILabel
*
seqLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
titleLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
priceLabel
;
//@property (nonatomic,strong)UILabel *standardLabel;
@property
(
nonatomic
,
strong
)
UILabel
*
countLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
lineLabel
;
@property
(
nonatomic
,
strong
)
UIView
*
showView
;
@property
(
nonatomic
,
strong
)
UILabel
*
show
Title
Label
;
@property
(
nonatomic
,
strong
)
UILabel
*
showStandLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
show
Count
Label
;
@property
(
nonatomic
,
strong
)
UILabel
*
showBaseCountLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
showDateLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
basePriceLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
totalPriceLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
placeLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
qualityLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
remarkLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
showPriceLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
showBasePriceLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
showTotalLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
showNoteLabel
;
-
(
void
)
setBillProduct
:(
PurchaseBillProduct
*
)
billProduct
row
:(
NSInteger
)
row
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Views/ProductCell.m
→
XFFruit/ViewControllers/Purchase/Views/Product
Bill
Cell.m
View file @
0c02d72c
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
View file @
0c02d72c
...
...
@@ -34,6 +34,9 @@
@property
(
nonatomic
,
strong
)
NSString
*
receiveWrh_uuid
;
@property
(
nonatomic
,
strong
)
NSString
*
receiveWrh_code
;
@property
(
nonatomic
,
strong
)
NSString
*
receiveWrh_name
;
@property
(
nonatomic
,
strong
)
NSNumber
*
total
;
@property
(
nonatomic
,
strong
)
NSNumber
*
chargePurchase
;
@property
(
nonatomic
,
strong
)
NSString
*
remark
;
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
View file @
0c02d72c
...
...
@@ -14,12 +14,10 @@
#import "ChooseWarehouseViewController.h"
#import "Vendor.h"
#define LeftMargin 15
#define TopMargin 20
#define LeftWidth 80
#define TableHeight 44
#define SpaceHeight 10
#define T
itleSize 15
#define T
opMargin 10
#define TableHeight 44
@interface
TopPurchaseView
()
<
UITableViewDataSource
,
UITableViewDelegate
,
HPGrowingTextViewDelegate
,
UITextFieldDelegate
>
{
UITableView
*
_tableView
;
...
...
@@ -87,10 +85,11 @@
[
cell
.
contentView
addSubview
:
textField
];
self
.
otherPriceFiled
=
textField
;
self
.
otherPriceFiled
.
placeholder
=
@"请输入其他费用"
;
[
self
.
otherPriceFiled
addTarget
:
self
action
:
@selector
(
boxValueChanged
:
)
forControlEvents
:
UIControlEventEditingChanged
];
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
textField
.
frame
)
+
5
,
0
,
20
,
TableHeight
)];
label
.
text
=
@"元"
;
label
.
textColor
=
GXF_CONTENT_COLOR
;
label
.
font
=
FontSize
(
TitleSize
)
;
label
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
cell
.
contentView
addSubview
:
label
];
}
else
if
(
indexPath
.
row
==
_dataArr
.
count
-
1
){
...
...
@@ -108,7 +107,7 @@
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
TableHeight
))];
contentLabel
.
textAlignment
=
NSTextAlignmentRight
;
contentLabel
.
textColor
=
GXF_PLACEHOLDER_COLOR
;
contentLabel
.
font
=
FontSize
(
TitleSize
)
;
contentLabel
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
cell
.
contentView
addSubview
:
contentLabel
];
if
(
indexPath
.
row
==
0
)
{
contentLabel
.
text
=
@"采购通知单号"
;
...
...
@@ -133,16 +132,23 @@
UILabel
*
label
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
contentLabel
.
frame
)
+
5
,
0
,
20
,
TableHeight
)];
label
.
text
=
@"元"
;
label
.
textColor
=
GXF_CONTENT_COLOR
;
label
.
font
=
FontSize
(
TitleSize
)
;
label
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
cell
.
contentView
addSubview
:
label
];
}
}
[
self
prepareDataInCell
];
}
-
(
void
)
prepareDataInCell
{
if
(
self
.
total
)
{
self
.
purchasePriceLabel
.
text
=
[
self
.
total
stringValue
];
}
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
2
){
ChooseVendorViewController
*
cvc
=
[
ChooseVendorViewController
new
];
cvc
.
title
=
@"供应商"
;
cvc
.
choseVendor
=
^
(
NSArray
*
vendors
){
if
(
vendors
.
count
>
0
)
{
Vendor
*
vendor
=
vendors
[
0
];
...
...
@@ -158,17 +164,18 @@
[
self
.
delegate
pushNextViewController
:
cvc
];
}
else
if
(
indexPath
.
row
==
1
){
ChooseTypeViewController
*
tvc
=
[[
ChooseTypeViewController
alloc
]
init
];
tvc
.
title
=
@"类型"
;
tvc
.
dataArr
=
@[
@"普通"
,
@"紧急"
];
tvc
.
choseType
=
^
(
NSString
*
type
){
self
.
purchaseTypeLabel
.
text
=
type
;
self
.
purchaseTypeLabel
.
textColor
=
GXF_CONTENT_COLOR
;
self
.
type
=
type
;
if
([
type
isEqualToString
:
@"紧急"
])
{
self
.
type
=
GXF_Critical
;
}
else
{
self
.
type
=
GXF_Normal
;
}
};
[
self
.
delegate
pushNextViewController
:
tvc
];
}
else
if
(
indexPath
.
row
==
3
){
ChooseWarehouseViewController
*
wvc
=
[[
ChooseWarehouseViewController
alloc
]
init
];
wvc
.
title
=
@"仓库"
;
wvc
.
choseWarehouse
=
^
(
Warehouse
*
warehouse
){
self
.
purchaseStoreLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
warehouse
.
name
,
warehouse
.
code
];
self
.
purchaseStoreLabel
.
textColor
=
GXF_CONTENT_COLOR
;
...
...
@@ -190,14 +197,12 @@
-
(
void
)
touchesEnded
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
[
self
.
delegate
hiddenKeyBoard
];
}
-
(
void
)
textFieldDidEndEditing
:
(
UITextField
*
)
textField
{
if
(
textField
==
self
.
otherPriceFiled
)
{
if
(
self
.
otherPriceFiled
.
text
.
length
>
0
)
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
SetProductTotalPrice
object
:
nil
];
}
-
(
void
)
boxValueChanged
:
(
UITextField
*
)
textFiled
{
if
(
self
.
otherPriceFiled
.
text
.
length
>
0
)
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
SetProductTotalPrice
object
:
nil
];
}
}
@end
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/controllers/ChooseProductViewController.m
View file @
0c02d72c
...
...
@@ -7,7 +7,8 @@
//
#import "ChooseProductViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseProductViewController
()
{
NSIndexPath
*
_currentIndexPath
;
...
...
@@ -22,7 +23,7 @@
self
.
title
=
@"选择商品"
;
[
self
fetchProductList
:
@""
];
}
-
(
void
)
getBaseDataFrom
Local
{
-
(
void
)
getBaseDataFrom
Server
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
...
...
@@ -55,7 +56,7 @@
if
(
!
[
GXF_NSUSERFEFTAULTS
objectForKey
:
ChooseProductUpdateDate
])
{
[
GXF_NSUSERFEFTAULTS
setObject
:[
NSDate
date
]
forKey
:
ChooseProductUpdateDate
];
[
GXF_NSUSERFEFTAULTS
synchronize
];
[
self
getBaseDataFrom
Local
];
[
self
getBaseDataFrom
Server
];
}
else
{
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObject
:
self
.
tableView
.
header
.
lastUpdatedTime
];
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/controllers/ChosePersonViewController.m
View file @
0c02d72c
...
...
@@ -9,7 +9,8 @@
#import "ChosePersonViewController.h"
#import "SurveyUser.h"
#import "User.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChosePersonViewController
(){
NSIndexPath
*
_currentIndexPath
;
}
...
...
@@ -25,7 +26,7 @@
[
self
fetchUserList
:
@""
];
}
-
(
void
)
getBaseDataFrom
Local
{
-
(
void
)
getBaseDataFrom
Server
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
...
...
@@ -59,7 +60,7 @@
if
(
!
[
GXF_NSUSERFEFTAULTS
objectForKey
:
ChoosePersonUpdateDate
])
{
[
GXF_NSUSERFEFTAULTS
setObject
:[
NSDate
date
]
forKey
:
ChoosePersonUpdateDate
];
[
GXF_NSUSERFEFTAULTS
synchronize
];
[
self
getBaseDataFrom
Local
];
[
self
getBaseDataFrom
Server
];
}
else
{
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObject
:
self
.
tableView
.
header
.
lastUpdatedTime
];
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
View file @
0c02d72c
...
...
@@ -211,7 +211,7 @@ typedef enum : NSUInteger {
uuidObject
=
uuidS
;
billNumberObject
=
billNumberS
;
versionObject
=
versionN
;
[
IBTLoadingView
showTips
:[
NSString
stringWithFormat
:
@"当前单据%@
以
保存成功"
,
billNumberS
]];
[
IBTLoadingView
showTips
:[
NSString
stringWithFormat
:
@"当前单据%@
已
保存成功"
,
billNumberS
]];
}
else
{
//提交成功
SurveyViewController
*
svc
=
[
SurveyViewController
new
];
[
self
PushViewController
:
svc
animated
:
YES
];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment