Commit a44e79ee authored by Sandy's avatar Sandy

bug fix

parent 03dec024
...@@ -4417,8 +4417,8 @@ ...@@ -4417,8 +4417,8 @@
baseConfigurationReference = 1B0B22845F5CD40B5CF655F2 /* Pods.debug.xcconfig */; baseConfigurationReference = 1B0B22845F5CD40B5CF655F2 /* Pods.debug.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer: jie zhang (9V9955H2BK)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: jie zhang (9V9955H2BK)";
COPYING_PRESERVES_HFS_DATA = NO; COPYING_PRESERVES_HFS_DATA = NO;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch"; GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch";
...@@ -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 = "d5f475ae-9bae-4ae0-a45a-673e85b7e684";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Debug; name = Debug;
...@@ -4442,7 +4442,7 @@ ...@@ -4442,7 +4442,7 @@
baseConfigurationReference = 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */; baseConfigurationReference = 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPYING_PRESERVES_HFS_DATA = NO; COPYING_PRESERVES_HFS_DATA = NO;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
...@@ -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 = "d5f475ae-9bae-4ae0-a45a-673e85b7e684";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Release; name = Release;
......
...@@ -322,15 +322,17 @@ ...@@ -322,15 +322,17 @@
hasSeeOption7 = NO; hasSeeOption7 = NO;
} }
//"收货单" // //"收货单"
if (displayFunction.functionId == 500802 && hasSeeOption8 == NO) { // if (displayFunction.functionId == 500802 && hasSeeOption8 == NO) {
hasSeeOption8 = YES; // hasSeeOption8 = YES;
} // }
if (displayFunction.functionId == 500803 && hasSeeOption8 == YES) { if (displayFunction.functionId == 500803) {
[muArr removeObject:displayFunction]; [muArr removeObject:displayFunction];
hasSeeOption8 = NO; hasSeeOption8 = NO;
} }
continue; continue;
} }
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.2.16</string> <string>1.2.17</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2.16</string> <string>1.2.17</string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
} }
#ifdef DEBUG #ifdef DEBUG
self.m_containerView.m_cCodeTextF.text = @"211534962"; self.m_containerView.m_cCodeTextF.text = @"923";
self.m_containerView.m_userNameTextF.text = @"admin"; self.m_containerView.m_userNameTextF.text = @"admin";
self.m_containerView.m_passwordTextF.text = @"thoradmin"; self.m_containerView.m_passwordTextF.text = @"thoradmin";
#else #else
......
...@@ -62,6 +62,19 @@ typedef enum : NSUInteger { ...@@ -62,6 +62,19 @@ typedef enum : NSUInteger {
return self; return self;
} }
- (void)viewWillAppear:(BOOL)animated {
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if(self.purchaseBill && [self.state isEqualToString:PURCHASE_STATE_INITIAL]){
[ICRUserUtil sharedInstance].needFresh = YES;
}
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
//布局 //布局
...@@ -310,9 +323,15 @@ typedef enum : NSUInteger { ...@@ -310,9 +323,15 @@ typedef enum : NSUInteger {
if (self.purchaseNotice) { if (self.purchaseNotice) {
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
}else{ }else{
[[NSNotificationCenter defaultCenter] removeObserver:self name:SetProductTotalPrice object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:KNOTIFICATION_AddPurchaseProduct object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:KNOTIFICATION_AddTransportCost object:nil];
PurchaseViewController *svc = [PurchaseViewController new]; PurchaseViewController *svc = [PurchaseViewController new];
svc.title = @"查看采购单"; svc.title = @"查看采购单";
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
} }
} }
}else{ }else{
...@@ -508,12 +527,6 @@ typedef enum : NSUInteger { ...@@ -508,12 +527,6 @@ typedef enum : NSUInteger {
[_purchaseView.otherPriceFiled resignFirstResponder]; [_purchaseView.otherPriceFiled resignFirstResponder];
[_purchaseView.remarkTextView resignFirstResponder]; [_purchaseView.remarkTextView resignFirstResponder];
} }
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
if(self.purchaseBill && [self.state isEqualToString:PURCHASE_STATE_INITIAL]){
[ICRUserUtil sharedInstance].needFresh = YES;
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) { if (buttonIndex == 1) {
......
...@@ -396,6 +396,10 @@ typedef enum : NSUInteger { ...@@ -396,6 +396,10 @@ typedef enum : NSUInteger {
} }
- (void)createBottomView{ - (void)createBottomView{
_aBottomView = [[BottomPurchaseView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300) withHidden:YES];
_aBottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_aBottomView];
if (self.type == PurchaseTypeAfterVerify) { if (self.type == PurchaseTypeAfterVerify) {
_recieveBottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300)]; _recieveBottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width,300)];
_recieveBottomView.backgroundColor = [UIColor redColor]; _recieveBottomView.backgroundColor = [UIColor redColor];
...@@ -405,11 +409,13 @@ typedef enum : NSUInteger { ...@@ -405,11 +409,13 @@ typedef enum : NSUInteger {
_pvc.viewFrame = _recieveBottomView.bounds; _pvc.viewFrame = _recieveBottomView.bounds;
_pvc.isHiddenAdd = YES; _pvc.isHiddenAdd = YES;
[_recieveBottomView addSubview:_pvc.view]; [_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];
} }
CGRect frame = _aBottomView.productVC.view.frame;
_recieveBottomView.frame = frame;
[_aBottomView.productVC.view addSubview:_recieveBottomView];
} }
- (void)createPurchaseView{ - (void)createPurchaseView{
...@@ -542,14 +548,20 @@ typedef enum : NSUInteger { ...@@ -542,14 +548,20 @@ typedef enum : NSUInteger {
[p setValuesForKeysWithDictionary:billDict]; [p setValuesForKeysWithDictionary:billDict];
billProbuct.purchasePdt = p; billProbuct.purchasePdt = p;
//待收货并且已收货数小于1的时候才可以显示默认值 //待收货的时候才可以显示默认值
if ([self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE] && billProbuct.rctQty.floatValue < 1) { if ([self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE] && self.bill.receive_id == nil && billProbuct.rctQty.floatValue == 0) {
if (self.isCenter) { if (self.isCenter) {
[billProbuct z_setRctQty:p.qty.floatValue]; [billProbuct z_setRctQty:p.qty.floatValue];
}else if (self.isWms){ }else if (self.isWms){
[billProbuct z_setRctQty:0]; [billProbuct z_setRctQty:0];
}else{
billProbuct.rctQty = nil;
billProbuct.rctBaseQty = nil;
billProbuct.rctTotal = nil;
} }
}else{
[billProbuct z_setRctQty:billProbuct.rctQty.floatValue];
} }
[productArr addObject:billProbuct]; [productArr addObject:billProbuct];
} }
...@@ -562,7 +574,6 @@ typedef enum : NSUInteger { ...@@ -562,7 +574,6 @@ typedef enum : NSUInteger {
// } // }
}else{ }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];
...@@ -571,9 +582,7 @@ typedef enum : NSUInteger { ...@@ -571,9 +582,7 @@ typedef enum : NSUInteger {
_aBottomView.productVC.productArr = productArr; _aBottomView.productVC.productArr = productArr;
[_aBottomView.productVC.tableView reloadData]; [_aBottomView.productVC.tableView reloadData];
} }
[self setNoteHeight]; [self setNoteHeight];
} }
...@@ -591,18 +600,18 @@ typedef enum : NSUInteger { ...@@ -591,18 +600,18 @@ typedef enum : NSUInteger {
purchaseFrame.size.height = totalHeight; purchaseFrame.size.height = totalHeight;
_purchaseView.frame = purchaseFrame; _purchaseView.frame = purchaseFrame;
if (self.type == PurchaseTypeAfterVerify) { // if (self.type == PurchaseTypeAfterVerify) {
CGRect bottomFrame = _recieveBottomView.frame; // CGRect bottomFrame = _recieveBottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin; // bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
_recieveBottomView.backgroundColor = [UIColor redColor]; // _recieveBottomView.backgroundColor = [UIColor redColor];
_recieveBottomView.frame = bottomFrame; // _recieveBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100); // _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100);
}else{ // }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);
} // }
} }
...@@ -639,6 +648,14 @@ typedef enum : NSUInteger { ...@@ -639,6 +648,14 @@ typedef enum : NSUInteger {
- (void)httpRecieve{ - (void)httpRecieve{
for (TransferPdtDetail *detail in _pvc.productArr) {
if (detail.rctQty == nil) {
ShowMessage(@"请选择商品实收数量后再提交!");
return;
}
}
NSString *receiveTime = [[NSDate date] httpParameterString]; NSString *receiveTime = [[NSDate date] httpParameterString];
self.bill.receive_time = receiveTime; self.bill.receive_time = receiveTime;
self.bill.receive_id = [ICRUserUtil sharedInstance].userId; self.bill.receive_id = [ICRUserUtil sharedInstance].userId;
...@@ -695,6 +712,13 @@ typedef enum : NSUInteger { ...@@ -695,6 +712,13 @@ typedef enum : NSUInteger {
} }
- (void)httpSave { - (void)httpSave {
for (TransferPdtDetail *detail in _pvc.productArr) {
if (detail.rctQty == nil) {
ShowMessage(@"请选择商品实收数量后再保存!");
return;
}
}
//保存 //保存
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
......
...@@ -168,15 +168,23 @@ ...@@ -168,15 +168,23 @@
self.showbzCountLabel.text =[NSString stringWithFormat:@"包装数量:%@%@",[transferProduct.qty stringValue],transferProduct.unit]; self.showbzCountLabel.text =[NSString stringWithFormat:@"包装数量:%@%@",[transferProduct.qty stringValue],transferProduct.unit];
self.showshCountLabel.text =[NSString stringWithFormat:@"包装数量[实收]:%@%@",transferProduct.rctQty?([transferProduct.rctQty stringValue]):@"0",transferProduct.unit]; self.showshCountLabel.text =[NSString stringWithFormat:@"包装数量[实收]:%@%@",transferProduct.rctQty?([transferProduct.rctQty stringValue]):@"0",transferProduct.unit];
if (transferProduct.rctQty == nil) {
self.showshCountLabel.text = @"包装数量[实收]:空";
}
self.showjcCountLabel.text = [NSString stringWithFormat:@"基础数量:%@%@",[transferProduct.baseQty stringValue],transferProduct.baseUnit]; self.showjcCountLabel.text = [NSString stringWithFormat:@"基础数量:%@%@",[transferProduct.baseQty stringValue],transferProduct.baseUnit];
self.showshjcCountLabel.text = [NSString stringWithFormat:@"基础数量[实收]:%@%@",transferProduct.rctBaseQty?[transferProduct.rctBaseQty stringValue]:@"0",transferProduct.baseUnit]; self.showshjcCountLabel.text = [NSString stringWithFormat:@"基础数量[实收]:%@%@",transferProduct.rctBaseQty?[transferProduct.rctBaseQty stringValue]:@"0",transferProduct.baseUnit];
if (transferProduct.rctBaseQty == nil) {
self.showshjcCountLabel.text = @"基础数量[实收]:空";
}
self.showbzPriceLabel.text = [NSString stringWithFormat:@"包装单价:%.2f元",[transferProduct.packprice floatValue]]; self.showbzPriceLabel.text = [NSString stringWithFormat:@"包装单价:%.2f元",[transferProduct.packprice floatValue]];
self.showjcPriceLabel.text = [NSString stringWithFormat:@"基础单价:%.2f元",[transferProduct.price floatValue]]; self.showjcPriceLabel.text = [NSString stringWithFormat:@"基础单价:%.2f元",[transferProduct.price floatValue]];
self.showshTotalLabel.text = [NSString stringWithFormat:@"总金额[实收]:%.2f元",transferProduct.rctTotal?[transferProduct.rctTotal floatValue]:0.00f]; self.showshTotalLabel.text = [NSString stringWithFormat:@"总金额[实收]:%.2f元",transferProduct.rctTotal?[transferProduct.rctTotal floatValue]:0.00f];
if (transferProduct.rctTotal == nil) {
self.showshTotalLabel.text = @"总金额[实收]:空";
}
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%.2f元",transferProduct.total?[transferProduct.total floatValue]:0.00f]; self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%.2f元",transferProduct.total?[transferProduct.total floatValue]:0.00f];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",transferProduct.note ? transferProduct.note :@"无" ]; self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",transferProduct.note ? transferProduct.note :@"无" ];
......
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
self.rctBaseQty = transportPdt.receivedBaseQty; self.rctBaseQty = transportPdt.receivedBaseQty;
} }
/**
* 转化为采购单对象
*
* @return return value description
*/
- (PurchaseBillProduct *)changeToPurchasePdt { - (PurchaseBillProduct *)changeToPurchasePdt {
if (!self.purchasePdt) { if (!self.purchasePdt) {
self.purchasePdt = [PurchaseBillProduct new]; self.purchasePdt = [PurchaseBillProduct new];
......
...@@ -184,23 +184,30 @@ typedef enum : NSUInteger { ...@@ -184,23 +184,30 @@ typedef enum : NSUInteger {
[t setValuesForKeysWithDictionary:billDict]; [t setValuesForKeysWithDictionary:billDict];
billProbuct.transportPdt = t; billProbuct.transportPdt = t;
if ([self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED]) { if ([self.transport.state isEqualToString:TRANSPORT_STATE_UNRECEIVED] && billProbuct.rctQty.floatValue == 0) {
if (self.isWms){ if (self.isWms){
[billProbuct z_setRctQty:0]; [billProbuct z_setRctQty:0];
}else{
billProbuct.rctQty = nil;
billProbuct.rctBaseQty = nil;
billProbuct.rctTotal = nil;
} }
}else{
[billProbuct z_setRctQty:billProbuct.rctQty.floatValue];
} }
[productArr addObject:billProbuct]; [productArr addObject:billProbuct];
} }
_pvc.productArr = productArr; _pvc.productArr = productArr;
[_pvc.tableView reloadData]; [_pvc.tableView reloadData];
[self setNoteHeight];
}else{ }else{
[_transView refreshTranProduct:self.transport.pdtDetails]; [_transView refreshTranProduct:self.transport.pdtDetails];
}
[_transView refreshCost:self.transport.accountDetails]; [_transView refreshCost:self.transport.accountDetails];
[self setNoteHeight]; [self setNoteHeight];
}
} }
- (NSString *)getPurchaseWith:(NSArray *)purchases{ - (NSString *)getPurchaseWith:(NSArray *)purchases{
...@@ -244,20 +251,20 @@ typedef enum : NSUInteger { ...@@ -244,20 +251,20 @@ typedef enum : NSUInteger {
_transportView.frame = purchaseFrame; _transportView.frame = purchaseFrame;
if (self.type == TransportTypeAfterSubmit) { // if (self.type == TransportTypeAfterSubmit) {
CGRect bottomFrame = _recieveBottomView.frame; // CGRect bottomFrame = _recieveBottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin; // bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
_recieveBottomView.backgroundColor = [UIColor redColor]; // _recieveBottomView.backgroundColor = [UIColor redColor];
_recieveBottomView.frame = bottomFrame; // _recieveBottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100); // _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100);
}else{ // }else{
CGRect bottomFrame = _bottomView.frame; CGRect bottomFrame = _bottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin; bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
_bottomView.frame = bottomFrame; _bottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2); _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
} // }
} }
...@@ -294,9 +301,19 @@ typedef enum : NSUInteger { ...@@ -294,9 +301,19 @@ typedef enum : NSUInteger {
case SaveTag: case SaveTag:
{ {
[self httpSave]; if ([self checkReceive]) {
[self httpSave];
}
} }
break; 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;
default: default:
break; break;
} }
...@@ -489,6 +506,12 @@ typedef enum : NSUInteger { ...@@ -489,6 +506,12 @@ typedef enum : NSUInteger {
} }
- (void)createBottomView{ - (void)createBottomView{
_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];
if (self.type == TransportTypeAfterSubmit) { if (self.type == TransportTypeAfterSubmit) {
_recieveBottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_transportView.frame) + TopMargin, ScreenSize.width, 300)]; _recieveBottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_transportView.frame) + TopMargin, ScreenSize.width, 300)];
_recieveBottomView.backgroundColor = [UIColor redColor]; _recieveBottomView.backgroundColor = [UIColor redColor];
...@@ -498,15 +521,13 @@ typedef enum : NSUInteger { ...@@ -498,15 +521,13 @@ typedef enum : NSUInteger {
_pvc.viewFrame = _recieveBottomView.bounds; _pvc.viewFrame = _recieveBottomView.bounds;
_pvc.isHiddenAdd = YES; _pvc.isHiddenAdd = YES;
[_recieveBottomView addSubview:_pvc.view]; [_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];
} }
CGRect frame = _transView.productVC.view.frame;
_recieveBottomView.frame = frame;
[_transView.productVC.view addSubview:_recieveBottomView];
} }
...@@ -531,7 +552,12 @@ typedef enum : NSUInteger { ...@@ -531,7 +552,12 @@ typedef enum : NSUInteger {
if (buttonIndex == 1) { if (buttonIndex == 1) {
[self httpRecieve]; [self httpRecieve];
} }
}else if (alertView.tag == SaveTag){
if (buttonIndex == 1) {
[self httpSave];
}
} }
} }
#pragma mark - 提交 #pragma mark - 提交
...@@ -633,6 +659,14 @@ typedef enum : NSUInteger { ...@@ -633,6 +659,14 @@ typedef enum : NSUInteger {
- (void)httpSave { - (void)httpSave {
for (TransferPdtDetail *detail in _pvc.productArr) {
if (detail.rctQty == nil) {
ShowMessage(@"请选择商品实收数量后再保存!");
return;
}
}
NSMutableDictionary *param = [self.transport dictForCommit].mutableCopy; NSMutableDictionary *param = [self.transport dictForCommit].mutableCopy;
NSMutableArray *arrProduct = [NSMutableArray array]; NSMutableArray *arrProduct = [NSMutableArray array];
for (TransferPdtDetail *pdt in _pvc.productArr) { for (TransferPdtDetail *pdt in _pvc.productArr) {
......
...@@ -22,6 +22,9 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -22,6 +22,9 @@ NSInteger purchaseStockCheckNumber = 0;
NSInteger _currentPage; NSInteger _currentPage;
id billNumberObject; id billNumberObject;
} }
/**
* 选中的商品
*/
@property (nonatomic,strong)NSMutableArray *indexArr; @property (nonatomic,strong)NSMutableArray *indexArr;
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
...@@ -279,8 +282,10 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -279,8 +282,10 @@ NSInteger purchaseStockCheckNumber = 0;
} }
#pragma mark - 按钮确定 #pragma mark - 按钮确定
- (void)sureClick{ - (void)sureClick{
NSMutableDictionary *dicProduct = [NSMutableDictionary dictionary]; NSMutableDictionary *dicProduct = [NSMutableDictionary dictionary];
//把选中的商品和采购单对应 //把选中的商品和采购单对应,根据单号存储对应的商品
for (PurchaseBill *bill in self.dataArr) { for (PurchaseBill *bill in self.dataArr) {
for (TransportPdtDetail *detail in bill.products) { for (TransportPdtDetail *detail in bill.products) {
if ([self.indexArr containsObject:detail]) { if ([self.indexArr containsObject:detail]) {
...@@ -296,7 +301,12 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -296,7 +301,12 @@ NSInteger purchaseStockCheckNumber = 0;
} }
NSArray *array = dicProduct.allKeys; NSArray *array = dicProduct.allKeys;
if (array.count == 0) {
ShowMessage(@"请选择商品!");
return;
}
__weak TransportPurchaseViewController *weakSelf = self; __weak TransportPurchaseViewController *weakSelf = self;
//判断数量问题
[self stockValidWithDic:dicProduct billNumbers:array complete:^{ [self stockValidWithDic:dicProduct billNumbers:array complete:^{
[weakSelf PopViewControllerAnimated:YES]; [weakSelf PopViewControllerAnimated:YES];
if (weakSelf.indexArr.count > 0) { if (weakSelf.indexArr.count > 0) {
...@@ -329,20 +339,29 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -329,20 +339,29 @@ NSInteger purchaseStockCheckNumber = 0;
} }
- (void)stockValidWithDic:(NSMutableDictionary *)dic billNumbers:(NSArray *)billNumbers complete:(void (^)(void))complete { - (void)stockValidWithDic:(NSMutableDictionary *)dic billNumbers:(NSArray *)billNumbers complete:(void (^)(void))complete {
NSString *billNum = billNumbers[purchaseStockCheckNumber]; NSString *billNum = billNumbers[purchaseStockCheckNumber];
NSMutableArray *arrProducts = [dic objectForKey:billNum]; NSMutableArray *arrProducts = [dic objectForKey:billNum];
__weak TransportPurchaseViewController *weakSelf = self; __weak TransportPurchaseViewController *weakSelf = self;
[HTTP purchaseStockWithPurchaseUuid:billNum success:^(id succ) { [HTTP purchaseStockWithPurchaseUuid:billNum success:^(id succ) {
if (![succ[@"data"] isKindOfClass:[NSArray class]]) {
ShowMessage(@"库存不足!");
return ;
}
for (NSDictionary *dict in succ[@"data"]) { for (NSDictionary *dict in succ[@"data"]) {
ProductStockModel *model = [ProductStockModel new]; ProductStockModel *model = [ProductStockModel new];
[model setValuesForKeysWithDictionary:dict]; [model setValuesForKeysWithDictionary:dict];
for (TransportPdtDetail *detail in arrProducts) { for (TransportPdtDetail *detail in arrProducts) {
if (detail.qty.floatValue > model.qty.floatValue) { if ([detail.productCode isEqualToString:model.productCode]) {
CLog(@"库存不足");
purchaseStockCheckNumber = 0; if (detail.qty.floatValue > model.qty.floatValue) {
NSString *msg = [NSString stringWithFormat:@"%@库存不足!", detail.productName]; CLog(@"库存不足");
ShowMessage(msg); purchaseStockCheckNumber = 0;
return ; NSString *msg = [NSString stringWithFormat:@"%@库存不足!", detail.productName];
ShowMessage(msg);
return ;
}
} }
} }
} }
......
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