Commit 739d52c3 authored by 陈俊俊's avatar 陈俊俊

采购单

parent 0c02d72c
......@@ -363,7 +363,6 @@
C1FE50531AE024FA00C18080 /* UIAlertView+Blocks.m in Sources */ = {isa = PBXBuildFile; fileRef = C1FE504D1AE024FA00C18080 /* UIAlertView+Blocks.m */; };
C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = C1FE50551AE3587F00C18080 /* ICRAttachmentUnit.m */; };
C1FE50571AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = C1FE50551AE3587F00C18080 /* ICRAttachmentUnit.m */; };
FE0C652C1B8EAB3400580183 /* AddProductViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE0C652B1B8EAB3400580183 /* AddProductViewController.m */; };
FE0C9B091B7C543D00335B39 /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = FE0C9B081B7C543D00335B39 /* User.m */; };
FE17F6791B85847D0078CE96 /* QueryOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = FE17F6781B85847D0078CE96 /* QueryOrder.m */; };
FE17F6831B85CA5B0078CE96 /* NewPurchaseNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE17F67C1B85CA5B0078CE96 /* NewPurchaseNoticeViewController.m */; };
......@@ -812,8 +811,6 @@
C1FE504D1AE024FA00C18080 /* UIAlertView+Blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertView+Blocks.m"; sourceTree = "<group>"; };
C1FE50541AE3587F00C18080 /* ICRAttachmentUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRAttachmentUnit.h; sourceTree = "<group>"; };
C1FE50551AE3587F00C18080 /* ICRAttachmentUnit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ICRAttachmentUnit.m; sourceTree = "<group>"; };
FE0C652A1B8EAB3400580183 /* AddProductViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddProductViewController.h; sourceTree = "<group>"; };
FE0C652B1B8EAB3400580183 /* AddProductViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddProductViewController.m; sourceTree = "<group>"; };
FE0C9B071B7C543D00335B39 /* User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = User.h; path = ../Views/User.h; sourceTree = "<group>"; };
FE0C9B081B7C543D00335B39 /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = User.m; path = ../Views/User.m; sourceTree = "<group>"; };
FE17F6771B85847D0078CE96 /* QueryOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QueryOrder.h; sourceTree = "<group>"; };
......@@ -1069,8 +1066,6 @@
FE4678A91B8D60F900B5EDA3 /* ChooseTypeViewController.m */,
FE4678AB1B8D636300B5EDA3 /* ChooseWarehouseViewController.h */,
FE4678AC1B8D636300B5EDA3 /* ChooseWarehouseViewController.m */,
FE0C652A1B8EAB3400580183 /* AddProductViewController.h */,
FE0C652B1B8EAB3400580183 /* AddProductViewController.m */,
);
path = Controllers;
sourceTree = "<group>";
......@@ -2208,7 +2203,6 @@
C15295CE1B24741400DF60D1 /* ASValuePopUpView.m in Sources */,
C159184D1AC062460013B391 /* IBTTableView.m in Sources */,
30D1859C1ADBB91000327997 /* ICRAnnouncement.m in Sources */,
FE0C652C1B8EAB3400580183 /* AddProductViewController.m in Sources */,
C142D2AE1AC3A155000109A7 /* NSString+TrimmingAdditions.m in Sources */,
C15918471AC062460013B391 /* IBTCommon.m in Sources */,
C1FE502D1ADD887400C18080 /* LBorderView.m in Sources */,
......
......@@ -135,6 +135,19 @@
#define PURCHASE_STATE_SHIPPING @"shipping"
#define PURCHASE_STATE_FINISHED @"finished"
//采购单操作
#define PURCHASE_ACTION_REJECT @"reject"
#define PURCHASE_ACTION_APPROVE @"approve"
#define PURCHASE_ACTION_VENDORCONFIRM @"vendorConfirm"
#define PURCHASE_ACTION_FINISH @"finish"
#define PURCHASE_ACTION_ABORT @"abort"
//权限列表vendorapprove
#define PURCHASE_PERMISSIONS_MANAGEAPPROVE @"500405"
#define PURCHASE_PERMISSIONS_VENDORAPPROVE @"500406"
#define PURCHASE_PERMISSIONS_FINISH @"500407"
#define PURCHASE_PERMISSIONS_ABORT @"500408"
#define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]
......
//
// AddProductViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "HPGrowingTextView.h"
@protocol AddProductViewDelegate <NSObject>
- (void)dissmiss;
- (void)pushViewController:(id)cvc;
@end
@interface AddProductViewController : ICRBaseViewController
@property (nonatomic,assign)CGRect viewFrame;
@property (nonatomic,strong)UILabel *productNameLabel;//商品
@property (nonatomic,strong)UILabel *productTypeLabel;//单位
@property (nonatomic,strong)UITextField *productStandFiled;//规格
@property (nonatomic,strong)UITextField *productCountFiled;//包装数量
@property (nonatomic,strong)UITextField *baseCountFiled;//基础数量
@property (nonatomic,strong)UITextField *basePriceFiled;//基础单价
@property (nonatomic,strong)UITextField *productPriceFiled;//包装单价
@property (nonatomic,strong)UITextField *totalPriceFiled;//总价格
@property (nonatomic,strong)HPGrowingTextView *remarkTextView;//备注
@property (nonatomic,weak)id<AddProductViewDelegate>delegate;
@end
......@@ -9,7 +9,6 @@
#import "NewPurchaseViewController.h"
#import "TopPurchaseView.h"
#import "ProductBillViewController.h"
#import "AddProductViewController.h"
#import "PurchaseBillProduct.h"
#import "PurchaseViewController.h"
#define TopHeight 328
......@@ -54,8 +53,50 @@ typedef enum : NSUInteger {
uuidObject = [NSNull null];
billNumberObject = [NSNull null];
versionObject = [NSNumber numberWithInteger:0];
if (self.purchaseBill) {
[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.purchaseBill = bill;
[strongSelf prepareDataInCell];
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@" 无记录 "];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getPurchaseResultWithPurchaseUuid:@"5a7417014f926eb5014f9ce2988a004d" success:succ failure:fail];
}
//赋值
- (void)prepareDataInCell{
_purchaseView.bill = self.purchaseBill;
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *productDict in self.purchaseBill.products) {
PurchaseBillProduct *billProduct = [[PurchaseBillProduct alloc]init];
[billProduct setValuesForKeysWithDictionary:productDict];
[arr addObject:billProduct];
}
_pvc.productArr = arr;
[_pvc.tableView reloadData];
}
#pragma mark - 布局
- (void)bulidLayout
......
......@@ -35,22 +35,22 @@
if (!self.productArr) {
self.productArr = [NSMutableArray array];
}
// 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];
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:40];
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];
}
......
......@@ -11,7 +11,8 @@
@interface PurchaseDetailViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill;
//模拟三个人员
@property (nonatomic,assign)NSInteger indexPerson;//0.1.2
//显示样式
@property (nonatomic,assign)NSInteger indexStyle;//0.1.2
@end
......@@ -7,6 +7,7 @@
//
#import "PurchaseViewController.h"
#import "NewPurchaseViewController.h"
#import "PurchaseCell.h"
#import "PurchaseBill.h"
#import "PurchaseDetailViewController.h"
......@@ -54,6 +55,7 @@ typedef enum : NSUInteger {
[super viewDidLoad];
self.view.backgroundColor = XXFBgColor;
[self initData];
[self createBackBtn];
[self createTableView];
[self createRefresh];
[self getData];
......@@ -63,15 +65,17 @@ typedef enum : NSUInteger {
self.dataArr = [NSMutableArray array];
for (NSInteger i = 0; i < 6; i++) {
PurchaseBill *bill = [PurchaseBill new];
bill.billNumber = @"222222222";
bill.billNumber = @"150903000013";
bill.noticeNumber = @"134594059654";
bill.create_operName = @"创建人";
bill.create_time = @"2013-03-04";
bill.vendor_name = @"供应商";
bill.total = [NSNumber numberWithFloat:22];
bill.charge = [NSNumber numberWithFloat:333];
bill.remark = @"备注";
bill.lastModify_operName = @"最后修改人";
bill.vendorConfirmTime = @"否";
if (i == 0) {
bill.state = @"initial";
}else if(i == 1){
......@@ -436,25 +440,43 @@ typedef enum : NSUInteger {
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
PurchaseDetailViewController *pvc = [PurchaseDetailViewController new];
pvc.title = @"查看采购单";
pvc.bill = _dataArr[indexPath.row];
if(indexPath.row == 0){
pvc.indexPerson = 0;
}else if(indexPath.row == 1){
pvc.indexPerson = 1;
}else if(indexPath.row == 2){
pvc.indexPerson = 2;
if (_dataArr.count > 0) {
PurchaseBill *bill = _dataArr[indexPath.row];
if ([bill.state isEqualToString:PURCHASE_STATE_INITIAL] || [bill.state isEqualToString:PURCHASE_STATE_REJECTED]) {
NewPurchaseViewController *nvc = [NewPurchaseViewController new];
nvc.purchaseBill = bill;
[self PushViewController:nvc animated:YES];
}else{
PurchaseDetailViewController *pvc = [PurchaseDetailViewController new];
pvc.title = @"查看采购单";
pvc.bill = bill;
[self PushViewController:pvc animated:YES];
}
}
[self PushViewController:pvc animated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)createBackBtn{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 0, 12, 20);
[btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithCustomView:btn];
self.navigationItem.leftBarButtonItem = back;
}
- (void)backRV{
[self PopToRootViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if ([ICRUserUtil sharedInstance].needFresh && self.tableView != nil) {
[self.tableView.header beginRefreshing];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
......
......@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
#import "HPGrowingTextView.h"
#import "PurchaseBill.h"
@protocol TopPurchaseViewDelegate <NSObject>
- (void)hiddenKeyBoard;
......@@ -37,7 +37,7 @@
@property (nonatomic,strong)NSNumber *total;
@property (nonatomic,strong)NSNumber *chargePurchase;
@property (nonatomic,strong)NSString *remark;
@property (nonatomic,strong)PurchaseBill *bill;
@property (nonatomic,weak)id <TopPurchaseViewDelegate>delegate;
......
......@@ -93,13 +93,14 @@
[cell.contentView addSubview:label];
}else if (indexPath.row == _dataArr.count -1){
self.remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
self.remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight/2)];
self.remarkTextView.backgroundColor = [UIColor redColor];
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 2;
self.remarkTextView.maxNumberOfLines = 1;
self.remarkTextView.font = GXF_FIFTEENTEN_SIZE;
self.remarkTextView.textAlignment = NSTextAlignmentRight;
self.remarkTextView.delegate = self;
self.remarkTextView.delegate = self;
self.remarkTextView.returnKeyType = UIReturnKeyDone;
self.remarkTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:self.remarkTextView];
......@@ -139,7 +140,49 @@
}
[self prepareDataInCell];
}
//赋值
- (void)setBill:(PurchaseBill *)bill{
if (bill) {
if (bill.noticeUuid.length > 0) {
self.purchaseNoticeLabel.text = bill.noticeNumber;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR;
}
if (bill.type.length > 0) {
NSString *type = [bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
self.purchaseTypeLabel.text = type;
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
self.type = bill.type;
}
if (bill.vendor_name.length > 0) {
self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",bill.vendor_name,bill.vendor_code];
self.purchaseSupplierLabel.textColor = GXF_CONTENT_COLOR;
self.vendor_uuid = bill.uuid;
self.vendor_code = bill.vendor_code;
self.vendor_name = bill.vendor_name;
}
if (bill.receiveWrh_name.length > 0) {
self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",bill.receiveWrh_name,bill.receiveWrh_code];
self.purchaseStoreLabel.textColor = GXF_CONTENT_COLOR;
self.receiveWrh_uuid = bill.receiveWrh_uuid;
self.receiveWrh_code = bill.receiveWrh_code;
self.receiveWrh_name = bill.receiveWrh_name;
}
if (bill.charge) {
self.otherPriceFiled.text = [bill.charge stringValue];
self.chargePurchase = bill.charge;
}
if (bill.total) {
self.purchasePriceLabel.text = [bill.total stringValue];
self.total = bill.total;
}
if (bill.remark.length > 0) {
self.remarkTextView.text = bill.remark;
self.remark = bill.remark;
}
}
}
- (void)prepareDataInCell{
if (self.total) {
......
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