Commit 335e7cd4 authored by Sandy's avatar Sandy

采购单、发运单完善

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