Commit 4a62d8c4 authored by Sandy's avatar Sandy

非产品中心非wms仓收货

parent 1fb47ad6
...@@ -329,7 +329,11 @@ static NSString *ICRDataBasePath = @""; ...@@ -329,7 +329,11 @@ static NSString *ICRDataBasePath = @"";
[_m_dbQueue inDatabase:^(FMDatabase *db) { [_m_dbQueue inDatabase:^(FMDatabase *db) {
// [db open]; // [db open];
//2017-05-08仓库增加了iswms 和 isproductcenter两个字段 /*
2017-05-08
Warehouse 增加了iswms 和 isproductcenter两个字段
Product 增加了purMeasureUnit默认采购单位字段
*/
if (![db columnExists:@"iswms" inTableWithName:@"Warehouse"]) { if (![db columnExists:@"iswms" inTableWithName:@"Warehouse"]) {
CLog(@"没有iswms 和 isproductcenter两个字段"); CLog(@"没有iswms 和 isproductcenter两个字段");
...@@ -340,6 +344,16 @@ static NSString *ICRDataBasePath = @""; ...@@ -340,6 +344,16 @@ static NSString *ICRDataBasePath = @"";
[db executeUpdate:addTable]; [db executeUpdate:addTable];
} }
if (![db columnExists:@"purMeasureUnit" inTableWithName:@"Product"]) {
NSString *sql = @"DROP TABLE IF EXISTS 'Product'";
[db executeUpdate:sql];
NSString *addTable = [Product SQLForCreateTable];
[db executeUpdate:addTable];
}
// [db close]; // [db close];
}]; }];
} }
......
...@@ -354,6 +354,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -354,6 +354,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//5.采购单收货
- (void)recievePurchase:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//1.添加发运单 //1.添加发运单
- (void)saveTransportWithData:(id)data - (void)saveTransportWithData:(id)data
success:(void (^)(id))succ success:(void (^)(id))succ
......
...@@ -2359,6 +2359,34 @@ acceptTypeJson:YES ...@@ -2359,6 +2359,34 @@ acceptTypeJson:YES
} }
- (void)recievePurchase:(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 );
}
};
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *url = [NSString stringWithFormat:@"%@/purchase/bill/receive?time=%@&operId=%@&operName=%@",HTTP_REST_API_BASE_URL,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:data
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
#pragma mark - 添加发运单 #pragma mark - 添加发运单
- (void)saveTransportWithData:(id)data - (void)saveTransportWithData:(id)data
success:(void (^)(id))succ success:(void (^)(id))succ
......
...@@ -149,6 +149,8 @@ ...@@ -149,6 +149,8 @@
#define PURCHASE_STATE_ABORTED @"aborted" //已作废 #define PURCHASE_STATE_ABORTED @"aborted" //已作废
#define PURCHASE_STATE_PROCESS @"process"//提交系统处理 #define PURCHASE_STATE_PROCESS @"process"//提交系统处理
#define PURCHASE_STATE_PROCESSFAIL @"processFail"//系统处理失败 #define PURCHASE_STATE_PROCESSFAIL @"processFail"//系统处理失败
#define PURCHASE_STATE_WAITE_RECIEVE @"waitReceive"//待收货
//采购单操作 //采购单操作
#define PURCHASE_ACTION_REJECT @"reject" #define PURCHASE_ACTION_REJECT @"reject"
#define PURCHASE_ACTION_APPROVE @"approve" #define PURCHASE_ACTION_APPROVE @"approve"
......
...@@ -186,13 +186,13 @@ typedef enum : NSUInteger { ...@@ -186,13 +186,13 @@ typedef enum : NSUInteger {
_purchaseView.delegate = self; _purchaseView.delegate = self;
[_scrollView addSubview:_purchaseView]; [_scrollView addSubview:_purchaseView];
// _bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight)]; // _bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight)];
// _bottomView.backgroundColor = [UIColor whiteColor]; // _bottomView.backgroundColor = [UIColor whiteColor];
// [_scrollView addSubview:_bottomView]; // [_scrollView addSubview:_bottomView];
// //
// _pvc = [[ProductBillViewController alloc]init]; // _pvc = [[ProductBillViewController alloc]init];
// _pvc.viewFrame = _bottomView.bounds; // _pvc.viewFrame = _bottomView.bounds;
// [_bottomView addSubview:_pvc.view]; // [_bottomView addSubview:_pvc.view];
_aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight) withHidden:NO]; _aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight) withHidden:NO];
_aBottomView.backgroundColor = [UIColor whiteColor]; _aBottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_aBottomView]; [_scrollView addSubview:_aBottomView];
...@@ -203,14 +203,14 @@ typedef enum : NSUInteger { ...@@ -203,14 +203,14 @@ typedef enum : NSUInteger {
- (void)setProductTotalPrice:(NSNotification *)fication{ - (void)setProductTotalPrice:(NSNotification *)fication{
//计算总金额 //计算总金额
NSDecimalNumber *otherPrice = [NSDecimalNumber decimalNumberWithString:@"0"]; NSDecimalNumber *otherPrice = [NSDecimalNumber decimalNumberWithString:@"0"];
// if (_aBottomView.costVC.costArr.count == 0) { // if (_aBottomView.costVC.costArr.count == 0) {
// otherPrice = [_purchaseView.otherPriceFiled.text floatValue]; // otherPrice = [_purchaseView.otherPriceFiled.text floatValue];
// }else{ // }else{
for (FeeAcountDetail *cost in _aBottomView.costVC.costArr) { for (FeeAcountDetail *cost in _aBottomView.costVC.costArr) {
otherPrice = [CalculateHelper calculateNum1:otherPrice num2:cost.leftmoney type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10]; otherPrice = [CalculateHelper calculateNum1:otherPrice num2:cost.leftmoney type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10];
} }
_purchaseView.otherPriceFiled.text = [NSString stringWithFormat:@"%@", otherPrice]; _purchaseView.otherPriceFiled.text = [NSString stringWithFormat:@"%@", otherPrice];
// } // }
//其他费用 + 商品总金额 //其他费用 + 商品总金额
...@@ -368,6 +368,7 @@ typedef enum : NSUInteger { ...@@ -368,6 +368,7 @@ typedef enum : NSUInteger {
@"total":_purchaseView.total, @"total":_purchaseView.total,
@"charge":_purchaseView.chargePurchase, @"charge":_purchaseView.chargePurchase,
@"remark":[IBTCommon checkString:_purchaseView.remark], @"remark":[IBTCommon checkString:_purchaseView.remark],
@"outSideBillNumber":[IBTCommon checkString:_purchaseView.purchaseExternal.text],
@"products":billProducts, @"products":billProducts,
@"accountDetails":costs}; @"accountDetails":costs};
[IBTLoadingView showProgressLabel:msg]; [IBTLoadingView showProgressLabel:msg];
...@@ -392,6 +393,10 @@ typedef enum : NSUInteger { ...@@ -392,6 +393,10 @@ typedef enum : NSUInteger {
ShowMessage(@"收货仓库不能为空"); ShowMessage(@"收货仓库不能为空");
return NO; return NO;
} }
if (_purchaseView.purchaseExternal.text == 0) {
ShowMessage(@"外部单据号不能为空");
return NO;
}
if (_aBottomView.productVC.productArr.count == 0) { if (_aBottomView.productVC.productArr.count == 0) {
ShowMessage(@"采购商品不能为空"); ShowMessage(@"采购商品不能为空");
return NO; return NO;
...@@ -405,10 +410,10 @@ typedef enum : NSUInteger { ...@@ -405,10 +410,10 @@ typedef enum : NSUInteger {
ShowMessage(@"有数量等于0的商品明细,请编辑后保存"); ShowMessage(@"有数量等于0的商品明细,请编辑后保存");
return NO; return NO;
} }
// if ([billProduct.price floatValue] <=0 || [billProduct.basePrice floatValue] <= 0) { // if ([billProduct.price floatValue] <=0 || [billProduct.basePrice floatValue] <= 0) {
// ShowMessage(@"有价格未填写的商品明细,请编辑后保存"); // ShowMessage(@"有价格未填写的商品明细,请编辑后保存");
// return NO; // return NO;
// } // }
} }
return YES; return YES;
...@@ -461,7 +466,7 @@ typedef enum : NSUInteger { ...@@ -461,7 +466,7 @@ typedef enum : NSUInteger {
NSMutableArray *billArr = [NSMutableArray array]; NSMutableArray *billArr = [NSMutableArray array];
for (NoticeProduct *product in arr) { for (NoticeProduct *product in arr) {
PurchaseBillProduct *billProduct = [PurchaseBillProduct new]; PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
// billProduct.uuid = product.uuid; // billProduct.uuid = product.uuid;
billProduct.product_name = product.productName; billProduct.product_name = product.productName;
billProduct.product_uuid = product.productUuid; billProduct.product_uuid = product.productUuid;
billProduct.product_code = product.productCode; billProduct.product_code = product.productCode;
...@@ -507,13 +512,13 @@ typedef enum : NSUInteger { ...@@ -507,13 +512,13 @@ typedef enum : NSUInteger {
} }
/* /*
#pragma mark - Navigation #pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation // In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController]. // Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller. // Pass the selected object to the new view controller.
} }
*/ */
@end @end
...@@ -8,6 +8,19 @@ ...@@ -8,6 +8,19 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
#import "PurchaseBill.h" #import "PurchaseBill.h"
/**
* 采购单状态
*/
typedef NS_ENUM(NSInteger, PurchaseType) {
/**
* 审核之前的状态(已保存、已提交)
*/
PurchaseTypeBeforeVerify = 1,
/**
* 审核之后的状态(待收货、发运中等。。)
*/
PurchaseTypeAfterVerify,
};
@interface PurchaseDetailViewController : ICRBaseViewController @interface PurchaseDetailViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill; @property (nonatomic,strong)PurchaseBill *bill;
...@@ -15,4 +28,8 @@ ...@@ -15,4 +28,8 @@
//显示样式 //显示样式
@property (nonatomic,assign)NSInteger indexStyle;//0.1.2 @property (nonatomic,assign)NSInteger indexStyle;//0.1.2
@property (nonatomic, assign) PurchaseType type;
@end @end
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#import "ProductBillViewController.h" #import "ProductBillViewController.h"
#import "PurchaseBillProduct.h" #import "PurchaseBillProduct.h"
#import "BottomPurchaseView.h" #import "BottomPurchaseView.h"
#import "ReceiveProductViewController.h"
#import "TransferPdtDetail.h"
#import "NewReceiveProductViewController.h"
//#import "RejectView.h" //#import "RejectView.h"
#define BottomHeight 50 #define BottomHeight 50
#define LeftMargin 15 #define LeftMargin 15
...@@ -24,7 +27,9 @@ typedef enum : NSUInteger { ...@@ -24,7 +27,9 @@ typedef enum : NSUInteger {
RejectTag, //拒绝 RejectTag, //拒绝
PassTag, //审核 PassTag, //审核
SureTag, //确定 SureTag, //确定
SaveTag, //收货状态:保存
ReceiveTag,//收货状态:收货
AbortTag//收货状态:作废
} BtnTag; } BtnTag;
@interface PurchaseDetailViewController ()<UIAlertViewDelegate> @interface PurchaseDetailViewController ()<UIAlertViewDelegate>
...@@ -37,6 +42,8 @@ typedef enum : NSUInteger { ...@@ -37,6 +42,8 @@ typedef enum : NSUInteger {
UIButton *_firstBtn; UIButton *_firstBtn;
UIButton *_secondBtn; UIButton *_secondBtn;
BottomPurchaseView *_aBottomView; BottomPurchaseView *_aBottomView;
UIView *_recieveBottomView;
ReceiveProductViewController *_pvc;
} }
@property (nonatomic,strong)UILabel *billNumberLabel; @property (nonatomic,strong)UILabel *billNumberLabel;
...@@ -51,10 +58,15 @@ typedef enum : NSUInteger { ...@@ -51,10 +58,15 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)UILabel *vendorIsSureLabel; @property (nonatomic,strong)UILabel *vendorIsSureLabel;
@property (nonatomic,strong)UILabel *warehouseLabel; @property (nonatomic,strong)UILabel *warehouseLabel;
@property (nonatomic,strong)UILabel *otherPriceLabel; @property (nonatomic,strong)UILabel *otherPriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel; @property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *noteLabel; @property (nonatomic,strong)UILabel *noteLabel;
@property (strong, nonatomic) UILabel *labelCreateTime;
@property (strong, nonatomic) UILabel *labelInspector;
@property (strong, nonatomic) UILabel *labelInspectTime;
@property (strong, nonatomic) UILabel *labelReciever;
@property (strong, nonatomic) UILabel *labelRecieveTime;
@property (nonatomic,assign)BOOL isNotShowEdit;
//@property (nonatomic,strong)RejectView *rejectView; //@property (nonatomic,strong)RejectView *rejectView;
@property (nonatomic,strong)NSString *rejectCause;//拒接原因 @property (nonatomic,strong)NSString *rejectCause;//拒接原因
...@@ -64,6 +76,12 @@ typedef enum : NSUInteger { ...@@ -64,6 +76,12 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
if ([self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE]) {
self.type = PurchaseTypeAfterVerify;
}else{
self.type = PurchaseTypeBeforeVerify;
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editReceiveProduct:) name:KNOTIFICATION_EditReceiveProduct object:nil];
[self bulidLayout]; [self bulidLayout];
[self getDataFromServer]; [self getDataFromServer];
} }
...@@ -80,6 +98,7 @@ typedef enum : NSUInteger { ...@@ -80,6 +98,7 @@ typedef enum : NSUInteger {
PurchaseBill *bill = [[PurchaseBill alloc]init]; PurchaseBill *bill = [[PurchaseBill alloc]init];
[bill setValuesForKeysWithDictionary:dictData]; [bill setValuesForKeysWithDictionary:dictData];
self.bill = bill; self.bill = bill;
[_aBottomView refreshCost:dictData[@"accountDetails"]]; [_aBottomView refreshCost:dictData[@"accountDetails"]];
[strongSelf fetchtPurchaseDetail]; [strongSelf fetchtPurchaseDetail];
}else{ }else{
...@@ -105,7 +124,7 @@ typedef enum : NSUInteger { ...@@ -105,7 +124,7 @@ typedef enum : NSUInteger {
_scrollView.showsVerticalScrollIndicator = NO; _scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = XXFBgColor; _scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView]; [self.view addSubview:_scrollView];
// [self createBtn]; // [self createBtn];
[self showBtnByPermissions]; [self showBtnByPermissions];
[self createBottomView]; [self createBottomView];
[self createPurchaseView]; [self createPurchaseView];
...@@ -135,6 +154,12 @@ typedef enum : NSUInteger { ...@@ -135,6 +154,12 @@ typedef enum : NSUInteger {
btnTag = EndTag; btnTag = EndTag;
}else if ([arr[i] isEqualToString:@"作废"]) { }else if ([arr[i] isEqualToString:@"作废"]) {
btnTag = CancleTag; btnTag = CancleTag;
}else if ([arr[i] isEqualToString:@"保存"]) {
btnTag = SaveTag;
}else if ([arr[i] isEqualToString:@"收货"]) {
btnTag = ReceiveTag;
}else if([arr[i] isEqualToString:@"作废"]){
btnTag = AbortTag;
} }
CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40); CGRect btnFrame = CGRectMake(LeftMargin + (LeftMargin + btnWidth)*i, ScreenSize.height - 64 - BottomHeight +5, btnWidth, 40);
UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR]; UIButton *perBtn = [IBTCustomButtom creatButtonWithFrame:btnFrame target:self sel:@selector(btnClick:) tag:btnTag image:nil title:arr[i] titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
...@@ -188,7 +213,15 @@ typedef enum : NSUInteger { ...@@ -188,7 +213,15 @@ typedef enum : NSUInteger {
}else{ }else{
[self hiddenTwoBtn]; [self hiddenTwoBtn];
} }
}else if([self.bill.state isEqualToString:PURCHASE_STATE_ABORTED]){//已作废 }else if (self.type == PurchaseTypeAfterVerify){
if ([IBTCommon checkIsPermission:RECEIVE_ACTION_RECEIVE]) {
[self createBtnWithArr:@[@"作废",@"收货"]];
}else{
[self hiddenTwoBtn];
}
}
else if([self.bill.state isEqualToString:PURCHASE_STATE_ABORTED]){//已作废
[self hiddenTwoBtn]; [self hiddenTwoBtn];
}else{ }else{
[self hiddenTwoBtn]; [self hiddenTwoBtn];
...@@ -260,6 +293,32 @@ typedef enum : NSUInteger { ...@@ -260,6 +293,32 @@ typedef enum : NSUInteger {
{ {
CLog(@"确认"); CLog(@"确认");
[self dealByAction:PURCHASE_ACTION_VENDORCONFIRM]; [self dealByAction:PURCHASE_ACTION_VENDORCONFIRM];
}
break;
case SaveTag:
{
// if ([self checkReceive]) {
// self.state = RECEIVE_STATE_SAVE;
// [self getDataFromServer:RECEIVE_STATE_SAVE msg:@"正在保存..."];
// }
}
break;
case ReceiveTag:{
if ([self checkReceive]) {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"收货后不能重复收货,请确认是否要收货?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = ReceiveTag;
[alertView show];
}
}
break;
case AbortTag:
{
// CLog(@"作废");
// UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认作废" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
// alertView.delegate = self;
// alertView.tag = AbortTag;
// [alertView show];
} }
break; break;
default: default:
...@@ -291,31 +350,49 @@ typedef enum : NSUInteger { ...@@ -291,31 +350,49 @@ typedef enum : NSUInteger {
[[ICRHTTPController sharedController]dealByActionWithPurchaseUuid:self.bill.uuid action:action remark:[IBTCommon checkString:self.rejectCause] version:self.bill.version success:succ failure:fail]; [[ICRHTTPController sharedController]dealByActionWithPurchaseUuid:self.bill.uuid action:action remark:[IBTCommon checkString:self.rejectCause] version:self.bill.version success:succ failure:fail];
} }
- (void)createBottomView{ - (BOOL)checkReceive{
// _bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width, 300)]; for (NSString *isEdit in _pvc.defaultState) {
// _bottomView.backgroundColor = [UIColor whiteColor]; if ([isEdit isEqualToString:@"NO"]) {
// [_scrollView addSubview:_bottomView]; ShowMessage(@"有商品行没有编辑过收货数量,请先编辑再收货");
// return NO;
// _pvc = [[ProductBillViewController alloc]init]; }
// [self addChildViewController:_pvc]; }
//
// _pvc.viewFrame = _bottomView.bounds;
// _pvc.isHiddenEdit = YES;
// [_bottomView addSubview:_pvc.view];
if (_pvc.productArr.count == 0) {
ShowMessage(@"商品不能为空");
return NO;
}
return YES;
}
- (void)createBottomView{
if (self.type == PurchaseTypeAfterVerify) {
_recieveBottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300)];
_recieveBottomView.backgroundColor = [UIColor redColor];
[_scrollView addSubview:_recieveBottomView];
_pvc = [[ReceiveProductViewController alloc]init];
_pvc.viewFrame = _recieveBottomView.bounds;
_pvc.isHiddenAdd = YES;
_pvc.isHiddenEdit = self.isNotShowEdit;
[_recieveBottomView addSubview:_pvc.view];
}else{
_aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300) withHidden:YES]; _aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300) withHidden:YES];
_aBottomView.backgroundColor = [UIColor whiteColor]; _aBottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_aBottomView]; [_scrollView addSubview:_aBottomView];
}
} }
- (void)createPurchaseView{ - (void)createPurchaseView{
_leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"最后修改人:",@"采购员:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"]; _leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"创建时间:",@"审核人:",@"审核时间:",@"收货人:",@"收货时间:",@"采购员:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"外部单据号:",@"备注:"];
_purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*_leftArr.count +LeftMargin)]; _purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*_leftArr.count +LeftMargin)];
_purchaseView.backgroundColor = [UIColor whiteColor]; _purchaseView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_purchaseView]; [_scrollView addSubview:_purchaseView];
for (NSInteger i = 0 ; i < _leftArr.count; i++) { for (NSString *title in _leftArr) {
NSInteger i = [_leftArr indexOfObject:title];
UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 10 + LeftHeight *i, LeftWidth, LeftHeight)]; UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 10 + LeftHeight *i, LeftWidth, LeftHeight)];
leftLabel.font = GXF_SEVENTEENTH_SIZE; leftLabel.font = GXF_SEVENTEENTH_SIZE;
leftLabel.text = _leftArr[i]; leftLabel.text = _leftArr[i];
...@@ -325,37 +402,45 @@ typedef enum : NSUInteger { ...@@ -325,37 +402,45 @@ typedef enum : NSUInteger {
UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), 10 + LeftHeight *i, _purchaseView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)]; UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), 10 + LeftHeight *i, _purchaseView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
rightLabel.font = GXF_SEVENTEENTH_SIZE; rightLabel.font = GXF_SEVENTEENTH_SIZE;
rightLabel.textColor = GXF_DETAIL_COLOR; rightLabel.textColor = GXF_DETAIL_COLOR;
if ([title isEqualToString:@"单号:"]) {
if (i == 0) {
self.billNumberLabel = rightLabel; self.billNumberLabel = rightLabel;
}else if (i == 1) { }else if ([title isEqualToString:@"采购通知单:"]){
self.noticeNumberLabel = rightLabel; self.noticeNumberLabel = rightLabel;
}else if(i == 2){ }else if ([title isEqualToString:@"创建人:"]){
self.createOperNameLabel = rightLabel; self.createOperNameLabel = rightLabel;
}else if (i == 3){ }else if ([title isEqualToString:@"最后修改人:"]){
self.lastModifyNameLabel = rightLabel; self.lastModifyNameLabel = rightLabel;
} }else if ([title isEqualToString:@"采购员:"]){
else if (i == 4){
self.purchaserLabel = rightLabel; self.purchaserLabel = rightLabel;
}else if(i == 5){ }else if ([title isEqualToString:@"状态:"]){
self.stateLabel = rightLabel; self.stateLabel = rightLabel;
}else if(i == 6){ }else if ([title isEqualToString:@"类型:"]){
self.typeLabel = rightLabel; self.typeLabel = rightLabel;
}else if(i == 7){ }else if ([title isEqualToString:@"供应商:"]){
self.vendorNameLabel = rightLabel; self.vendorNameLabel = rightLabel;
}else if(i == 8){ }else if ([title isEqualToString:@"供应商确认:"]){
self.vendorIsSureLabel = rightLabel; self.vendorIsSureLabel = rightLabel;
}else if(i == 9){ }else if ([title isEqualToString:@"收货仓库:"]){
self.warehouseLabel = rightLabel; self.warehouseLabel = rightLabel;
}else if(i == _leftArr.count - 3){ }else if ([title isEqualToString:@"其他费用:"]){
self.otherPriceLabel = rightLabel; self.otherPriceLabel = rightLabel;
}else if(i == _leftArr.count - 2){ }else if ([title isEqualToString:@"总金额:"]){
self.totalPriceLabel = rightLabel; self.totalPriceLabel = rightLabel;
}else if(i == _leftArr.count - 1){ }else if ([title isEqualToString:@"备注:"]){
rightLabel.numberOfLines = 0; rightLabel.numberOfLines = 0;
self.noteLabel = rightLabel; self.noteLabel = rightLabel;
//rightLabel.backgroundColor = [UIColor redColor]; }else if ([title isEqualToString:@"创建时间:"]){
self.labelCreateTime = rightLabel;
}else if ([title isEqualToString:@"审核人:"]){
self.labelInspector = rightLabel;
}else if ([title isEqualToString:@"审核时间:"]){
self.labelInspectTime = rightLabel;
}else if ([title isEqualToString:@"收货人:"]){
self.labelReciever = rightLabel;
}else if ([title isEqualToString:@"收货时间:"]){
self.labelRecieveTime = rightLabel;
} }
[_purchaseView addSubview:rightLabel]; [_purchaseView addSubview:rightLabel];
} }
} }
...@@ -400,7 +485,26 @@ typedef enum : NSUInteger { ...@@ -400,7 +485,26 @@ typedef enum : NSUInteger {
self.vendorIsSureLabel.text = (self.bill.vendorConfirmTime.length > 0 && self.bill.vendorConfirmTime)? @"是":@"否"; self.vendorIsSureLabel.text = (self.bill.vendorConfirmTime.length > 0 && self.bill.vendorConfirmTime)? @"是":@"否";
self.warehouseLabel.text = [IBTCommon checkString:self.bill.receiveWrh_name]; self.warehouseLabel.text = [IBTCommon checkString:self.bill.receiveWrh_name];
self.otherPriceLabel.text = [self.bill.charge stringValue]; self.otherPriceLabel.text = [self.bill.charge stringValue];
self.labelCreateTime.text = [IBTCommon checkString:self.bill.create_time];
self.labelInspector.text = [IBTCommon checkString:self.bill.approv_operName];
self.labelInspectTime.text = [IBTCommon checkString:self.bill.approv_time];
NSMutableArray *productArr = [NSMutableArray array]; NSMutableArray *productArr = [NSMutableArray array];
if (self.type == PurchaseTypeAfterVerify) {
for (NSDictionary *billDict in self.bill.products) {
TransferPdtDetail *billProbuct = [TransferPdtDetail new];
[billProbuct setValuesForKeysWithDictionary:billDict];
PurchaseBillProduct *p = [PurchaseBillProduct new];
[p setValuesForKeysWithDictionary:billDict];
billProbuct.purchasePdt = p;
[productArr addObject:billProbuct];
}
_pvc.productArr = productArr;
[_pvc.tableView reloadData];
}else{
for (NSDictionary *billDict in self.bill.products) { for (NSDictionary *billDict in self.bill.products) {
PurchaseBillProduct *billProbuct = [PurchaseBillProduct new]; PurchaseBillProduct *billProbuct = [PurchaseBillProduct new];
[billProbuct setValuesForKeysWithDictionary:billDict]; [billProbuct setValuesForKeysWithDictionary:billDict];
...@@ -408,6 +512,7 @@ typedef enum : NSUInteger { ...@@ -408,6 +512,7 @@ typedef enum : NSUInteger {
} }
_aBottomView.productVC.productArr = productArr; _aBottomView.productVC.productArr = productArr;
[_aBottomView.productVC.tableView reloadData]; [_aBottomView.productVC.tableView reloadData];
}
[self setNoteHeight]; [self setNoteHeight];
} }
...@@ -425,19 +530,25 @@ typedef enum : NSUInteger { ...@@ -425,19 +530,25 @@ typedef enum : NSUInteger {
purchaseFrame.size.height = totalHeight; purchaseFrame.size.height = totalHeight;
_purchaseView.frame = purchaseFrame; _purchaseView.frame = purchaseFrame;
if (self.type == PurchaseTypeAfterVerify) {
CGRect bottomFrame = _recieveBottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
_recieveBottomView.backgroundColor = [UIColor redColor];
_recieveBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100);
}else{
CGRect bottomFrame = _aBottomView.frame; CGRect bottomFrame = _aBottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin; bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
_aBottomView.frame = bottomFrame; _aBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_aBottomView.frame) + TopMargin*2); _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_aBottomView.frame) + TopMargin*2);
}
} }
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (alertView.tag == CancleTag) { if (alertView.tag == CancleTag) {
if (buttonIndex == 1) { if (buttonIndex == 1) {
[self dealByAction:PURCHASE_ACTION_ABORT];//作废 [self dealByAction:PURCHASE_ACTION_ABORT];//作废
} }
}else if (alertView.tag == EndTag){ }else if (alertView.tag == EndTag){
if (buttonIndex == 1) { if (buttonIndex == 1) {
...@@ -451,21 +562,87 @@ typedef enum : NSUInteger { ...@@ -451,21 +562,87 @@ typedef enum : NSUInteger {
if (buttonIndex == 1) { if (buttonIndex == 1) {
[self dealByAction:PURCHASE_ACTION_APPROVE]; [self dealByAction:PURCHASE_ACTION_APPROVE];
} }
}else if (alertView.tag == AbortTag) {
if (buttonIndex == 1) {
[self dealByAction:TRANSFER_STATE_ABORTED];//作废
}
}else if(alertView.tag == ReceiveTag){
if (buttonIndex == 1) {
// //提交
// self.state = RECEIVE_STATE_RECEIVE;
// [self getDataFromServer:RECEIVE_STATE_RECEIVE msg:@"收货中..."];
[self httpRecieve];
}
} }
} }
- (void)httpRecieve{
NSMutableDictionary *param = [self.bill dictForCommit].mutableCopy;
NSMutableArray *arrProduct = [NSMutableArray array];
for (TransferPdtDetail *pdt in _pvc.productArr) {
PurchaseBillProduct *pPdt = [pdt changeToPurchasePdt];
NSDictionary *dict = [pPdt dictForCommit];
[arrProduct addObject:dict];
}
[param setObject:arrProduct forKey:@"product"];
[param setObject:self.bill.accountDetails forKey:@"accountDetails"];
// IBTLoadingView showHUDAddedTo:self.view animated:<#(BOOL)#>
ICRHTTPController *http = [ICRHTTPController sharedController];
__weak UIViewController *weakSelf = self;
[http recievePurchase:param success:^(id succ) {
if ([succ[@"success"] boolValue]) {
[IBTLoadingView showTips:@" 收货成功! "];
[weakSelf.navigationController popViewControllerAnimated:YES];
}
} failure:^(id fail) {
}];
}
- (void)editReceiveProduct:(NSNotification *)fination{
NewReceiveProductViewController *nvc = [NewReceiveProductViewController new];
NSInteger indexTag = [[[fination userInfo] objectForKey:@"indexPath"] integerValue];
TransferPdtDetail *transferPdtDetail = [[fination userInfo] objectForKey:@"transferPdtDetail"];
if (transferPdtDetail) {
nvc.navTitle = @"商品明细";
nvc.indexTag = indexTag;
nvc.noticeProduct = transferPdtDetail;
}
nvc.editReceiveProduct = ^(TransferPdtDetail *transferPdtDetail,NSInteger indexTag){
if (transferPdtDetail) {
[_pvc.productArr replaceObjectAtIndex:indexTag withObject:transferPdtDetail];
[_pvc.defaultState replaceObjectAtIndex:indexTag withObject:@"YES"];
[_pvc.tableView reloadData];
}
};
[self PushViewController:nvc animated:YES];
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
/* /*
#pragma mark - Navigation #pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation // In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController]. // Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller. // Pass the selected object to the new view controller.
} }
*/ */
@end @end
...@@ -36,7 +36,11 @@ ...@@ -36,7 +36,11 @@
@property (nonatomic,strong)NSString *type;//类型 @property (nonatomic,strong)NSString *type;//类型
@property (nonatomic, strong) NSString *purchaserName;//采购员名字 @property (nonatomic, strong) NSString *purchaserName;//采购员名字
@property (nonatomic, strong) NSString *purchaserCode;//采购员代码 @property (nonatomic, strong) NSString *purchaserCode;//采购员代码
@property (nonatomic, strong) NSString *purchaserUuid;//采购员uuid
@property (strong, nonatomic) NSString *outSideBillNumber;//外部单据号
@property (nonatomic,strong)NSArray *products; @property (nonatomic,strong)NSArray *products;
@property (strong, nonatomic) NSArray *accountDetails; @property (strong, nonatomic) NSArray *accountDetails;
@property (nonatomic, strong) NSString *approv_time;//审核时间
@property (nonatomic, strong) NSString *approv_id;//审核人id
@property (nonatomic, strong) NSString *approv_operName;//审核人
@end @end
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
@property (nonatomic,strong)NSNumber *shippedFlag;//发运标志,0 未发运,1已发运 @property (nonatomic,strong)NSNumber *shippedFlag;//发运标志,0 未发运,1已发运
@property (nonatomic,strong)NSNumber *shippedQty;//发运包装数量 @property (nonatomic,strong)NSNumber *shippedQty;//发运包装数量
@property (nonatomic,strong)NSNumber *shippedBaseQty;//发运基础数量 @property (nonatomic,strong)NSNumber *shippedBaseQty;//发运基础数量
@property (strong, nonatomic) NSNumber *receivedQty;//收货数量
@property (strong, nonatomic) NSNumber *receivedBaseQty;//收货基础数量
......
...@@ -71,7 +71,8 @@ ...@@ -71,7 +71,8 @@
- (void)setPurchaseBill:(PurchaseBill *)purchaseBill{ - (void)setPurchaseBill:(PurchaseBill *)purchaseBill{
self.billNumberLabel.text = [NSString stringWithFormat:@"单号:%@",purchaseBill.billNumber]; self.billNumberLabel.text = [NSString stringWithFormat:@"单号:%@",purchaseBill.billNumber];
self.noticeNumberLabel.text = [NSString stringWithFormat:@"采购通知单号:%@",purchaseBill.noticeNumber.length > 0 ? purchaseBill.noticeNumber: @"无"]; self.noticeNumberLabel.text = [NSString stringWithFormat:@"收货仓库:%@[%@]",
purchaseBill.receiveWrh_name, purchaseBill.receiveWrh_code];
self.vendorLabel.text = [NSString stringWithFormat:@"供应商:%@[%@]",purchaseBill.vendor_name,purchaseBill.vendor_code] ; self.vendorLabel.text = [NSString stringWithFormat:@"供应商:%@[%@]",purchaseBill.vendor_name,purchaseBill.vendor_code] ;
self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseBill.create_operName] ; self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseBill.create_operName] ;
self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseBill.create_time]; self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseBill.create_time];
...@@ -113,6 +114,10 @@ ...@@ -113,6 +114,10 @@
// self.stateBtn.frame = CGRectMake(0 , TopMargin, LeftMargin - TopMargin, 20); // self.stateBtn.frame = CGRectMake(0 , TopMargin, LeftMargin - TopMargin, 20);
stateStr = @"系统处理失败"; stateStr = @"系统处理失败";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled]; [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE]){
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
stateStr = @"待收货";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
} }
[self.stateBtn setTitle:stateStr forState:UIControlStateNormal]; [self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
......
...@@ -17,13 +17,17 @@ ...@@ -17,13 +17,17 @@
@end @end
@interface TopPurchaseView : UIView @interface TopPurchaseView : UIView
@property (nonatomic,strong)UILabel *purchaseNoticeLabel;//采购通知单号 @property (nonatomic,strong)UILabel *purchaserLabel;//采购员
@property (nonatomic,strong)UILabel *purchaseTypeLabel;//类型 @property (nonatomic,strong)UILabel *purchaseTypeLabel;//类型
@property (nonatomic,strong)UILabel *purchaseSupplierLabel;//供应商 @property (nonatomic,strong)UILabel *purchaseSupplierLabel;//供应商
@property (nonatomic,strong)UILabel *purchaseStoreLabel;//收货仓库 @property (nonatomic,strong)UILabel *purchaseStoreLabel;//收货仓库
@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 (strong, nonatomic) UITextField *purchaseExternal;
//数据 //数据
@property (nonatomic,strong)NSString *noticeUuid; @property (nonatomic,strong)NSString *noticeUuid;
@property (nonatomic,strong)NSString *noticeNumber; @property (nonatomic,strong)NSString *noticeNumber;
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
{ {
self.backgroundColor = XXFBgColor; self.backgroundColor = XXFBgColor;
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
NSArray *arr = @[@"采购员:",@"类型:",@"供应商:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"]; NSArray *arr = @[@"采购员:",@"类型:",@"供应商:",@"收货仓库:",@"其他费用:",@"总金额:",@"外部单据号:",@"备注:"];
[_dataArr addObjectsFromArray:arr]; [_dataArr addObjectsFromArray:arr];
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)]; _tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)];
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
_tableView.bounces = NO; _tableView.bounces = NO;
_tableView.delegate = self; _tableView.delegate = self;
_tableView.dataSource = self; _tableView.dataSource = self;
[self addSubview:_tableView]; [self addSubview:_tableView];
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
...@@ -108,7 +109,7 @@ ...@@ -108,7 +109,7 @@
[cell.contentView addSubview:label]; [cell.contentView addSubview:label];
cell.alpha = 0; cell.alpha = 0;
}else if (indexPath.row == _dataArr.count -1){ }else if ([_dataArr[indexPath.row] isEqualToString:@"备注:"]){
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)];
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0); self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1; self.remarkTextView.minNumberOfLines = 1;
...@@ -121,6 +122,15 @@ ...@@ -121,6 +122,15 @@
self.remarkTextView.placeholder = @"输入备注内容"; self.remarkTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:self.remarkTextView]; [cell.contentView addSubview:self.remarkTextView];
}else if ([_dataArr[indexPath.row] isEqualToString:@"外部单据号:"]){
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.delegate = self;
[cell.contentView addSubview:textField];
self.purchaseExternal = textField;
self.purchaseExternal.placeholder = @"输入外部单据号";
}else{ }else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))]; UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight; contentLabel.textAlignment= NSTextAlignmentRight;
...@@ -129,7 +139,7 @@ ...@@ -129,7 +139,7 @@
[cell.contentView addSubview:contentLabel]; [cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) { if (indexPath.row == 0) {
contentLabel.text = @"选择采购员"; contentLabel.text = @"选择采购员";
self.purchaseNoticeLabel = contentLabel; self.purchaserLabel = contentLabel;
}else if(indexPath.row == 1){ }else if(indexPath.row == 1){
contentLabel.text = @"选择类型"; contentLabel.text = @"选择类型";
...@@ -138,6 +148,8 @@ ...@@ -138,6 +148,8 @@
}else if(indexPath.row == 2){ }else if(indexPath.row == 2){
contentLabel.text = @"选择供应商"; contentLabel.text = @"选择供应商";
self.purchaseSupplierLabel = contentLabel; self.purchaseSupplierLabel = contentLabel;
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
self.purchaseTypeLabel.text = @"普通";
}else if(indexPath.row == 3){ }else if(indexPath.row == 3){
contentLabel.text = @"选择收货仓库"; contentLabel.text = @"选择收货仓库";
...@@ -152,7 +164,6 @@ ...@@ -152,7 +164,6 @@
label.textColor = GXF_CONTENT_COLOR; label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE; label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label]; [cell.contentView addSubview:label];
} }
} }
[self prepareDataInCell]; [self prepareDataInCell];
...@@ -160,9 +171,14 @@ ...@@ -160,9 +171,14 @@
//赋值 //赋值
- (void)setBill:(PurchaseBill *)bill{ - (void)setBill:(PurchaseBill *)bill{
if (bill) { if (bill) {
if (bill.noticeUuid.length > 0) {
self.purchaseNoticeLabel.text = bill.noticeNumber; if (bill.purchaserName.length > 0) {
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR; self.selectPerson = [SurveyUser new];
self.selectPerson.userCode = bill.purchaserCode;
self.selectPerson.userName = bill.purchaserName;
self.selectPerson.userUuid = bill.purchaserUuid;
self.purchaserLabel.text = bill.purchaserName;
self.purchaserLabel.textColor = GXF_CONTENT_COLOR;
} }
if (bill.type.length > 0) { if (bill.type.length > 0) {
NSString *type = [bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通"; NSString *type = [bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
...@@ -198,6 +214,8 @@ ...@@ -198,6 +214,8 @@
self.purchasePriceLabel.text = [bill.total stringValue]; self.purchasePriceLabel.text = [bill.total stringValue];
self.total = bill.total; self.total = bill.total;
} }
self.purchaseExternal.text = bill.outSideBillNumber;
if (bill.remark.length > 0) { if (bill.remark.length > 0) {
self.remarkTextView.text = bill.remark; self.remarkTextView.text = bill.remark;
self.remark = bill.remark; self.remark = bill.remark;
...@@ -209,8 +227,8 @@ ...@@ -209,8 +227,8 @@
self.purchasePriceLabel.text = [self.total stringValue]; self.purchasePriceLabel.text = [self.total stringValue];
} }
if (self.noticeNumber.length > 0) { if (self.noticeNumber.length > 0) {
self.purchaseNoticeLabel.text = self.noticeNumber; self.purchaserLabel.text = self.noticeNumber;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR; self.purchaserLabel.textColor = GXF_CONTENT_COLOR;
} }
} }
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
...@@ -271,8 +289,8 @@ ...@@ -271,8 +289,8 @@
cvc.choseBaseInfo = ^(NSArray *users){ cvc.choseBaseInfo = ^(NSArray *users){
if(users.count == 1){ if(users.count == 1){
self.selectPerson = users[0]; self.selectPerson = users[0];
self.purchaseNoticeLabel.text = _selectPerson.userName; self.purchaserLabel.text = _selectPerson.userName;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR; self.purchaserLabel.textColor = GXF_CONTENT_COLOR;
} }
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
...@@ -280,6 +298,15 @@ ...@@ -280,6 +298,15 @@
} }
} }
- (NSString *)type {
if ([self.purchaseTypeLabel.text isEqualToString:@"紧急"]) {
_type = GXF_Critical;
}else{
_type = GXF_Normal;
}
return _type;
}
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{ - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[self.remarkTextView resignFirstResponder]; [self.remarkTextView resignFirstResponder];
return YES; return YES;
......
...@@ -406,7 +406,7 @@ typedef enum : NSUInteger { ...@@ -406,7 +406,7 @@ typedef enum : NSUInteger {
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//选择商品
if(indexPath.row == 0){ if(indexPath.row == 0){
ChooseProductViewController *cvc = [ChooseProductViewController new]; ChooseProductViewController *cvc = [ChooseProductViewController new];
if (self.selectProducts.count > 0) { if (self.selectProducts.count > 0) {
...@@ -432,6 +432,7 @@ typedef enum : NSUInteger { ...@@ -432,6 +432,7 @@ typedef enum : NSUInteger {
_measureUnitLabel.text = self.productMeasureUnit; _measureUnitLabel.text = self.productMeasureUnit;
_baseCountLabel.text = self.productMeasureUnit; _baseCountLabel.text = self.productMeasureUnit;
} }
[self setPackageUnit:product.purMeasureUnit];
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
...@@ -444,11 +445,7 @@ typedef enum : NSUInteger { ...@@ -444,11 +445,7 @@ typedef enum : NSUInteger {
cvc.choseBaseInfo = ^(NSArray *products){ cvc.choseBaseInfo = ^(NSArray *products){
if (products.count > 0) { if (products.count > 0) {
GXFProductUnit *productUnit=products [0]; GXFProductUnit *productUnit=products [0];
_PackagingLable.text = [NSString stringWithFormat:@"%@",productUnit.name]; [self setPackageUnit:productUnit.name];
_PackagingLable.textColor = GXF_CONTENT_COLOR;
_packageCountLabel.text = productUnit.name;
self.packageUintStr = productUnit.name;
self.selectUnit = productUnit.name;
} }
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
...@@ -456,6 +453,19 @@ typedef enum : NSUInteger { ...@@ -456,6 +453,19 @@ typedef enum : NSUInteger {
} }
} }
/**
* 设置包装单位
*
* @param packageUnit 包装单位
*/
- (void)setPackageUnit:(NSString *)packageUnit {
_PackagingLable.text = packageUnit;
_PackagingLable.textColor = GXF_CONTENT_COLOR;
_packageCountLabel.text = packageUnit;
self.packageUintStr = packageUnit;
self.selectUnit = packageUnit;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField.tag != 111) { if (textField.tag != 111) {
return YES; return YES;
......
...@@ -301,8 +301,6 @@ typedef enum : NSUInteger { ...@@ -301,8 +301,6 @@ typedef enum : NSUInteger {
_pvc.isHiddenAdd = YES; _pvc.isHiddenAdd = YES;
_pvc.isHiddenEdit = self.isNotShowEdit; _pvc.isHiddenEdit = self.isNotShowEdit;
[_bottomView addSubview:_pvc.view]; [_bottomView addSubview:_pvc.view];
NSLog(@">>>>>>>>>>>>>>>>>>>>>>>>>>%f", _transportView.bottom);
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
@property (nonatomic,strong)NSString *remark; @property (nonatomic,strong)NSString *remark;
@property (nonatomic,strong)NSString *specification; @property (nonatomic,strong)NSString *specification;
@property (nonatomic,strong)NSString *version; @property (nonatomic,strong)NSString *version;
@property (nonatomic,strong)NSString *purMeasureUnit;//默认采购单位
@end @end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "IBTModel.h" #import "IBTModel.h"
#import "PurchaseBillProduct.h"
@interface TransferPdtDetail : IBTModel @interface TransferPdtDetail : IBTModel
@property (nonatomic,strong)NSString *uuid; //唯一标识 @property (nonatomic,strong)NSString *uuid; //唯一标识
@property (nonatomic,strong)NSString *productUuid; //商品id @property (nonatomic,strong)NSString *productUuid; //商品id
...@@ -37,4 +37,25 @@ ...@@ -37,4 +37,25 @@
@property (nonatomic,strong)NSString *carnumber; //车牌号 @property (nonatomic,strong)NSString *carnumber; //车牌号
//采购单商品对象
//@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)NSString *baseUnit;//规格单位
//@property (nonatomic,strong)NSNumber *total;// 金额
@property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,strong)NSNumber *shippedFlag;//发运标志,0 未发运,1已发运
@property (nonatomic,strong)NSNumber *shippedQty;//发运包装数量
@property (nonatomic,strong)NSNumber *shippedBaseQty;//发运基础数量
@property (strong, nonatomic) PurchaseBillProduct *purchasePdt;
- (PurchaseBillProduct *)changeToPurchasePdt;
@end @end
...@@ -10,4 +10,23 @@ ...@@ -10,4 +10,23 @@
@implementation TransferPdtDetail @implementation TransferPdtDetail
- (void)setPurchasePdt:(PurchaseBillProduct *)purchasePdt {
_purchasePdt = purchasePdt;
self.productUuid = purchasePdt.product_uuid;
self.productCode = purchasePdt.product_code;
self.productName = purchasePdt.product_name;
self.price = purchasePdt.basePrice;
self.packprice = purchasePdt.price;
}
- (PurchaseBillProduct *)changeToPurchasePdt {
if (!self.purchasePdt) {
self.purchasePdt = [PurchaseBillProduct new];
NSDictionary *dict = [self dictForCommit];
[self.purchasePdt setValuesForKeysWithDictionary:dict];
}
self.purchasePdt.receivedQty = self.rctQty;
self.purchasePdt.receivedBaseQty = self.rctBaseQty;
return self.purchasePdt;
}
@end @end
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