Commit d9568f12 authored by n22's avatar n22

采购单接口

parent c21d80e7
...@@ -372,6 +372,7 @@ ...@@ -372,6 +372,7 @@
FE4678B61B8D986900B5EDA3 /* PurchaseBoltView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4678B51B8D986900B5EDA3 /* PurchaseBoltView.m */; }; FE4678B61B8D986900B5EDA3 /* PurchaseBoltView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4678B51B8D986900B5EDA3 /* PurchaseBoltView.m */; };
FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; }; FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; };
FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; }; FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; };
FE95FDDA1B93FC12008040D0 /* PurchaseBillProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = FE95FDD91B93FC12008040D0 /* PurchaseBillProduct.m */; };
FEA2F2FD1B8423B900D64735 /* BottomSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */; }; FEA2F2FD1B8423B900D64735 /* BottomSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */; };
FEA2F3001B842A1C00D64735 /* MaterialVIewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FF1B842A1C00D64735 /* MaterialVIewController.m */; }; FEA2F3001B842A1C00D64735 /* MaterialVIewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FF1B842A1C00D64735 /* MaterialVIewController.m */; };
FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F3021B8453C700D64735 /* GoodsViewController.m */; }; FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F3021B8453C700D64735 /* GoodsViewController.m */; };
...@@ -820,6 +821,8 @@ ...@@ -820,6 +821,8 @@
FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; }; FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; };
FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; }; FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
FE7155D81B7B328400595B0A /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; }; FE7155D81B7B328400595B0A /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; };
FE95FDD81B93FC12008040D0 /* PurchaseBillProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseBillProduct.h; sourceTree = "<group>"; };
FE95FDD91B93FC12008040D0 /* PurchaseBillProduct.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseBillProduct.m; sourceTree = "<group>"; };
FEA2F2FB1B8423B900D64735 /* BottomSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomSheetView.h; sourceTree = "<group>"; }; FEA2F2FB1B8423B900D64735 /* BottomSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomSheetView.h; sourceTree = "<group>"; };
FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BottomSheetView.m; sourceTree = "<group>"; }; FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BottomSheetView.m; sourceTree = "<group>"; };
FEA2F2FE1B842A1C00D64735 /* MaterialVIewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaterialVIewController.h; sourceTree = "<group>"; }; FEA2F2FE1B842A1C00D64735 /* MaterialVIewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaterialVIewController.h; sourceTree = "<group>"; };
...@@ -1023,6 +1026,8 @@ ...@@ -1023,6 +1026,8 @@
7281A0C71B89BFE60052B1AC /* Vendor.m */, 7281A0C71B89BFE60052B1AC /* Vendor.m */,
FE4678AE1B8D63A100B5EDA3 /* Warehouse.h */, FE4678AE1B8D63A100B5EDA3 /* Warehouse.h */,
FE4678AF1B8D63A100B5EDA3 /* Warehouse.m */, FE4678AF1B8D63A100B5EDA3 /* Warehouse.m */,
FE95FDD81B93FC12008040D0 /* PurchaseBillProduct.h */,
FE95FDD91B93FC12008040D0 /* PurchaseBillProduct.m */,
); );
path = Models; path = Models;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2274,6 +2279,7 @@ ...@@ -2274,6 +2279,7 @@
7281A0C21B898A040052B1AC /* PurchaseDetailViewController.m in Sources */, 7281A0C21B898A040052B1AC /* PurchaseDetailViewController.m in Sources */,
FEA2F3061B8453DE00D64735 /* CostViewController.m in Sources */, FEA2F3061B8453DE00D64735 /* CostViewController.m in Sources */,
C14BE3061ADB84350049F1AA /* IBTTextFieldCell.m in Sources */, C14BE3061ADB84350049F1AA /* IBTTextFieldCell.m in Sources */,
FE95FDDA1B93FC12008040D0 /* PurchaseBillProduct.m in Sources */,
30F7F5711ADE723100A9B24E /* ICRAttachmentCellContentView.m in Sources */, 30F7F5711ADE723100A9B24E /* ICRAttachmentCellContentView.m in Sources */,
C15918451AC062460013B391 /* IBTBadgeView.m in Sources */, C15918451AC062460013B391 /* IBTBadgeView.m in Sources */,
7281A0C81B89BFE60052B1AC /* Vendor.m in Sources */, 7281A0C81B89BFE60052B1AC /* Vendor.m in Sources */,
......
...@@ -230,6 +230,13 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -230,6 +230,13 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size:(NSUInteger)page_size page_size:(NSUInteger)page_size
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//添加采购单
- (void)savePurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
...@@ -1312,7 +1312,9 @@ acceptTypeJson:YES ...@@ -1312,7 +1312,9 @@ acceptTypeJson:YES
//添加行情调研单 //添加行情调研单
- (void)saveSurveyWithAuthenticode:(id)data success:(void (^)(id))succ failure:(void (^)(id))fail - (void)saveSurveyWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail
{ {
if (!data) { if (!data) {
if (fail) { if (fail) {
...@@ -1705,4 +1707,43 @@ acceptTypeJson:YES ...@@ -1705,4 +1707,43 @@ acceptTypeJson:YES
failure:failure]; failure:failure];
} }
//添加采购单
- (void)savePurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
if (!data) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end @end
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
#ifndef XFFruit_ICRNotificationMacro_h #ifndef XFFruit_ICRNotificationMacro_h
#define XFFruit_ICRNotificationMacro_h #define XFFruit_ICRNotificationMacro_h
#define SetProductTotalPrice @"setProductTotalPrice"
#endif #endif
...@@ -62,8 +62,10 @@ ...@@ -62,8 +62,10 @@
- (void)sureClick{ - (void)sureClick{
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
NSString *type = self.dataArr[_currentIndexPath.row]; if (_currentIndexPath) {
self.choseType(type); NSString *type = self.dataArr[_currentIndexPath.row];
self.choseType(type);
}
} }
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
......
...@@ -110,8 +110,10 @@ ...@@ -110,8 +110,10 @@
- (void)sureClick{ - (void)sureClick{
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
Warehouse *warehouse = self.dataArr[_currentIndexPath.row]; if (_currentIndexPath) {
self.choseWarehouse(warehouse); Warehouse *warehouse = self.dataArr[_currentIndexPath.row];
self.choseWarehouse(warehouse);
}
} }
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#import "TopPurchaseView.h" #import "TopPurchaseView.h"
#import "ProductViewController.h" #import "ProductViewController.h"
#import "AddProductViewController.h" #import "AddProductViewController.h"
#import "PurchaseBillProduct.h"
#define TopHeight 328 #define TopHeight 328
#define BottomHeight 300 #define BottomHeight 300
#define SpaceHeight 20 #define SpaceHeight 20
...@@ -28,10 +29,25 @@ typedef enum : NSUInteger { ...@@ -28,10 +29,25 @@ typedef enum : NSUInteger {
ProductViewController *_pvc ; ProductViewController *_pvc ;
AddProductViewController *_avc; AddProductViewController *_avc;
} }
@property (nonatomic,strong)NSNumber *total;
@property (nonatomic,strong)NSNumber *charge;
@property (nonatomic,strong)NSString *remark;
@property (nonatomic,strong)NSString *state;
@end @end
@implementation NewPurchaseViewController @implementation NewPurchaseViewController
- (instancetype)init{
self = [super init];
if (self) {
//监听值的改变
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setProductTotalPrice:) name:SetProductTotalPrice object:nil];
}
return self;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
//布局 //布局
...@@ -74,10 +90,50 @@ typedef enum : NSUInteger { ...@@ -74,10 +90,50 @@ typedef enum : NSUInteger {
} }
- (void)setProductTotalPrice:(NSNotification *)fication{
//计算总金额
//其他费用 + 商品总金额
float otherPrice = [_purchaseView.otherPriceFiled.text floatValue];
NSMutableArray *purchaseProduct = _pvc.productArr;
float totalPrice = 0;
for (PurchaseBillProduct *billProduct in purchaseProduct) {
totalPrice += [billProduct.total floatValue];
}
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice];
self.charge = [NSNumber numberWithFloat:otherPrice];
self.total = [NSNumber numberWithFloat:totalPrice];
}
- (void)btnClick:(UIButton *)btn{ - (void)btnClick:(UIButton *)btn{
switch (btn.tag) {
case SaveTag:
{
if ([self checkPurchase]) {
}
}
break;
case CommitTag:{
}
break;
default:
break;
}
}
#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];
return NO;
}
return YES;
} }
#pragma mark - TopPurchaseViewDelegate #pragma mark - TopPurchaseViewDelegate
- (void)pushNextViewController:(id)vc{ - (void)pushNextViewController:(id)vc{
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#import "HeaderCell.h" #import "HeaderCell.h"
#import "ProductCell.h" #import "ProductCell.h"
#import "AddProductViewController.h" #import "AddProductViewController.h"
#import "PurchaseBillProduct.h"
#define TableHeight 44 #define TableHeight 44
@interface ProductViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,AddProductViewDelegate> @interface ProductViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,AddProductViewDelegate>
...@@ -35,8 +36,12 @@ ...@@ -35,8 +36,12 @@
if (!self.productArr) { if (!self.productArr) {
self.productArr = [NSMutableArray array]; self.productArr = [NSMutableArray array];
} }
[self.productArr addObject:@"ffff"]; PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
[self.productArr addObject:@"fffff"]; billProduct.total = [NSNumber numberWithFloat:25];
[self.productArr addObject:billProduct];
[self.productArr addObject:billProduct];
} }
- (void)setViewFrame:(CGRect)viewFrame{ - (void)setViewFrame:(CGRect)viewFrame{
......
...@@ -231,21 +231,21 @@ typedef enum : NSUInteger { ...@@ -231,21 +231,21 @@ typedef enum : NSUInteger {
- (void)getSortValueSelectRow:(NSString *)state{ - (void)getSortValueSelectRow:(NSString *)state{
if (state.length > 0) { if (state.length > 0) {
self.orderDirection = state; self.orderDirection = state;
NSLog(@"%@",state); CLog(@"%@",state);
} }
} }
#pragma mark - boltDelegate #pragma mark - boltDelegate
- (void)getBoltValueSelectRow:(NSString *)state{ - (void)getBoltValueSelectRow:(NSString *)state{
self.state = state; self.state = state;
NSLog(@"%@",state); CLog(@"%@",state);
} }
- (void)getbillLike:(NSString *)billLike{ - (void)getbillLike:(NSString *)billLike{
self.billLike = billLike; self.billLike = billLike;
NSLog(@"%@",billLike); CLog(@"%@",billLike);
} }
- (void)getnoticeLike:(NSString *)noticeLike{ - (void)getnoticeLike:(NSString *)noticeLike{
self.noticeLike = noticeLike; self.noticeLike = noticeLike;
NSLog(@"%@",noticeLike); CLog(@"%@",noticeLike);
} }
- (void)clearBoltInformation{ - (void)clearBoltInformation{
//清空所有条件 //清空所有条件
......
...@@ -10,14 +10,15 @@ ...@@ -10,14 +10,15 @@
@interface PurchaseBill : IBTModel @interface PurchaseBill : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识 @property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *version;//版本 @property (nonatomic,strong)NSNumber *version;//版本
@property (nonatomic,strong)NSString *noticeUuid;//采购通知单uuid @property (nonatomic,strong)NSString *noticeUuid;//采购通知单uuid
@property (nonatomic,strong)NSString *noticeNumber;//采购通知单号 @property (nonatomic,strong)NSString *noticeNumber;//采购通知单号
@property (nonatomic,strong)NSString *billNumber;//采购单号 @property (nonatomic,strong)NSString *billNumber;//采购单号
@property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid @property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid
@property (nonatomic,strong)NSString *vendor_code;//供应商代码 @property (nonatomic,strong)NSString *vendor_code;//供应商代码
@property (nonatomic,strong)NSString *vendor_name;//供应商姓名 @property (nonatomic,strong)NSString *vendor_name;//供应商姓名
@property (nonatomic,strong)NSString *total;//总金额 @property (nonatomic,strong)NSNumber *total;//总金额
@property (nonatomic,strong)NSNumber *charge;//费用
@property (nonatomic,strong)NSString *endDate;//调研结束时间 @property (nonatomic,strong)NSString *endDate;//调研结束时间
@property (nonatomic,strong)NSString *remark;//备注 @property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成) @property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
...@@ -29,7 +30,4 @@ ...@@ -29,7 +30,4 @@
@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码 @property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModified_operName;//最后修改人名称 @property (nonatomic,strong)NSString *lastModified_operName;//最后修改人名称
@end @end
//
// PurchaseBillProduct.h
// XFFruit
//
// Created by n22 on 15/8/31.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface PurchaseBillProduct : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *product_uuid;//商品uuid
@property (nonatomic,strong)NSString *product_code;//商品代码
@property (nonatomic,strong)NSString *product_name;//商品名称
@property (nonatomic,strong)NSNumber *qpc;//包装规格
@property (nonatomic,strong)NSString *qpcStr;//包装规格描述
@property (nonatomic,strong)NSString *unit;//包装单位
@property (nonatomic,strong)NSNumber *qty;//包装数量
@property (nonatomic,strong)NSNumber *price;//包装单价
@property (nonatomic,strong)NSNumber *baseQty;//基础数量
@property (nonatomic,strong)NSNumber *basePrice;//基础单价
@property (nonatomic,strong)NSNumber *total;// 金额
@property (nonatomic,strong)NSString *remark;//备注
@end
//
// PurchaseBillProduct.m
// XFFruit
//
// Created by n22 on 15/8/31.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseBillProduct.h"
@implementation PurchaseBillProduct
@end
...@@ -23,6 +23,19 @@ ...@@ -23,6 +23,19 @@
@property (nonatomic,strong)UITextField *otherPriceFiled;//其他费用 @property (nonatomic,strong)UITextField *otherPriceFiled;//其他费用
@property (nonatomic,strong)UILabel *purchasePriceLabel;//总金额 @property (nonatomic,strong)UILabel *purchasePriceLabel;//总金额
@property (nonatomic,strong)HPGrowingTextView *remarkTextView;//备注 @property (nonatomic,strong)HPGrowingTextView *remarkTextView;//备注
//数据
@property (nonatomic,strong)NSString *noticeUuid;
@property (nonatomic,strong)NSString *noticeNumber;
@property (nonatomic,strong)NSString *billNumber;
@property (nonatomic,strong)NSString *type;
@property (nonatomic,strong)NSString *vendor_uuid;
@property (nonatomic,strong)NSString *vendor_code;
@property (nonatomic,strong)NSString *vendor_name;
@property (nonatomic,strong)NSString *receiveWrh_uuid;
@property (nonatomic,strong)NSString *receiveWrh_code;
@property (nonatomic,strong)NSString *receiveWrh_name;
@property (nonatomic,weak)id <TopPurchaseViewDelegate>delegate; @property (nonatomic,weak)id <TopPurchaseViewDelegate>delegate;
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row !=4 && indexPath.row != 5 && indexPath.row != 6) { if (indexPath.row > 0 && indexPath.row < 4) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
} }
[self createViewInCell:cell indexPath:indexPath]; [self createViewInCell:cell indexPath:indexPath];
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
contentLabel.font = FontSize(TitleSize); contentLabel.font = FontSize(TitleSize);
[cell.contentView addSubview:contentLabel]; [cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) { if (indexPath.row == 0) {
contentLabel.text = @"选择采购通知"; contentLabel.text = @"采购通知单号";
self.purchaseNoticeLabel = contentLabel; self.purchaseNoticeLabel = contentLabel;
}else if(indexPath.row == 1){ }else if(indexPath.row == 1){
...@@ -146,8 +146,11 @@ ...@@ -146,8 +146,11 @@
cvc.choseVendor = ^(NSArray *vendors){ cvc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) { if (vendors.count > 0) {
Vendor *vendor = vendors[0]; Vendor *vendor = vendors[0];
self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code]; self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
self.purchaseSupplierLabel.textColor = HexColor(@"444444"); self.purchaseSupplierLabel.textColor = HexColor(@"444444");
self.vendor_uuid = vendor.uuid;
self.vendor_code = vendor.code;
self.vendor_name = vendor.name;
} }
}; };
...@@ -160,6 +163,7 @@ ...@@ -160,6 +163,7 @@
tvc.choseType = ^(NSString *type){ tvc.choseType = ^(NSString *type){
self.purchaseTypeLabel.text = type; self.purchaseTypeLabel.text = type;
self.purchaseTypeLabel.textColor = HexColor(@"444444"); self.purchaseTypeLabel.textColor = HexColor(@"444444");
self.type = type;
}; };
[self.delegate pushNextViewController:tvc]; [self.delegate pushNextViewController:tvc];
}else if(indexPath.row == 3){ }else if(indexPath.row == 3){
...@@ -168,6 +172,9 @@ ...@@ -168,6 +172,9 @@
wvc.choseWarehouse = ^(Warehouse *warehouse){ wvc.choseWarehouse = ^(Warehouse *warehouse){
self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code]; self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
self.purchaseStoreLabel.textColor = HexColor(@"444444"); self.purchaseStoreLabel.textColor = HexColor(@"444444");
self.receiveWrh_uuid = warehouse.uuid;
self.receiveWrh_code = warehouse.code;
self.receiveWrh_name = warehouse.name;
}; };
[self.delegate pushNextViewController:wvc]; [self.delegate pushNextViewController:wvc];
} }
...@@ -183,6 +190,13 @@ ...@@ -183,6 +190,13 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self.delegate hiddenKeyBoard]; [self.delegate hiddenKeyBoard];
} }
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.otherPriceFiled) {
if (self.otherPriceFiled.text.length > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
}
}
}
......
...@@ -109,8 +109,10 @@ ...@@ -109,8 +109,10 @@
}else{ }else{
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
Product *product = self.dataArr[_currentIndexPath.row]; if (_currentIndexPath) {
self.choseProduct(product); Product *product = self.dataArr[_currentIndexPath.row];
self.choseProduct(product);
}
} }
} }
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
......
...@@ -121,26 +121,19 @@ ...@@ -121,26 +121,19 @@
survey.userName = user.name; survey.userName = user.name;
[arr addObject:survey]; [arr addObject:survey];
} }
if (arr.count == 0) { self.chosePerson(arr);
SurveyUser *user = [[SurveyUser alloc]init];
user.userUuid = @"5a7417014e4c2928014e4dea21fb002f";
user.userName = @"栗阳";
user.userCode = @"admin";
[arr addObject:user];
self.chosePerson(arr);
}else{
self.chosePerson(arr);
}
}else{ }else{
NSMutableArray *arr = [[NSMutableArray alloc]init]; NSMutableArray *arr = [[NSMutableArray alloc]init];
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
User *user = self.dataArr[_currentIndexPath.row]; if (_currentIndexPath) {
SurveyUser * survey = [[SurveyUser alloc]init]; User *user = self.dataArr[_currentIndexPath.row];
survey.userUuid = user.uuid; SurveyUser * survey = [[SurveyUser alloc]init];
survey.userCode = user.login; survey.userUuid = user.uuid;
survey.userName = user.name; survey.userCode = user.login;
[arr addObject:survey]; survey.userName = user.name;
self.chosePerson(arr); [arr addObject:survey];
self.chosePerson(arr);
}
} }
} }
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
......
...@@ -47,7 +47,8 @@ typedef enum : NSUInteger { ...@@ -47,7 +47,8 @@ typedef enum : NSUInteger {
StartTimeView *_startTimeView; StartTimeView *_startTimeView;
id uuidObject; id uuidObject;
id billNumberObject; id billNumberObject;
NSNumber *version; NSNumber *versionObject;
NSString *_clickState;
} }
@property (nonatomic,strong)NSString *titleStr; @property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr; @property (nonatomic,strong)NSString *productCodeStr;
...@@ -80,7 +81,7 @@ typedef enum : NSUInteger { ...@@ -80,7 +81,7 @@ typedef enum : NSUInteger {
[_dataArr addObject:@"备注"]; [_dataArr addObject:@"备注"];
uuidObject = [NSNull null]; uuidObject = [NSNull null];
billNumberObject = [NSNull null]; billNumberObject = [NSNull null];
version = [NSNumber numberWithInt:0]; versionObject = [NSNumber numberWithInt:0];
} }
- (void)createTableView - (void)createTableView
...@@ -111,6 +112,7 @@ typedef enum : NSUInteger { ...@@ -111,6 +112,7 @@ typedef enum : NSUInteger {
case SaveTag: case SaveTag:
{ {
if ([self checkSurvey]) { if ([self checkSurvey]) {
_clickState = @"initial";
[self saveSurvey:@"initial" message:@"正在保存..."]; [self saveSurvey:@"initial" message:@"正在保存..."];
} }
} }
...@@ -118,6 +120,7 @@ typedef enum : NSUInteger { ...@@ -118,6 +120,7 @@ typedef enum : NSUInteger {
case CommitTag: case CommitTag:
{ {
if ([self checkSurvey]) { if ([self checkSurvey]) {
_clickState = @"submitted";
[self saveSurvey:@"submitted" message:@"正在提交..."]; [self saveSurvey:@"submitted" message:@"正在提交..."];
} }
} }
...@@ -150,7 +153,13 @@ typedef enum : NSUInteger { ...@@ -150,7 +153,13 @@ typedef enum : NSUInteger {
if (success == 1) { if (success == 1) {
//成功 //成功
if ([state isEqualToString:@"initial"]) {//保存成功 if ([state isEqualToString:@"initial"]) {//保存成功
[IBTLoadingView showTips:@"操作成功"]; 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{//提交成功 }else{//提交成功
SurveyViewController *svc = [SurveyViewController new]; SurveyViewController *svc = [SurveyViewController new];
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
...@@ -168,14 +177,14 @@ typedef enum : NSUInteger { ...@@ -168,14 +177,14 @@ typedef enum : NSUInteger {
if(self.survey.uuid.length > 0 && uuidObject == [NSNull null]){ if(self.survey.uuid.length > 0 && uuidObject == [NSNull null]){
uuidObject = self.survey.uuid; uuidObject = self.survey.uuid;
} }
if (self.survey.billNumber > 0 && billNumberObject == [NSNull null]) { if (self.survey.billNumber > 0 && billNumberObject == [NSNull null]) {
billNumberObject = self.survey.billNumber; billNumberObject = self.survey.billNumber;
} }
if (self.survey && [version integerValue] == 0) { if (self.survey && [versionObject integerValue] == 0) {
version = self.survey.version; versionObject = self.survey.version;
} }
NSDictionary *dict = @{@"uuid":uuidObject, NSDictionary *dict = @{@"uuid":uuidObject,
@"version":version, @"version":versionObject,
@"billnumber":billNumberObject, @"billnumber":billNumberObject,
@"title":[IBTCommon checkString:self.titleStr], @"title":[IBTCommon checkString:self.titleStr],
@"state":state, @"state":state,
...@@ -190,32 +199,6 @@ typedef enum : NSUInteger { ...@@ -190,32 +199,6 @@ typedef enum : NSUInteger {
[[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail]; [[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail];
} }
- (void)clearAllInformation{
_titleField.text = @"";
_productLabel.text = @"请输入商品";
_productLabel.textColor = HexColor(@"bbbbbb");
_startDateLabel.text = @"选择日期";
_startDateLabel.textColor = HexColor(@"bbbbbb");
_endDateLabel.text = @"选择日期";
_endDateLabel.textColor = HexColor(@"bbbbbb");
_personLabel.text = @"选择调研人员";
_personLabel.textColor = HexColor(@"bbbbbb");
_noteTextView.text = @"";
//清空数据
self.titleStr = @"";
self.productCodeStr = @"";
self.productNameStr = @"";
self.productUuidStr = @"";
self.beginDateStr = @"";
self.endDateStr = @"";
[self.users removeAllObjects];
self.remarkStr = @"";
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1; return 1;
...@@ -331,7 +314,7 @@ typedef enum : NSUInteger { ...@@ -331,7 +314,7 @@ typedef enum : NSUInteger {
} }
- (void)preferDataInProductLabel{ - (void)preferDataInProductLabel{
if (self.survey) { if (self.survey) {
_productLabel.text = [IBTCommon checkString:self.survey.productName]; _productLabel.text = [NSString stringWithFormat:@"%@[%@]",[IBTCommon checkString:self.survey.productName],[IBTCommon checkString:self.survey.productCode]];
_productLabel.textColor = HexColor(@"444444"); _productLabel.textColor = HexColor(@"444444");
self.productCodeStr = [IBTCommon checkString:self.survey.productCode]; self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName]; self.productNameStr = [IBTCommon checkString:self.survey.productName];
...@@ -358,20 +341,22 @@ typedef enum : NSUInteger { ...@@ -358,20 +341,22 @@ typedef enum : NSUInteger {
}else if(indexPath.row == 4){ }else if(indexPath.row == 4){
ChosePersonViewController *cvc = [ChosePersonViewController new]; ChosePersonViewController *cvc = [ChosePersonViewController new];
cvc.chosePerson = ^(NSArray *users){ cvc.chosePerson = ^(NSArray *users){
NSString *textStr = @""; if(users.count > 0){
if (self.users.count > 0) { NSString *textStr = @"";
[self.users removeAllObjects]; if (self.users.count > 0) {
} [self.users removeAllObjects];
for (SurveyUser *user in users) { }
if (textStr.length == 0) { for (SurveyUser *user in users) {
textStr = [textStr stringByAppendingFormat:@"%@",user.userName]; if (textStr.length == 0) {
}else { textStr = [textStr stringByAppendingFormat:@"%@",user.userName];
textStr = [textStr stringByAppendingFormat:@"、%@",user.userName]; }else {
textStr = [textStr stringByAppendingFormat:@"、%@",user.userName];
}
[self.users addObject:[user dictForCommit]];
} }
[self.users addObject:[user dictForCommit]]; _personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444");
} }
_personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444");
}; };
cvc.isMoreChose = YES; cvc.isMoreChose = YES;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
...@@ -461,7 +446,9 @@ typedef enum : NSUInteger { ...@@ -461,7 +446,9 @@ typedef enum : NSUInteger {
- (void)viewWillDisappear:(BOOL)animated{ - (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated]; [super viewWillDisappear:animated];
if(self.survey && [_clickState isEqualToString:@"initial"]){
[ICRUserUtil sharedInstance].needFresh = YES;
}
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
......
...@@ -95,8 +95,8 @@ typedef enum : NSUInteger { ...@@ -95,8 +95,8 @@ typedef enum : NSUInteger {
} }
- (void)viewWillAppear:(BOOL)animated{ - (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated]; [super viewWillAppear:animated];
if ([ICRUserUtil sharedInstance].needFresh) { if ([ICRUserUtil sharedInstance].needFresh && self.tableView != nil) {
[self getData]; [self.tableView.header beginRefreshing];
} }
} }
...@@ -363,21 +363,21 @@ typedef enum : NSUInteger { ...@@ -363,21 +363,21 @@ typedef enum : NSUInteger {
- (void)getSortValueSelectRow:(NSString *)state{ - (void)getSortValueSelectRow:(NSString *)state{
if (state.length > 0) { if (state.length > 0) {
self.orderDirection = state; self.orderDirection = state;
NSLog(@"%@",state); CLog(@"%@",state);
} }
} }
#pragma mark - boltDelegate #pragma mark - boltDelegate
- (void)getBoltValueSelectRow:(NSString *)state{ - (void)getBoltValueSelectRow:(NSString *)state{
self.state = state; self.state = state;
NSLog(@"%@",state); CLog(@"%@",state);
} }
- (void)getTitleLike:(NSString *)titleLike{ - (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike; self.titleLike = titleLike;
NSLog(@"%@",titleLike); CLog(@"%@",titleLike);
} }
- (void)getBillNumber:(NSString *)billNumber{ - (void)getBillNumber:(NSString *)billNumber{
self.billNumberLike = billNumber; self.billNumberLike = billNumber;
NSLog(@"%@",billNumber); CLog(@"%@",billNumber);
} }
- (void)clearBoltInformation{ - (void)clearBoltInformation{
//清空所有条件 //清空所有条件
......
...@@ -14,5 +14,6 @@ ...@@ -14,5 +14,6 @@
#import "IBTConstants.h" #import "IBTConstants.h"
#import "ICRAppMacro.h" #import "ICRAppMacro.h"
#import "ICRNotificationMacro.h"
#endif #endif
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