Commit c70042bf authored by Sandy's avatar Sandy

no message

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