Commit 70926883 authored by Sandy's avatar Sandy

发运单收货逻辑完成

parent c8199aad
...@@ -4432,7 +4432,7 @@ ...@@ -4432,7 +4432,7 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit; PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit;
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "e2cec26c-3666-4512-9b9a-cdb4cd9da56d"; PROVISIONING_PROFILE = "";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Debug; name = Debug;
...@@ -4457,7 +4457,7 @@ ...@@ -4457,7 +4457,7 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit; PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit;
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "e2cec26c-3666-4512-9b9a-cdb4cd9da56d"; PROVISIONING_PROFILE = "";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Release; name = Release;
......
...@@ -358,6 +358,16 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -358,6 +358,16 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
- (void)recievePurchase:(id)data - (void)recievePurchase:(id)data
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
/**
* 发运单收货
*
* @param data data description
* @param succ succ description
* @param fail fail description
*/
- (void)recieveTransport:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
/** /**
* 获取采购单库存库存 * 获取采购单库存库存
* *
......
...@@ -2386,6 +2386,34 @@ acceptTypeJson:YES ...@@ -2386,6 +2386,34 @@ acceptTypeJson:YES
success:success success:success
failure:failure]; failure:failure];
} }
- (void)recieveTransport:(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:@"%@/transport/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];
}
/** /**
* 获取采购单库存库存 * 获取采购单库存库存
* *
......
...@@ -185,12 +185,15 @@ ...@@ -185,12 +185,15 @@
//发运单状态 //发运单状态
#define TRANSPORT_STATE_INITIAL @"initial" //未提交 #define TRANSPORT_STATE_INITIAL @"initial" //未提交
#define TRANSPORT_STATE_UNRECEIVED @"unreceived"//未收货 #define TRANSPORT_STATE_UNRECEIVED @"waitReceive"//未收货
#define TRANSPORT_STATE_RECEIVED @"received" //已收货 #define TRANSPORT_STATE_RECEIVED @"received" //已收货
#define TRANSPORT_STATE_ABORTED @"aborted" //已废用 #define TRANSPORT_STATE_ABORTED @"aborted" //已废用
#define TRANSPORT_STATE_FINISHED @"finished" //已完成 #define TRANSPORT_STATE_FINISHED @"finished" //已完成
#define TRANSPORT_STATE_PROCESS @"process"//提交系统处理 #define TRANSPORT_STATE_PROCESS @"process"//提交系统处理
#define TRANSPORT_STATE_PROCESSFAIL @"processFail"//系统处理失败 #define TRANSPORT_STATE_PROCESSFAIL @"processFail"//系统处理失败
//采购通知单状态 //采购通知单状态
//initial("未提交"), notAccepted("未接受"), purchasing("采购中"), finished("已完成") //initial("未提交"), notAccepted("未接受"), purchasing("采购中"), finished("已完成")
#define PURCHASENOTICE_STATE_INITIAL @"initial" #define PURCHASENOTICE_STATE_INITIAL @"initial"
......
...@@ -88,8 +88,6 @@ typedef enum : NSUInteger { ...@@ -88,8 +88,6 @@ typedef enum : NSUInteger {
* 外部单据号 * 外部单据号
*/ */
@property (strong, nonatomic) UILabel *labelOutSideNum; @property (strong, nonatomic) UILabel *labelOutSideNum;
@property (nonatomic,assign)BOOL isNotShowEdit;
//@property (nonatomic,strong)RejectView *rejectView;
@property (nonatomic,strong)NSString *rejectCause;//拒接原因 @property (nonatomic,strong)NSString *rejectCause;//拒接原因
@end @end
...@@ -103,7 +101,9 @@ typedef enum : NSUInteger { ...@@ -103,7 +101,9 @@ typedef enum : NSUInteger {
[self bulidLayout]; [self bulidLayout];
[self getDataFromServer]; [self getDataFromServer];
} }
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)judgeType { - (void)judgeType {
if ([self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE] || if ([self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE] ||
[self.bill.state isEqualToString:PURCHASE_STATE_RECEIVED] || [self.bill.state isEqualToString:PURCHASE_STATE_RECEIVED] ||
...@@ -415,7 +415,6 @@ typedef enum : NSUInteger { ...@@ -415,7 +415,6 @@ typedef enum : NSUInteger {
_pvc = [[ReceiveProductViewController alloc]init]; _pvc = [[ReceiveProductViewController alloc]init];
_pvc.viewFrame = _recieveBottomView.bounds; _pvc.viewFrame = _recieveBottomView.bounds;
_pvc.isHiddenAdd = YES; _pvc.isHiddenAdd = YES;
_pvc.isHiddenEdit = self.isNotShowEdit;
[_recieveBottomView addSubview:_pvc.view]; [_recieveBottomView addSubview:_pvc.view];
}else{ }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];
...@@ -552,16 +551,20 @@ typedef enum : NSUInteger { ...@@ -552,16 +551,20 @@ typedef enum : NSUInteger {
[p setValuesForKeysWithDictionary:billDict]; [p setValuesForKeysWithDictionary:billDict];
billProbuct.purchasePdt = p; billProbuct.purchasePdt = p;
if (self.isCenter) { if ([self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE]) {
[billProbuct z_setRctQty:p.qty.floatValue];
}else if (self.isWms){ if (self.isCenter) {
[billProbuct z_setRctQty:0]; [billProbuct z_setRctQty:p.qty.floatValue];
}else if (self.isWms){
[billProbuct z_setRctQty:0];
}
} }
[productArr addObject:billProbuct]; [productArr addObject:billProbuct];
} }
_pvc.productArr = productArr; _pvc.productArr = productArr;
[_pvc.tableView reloadData]; [_pvc.tableView reloadData];
//如果是wms,非中心仓,则审核直接收货
if (self.isWms && self.isCenter == NO) { if (self.isWms && self.isCenter == NO) {
[self httpRecieve]; [self httpRecieve];
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import "IBTModel.h" #import "IBTModel.h"
#import "PurchaseBillProduct.h" #import "PurchaseBillProduct.h"
#import "TransportPdtDetail.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
...@@ -56,7 +57,9 @@ ...@@ -56,7 +57,9 @@
@property (nonatomic,strong)NSNumber *shippedQty;//发运包装数量 @property (nonatomic,strong)NSNumber *shippedQty;//发运包装数量
@property (nonatomic,strong)NSNumber *shippedBaseQty;//发运基础数量 @property (nonatomic,strong)NSNumber *shippedBaseQty;//发运基础数量
@property (strong, nonatomic) PurchaseBillProduct *purchasePdt; @property (strong, nonatomic) PurchaseBillProduct *purchasePdt;
@property (strong, nonatomic) TransportPdtDetail *transportPdt;
- (PurchaseBillProduct *)changeToPurchasePdt; - (PurchaseBillProduct *)changeToPurchasePdt;
- (TransportPdtDetail *)changeToTransportPdt;
- (void)z_setRctQty:(CGFloat)qty; - (void)z_setRctQty:(CGFloat)qty;
@end @end
...@@ -19,6 +19,13 @@ ...@@ -19,6 +19,13 @@
self.packprice = purchasePdt.price; self.packprice = purchasePdt.price;
self.rctQty = purchasePdt.receivedQty; self.rctQty = purchasePdt.receivedQty;
self.rctBaseQty = purchasePdt.receivedBaseQty; self.rctBaseQty = purchasePdt.receivedBaseQty;
}
- (void)setTransportPdt:(TransportPdtDetail *)transportPdt {
_transportPdt = transportPdt;
self.rctQty = transportPdt.receivedQty;
self.rctBaseQty = transportPdt.receivedBaseQty;
} }
- (PurchaseBillProduct *)changeToPurchasePdt { - (PurchaseBillProduct *)changeToPurchasePdt {
...@@ -32,6 +39,17 @@ ...@@ -32,6 +39,17 @@
return self.purchasePdt; return self.purchasePdt;
} }
- (TransportPdtDetail *)changeToTransportPdt {
if (!self.transportPdt) {
self.transportPdt = [TransportPdtDetail new];
NSDictionary *dict = [self dictForCommit];
[self.transportPdt setValuesForKeysWithDictionary:dict];
}
self.transportPdt.receivedQty = self.rctQty;
self.transportPdt.receivedBaseQty = self.rctBaseQty;
return self.transportPdt;
}
- (void)z_setRctQty:(CGFloat)qty { - (void)z_setRctQty:(CGFloat)qty {
//基础数量【实收】= 包装数量【实收】* 规格 //基础数量【实收】= 包装数量【实收】* 规格
float baseCount = qty * [self.qpc floatValue]; float baseCount = qty * [self.qpc floatValue];
......
...@@ -209,11 +209,20 @@ typedef enum : NSUInteger { ...@@ -209,11 +209,20 @@ typedef enum : NSUInteger {
[costs addObject:[fee dictForCommit]]; [costs addObject:[fee dictForCommit]];
} }
//获取到期时间
NSString *dateString = [[NSDate date] httpParameterString];
NSDateFormatter *f = [NSDateFormatter new];
[f setDateFormat:@"yyy-MM-dd HH:ss:mm"];
NSDate *date = [f dateFromString:dateString];
NSDate *new = [NSDate dateWithTimeInterval:60 * 60 * 24 * 5 sinceDate:date];
NSString *expiredTime = [f stringFromDate:new];
NSDictionary *dict = @{@"uuid":uuidObject, NSDictionary *dict = @{@"uuid":uuidObject,
@"version":versionObject, @"version":versionObject,
@"billnumber":billNumberObject, @"billnumber":billNumberObject,
@"enterprise":[ICRUserUtil sharedInstance].orgId, @"enterprise":[ICRUserUtil sharedInstance].orgId,
@"state":stateObject, @"state":stateObject,
@"expiredDate":expiredTime,
@"warehouseUuid":[IBTCommon checkString:_sheetView.warehouseUuid], @"warehouseUuid":[IBTCommon checkString:_sheetView.warehouseUuid],
@"warehouseCode":[IBTCommon checkString:_sheetView.warehouseCode], @"warehouseCode":[IBTCommon checkString:_sheetView.warehouseCode],
@"warehouseName":[IBTCommon checkString:_sheetView.warehouseName], @"warehouseName":[IBTCommon checkString:_sheetView.warehouseName],
......
...@@ -8,6 +8,26 @@ ...@@ -8,6 +8,26 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
#import "Transport.h" #import "Transport.h"
/**
* 发运单状态
*/
typedef NS_ENUM(NSInteger, TransportType) {
/**
* 审核之前的状态(已保存、已提交)
*/
TransportTypeBeforeSubmit = 1,
/**
* 审核之后的状态(待收货、发运中等。。)
*/
TransportTypeAfterSubmit,
};
@interface TransportDetailViewController : ICRBaseViewController @interface TransportDetailViewController : ICRBaseViewController
@property (nonatomic,strong)Transport *transport; @property (nonatomic,strong)Transport *transport;
@property (assign, nonatomic) TransportType type;
/**
* 收货仓库是否wms
*/
@property (nonatomic, assign) BOOL isWms;
@end @end
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
#import "TransportPdtDetail.h" #import "TransportPdtDetail.h"
#import "FeeAcountDetail.h" #import "FeeAcountDetail.h"
#import "BottomTransportView.h" #import "BottomTransportView.h"
#import "TransferPdtDetail.h"
#import "ReceiveProductViewController.h"
#import "NewReceiveProductViewController.h"
#define BottomHeight 50 #define BottomHeight 50
#define LeftMargin 15 #define LeftMargin 15
#define LeftWidth 130 #define LeftWidth 130
...@@ -20,8 +25,8 @@ ...@@ -20,8 +25,8 @@
typedef enum : NSUInteger { typedef enum : NSUInteger {
AbortTag = 20000, AbortTag = 20000,
EndTag, EndTag,
SubmitTag SubmitTag,
ReceiveTag,//收货状态:收货
} BtnTag; } BtnTag;
@interface TransportDetailViewController () @interface TransportDetailViewController ()
...@@ -32,6 +37,9 @@ typedef enum : NSUInteger { ...@@ -32,6 +37,9 @@ typedef enum : NSUInteger {
UIButton *_firstBtn; UIButton *_firstBtn;
UIButton *_secondBtn; UIButton *_secondBtn;
BottomTransportView *_transView; BottomTransportView *_transView;
ReceiveProductViewController *_pvc;
UIView *_recieveBottomView;
} }
@property (nonatomic,strong)UILabel *billNumberLabel; @property (nonatomic,strong)UILabel *billNumberLabel;
@property (nonatomic,strong)UILabel *purchaseLabel; @property (nonatomic,strong)UILabel *purchaseLabel;
...@@ -57,6 +65,7 @@ typedef enum : NSUInteger { ...@@ -57,6 +65,7 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)UILabel *leftArriveDateLabel; @property (nonatomic,strong)UILabel *leftArriveDateLabel;
@property (nonatomic,strong)UILabel *leftNoteLabel; @property (nonatomic,strong)UILabel *leftNoteLabel;
/** /**
* 创建时间 * 创建时间
*/ */
...@@ -92,6 +101,11 @@ typedef enum : NSUInteger { ...@@ -92,6 +101,11 @@ typedef enum : NSUInteger {
self.title = @"发运单详情"; self.title = @"发运单详情";
[self bulifLayout]; [self bulifLayout];
[self getDataFromServer]; [self getDataFromServer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editReceiveProduct:) name:KNOTIFICATION_EditReceiveProduct object:nil];
}
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
} }
- (void)getDataFromServer{ - (void)getDataFromServer{
...@@ -127,6 +141,7 @@ typedef enum : NSUInteger { ...@@ -127,6 +141,7 @@ typedef enum : NSUInteger {
- (void)fetchtTransportDetail{ - (void)fetchtTransportDetail{
_pvc.isHiddenEdit = ![self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED];
self.billNumberLabel.text = [IBTCommon checkString:self.transport.billnumber]; self.billNumberLabel.text = [IBTCommon checkString:self.transport.billnumber];
if ([self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED]) { if ([self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED]) {
self.stateLabel.textColor = [UIColor redColor]; self.stateLabel.textColor = [UIColor redColor];
...@@ -153,14 +168,39 @@ typedef enum : NSUInteger { ...@@ -153,14 +168,39 @@ typedef enum : NSUInteger {
self.createOperLabel.text = [IBTCommon checkString:self.transport.create_operName]; self.createOperLabel.text = [IBTCommon checkString:self.transport.create_operName];
self.labelCreateTime.text = [IBTCommon checkString:self.transport.create_time]; self.labelCreateTime.text = [IBTCommon checkString:self.transport.create_time];
self.labelCreateTime.text = [IBTCommon checkString:self.transport.create_time]; self.labelCreateTime.text = [IBTCommon checkString:self.transport.create_time];
self.labelInspector.text = [IBTCommon checkString:self.transport.approv_operName]; self.labelReciever.text = [IBTCommon checkString:self.transport.receive_operName];
self.labelInspectTime.text = [IBTCommon checkString:self.transport.approv_time]; self.labelRecieveTime.text = [IBTCommon checkString:self.transport.receive_time];
self.labelExpiredDate.text = [IBTCommon checkString:self.transport.expiredDate]; self.labelExpiredDate.text = [IBTCommon checkString:self.transport.expiredDate];
self.lastModifierLabel.text = [IBTCommon checkString:self.transport.lastModify_operName]; self.lastModifierLabel.text = [IBTCommon checkString:self.transport.lastModify_operName];
self.arriveDateLabel.text = [NSString stringWithFormat:@"%@",self.transport.arriveDate?[[IBTCommon checkString:self.transport.arriveDate]substringToIndex:10]:@"无"]; self.arriveDateLabel.text = [NSString stringWithFormat:@"%@",self.transport.arriveDate?[[IBTCommon checkString:self.transport.arriveDate]substringToIndex:10]:@"无"];
[_transView refreshTranProduct:self.transport.pdtDetails];
[_transView refreshCost:self.transport.accountDetails]; NSMutableArray *productArr = [NSMutableArray array];
[self setNoteHeight]; if (self.type == TransportTypeAfterSubmit) {
for (NSDictionary *billDict in self.transport.pdtDetails) {
TransferPdtDetail *billProbuct = [TransferPdtDetail new];
[billProbuct setValuesForKeysWithDictionary:billDict];
TransportPdtDetail *t = [TransportPdtDetail new];
[t setValuesForKeysWithDictionary:billDict];
billProbuct.transportPdt = t;
if ([self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED]) {
if (self.isWms){
[billProbuct z_setRctQty:0];
}
}
[productArr addObject:billProbuct];
}
_pvc.productArr = productArr;
[_pvc.tableView reloadData];
[self setNoteHeight];
}else{
[_transView refreshTranProduct:self.transport.pdtDetails];
[_transView refreshCost:self.transport.accountDetails];
[self setNoteHeight];
}
} }
- (NSString *)getPurchaseWith:(NSArray *)purchases{ - (NSString *)getPurchaseWith:(NSArray *)purchases{
NSString *purchseNumber = @""; NSString *purchseNumber = @"";
...@@ -202,11 +242,22 @@ typedef enum : NSUInteger { ...@@ -202,11 +242,22 @@ typedef enum : NSUInteger {
purchaseFrame.size.height = totalHeight + LeftMargin; purchaseFrame.size.height = totalHeight + LeftMargin;
_transportView.frame = purchaseFrame; _transportView.frame = purchaseFrame;
CGRect bottomFrame = _bottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
_bottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2); if (self.type == TransportTypeAfterSubmit) {
CGRect bottomFrame = _recieveBottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
_recieveBottomView.backgroundColor = [UIColor redColor];
_recieveBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100);
}else{
CGRect bottomFrame = _bottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
_bottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
}
} }
- (void)btnClick:(UIButton *)btn{ - (void)btnClick:(UIButton *)btn{
...@@ -237,6 +288,17 @@ typedef enum : NSUInteger { ...@@ -237,6 +288,17 @@ typedef enum : NSUInteger {
alertView.delegate = self; alertView.delegate = self;
alertView.tag = SubmitTag; alertView.tag = SubmitTag;
[alertView show]; [alertView show];
}
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; break;
default: default:
...@@ -287,6 +349,8 @@ typedef enum : NSUInteger { ...@@ -287,6 +349,8 @@ typedef enum : NSUInteger {
btnTag = AbortTag; btnTag = AbortTag;
}else if ([arr[i] isEqualToString:@"提交"]) { }else if ([arr[i] isEqualToString:@"提交"]) {
btnTag = SubmitTag; btnTag = SubmitTag;
}else if([arr[i] isEqualToString:@"收货"]){
btnTag = ReceiveTag;
} }
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];
...@@ -318,10 +382,10 @@ typedef enum : NSUInteger { ...@@ -318,10 +382,10 @@ typedef enum : NSUInteger {
if ([IBTCommon checkIsPermission:TRANSPORT_ACTION_ABORT]) { if ([IBTCommon checkIsPermission:TRANSPORT_ACTION_ABORT]) {
[arr addObject:@"作废"]; [arr addObject:@"作废"];
} }
if([IBTCommon checkIsPermission:TRANSPORT_ACTION_FINISH]) // if([IBTCommon checkIsPermission:TRANSPORT_ACTION_FINISH])
{ // {
[arr addObject:@"结束"]; // [arr addObject:@"结束"];
} // }
if (arr.count == 0) { if (arr.count == 0) {
[self hiddenAllBtn]; [self hiddenAllBtn];
}else{ }else{
...@@ -339,10 +403,14 @@ typedef enum : NSUInteger { ...@@ -339,10 +403,14 @@ typedef enum : NSUInteger {
}else{ }else{
[self createBtnWithArr:arr]; [self createBtnWithArr:arr];
} }
}else if ([self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED] && !self.isWms){
[self createBtnWithArr:@[@"收货"]];
}else{ }else{
[self hiddenAllBtn]; [self hiddenAllBtn];
} }
NSArray *leftArr = @[@"单号:",@"采购单:",@"状态:",@"发货仓库:",@"收货仓库:",@"车辆:",@"司机电话:",@"创建人:",@"创建时间:",@"审核人:",@"审核时间:",@"收货人:",@"收货时间:",@"有效期:",@"最后修改人:", @"预计到货时间:",@"备注:"]; NSArray *leftArr = @[@"单号:",@"采购单:",@"状态:",@"发货仓库:",@"收货仓库:",@"车辆:",@"司机电话:",@"创建人:",@"创建时间:",@"收货人:",@"收货时间:",@"有效期:",@"最后修改人:", @"预计到货时间:",@"备注:"];
self.leftArr = leftArr; self.leftArr = leftArr;
CGFloat height = LeftHeight * leftArr.count +LeftMargin; CGFloat height = LeftHeight * leftArr.count +LeftMargin;
_transportView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, height)]; _transportView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, height)];
...@@ -417,62 +485,31 @@ typedef enum : NSUInteger { ...@@ -417,62 +485,31 @@ typedef enum : NSUInteger {
}else if ([title isEqualToString:@"有效期:"]){ }else if ([title isEqualToString:@"有效期:"]){
self.labelExpiredDate = rightLabel; self.labelExpiredDate = rightLabel;
} }
// if (i == 0) {
// self.billNumberLabel = rightLabel;
// self.leftBillNumberLabel = leftLabel;
// }else if (i == 1) {
// self.purchaseLabel = rightLabel;
// self.purchaseLabel.numberOfLines = 0;
// self.leftPurchaseLabel = leftLabel;
// }else if(i == 2){
// self.stateLabel = rightLabel;
// self.leftStateLabel = leftLabel;
// }else if(i == 3){
// self.warehouseLabel = rightLabel;
// self.leftWarehouseLabel = leftLabel;
// }else if(i == 4){
// self.rwarehouseLabel = rightLabel;
// self.leftRwarehouseLabel = leftLabel;
// }else if(i == 5){
// self.carnumberLabel = rightLabel;
// self.leftCarnumberLabel = leftLabel;
// }else if(i == 6){
// self.carhoneLabel = rightLabel;
// self.leftCarhoneLabel = leftLabel;
// }else if(i == 7){
// self.createOperLabel = rightLabel;
// self.leftCreateOperLabel = leftLabel;
// }else if(i == 8){//最后修改人
// self.lastModifierLabel = rightLabel;
// self.leftLastModifierLabel = leftLabel;
// }else if(i == 9){
// leftLabel.width = LeftWidth + 10;
// rightLabel.left = leftLabel.right;
// rightLabel.width = ScreenSize.width - leftLabel.width - LeftMargin;
// self.arriveDateLabel = rightLabel;
// self.leftArriveDateLabel = leftLabel;
// }else if(i == leftArr.count - 1){
// rightLabel.numberOfLines = 0;
// self.noteLabel = rightLabel;
// self.leftNoteLabel = leftLabel;
// }
[_transportView addSubview:rightLabel]; [_transportView addSubview:rightLabel];
} }
[self createBottomView]; [self createBottomView];
} }
- (void)createBottomView{ - (void)createBottomView{
_bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_transportView.frame) + TopMargin, ScreenSize.width, 300)]; if (self.type == TransportTypeAfterSubmit) {
_bottomView.backgroundColor = [UIColor whiteColor]; _recieveBottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_transportView.frame) + TopMargin, ScreenSize.width, 300)];
_recieveBottomView.backgroundColor = [UIColor redColor];
[_scrollView addSubview:_recieveBottomView];
_pvc = [[ReceiveProductViewController alloc]init];
_pvc.viewFrame = _recieveBottomView.bounds;
_pvc.isHiddenAdd = YES;
[_recieveBottomView addSubview:_pvc.view];
}else{
_bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_transportView.frame) + TopMargin, ScreenSize.width, 300)];
_bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView];
_transView = [[BottomTransportView alloc]initWithFrame:_bottomView.bounds withHidden:YES];
[_bottomView addSubview:_transView];
}
[_scrollView addSubview:_bottomView];
_transView = [[BottomTransportView alloc]initWithFrame:_bottomView.bounds withHidden:YES];
[_bottomView addSubview:_transView];
} }
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
...@@ -488,6 +525,10 @@ typedef enum : NSUInteger { ...@@ -488,6 +525,10 @@ typedef enum : NSUInteger {
if (buttonIndex == 1) { if (buttonIndex == 1) {
[self getDataFromServer:TRANSPORT_STATE_RECEIVED msg:@"正在提交..."]; [self getDataFromServer:TRANSPORT_STATE_RECEIVED msg:@"正在提交..."];
} }
}else if(alertView.tag == ReceiveTag){
if (buttonIndex == 1) {
[self httpRecieve];
}
} }
} }
...@@ -534,6 +575,74 @@ typedef enum : NSUInteger { ...@@ -534,6 +575,74 @@ typedef enum : NSUInteger {
} }
- (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)httpRecieve{
NSString *receiveTime = [[NSDate date] httpParameterString];
self.transport.receive_time = receiveTime;
self.transport.receive_id = [ICRUserUtil sharedInstance].userId;
self.transport.receive_operName = [ICRUserUtil sharedInstance].userName;
NSMutableDictionary *param = [self.transport dictForCommit].mutableCopy;
NSMutableArray *arrProduct = [NSMutableArray array];
for (TransferPdtDetail *pdt in _pvc.productArr) {
TransportPdtDetail *pPdt = [pdt changeToTransportPdt];
NSDictionary *dict = [pPdt dictForCommit];
[arrProduct addObject:dict];
}
[param setObject:arrProduct forKey:@"pdtDetails"];
[param setObject:self.transport.accountDetails forKey:@"accountDetails"];
IBTLoadingView *hud = [IBTLoadingView showHUDAddedTo:self.view animated:YES];
__weak UIViewController *weakSelf = self;
[HTTP recieveTransport:param success:^(id succ) {
[hud hide:YES];
if ([succ[@"success"] boolValue]) {
[ICRUserUtil sharedInstance].needFresh = YES;
[IBTLoadingView showTips:@" 收货成功! "];
[weakSelf.navigationController popViewControllerAnimated:YES];
}
} failure:^(id fail) {
[IBTLoadingView showTips:fail];
}];
}
- (BOOL)checkReceive{
for (NSString *isEdit in _pvc.defaultState) {
if ([isEdit isEqualToString:@"NO"]) {
ShowMessage(@"有商品行没有编辑过收货数量,请先编辑再收货");
return NO;
}
}
if (_pvc.productArr.count == 0) {
ShowMessage(@"商品不能为空");
return NO;
}
return 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.
......
...@@ -82,7 +82,7 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -82,7 +82,7 @@ NSInteger purchaseStockCheckNumber = 0;
billNumberObject = self.contentStr; billNumberObject = self.contentStr;
} }
NSDictionary *dict = @{ NSDictionary *dict = @{
@"state":@"shipping", @"state":PURCHASE_STATE_RECEIVED,
@"queryOrders":orderArr, @"queryOrders":orderArr,
@"userUuid":userUtil.userId, @"userUuid":userUtil.userId,
@"billNumberProductLike":billNumberObject, @"billNumberProductLike":billNumberObject,
......
...@@ -450,10 +450,16 @@ typedef enum : NSUInteger { ...@@ -450,10 +450,16 @@ typedef enum : NSUInteger {
nvc.title = @"修改发运单"; nvc.title = @"修改发运单";
[self PushViewController:nvc animated:YES]; [self PushViewController:nvc animated:YES];
}else{ }else{
TransportDetailViewController *pvc = [TransportDetailViewController new]; [HTTP isWmsWarehouse:transport.rwarehouseUuid success:^(id succ) {
pvc.title = @"查看发运单"; TransportDetailViewController *pvc = [TransportDetailViewController new];
pvc.transport = transport; pvc.title = @"查看发运单";
[self PushViewController:pvc animated:YES]; pvc.type = TransportTypeAfterSubmit;
pvc.isWms = [succ[@"data"] boolValue];
pvc.transport = transport;
[self PushViewController:pvc animated:YES];
} failure:nil];
} }
} }
} }
...@@ -485,13 +491,13 @@ typedef enum : NSUInteger { ...@@ -485,13 +491,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
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
@property (nonatomic,strong)NSString *warehouseUuid;//仓库id @property (nonatomic,strong)NSString *warehouseUuid;//仓库id
@property (nonatomic,strong)NSString *warehouseCode;//仓库代码 @property (nonatomic,strong)NSString *warehouseCode;//仓库代码
@property (nonatomic,strong)NSString *warehouseName;//仓库名称 @property (nonatomic,strong)NSString *warehouseName;//仓库名称
@property (strong, nonatomic) NSString *enterprise;
@property (nonatomic,strong)NSString *rwarehouseUuid;//收货仓库id @property (nonatomic,strong)NSString *rwarehouseUuid;//收货仓库id
@property (nonatomic,strong)NSString *rwarehouseCode;//收货仓库代码 @property (nonatomic,strong)NSString *rwarehouseCode;//收货仓库代码
@property (nonatomic,strong)NSString *rwarehouseName;//收货仓库名称 @property (nonatomic,strong)NSString *rwarehouseName;//收货仓库名称
......
...@@ -32,5 +32,8 @@ ...@@ -32,5 +32,8 @@
@property (nonatomic,strong)NSString *carphone; //司机电话 @property (nonatomic,strong)NSString *carphone; //司机电话
@property (nonatomic,strong)NSString *carnumber; //车牌号 @property (nonatomic,strong)NSString *carnumber; //车牌号
@property (strong, nonatomic) NSNumber *receivedQty;//收货数量
@property (strong, nonatomic) NSNumber *receivedBaseQty;//收货基础数量
@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