Commit c70042bf authored by Sandy's avatar Sandy

no message

parent a44e79ee
...@@ -378,6 +378,9 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -378,6 +378,9 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
- (void)purchaseStockWithPurchaseUuid:(NSString *)PurchaseUuid - (void)purchaseStockWithPurchaseUuid:(NSString *)PurchaseUuid
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
- (void)purchaseStockWithPurchaseUuid:(NSString *)PurchaseUuid product:(NSString *)productCode
success:(void (^)(id))succ
failure:(void (^)(id))fail;
/** /**
* 是否wms仓库 * 是否wms仓库
......
...@@ -2454,6 +2454,38 @@ acceptTypeJson:YES ...@@ -2454,6 +2454,38 @@ acceptTypeJson:YES
failure:failure]; failure:failure];
} }
- (void)purchaseStockWithPurchaseUuid:(NSString *)PurchaseUuid product:(NSString *)productCode
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!PurchaseUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *url = [NSString stringWithFormat:@"%@/mdata/inv/gets/%@?productCode=%@",HTTP_REST_API_BASE_URL,PurchaseUuid, productCode];
NSString *encodeUrlStr = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
/** /**
* 是否wms仓库 * 是否wms仓库
......
...@@ -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.17</string> <string>1.2.18</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2.17</string> <string>1.2.18</string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
......
...@@ -249,6 +249,7 @@ typedef enum : NSUInteger { ...@@ -249,6 +249,7 @@ typedef enum : NSUInteger {
NSInteger indexTag = [[[fication userInfo] objectForKey:@"indexTag"] integerValue]; NSInteger indexTag = [[[fication userInfo] objectForKey:@"indexTag"] integerValue];
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init]; ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
if (billProduct) { if (billProduct) {
svc.navTitle = @"编辑商品"; svc.navTitle = @"编辑商品";
ShopDetail *shopDetail=[self coverShopDetail:billProduct]; ShopDetail *shopDetail=[self coverShopDetail:billProduct];
......
...@@ -214,23 +214,23 @@ typedef enum : NSUInteger { ...@@ -214,23 +214,23 @@ typedef enum : NSUInteger {
//显示结束按钮 //显示结束按钮
[arr addObject:@"结束"]; [arr addObject:@"结束"];
} }
if([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]){//作废权 // if([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]){//作废权
//显示作废按钮 // //显示作废按钮
[arr addObject:@"作废"]; // [arr addObject:@"作废"];
} // }
[self createBtnWithArr:arr]; [self createBtnWithArr:arr];
if (arr.count == 0) { if (arr.count == 0) {
[self hiddenTwoBtn]; [self hiddenTwoBtn];
} }
}else if([self.bill.state isEqualToString:PURCHASE_STATE_FINISHED]){//完成 }else if([self.bill.state isEqualToString:PURCHASE_STATE_FINISHED]){//完成
if ([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {//有作废权的 // if ([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {//有作废权的
//显示作废按钮 // //显示作废按钮
NSArray *arr = @[@"作废"]; // NSArray *arr = @[@"作废"];
[self createBtnWithArr:arr]; // [self createBtnWithArr:arr];
//
}else{ // }else{
[self hiddenTwoBtn]; [self hiddenTwoBtn];
} // }
}else if([self.bill.state isEqualToString:PURCHASE_STATE_PROCESSFAIL]){//系统处理失败的 }else if([self.bill.state isEqualToString:PURCHASE_STATE_PROCESSFAIL]){//系统处理失败的
if ([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {//有作废权的 if ([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {//有作废权的
//显示作废按钮 //显示作废按钮
......
...@@ -9,10 +9,18 @@ ...@@ -9,10 +9,18 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
#import "Survey.h" #import "Survey.h"
#import "ShopDetail.h" #import "ShopDetail.h"
typedef NS_ENUM(NSInteger, ShopDetailInterType) {
ShopDetailInterTypeTransport = 1,
ShopDetailInterTypePurchase,
ShopDetailInterTypeTranfer
};
typedef void(^ChoseShopDetail)(ShopDetail *shopDetail); typedef void(^ChoseShopDetail)(ShopDetail *shopDetail);
@interface ShopDetaileViewController : ICRBaseViewController @interface ShopDetaileViewController : ICRBaseViewController
@property (nonatomic,strong)Survey *survey; @property (nonatomic,strong)Survey *survey;
@property (nonatomic,strong)ShopDetail *shopDetail; @property (nonatomic,strong)ShopDetail *shopDetail;
@property (nonatomic,strong)ChoseShopDetail choseShopDetail; @property (nonatomic,strong)ChoseShopDetail choseShopDetail;
@property (nonatomic,strong)NSString *navTitle; @property (nonatomic,strong)NSString *navTitle;
@property (assign, nonatomic) ShopDetailInterType intertype;
@end @end
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#import "GXFSearchVendorViewController.h" #import "GXFSearchVendorViewController.h"
#import "GXFProductUnit.h" #import "GXFProductUnit.h"
#import "CalculateHelper.h" #import "CalculateHelper.h"
#import "ProductStockModel.h"
#define LeftMargin 15 #define LeftMargin 15
#define BtnHeight 44 #define BtnHeight 44
#define TableHeight 46 #define TableHeight 46
...@@ -174,18 +175,70 @@ typedef enum : NSUInteger { ...@@ -174,18 +175,70 @@ typedef enum : NSUInteger {
break; break;
case CommitTag: case CommitTag:
{ {
if ([self informationComplete]) { if ([self informationComplete]) {
//只有发运单才需要差库存
if (self.intertype == ShopDetailInterTypeTransport) {
__weak ShopDetaileViewController *weakSelf = self;
[self stockValidWithBillNumber:self.shopDetail.sourceBillNumber complete:^{
ShopDetail *shopDetail=self.shopDetail;
shopDetail.IsDeleted=NO;
weakSelf.choseShopDetail(shopDetail);//回调
[weakSelf PopViewControllerAnimated:YES];
}];
}else{
ShopDetail *shopDetail=self.shopDetail; ShopDetail *shopDetail=self.shopDetail;
shopDetail.IsDeleted=NO; shopDetail.IsDeleted=NO;
self.choseShopDetail(shopDetail);//回调 self.choseShopDetail(shopDetail);//回调
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
} }
}
break; break;
default: default:
break; break;
} }
} }
- (void)stockValidWithBillNumber:(NSString *)billNumber complete:(void (^)(void))complete {
__weak ShopDetaileViewController *weakSelf = self;
IBTLoadingView *hud = [IBTLoadingView showHUDAddedTo:self.view animated:YES];
[HTTP purchaseStockWithPurchaseUuid:billNumber product:self.shopDetail.product_code success:^(id succ) {
[hud hide:YES];
[IBTLoadingView hideHUDForView:weakSelf.view];
if (![succ[@"data"] isKindOfClass:[NSArray class]]) {
NSString *msg = [NSString stringWithFormat:@"该批次<%@>在总部系统的库存不足!", billNumber];
ShowMessage(msg);
return ;
}
for (NSDictionary *dict in succ[@"data"]) {
ProductStockModel *model = [ProductStockModel new];
[model setValuesForKeysWithDictionary:dict];
if ([self.shopDetail.product_code isEqualToString:model.productCode]) {
if (self.shopDetail.foundationQuantity.floatValue > model.qty.floatValue) {
CLog(@"库存不足");
NSString *msg = [NSString stringWithFormat:@"该批次<%@>在总部系统的库存不足!", billNumber];
ShowMessage(msg);
return ;
}
}
}
complete();
} failure:^(id fail) {
[hud hide:YES];
[IBTLoadingView showTips:fail];
}];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) { if (buttonIndex == 1) {
if (self.shopDetail!=nil) { if (self.shopDetail!=nil) {
......
...@@ -41,6 +41,10 @@ typedef enum : NSUInteger { ...@@ -41,6 +41,10 @@ typedef enum : NSUInteger {
* 用户选择的第一个商品的采购单 * 用户选择的第一个商品的采购单
*/ */
@property (strong, nonatomic) PurchaseBill *firstBill; @property (strong, nonatomic) PurchaseBill *firstBill;
/**
* 缓存的选择的采购单数据
*/
@property (strong, nonatomic) NSMutableDictionary *dicProduct;
@end @end
@implementation NewTransportViewController @implementation NewTransportViewController
...@@ -334,8 +338,12 @@ typedef enum : NSUInteger { ...@@ -334,8 +338,12 @@ typedef enum : NSUInteger {
} }
}; };
tpv.dicProduct = self.dicProduct;
[self PushViewController:tpv animated:YES]; [self PushViewController:tpv animated:YES];
} }
- (void)addTransportCost:(NSNotification *)fination{ - (void)addTransportCost:(NSNotification *)fination{
NewCostViewController *nvc = [NewCostViewController new]; NewCostViewController *nvc = [NewCostViewController new];
...@@ -368,6 +376,7 @@ typedef enum : NSUInteger { ...@@ -368,6 +376,7 @@ typedef enum : NSUInteger {
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init]; ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
if (billProduct) { if (billProduct) {
svc.intertype = ShopDetailInterTypeTransport;
svc.navTitle = @"编辑商品"; svc.navTitle = @"编辑商品";
ShopDetail *shopDetail=[self coverShopDetail:billProduct]; ShopDetail *shopDetail=[self coverShopDetail:billProduct];
shopDetail.IsXiuGai=YES; shopDetail.IsXiuGai=YES;
...@@ -467,6 +476,13 @@ typedef enum : NSUInteger { ...@@ -467,6 +476,13 @@ typedef enum : NSUInteger {
} }
} }
- (NSMutableDictionary *)dicProduct {
if (!_dicProduct) {
_dicProduct = [NSMutableDictionary dictionary];
}
return _dicProduct;
}
/* /*
#pragma mark - Navigation #pragma mark - Navigation
......
...@@ -717,6 +717,13 @@ typedef enum : NSUInteger { ...@@ -717,6 +717,13 @@ typedef enum : NSUInteger {
return NO; return NO;
} }
for (TransferPdtDetail *pdt in _pvc.productArr) {
if (pdt.rctQty == nil) {
ShowMessage(@"有商品未填写收货数量!");
return NO;
}
}
return YES; return YES;
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
......
...@@ -18,4 +18,7 @@ typedef void(^GetPurchaseProduct)(NSArray *products); ...@@ -18,4 +18,7 @@ typedef void(^GetPurchaseProduct)(NSArray *products);
* 如果是发运单界面进入,则只显示已收货的。否的话则是转运单进入,则不限时 * 如果是发运单界面进入,则只显示已收货的。否的话则是转运单进入,则不限时
*/ */
@property (nonatomic, assign) BOOL isTransportIn; @property (nonatomic, assign) BOOL isTransportIn;
@property (weak, nonatomic) NSMutableDictionary *dicProduct;
@end @end
...@@ -124,8 +124,26 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -124,8 +124,26 @@ NSInteger purchaseStockCheckNumber = 0;
PurchaseBill *purchaseBill = [[PurchaseBill alloc]init]; PurchaseBill *purchaseBill = [[PurchaseBill alloc]init];
[purchaseBill setValuesForKeysWithDictionary:purchaseBillDict]; [purchaseBill setValuesForKeysWithDictionary:purchaseBillDict];
purchaseBill.products = [self coverTransportDetProduct:purchaseBillDict[@"products"] purchaseBill:purchaseBill]; purchaseBill.products = [self coverTransportDetProduct:purchaseBillDict[@"products"] purchaseBill:purchaseBill];
//*******筛选掉已经选择过的商品******
//获取缓存的商品数据
NSMutableArray *arr = [self.dicProduct objectForKey:purchaseBill.billNumber];
if (arr.count == purchaseBill.products.count) {
CLog(@"采购单中的商品已经全部选择过了,不显示这个采购单");
}else{
NSMutableArray *tempProduct = purchaseBill.products.mutableCopy;
for (TransportPdtDetail *pdt in arr) {
for (TransportPdtDetail *onlinePdt in purchaseBill.products) {
if ([pdt.productCode isEqualToString:onlinePdt.productCode]) {
[tempProduct removeObject:onlinePdt];
}
}
}
purchaseBill.products = tempProduct.mutableCopy;
[self.dataArr addObject:purchaseBill]; [self.dataArr addObject:purchaseBill];
} }
}
NSDictionary *pageDict = data[ @"data" ][ @"paging" ]; NSDictionary *pageDict = data[ @"data" ][ @"paging" ];
NSInteger pageCount = [pageDict[@"pageCount"] integerValue]; NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
...@@ -160,6 +178,8 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -160,6 +178,8 @@ NSInteger purchaseStockCheckNumber = 0;
detail.transferBaseQty = arrDict[@"shippedBaseQty"]; detail.transferBaseQty = arrDict[@"shippedBaseQty"];
detail.transferQty = arrDict[@"shippedQty"]; detail.transferQty = arrDict[@"shippedQty"];
detail.note = arrDict[@"remark"] != [NSNull null] ? arrDict[@"remark"] : @"无"; detail.note = arrDict[@"remark"] != [NSNull null] ? arrDict[@"remark"] : @"无";
[transArr addObject:detail]; [transArr addObject:detail];
} }
return transArr; return transArr;
...@@ -284,15 +304,16 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -284,15 +304,16 @@ NSInteger purchaseStockCheckNumber = 0;
- (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) {
detail.purchasebillnumber = bill.billNumber;
if ([self.indexArr containsObject:detail]) { if ([self.indexArr containsObject:detail]) {
NSMutableArray *arrProduct = [dicProduct objectForKey:bill.billNumber]; NSMutableArray *arrProduct = [self.dicProduct objectForKey:bill.billNumber];
if (!arrProduct) { if (!arrProduct) {
arrProduct = [NSMutableArray array]; arrProduct = [NSMutableArray array];
[dicProduct setObject:arrProduct forKey:bill.billNumber]; [self.dicProduct setObject:arrProduct forKey:bill.billNumber];
} }
[arrProduct addObject:detail]; [arrProduct addObject:detail];
...@@ -300,14 +321,14 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -300,14 +321,14 @@ NSInteger purchaseStockCheckNumber = 0;
} }
} }
NSArray *array = dicProduct.allKeys; NSArray *array = self.dicProduct.allKeys;
if (array.count == 0) { if (array.count == 0) {
ShowMessage(@"请选择商品!"); ShowMessage(@"请选择商品!");
return; return;
} }
__weak TransportPurchaseViewController *weakSelf = self; __weak TransportPurchaseViewController *weakSelf = self;
//判断数量问题 //判断数量问题
[self stockValidWithDic:dicProduct billNumbers:array complete:^{ [self stockValidWithDic:self.dicProduct billNumbers:array complete:^{
[weakSelf PopViewControllerAnimated:YES]; [weakSelf PopViewControllerAnimated:YES];
if (weakSelf.indexArr.count > 0) { if (weakSelf.indexArr.count > 0) {
NSMutableArray*arr = [NSMutableArray array]; NSMutableArray*arr = [NSMutableArray array];
...@@ -345,7 +366,8 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -345,7 +366,8 @@ NSInteger purchaseStockCheckNumber = 0;
__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]]) { if (![succ[@"data"] isKindOfClass:[NSArray class]]) {
ShowMessage(@"库存不足!"); NSString *msg = [NSString stringWithFormat:@"该批次<%@>在总部系统的库存不足!", billNum];
ShowMessage(msg);
return ; return ;
} }
...@@ -355,10 +377,10 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -355,10 +377,10 @@ NSInteger purchaseStockCheckNumber = 0;
for (TransportPdtDetail *detail in arrProducts) { for (TransportPdtDetail *detail in arrProducts) {
if ([detail.productCode isEqualToString:model.productCode]) { if ([detail.productCode isEqualToString:model.productCode]) {
if (detail.qty.floatValue > model.qty.floatValue) { if (detail.baseQty.floatValue > model.qty.floatValue) {
CLog(@"库存不足"); CLog(@"库存不足");
purchaseStockCheckNumber = 0; purchaseStockCheckNumber = 0;
NSString *msg = [NSString stringWithFormat:@"%@库存不足!", detail.productName]; NSString *msg = [NSString stringWithFormat:@"该批次<%@>的商品%@在总部系统的库存不足!", billNum, detail.productName];
ShowMessage(msg); ShowMessage(msg);
return ; return ;
} }
...@@ -379,6 +401,13 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -379,6 +401,13 @@ NSInteger purchaseStockCheckNumber = 0;
}]; }];
} }
- (NSMutableDictionary *)dicProduct {
if (!_dicProduct) {
_dicProduct = [NSMutableDictionary dictionary];
}
return _dicProduct;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
@property (strong, nonatomic) NSNumber *receivedQty;//收货数量 @property (strong, nonatomic) NSNumber *receivedQty;//收货数量
@property (strong, nonatomic) NSNumber *receivedBaseQty;//收货基础数量 @property (strong, nonatomic) NSNumber *receivedBaseQty;//收货基础数量
///**
// * 自定义的采购单的单号
// */
//@property (nonatomic,strong)NSString *z_purchaseBillNumber;
@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