Commit 4a62d8c4 authored by Sandy's avatar Sandy

非产品中心非wms仓收货

parent 1fb47ad6
......@@ -329,7 +329,11 @@ static NSString *ICRDataBasePath = @"";
[_m_dbQueue inDatabase:^(FMDatabase *db) {
// [db open];
//2017-05-08仓库增加了iswms 和 isproductcenter两个字段
/*
2017-05-08
Warehouse 增加了iswms 和 isproductcenter两个字段
Product 增加了purMeasureUnit默认采购单位字段
*/
if (![db columnExists:@"iswms" inTableWithName:@"Warehouse"]) {
CLog(@"没有iswms 和 isproductcenter两个字段");
......@@ -340,6 +344,16 @@ static NSString *ICRDataBasePath = @"";
[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];
}];
}
......
......@@ -354,6 +354,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//5.采购单收货
- (void)recievePurchase:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//1.添加发运单
- (void)saveTransportWithData:(id)data
success:(void (^)(id))succ
......
......@@ -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 - 添加发运单
- (void)saveTransportWithData:(id)data
success:(void (^)(id))succ
......
......@@ -149,6 +149,8 @@
#define PURCHASE_STATE_ABORTED @"aborted" //已作废
#define PURCHASE_STATE_PROCESS @"process"//提交系统处理
#define PURCHASE_STATE_PROCESSFAIL @"processFail"//系统处理失败
#define PURCHASE_STATE_WAITE_RECIEVE @"waitReceive"//待收货
//采购单操作
#define PURCHASE_ACTION_REJECT @"reject"
#define PURCHASE_ACTION_APPROVE @"approve"
......
......@@ -120,7 +120,7 @@ typedef enum : NSUInteger {
[arr addObject:billProduct];
}
_aBottomView.productVC.productArr = arr;
[_aBottomView.productVC.tableView reloadData];
[_aBottomView.productVC.tableView reloadData];
NSMutableArray *arrCost = [NSMutableArray array];
......@@ -181,18 +181,18 @@ typedef enum : NSUInteger {
[footView addSubview:commitBtn];
[self.view addSubview:footView];
_purchaseView = [[TopPurchaseView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TopHeight)];
_purchaseView.delegate = self;
[_scrollView addSubview:_purchaseView];
// _bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight)];
// _bottomView.backgroundColor = [UIColor whiteColor];
// [_scrollView addSubview:_bottomView];
//
// _pvc = [[ProductBillViewController alloc]init];
// _pvc.viewFrame = _bottomView.bounds;
// [_bottomView addSubview:_pvc.view];
// _bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight)];
// _bottomView.backgroundColor = [UIColor whiteColor];
// [_scrollView addSubview:_bottomView];
//
// _pvc = [[ProductBillViewController alloc]init];
// _pvc.viewFrame = _bottomView.bounds;
// [_bottomView addSubview:_pvc.view];
_aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + 20, ScreenSize.width,BottomHeight) withHidden:NO];
_aBottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_aBottomView];
......@@ -203,14 +203,14 @@ typedef enum : NSUInteger {
- (void)setProductTotalPrice:(NSNotification *)fication{
//计算总金额
NSDecimalNumber *otherPrice = [NSDecimalNumber decimalNumberWithString:@"0"];
// if (_aBottomView.costVC.costArr.count == 0) {
// otherPrice = [_purchaseView.otherPriceFiled.text floatValue];
// }else{
for (FeeAcountDetail *cost in _aBottomView.costVC.costArr) {
otherPrice = [CalculateHelper calculateNum1:otherPrice num2:cost.leftmoney type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10];
}
_purchaseView.otherPriceFiled.text = [NSString stringWithFormat:@"%@", otherPrice];
// }
// if (_aBottomView.costVC.costArr.count == 0) {
// otherPrice = [_purchaseView.otherPriceFiled.text floatValue];
// }else{
for (FeeAcountDetail *cost in _aBottomView.costVC.costArr) {
otherPrice = [CalculateHelper calculateNum1:otherPrice num2:cost.leftmoney type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10];
}
_purchaseView.otherPriceFiled.text = [NSString stringWithFormat:@"%@", otherPrice];
// }
//其他费用 + 商品总金额
......@@ -225,7 +225,7 @@ typedef enum : NSUInteger {
_purchaseView.chargePurchase = otherPrice;
......@@ -261,7 +261,7 @@ typedef enum : NSUInteger {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
};
}
svc.title = [IBTCommon localizableString:@"AddShopDetail"];
[self PushViewController:svc animated:YES];
}
......@@ -368,6 +368,7 @@ typedef enum : NSUInteger {
@"total":_purchaseView.total,
@"charge":_purchaseView.chargePurchase,
@"remark":[IBTCommon checkString:_purchaseView.remark],
@"outSideBillNumber":[IBTCommon checkString:_purchaseView.purchaseExternal.text],
@"products":billProducts,
@"accountDetails":costs};
[IBTLoadingView showProgressLabel:msg];
......@@ -392,6 +393,10 @@ typedef enum : NSUInteger {
ShowMessage(@"收货仓库不能为空");
return NO;
}
if (_purchaseView.purchaseExternal.text == 0) {
ShowMessage(@"外部单据号不能为空");
return NO;
}
if (_aBottomView.productVC.productArr.count == 0) {
ShowMessage(@"采购商品不能为空");
return NO;
......@@ -405,12 +410,12 @@ typedef enum : NSUInteger {
ShowMessage(@"有数量等于0的商品明细,请编辑后保存");
return NO;
}
// if ([billProduct.price floatValue] <=0 || [billProduct.basePrice floatValue] <= 0) {
// ShowMessage(@"有价格未填写的商品明细,请编辑后保存");
// return NO;
// }
// if ([billProduct.price floatValue] <=0 || [billProduct.basePrice floatValue] <= 0) {
// ShowMessage(@"有价格未填写的商品明细,请编辑后保存");
// return NO;
// }
}
return YES;
}
......@@ -461,7 +466,7 @@ typedef enum : NSUInteger {
NSMutableArray *billArr = [NSMutableArray array];
for (NoticeProduct *product in arr) {
PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
// billProduct.uuid = product.uuid;
// billProduct.uuid = product.uuid;
billProduct.product_name = product.productName;
billProduct.product_uuid = product.productUuid;
billProduct.product_code = product.productCode;
......@@ -507,13 +512,13 @@ typedef enum : NSUInteger {
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -8,6 +8,19 @@
#import "ICRBaseViewController.h"
#import "PurchaseBill.h"
/**
* 采购单状态
*/
typedef NS_ENUM(NSInteger, PurchaseType) {
/**
* 审核之前的状态(已保存、已提交)
*/
PurchaseTypeBeforeVerify = 1,
/**
* 审核之后的状态(待收货、发运中等。。)
*/
PurchaseTypeAfterVerify,
};
@interface PurchaseDetailViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill;
......@@ -15,4 +28,8 @@
//显示样式
@property (nonatomic,assign)NSInteger indexStyle;//0.1.2
@property (nonatomic, assign) PurchaseType type;
@end
......@@ -10,6 +10,9 @@
#import "ProductBillViewController.h"
#import "PurchaseBillProduct.h"
#import "BottomPurchaseView.h"
#import "ReceiveProductViewController.h"
#import "TransferPdtDetail.h"
#import "NewReceiveProductViewController.h"
//#import "RejectView.h"
#define BottomHeight 50
#define LeftMargin 15
......@@ -24,7 +27,9 @@ typedef enum : NSUInteger {
RejectTag, //拒绝
PassTag, //审核
SureTag, //确定
SaveTag, //收货状态:保存
ReceiveTag,//收货状态:收货
AbortTag//收货状态:作废
} BtnTag;
@interface PurchaseDetailViewController ()<UIAlertViewDelegate>
......@@ -37,7 +42,9 @@ typedef enum : NSUInteger {
UIButton *_firstBtn;
UIButton *_secondBtn;
BottomPurchaseView *_aBottomView;
UIView *_recieveBottomView;
ReceiveProductViewController *_pvc;
}
@property (nonatomic,strong)UILabel *billNumberLabel;
@property (nonatomic,strong)UILabel *noticeNumberLabel;
......@@ -51,10 +58,15 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)UILabel *vendorIsSureLabel;
@property (nonatomic,strong)UILabel *warehouseLabel;
@property (nonatomic,strong)UILabel *otherPriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel;
@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)NSString *rejectCause;//拒接原因
......@@ -64,6 +76,12 @@ typedef enum : NSUInteger {
- (void)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 getDataFromServer];
}
......@@ -80,6 +98,7 @@ typedef enum : NSUInteger {
PurchaseBill *bill = [[PurchaseBill alloc]init];
[bill setValuesForKeysWithDictionary:dictData];
self.bill = bill;
[_aBottomView refreshCost:dictData[@"accountDetails"]];
[strongSelf fetchtPurchaseDetail];
}else{
......@@ -105,7 +124,7 @@ typedef enum : NSUInteger {
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView];
// [self createBtn];
// [self createBtn];
[self showBtnByPermissions];
[self createBottomView];
[self createPurchaseView];
......@@ -135,6 +154,12 @@ typedef enum : NSUInteger {
btnTag = EndTag;
}else if ([arr[i] isEqualToString:@"作废"]) {
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);
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];
......@@ -159,11 +184,11 @@ typedef enum : NSUInteger {
[arr addObject:@"确认"];
}
if ([self checkIsPermission:PURCHASE_PERMISSIONS_FINISH]){//结束权
//显示结束按钮
//显示结束按钮
[arr addObject:@"结束"];
}
if([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]){//作废权
//显示作废按钮
//显示作废按钮
[arr addObject:@"作废"];
}
[self createBtnWithArr:arr];
......@@ -175,7 +200,7 @@ typedef enum : NSUInteger {
//显示作废按钮
NSArray *arr = @[@"作废"];
[self createBtnWithArr:arr];
}else{
[self hiddenTwoBtn];
}
......@@ -188,10 +213,18 @@ typedef enum : NSUInteger {
}else{
[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];
}else{
[self hiddenTwoBtn];
[self hiddenTwoBtn];
}
}
......@@ -260,6 +293,32 @@ typedef enum : NSUInteger {
{
CLog(@"确认");
[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;
default:
......@@ -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];
}
- (void)createBottomView{
// _bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width, 300)];
// _bottomView.backgroundColor = [UIColor whiteColor];
// [_scrollView addSubview:_bottomView];
//
// _pvc = [[ProductBillViewController alloc]init];
// [self addChildViewController:_pvc];
//
// _pvc.viewFrame = _bottomView.bounds;
// _pvc.isHiddenEdit = YES;
// [_bottomView addSubview:_pvc.view];
- (BOOL)checkReceive{
for (NSString *isEdit in _pvc.defaultState) {
if ([isEdit isEqualToString:@"NO"]) {
ShowMessage(@"有商品行没有编辑过收货数量,请先编辑再收货");
return NO;
}
}
if (_pvc.productArr.count == 0) {
ShowMessage(@"商品不能为空");
return NO;
}
_aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300) withHidden:YES];
_aBottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_aBottomView];
return YES;
}
- (void)createPurchaseView{
_leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"最后修改人:",@"采购员:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"];
- (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.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_aBottomView];
}
}
- (void)createPurchaseView{
_leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"创建时间:",@"审核人:",@"审核时间:",@"收货人:",@"收货时间:",@"采购员:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"外部单据号:",@"备注:"];
_purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*_leftArr.count +LeftMargin)];
_purchaseView.backgroundColor = [UIColor whiteColor];
[_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)];
leftLabel.font = GXF_SEVENTEENTH_SIZE;
leftLabel.text = _leftArr[i];
......@@ -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)];
rightLabel.font = GXF_SEVENTEENTH_SIZE;
rightLabel.textColor = GXF_DETAIL_COLOR;
if (i == 0) {
if ([title isEqualToString:@"单号:"]) {
self.billNumberLabel = rightLabel;
}else if (i == 1) {
}else if ([title isEqualToString:@"采购通知单:"]){
self.noticeNumberLabel = rightLabel;
}else if(i == 2){
}else if ([title isEqualToString:@"创建人:"]){
self.createOperNameLabel = rightLabel;
}else if (i == 3){
}else if ([title isEqualToString:@"最后修改人:"]){
self.lastModifyNameLabel = rightLabel;
}
else if (i == 4){
}else if ([title isEqualToString:@"采购员:"]){
self.purchaserLabel = rightLabel;
}else if(i == 5){
}else if ([title isEqualToString:@"状态:"]){
self.stateLabel = rightLabel;
}else if(i == 6){
}else if ([title isEqualToString:@"类型:"]){
self.typeLabel = rightLabel;
}else if(i == 7){
}else if ([title isEqualToString:@"供应商:"]){
self.vendorNameLabel = rightLabel;
}else if(i == 8){
}else if ([title isEqualToString:@"供应商确认:"]){
self.vendorIsSureLabel = rightLabel;
}else if(i == 9){
}else if ([title isEqualToString:@"收货仓库:"]){
self.warehouseLabel = rightLabel;
}else if(i == _leftArr.count - 3){
}else if ([title isEqualToString:@"其他费用:"]){
self.otherPriceLabel = rightLabel;
}else if(i == _leftArr.count - 2){
}else if ([title isEqualToString:@"总金额:"]){
self.totalPriceLabel = rightLabel;
}else if(i == _leftArr.count - 1){
}else if ([title isEqualToString:@"备注:"]){
rightLabel.numberOfLines = 0;
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];
}
}
......@@ -400,14 +485,34 @@ typedef enum : NSUInteger {
self.vendorIsSureLabel.text = (self.bill.vendorConfirmTime.length > 0 && self.bill.vendorConfirmTime)? @"是":@"否";
self.warehouseLabel.text = [IBTCommon checkString:self.bill.receiveWrh_name];
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];
for (NSDictionary *billDict in self.bill.products) {
PurchaseBillProduct *billProbuct = [PurchaseBillProduct new];
[billProbuct setValuesForKeysWithDictionary:billDict];
[productArr addObject:billProbuct];
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) {
PurchaseBillProduct *billProbuct = [PurchaseBillProduct new];
[billProbuct setValuesForKeysWithDictionary:billDict];
[productArr addObject:billProbuct];
}
_aBottomView.productVC.productArr = productArr;
[_aBottomView.productVC.tableView reloadData];
}
_aBottomView.productVC.productArr = productArr;
[_aBottomView.productVC.tableView reloadData];
[self setNoteHeight];
}
......@@ -425,19 +530,25 @@ typedef enum : NSUInteger {
purchaseFrame.size.height = totalHeight;
_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;
bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
_aBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_aBottomView.frame) + TopMargin*2);
}
CGRect bottomFrame = _aBottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
_aBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_aBottomView.frame) + TopMargin*2);
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (alertView.tag == CancleTag) {
if (buttonIndex == 1) {
[self dealByAction:PURCHASE_ACTION_ABORT];//作废
}
}else if (alertView.tag == EndTag){
if (buttonIndex == 1) {
......@@ -451,21 +562,87 @@ typedef enum : NSUInteger {
if (buttonIndex == 1) {
[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 {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -36,7 +36,11 @@
@property (nonatomic,strong)NSString *type;//类型
@property (nonatomic, strong) NSString *purchaserName;//采购员名字
@property (nonatomic, strong) NSString *purchaserCode;//采购员代码
@property (nonatomic, strong) NSString *purchaserUuid;//采购员uuid
@property (strong, nonatomic) NSString *outSideBillNumber;//外部单据号
@property (nonatomic,strong)NSArray *products;
@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
......@@ -26,6 +26,9 @@
@property (nonatomic,strong)NSNumber *shippedFlag;//发运标志,0 未发运,1已发运
@property (nonatomic,strong)NSNumber *shippedQty;//发运包装数量
@property (nonatomic,strong)NSNumber *shippedBaseQty;//发运基础数量
@property (strong, nonatomic) NSNumber *receivedQty;//收货数量
@property (strong, nonatomic) NSNumber *receivedBaseQty;//收货基础数量
......
......@@ -71,7 +71,8 @@
- (void)setPurchaseBill:(PurchaseBill *)purchaseBill{
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.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseBill.create_operName] ;
self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseBill.create_time];
......@@ -113,6 +114,10 @@
// self.stateBtn.frame = CGRectMake(0 , TopMargin, LeftMargin - TopMargin, 20);
stateStr = @"系统处理失败";
[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];
......
......@@ -17,13 +17,17 @@
@end
@interface TopPurchaseView : UIView
@property (nonatomic,strong)UILabel *purchaseNoticeLabel;//采购通知单号
@property (nonatomic,strong)UILabel *purchaserLabel;//采购员
@property (nonatomic,strong)UILabel *purchaseTypeLabel;//类型
@property (nonatomic,strong)UILabel *purchaseSupplierLabel;//供应商
@property (nonatomic,strong)UILabel *purchaseStoreLabel;//收货仓库
@property (nonatomic,strong)UITextField *otherPriceFiled;//其他费用
@property (nonatomic,strong)UILabel *purchasePriceLabel;//总金额
@property (nonatomic,strong)HPGrowingTextView *remarkTextView;//备注
/**
* 外部单据号
*/
@property (strong, nonatomic) UITextField *purchaseExternal;
//数据
@property (nonatomic,strong)NSString *noticeUuid;
@property (nonatomic,strong)NSString *noticeNumber;
......
......@@ -47,7 +47,7 @@
{
self.backgroundColor = XXFBgColor;
_dataArr = [NSMutableArray array];
NSArray *arr = @[@"采购员:",@"类型:",@"供应商:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"];
NSArray *arr = @[@"采购员:",@"类型:",@"供应商:",@"收货仓库:",@"其他费用:",@"总金额:",@"外部单据号:",@"备注:"];
[_dataArr addObjectsFromArray:arr];
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)];
......@@ -55,6 +55,7 @@
_tableView.bounces = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
[self addSubview:_tableView];
}
#pragma mark - 协议方法
......@@ -108,7 +109,7 @@
[cell.contentView addSubview:label];
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.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
......@@ -121,6 +122,15 @@
self.remarkTextView.placeholder = @"输入备注内容";
[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{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
......@@ -129,7 +139,7 @@
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) {
contentLabel.text = @"选择采购员";
self.purchaseNoticeLabel = contentLabel;
self.purchaserLabel = contentLabel;
}else if(indexPath.row == 1){
contentLabel.text = @"选择类型";
......@@ -138,6 +148,8 @@
}else if(indexPath.row == 2){
contentLabel.text = @"选择供应商";
self.purchaseSupplierLabel = contentLabel;
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
self.purchaseTypeLabel.text = @"普通";
}else if(indexPath.row == 3){
contentLabel.text = @"选择收货仓库";
......@@ -152,7 +164,6 @@
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
}
}
[self prepareDataInCell];
......@@ -160,9 +171,14 @@
//赋值
- (void)setBill:(PurchaseBill *)bill{
if (bill) {
if (bill.noticeUuid.length > 0) {
self.purchaseNoticeLabel.text = bill.noticeNumber;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR;
if (bill.purchaserName.length > 0) {
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) {
NSString *type = [bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
......@@ -198,6 +214,8 @@
self.purchasePriceLabel.text = [bill.total stringValue];
self.total = bill.total;
}
self.purchaseExternal.text = bill.outSideBillNumber;
if (bill.remark.length > 0) {
self.remarkTextView.text = bill.remark;
self.remark = bill.remark;
......@@ -209,8 +227,8 @@
self.purchasePriceLabel.text = [self.total stringValue];
}
if (self.noticeNumber.length > 0) {
self.purchaseNoticeLabel.text = self.noticeNumber;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR;
self.purchaserLabel.text = self.noticeNumber;
self.purchaserLabel.textColor = GXF_CONTENT_COLOR;
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
......@@ -271,8 +289,8 @@
cvc.choseBaseInfo = ^(NSArray *users){
if(users.count == 1){
self.selectPerson = users[0];
self.purchaseNoticeLabel.text = _selectPerson.userName;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR;
self.purchaserLabel.text = _selectPerson.userName;
self.purchaserLabel.textColor = GXF_CONTENT_COLOR;
}
};
cvc.isMoreChose = NO;
......@@ -280,6 +298,15 @@
}
}
- (NSString *)type {
if ([self.purchaseTypeLabel.text isEqualToString:@"紧急"]) {
_type = GXF_Critical;
}else{
_type = GXF_Normal;
}
return _type;
}
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[self.remarkTextView resignFirstResponder];
return YES;
......
......@@ -406,7 +406,7 @@ typedef enum : NSUInteger {
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//选择商品
if(indexPath.row == 0){
ChooseProductViewController *cvc = [ChooseProductViewController new];
if (self.selectProducts.count > 0) {
......@@ -432,6 +432,7 @@ typedef enum : NSUInteger {
_measureUnitLabel.text = self.productMeasureUnit;
_baseCountLabel.text = self.productMeasureUnit;
}
[self setPackageUnit:product.purMeasureUnit];
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
......@@ -444,11 +445,7 @@ typedef enum : NSUInteger {
cvc.choseBaseInfo = ^(NSArray *products){
if (products.count > 0) {
GXFProductUnit *productUnit=products [0];
_PackagingLable.text = [NSString stringWithFormat:@"%@",productUnit.name];
_PackagingLable.textColor = GXF_CONTENT_COLOR;
_packageCountLabel.text = productUnit.name;
self.packageUintStr = productUnit.name;
self.selectUnit = productUnit.name;
[self setPackageUnit:productUnit.name];
}
};
cvc.isMoreChose = NO;
......@@ -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 {
if (textField.tag != 111) {
return YES;
......
......@@ -301,8 +301,6 @@ typedef enum : NSUInteger {
_pvc.isHiddenAdd = YES;
_pvc.isHiddenEdit = self.isNotShowEdit;
[_bottomView addSubview:_pvc.view];
NSLog(@">>>>>>>>>>>>>>>>>>>>>>>>>>%f", _transportView.bottom);
}
......
......@@ -33,6 +33,7 @@
@property (nonatomic,strong)NSString *remark;
@property (nonatomic,strong)NSString *specification;
@property (nonatomic,strong)NSString *version;
@property (nonatomic,strong)NSString *purMeasureUnit;//默认采购单位
@end
......@@ -7,7 +7,7 @@
//
#import "IBTModel.h"
#import "PurchaseBillProduct.h"
@interface TransferPdtDetail : IBTModel
@property (nonatomic,strong)NSString *uuid; //唯一标识
@property (nonatomic,strong)NSString *productUuid; //商品id
......@@ -37,4 +37,25 @@
@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
......@@ -10,4 +10,23 @@
@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
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