Commit 335e7cd4 authored by Sandy's avatar Sandy

采购单、发运单完善

parent f4408632
...@@ -11,7 +11,11 @@ ...@@ -11,7 +11,11 @@
#import "MJRefresh.h" #import "MJRefresh.h"
typedef void(^ChoseBaseInfo)(NSArray *baseInfos); typedef void(^ChoseBaseInfo)(NSArray *baseInfos);
typedef NS_ENUM(NSInteger, WareHouseType) {
WareHouseTypeALl = 0,
WareHouseTypeCenter,
WareHouseTypeNotCenter,
};
@interface ChooseParentViewController : ICRBaseViewController @interface ChooseParentViewController : ICRBaseViewController
...@@ -30,6 +34,14 @@ typedef void(^ChoseBaseInfo)(NSArray *baseInfos); ...@@ -30,6 +34,14 @@ typedef void(^ChoseBaseInfo)(NSArray *baseInfos);
@property (nonatomic,assign)NSInteger currentPage; @property (nonatomic,assign)NSInteger currentPage;
@property (nonatomic,strong)NSString *startDate; @property (nonatomic,strong)NSString *startDate;
//选择仓库定制参数
/**
* 是否产品中心仓
*/
@property (nonatomic, assign) WareHouseType warehouseType;
- (void)endRefreshing; - (void)endRefreshing;
- (void)getBaseDataFromServer; - (void)getBaseDataFromServer;
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath; - (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath;
......
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
} }
}else if([tableStr isEqualToString:GXF_BASECLASS_UserWAREHOUSE]){ }else if([tableStr isEqualToString:GXF_BASECLASS_UserWAREHOUSE]){
//进仓库选择仓库页面第一次进入时查询的语句 //进仓库选择仓库页面第一次进入时查询的语句
sql = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", tableStr,[ICRUserUtil sharedInstance].userId];//@"4028b88150a987080150a987dce5007a" sql = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", tableStr,[ICRUserUtil sharedInstance].userId];//@"4028b88150a987080150a987dce5007a"
}else if([tableStr isEqualToString:GXF_BASECLASS_VENDOR]){ }else if([tableStr isEqualToString:GXF_BASECLASS_VENDOR]){
if (titleStr.length > 0) { if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND ENABLED = 1 ORDER BY %@", tableStr,titleStr,titleStr, @"code"]; sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND ENABLED = 1 ORDER BY %@", tableStr,titleStr,titleStr, @"code"];
...@@ -231,9 +231,27 @@ ...@@ -231,9 +231,27 @@
}else { }else {
if (titleStr.length > 0) { if (titleStr.length > 0) {
// NSString *aaa = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", titleStr,[ICRUserUtil sharedInstance].userId]; // NSString *aaa = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", titleStr,[ICRUserUtil sharedInstance].userId];
sql = [NSString stringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')", tableStr, titleStr, titleStr,[ICRUserUtil sharedInstance].userId]; if (self.warehouseType == WareHouseTypeCenter) {
sql = [NSString stringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND isProductCenter = '1'AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')", tableStr, titleStr, titleStr,[ICRUserUtil sharedInstance].userId];
}else if(self.warehouseType == WareHouseTypeNotCenter){
sql = [NSString stringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND isProductCenter != '1'AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')", tableStr, titleStr, titleStr,[ICRUserUtil sharedInstance].userId];
}else{
sql = [NSString stringWithFormat:@"SELECT * from %@ a WHERE (NAME LIKE '%%%@%%' or CODE LIKE '%%%@%%') AND enabled = '1' AND EXISTS (SELECT 1 FROM UserWarehouse b WHERE b.warehouseUuid = a.uuid AND b.userUuid = '%@' AND b.enabled='1')", tableStr, titleStr, titleStr,[ICRUserUtil sharedInstance].userId];
}
}else{ }else{
sql = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", tableStr,[ICRUserUtil sharedInstance].userId]; if (self.warehouseType == WareHouseTypeCenter) {
sql = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' AND isProductCenter = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", tableStr,[ICRUserUtil sharedInstance].userId];
}else if(self.warehouseType == WareHouseTypeNotCenter){
sql = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' AND isProductCenter != '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", tableStr,[ICRUserUtil sharedInstance].userId];
}else{
sql = [NSString stringWithFormat:@"select * from %@ a where enabled = '1' and exists (select 1 from UserWarehouse b where b.warehouseUuid = a.uuid and b.userUuid = '%@' and b.enabled='1')", tableStr,[ICRUserUtil sharedInstance].userId];
}
} }
} }
return [db executeQuery:sql]; return [db executeQuery:sql];
......
...@@ -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.13</string> <string>1.2.16</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2.13</string> <string>1.2.16</string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#else #else
//********开发环境******** //********开发环境********
#define HTTP_REST_API_BASE_URL @"http://gomoredev:8090/cruiser-server/rest" //#define HTTP_REST_API_BASE_URL @"http://gomoredev:8090/cruiser-server/rest"
//********测试环境******** //********测试环境********
//#define HTTP_REST_API_BASE_URL @"http://122.224.171.126:7280/cruiser-server/rest" #define HTTP_REST_API_BASE_URL @"http://122.224.171.126:7280/cruiser-server/rest"
//********正式环境********* //********正式环境*********
//#define HTTP_REST_API_BASE_URL //#define HTTP_REST_API_BASE_URL
......
...@@ -403,7 +403,7 @@ typedef enum : NSUInteger { ...@@ -403,7 +403,7 @@ typedef enum : NSUInteger {
ShowMessage(@"收货仓库不能为空"); ShowMessage(@"收货仓库不能为空");
return NO; return NO;
} }
if (_purchaseView.purchaseExternal.text == 0) { if (_purchaseView.purchaseExternal.text.length == 0) {
ShowMessage(@"外部单据号不能为空"); ShowMessage(@"外部单据号不能为空");
return NO; return NO;
} }
...@@ -415,6 +415,11 @@ typedef enum : NSUInteger { ...@@ -415,6 +415,11 @@ typedef enum : NSUInteger {
ShowMessage(@"金额不能为空"); ShowMessage(@"金额不能为空");
return NO; return NO;
} }
if (_aBottomView.costVC.costArr.count == 0) {
ShowMessage(@"请添加费用明细");
return NO;
}
for (PurchaseBillProduct *billProduct in _aBottomView.productVC.productArr) { for (PurchaseBillProduct *billProduct in _aBottomView.productVC.productArr) {
if ([billProduct.qty floatValue] <= 0 || [billProduct.baseQty floatValue] <= 0) { if ([billProduct.qty floatValue] <= 0 || [billProduct.baseQty floatValue] <= 0) {
ShowMessage(@"有数量等于0的商品明细,请编辑后保存"); ShowMessage(@"有数量等于0的商品明细,请编辑后保存");
......
...@@ -530,6 +530,8 @@ typedef enum : NSUInteger { ...@@ -530,6 +530,8 @@ typedef enum : NSUInteger {
self.labelInspectTime.text = [IBTCommon checkString:self.bill.approv_time]; self.labelInspectTime.text = [IBTCommon checkString:self.bill.approv_time];
self.labelExpiredDate.text = [IBTCommon checkString:self.bill.expiredDate]; self.labelExpiredDate.text = [IBTCommon checkString:self.bill.expiredDate];
self.labelOutSideNum.text = [IBTCommon checkString:self.bill.outSideBillNumber]; self.labelOutSideNum.text = [IBTCommon checkString:self.bill.outSideBillNumber];
self.labelReciever.text = [IBTCommon checkString:self.bill.receive_operName];
self.labelRecieveTime.text = [IBTCommon checkString:self.bill.receive_time];
NSMutableArray *productArr = [NSMutableArray array]; NSMutableArray *productArr = [NSMutableArray array];
if (self.type == PurchaseTypeAfterVerify) { if (self.type == PurchaseTypeAfterVerify) {
...@@ -554,8 +556,8 @@ typedef enum : NSUInteger { ...@@ -554,8 +556,8 @@ typedef enum : NSUInteger {
_pvc.productArr = productArr; _pvc.productArr = productArr;
[_pvc.tableView reloadData]; [_pvc.tableView reloadData];
//如果是wms,非中心仓,则审核直接收货 //如果是wms,非中心仓,则审核完加载详情的时候自动收货
if (self.isWms && self.isCenter == NO) { if (self.isWms && self.isCenter == NO && [self.bill.state isEqualToString:PURCHASE_STATE_WAITE_RECIEVE]) {
[self httpRecieve]; [self httpRecieve];
} }
...@@ -662,6 +664,7 @@ typedef enum : NSUInteger { ...@@ -662,6 +664,7 @@ typedef enum : NSUInteger {
[weakSelf.navigationController popViewControllerAnimated:YES]; [weakSelf.navigationController popViewControllerAnimated:YES];
} }
} failure:^(id fail) { } failure:^(id fail) {
[hud hide:YES];
[IBTLoadingView showTips:fail]; [IBTLoadingView showTips:fail];
}]; }];
......
...@@ -89,7 +89,7 @@ typedef enum : NSUInteger { ...@@ -89,7 +89,7 @@ typedef enum : NSUInteger {
NSMutableArray *orderArr =[NSMutableArray array]; NSMutableArray *orderArr =[NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) { if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new]; QueryOrder *order = [QueryOrder new];
order.field = @"lastModified"; order.field = @"lastModify_time";
order.direction = self.orderDirection; order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]]; [orderArr addObject:[order dictForCommit]];
} }
...@@ -141,7 +141,7 @@ typedef enum : NSUInteger { ...@@ -141,7 +141,7 @@ typedef enum : NSUInteger {
@"queryOrders":orderArr, @"queryOrders":orderArr,
@"userUuid":userUtil.userId, @"userUuid":userUtil.userId,
@"pageNumber":@(_currentPage), @"pageNumber":@(_currentPage),
@"pageSize":@(20)}; @"pageSize":@(10)};
[[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail]; [[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail];
} }
- (void)fetchtPuchaseList:(id)data{ - (void)fetchtPuchaseList:(id)data{
......
...@@ -287,6 +287,7 @@ typedef enum : NSUInteger { ...@@ -287,6 +287,7 @@ typedef enum : NSUInteger {
#pragma mark - 通知选择采购单 #pragma mark - 通知选择采购单
- (void)choseTransferPurchase{ - (void)choseTransferPurchase{
TransportPurchaseViewController *tpv = [TransportPurchaseViewController new]; TransportPurchaseViewController *tpv = [TransportPurchaseViewController new];
tpv.isTransportIn = NO;
tpv.getProchaseProduct = ^(NSArray *products){ tpv.getProchaseProduct = ^(NSArray *products){
if (products.count > 0) { if (products.count > 0) {
NSMutableArray *arr = [self coverTransferProduct:products]; NSMutableArray *arr = [self coverTransferProduct:products];
......
...@@ -321,6 +321,7 @@ typedef enum : NSUInteger { ...@@ -321,6 +321,7 @@ typedef enum : NSUInteger {
- (void)choseTransportPurchase{ - (void)choseTransportPurchase{
__weak NewTransportViewController *weakSelf = self; __weak NewTransportViewController *weakSelf = self;
TransportPurchaseViewController *tpv = [TransportPurchaseViewController new]; TransportPurchaseViewController *tpv = [TransportPurchaseViewController new];
tpv.isTransportIn = YES;
tpv.getProchaseProduct = ^(NSArray *products){ tpv.getProchaseProduct = ^(NSArray *products){
if (products.count > 0) { if (products.count > 0) {
[_bottomView reProduct:products]; [_bottomView reProduct:products];
......
...@@ -14,4 +14,8 @@ typedef void(^GetPurchaseProduct)(NSArray *products); ...@@ -14,4 +14,8 @@ typedef void(^GetPurchaseProduct)(NSArray *products);
@property (nonatomic,copy)GetPurchaseProduct getProchaseProduct; @property (nonatomic,copy)GetPurchaseProduct getProchaseProduct;
@property (nonatomic,copy)GetPurchaseProduct blockFirstWarehouse; @property (nonatomic,copy)GetPurchaseProduct blockFirstWarehouse;
/**
* 如果是发运单界面进入,则只显示已收货的。否的话则是转运单进入,则不限时
*/
@property (nonatomic, assign) BOOL isTransportIn;
@end @end
...@@ -81,15 +81,29 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -81,15 +81,29 @@ NSInteger purchaseStockCheckNumber = 0;
if (self.contentStr.length > 0) { if (self.contentStr.length > 0) {
billNumberObject = self.contentStr; billNumberObject = self.contentStr;
} }
NSDictionary *dict = @{ NSDictionary *dict;
@"state":PURCHASE_STATE_RECEIVED,
@"queryOrders":orderArr, if (self.isTransportIn) {
@"userUuid":userUtil.userId, dict = @{
@"billNumberProductLike":billNumberObject, @"state":PURCHASE_STATE_RECEIVED,
@"fetchParts":@"products", @"queryOrders":orderArr,
@"isProductCenter":@(1), @"userUuid":userUtil.userId,
@"pageNumber":@(_currentPage), @"billNumberProductLike":billNumberObject,
@"pageSize":@(20)}; @"fetchParts":@"products",
@"isProductCenter":@(1),
@"pageNumber":@(_currentPage),
@"pageSize":@(20)};
}else{
dict = @{
@"state":[NSNull null],
@"stateNotIn":@[PURCHASE_STATE_ABORTED,PURCHASE_STATE_REJECTED],
@"queryOrders":orderArr,
@"userUuid":userUtil.userId,
@"billNumberProductLike":billNumberObject,
@"fetchParts":@"products",
@"pageNumber":@(_currentPage),
@"pageSize":@(20)};
}
[[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail]; [[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail];
} }
- (void)fetchtPuchaseList:(id)data{ - (void)fetchtPuchaseList:(id)data{
...@@ -292,7 +306,11 @@ NSInteger purchaseStockCheckNumber = 0; ...@@ -292,7 +306,11 @@ NSInteger purchaseStockCheckNumber = 0;
detail.uuid = nil; detail.uuid = nil;
[arr addObject:detail]; [arr addObject:detail];
} }
weakSelf.getProchaseProduct(arr);
if (weakSelf.getProchaseProduct) {
weakSelf.getProchaseProduct(arr);
}
for (PurchaseBill *bill in self.dataArr) { for (PurchaseBill *bill in self.dataArr) {
if ([array containsObject:bill.billNumber]) { if ([array containsObject:bill.billNumber]) {
if (weakSelf.blockFirstWarehouse) { if (weakSelf.blockFirstWarehouse) {
......
...@@ -84,7 +84,7 @@ typedef enum : NSUInteger { ...@@ -84,7 +84,7 @@ typedef enum : NSUInteger {
NSMutableArray *orderArr =[NSMutableArray array]; NSMutableArray *orderArr =[NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) { if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new]; QueryOrder *order = [QueryOrder new];
order.field = @"lastModified"; order.field = @"lastModify_time";
order.direction = self.orderDirection; order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]]; [orderArr addObject:[order dictForCommit]];
} }
...@@ -132,7 +132,7 @@ typedef enum : NSUInteger { ...@@ -132,7 +132,7 @@ typedef enum : NSUInteger {
@"queryOrders":orderArr, @"queryOrders":orderArr,
@"userUuid":userUtil.userId, @"userUuid":userUtil.userId,
@"pageNumber":@(_currentPage), @"pageNumber":@(_currentPage),
@"pageSize":@(20)}; @"pageSize":@(10)};
[[ICRHTTPController sharedController] queryTransPortWithData:dict success:succ failure:fail]; [[ICRHTTPController sharedController] queryTransPortWithData:dict success:succ failure:fail];
} }
- (void)fetchtPuchaseList:(id)data{ - (void)fetchtPuchaseList:(id)data{
......
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
if (self.selectWarehouse.length > 0) { if (self.selectWarehouse.length > 0) {
cvc.selectStr = self.selectWarehouse; cvc.selectStr = self.selectWarehouse;
} }
cvc.warehouseType = WareHouseTypeCenter;
cvc.choseBaseInfo = ^(NSArray *warehouses){ cvc.choseBaseInfo = ^(NSArray *warehouses){
if (warehouses.count > 0) { if (warehouses.count > 0) {
Warehouse *warehouse = warehouses[0]; Warehouse *warehouse = warehouses[0];
...@@ -207,6 +208,8 @@ ...@@ -207,6 +208,8 @@
if (self.selectRwarehouse.length > 0) { if (self.selectRwarehouse.length > 0) {
tvc.selectStr = self.selectRwarehouse; tvc.selectStr = self.selectRwarehouse;
} }
tvc.warehouseType = WareHouseTypeNotCenter;
tvc.choseBaseInfo = ^(NSArray *warehouses){ tvc.choseBaseInfo = ^(NSArray *warehouses){
if (warehouses.count > 0) { if (warehouses.count > 0) {
Warehouse *warehouse = warehouses[0]; Warehouse *warehouse = warehouses[0];
......
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