Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
f4b160b0
Commit
f4b160b0
authored
7 years ago
by
Sandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决新建发运单选择采购单时缓存已选择商品遗留的问题
parent
c70042bf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
51 deletions
+118
-51
Info.plist
XFFruit/Info.plist
+2
-2
NewTransportViewController.m
...ollers/Transport/Controllers/NewTransportViewController.m
+60
-3
TransportPurchaseViewController.m
...s/Transport/Controllers/TransportPurchaseViewController.m
+56
-46
No files found.
XFFruit/Info.plist
View file @
f4b160b0
...
...
@@ -15,11 +15,11 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.2.1
8
<
/string
>
<
string
>
1.2.1
9
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1.2.1
8
<
/string
>
<
string
>
1.2.1
9
<
/string
>
<
k
e
y
>
NSAppTransportSecurity
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Transport/Controllers/NewTransportViewController.m
View file @
f4b160b0
...
...
@@ -16,6 +16,8 @@
#import "TransportViewController.h"
#import "ShopDetaileViewController.h"
#import "PurchaseBill.h"
#import "ProductStockModel.h"
NSInteger
purchaseAddStockCheckNumber
=
0
;
typedef
enum
:
NSUInteger
{
SaveTag
=
7000
,
CommitTag
,
...
...
@@ -148,9 +150,17 @@ typedef enum : NSUInteger {
break
;
case
CommitTag
:{
if
([
self
checkTransport
])
{
UIAlertView
*
alertView
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"温馨提示"
message
:
@"请确认提交"
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确认"
,
nil
];
alertView
.
delegate
=
self
;
[
alertView
show
];
NSArray
*
array
=
self
.
dicProduct
.
allKeys
;
__weak
NewTransportViewController
*
weakSelf
=
self
;
//判断数量问题
[
IBTLoadingView
showProgressLabel
:
@""
];
[
self
stockValidWithDic
:
self
.
dicProduct
billNumbers
:
array
complete
:^
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
UIAlertView
*
alertView
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"温馨提示"
message
:
@"请确认提交"
delegate
:
weakSelf
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确认"
,
nil
];
alertView
.
delegate
=
weakSelf
;
[
alertView
show
];
}];
}
}
break
;
...
...
@@ -158,6 +168,53 @@ typedef enum : NSUInteger {
break
;
}
}
-
(
void
)
stockValidWithDic
:
(
NSMutableDictionary
*
)
dic
billNumbers
:
(
NSArray
*
)
billNumbers
complete
:
(
void
(
^
)(
void
))
complete
{
NSString
*
billNum
=
billNumbers
[
purchaseAddStockCheckNumber
];
NSMutableArray
*
arrProducts
=
[
dic
objectForKey
:
billNum
];
__weak
NewTransportViewController
*
weakSelf
=
self
;
[
HTTP
purchaseStockWithPurchaseUuid
:
billNum
success
:
^
(
id
succ
)
{
if
(
!
[
succ
[
@"data"
]
isKindOfClass
:[
NSArray
class
]])
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
NSString
*
msg
=
[
NSString
stringWithFormat
:
@"该批次<%@>在总部系统的库存不足!"
,
billNum
];
ShowMessage
(
msg
);
return
;
}
for
(
NSDictionary
*
dict
in
succ
[
@"data"
])
{
ProductStockModel
*
model
=
[
ProductStockModel
new
];
[
model
setValuesForKeysWithDictionary
:
dict
];
for
(
TransportPdtDetail
*
detail
in
arrProducts
)
{
if
([
detail
.
productCode
isEqualToString
:
model
.
productCode
])
{
if
(
detail
.
baseQty
.
floatValue
>
model
.
qty
.
floatValue
)
{
CLog
(
@"库存不足"
);
[
IBTLoadingView
hideHUDWithText
:
@""
];
purchaseAddStockCheckNumber
=
0
;
NSString
*
msg
=
[
NSString
stringWithFormat
:
@"该批次<%@>的商品%@在总部系统的库存不足!"
,
billNum
,
detail
.
productName
];
ShowMessage
(
msg
);
return
;
}
}
}
}
purchaseAddStockCheckNumber
+=
1
;
if
(
purchaseAddStockCheckNumber
==
billNumbers
.
count
)
{
purchaseAddStockCheckNumber
=
0
;
complete
();
}
else
{
[
weakSelf
stockValidWithDic
:
dic
billNumbers
:
billNumbers
complete
:
complete
];
}
}
failure
:^
(
id
fail
)
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
purchaseAddStockCheckNumber
=
0
;
}];
}
-
(
void
)
getDataFromServer
:
(
NSString
*
)
state
msg
:
(
NSString
*
)
msg
{
//保存
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Transport/Controllers/TransportPurchaseViewController.m
View file @
f4b160b0
...
...
@@ -37,7 +37,7 @@ NSInteger purchaseStockCheckNumber = 0;
-
(
instancetype
)
init
{
self
=
[
super
init
];
if
(
self
)
{
}
return
self
;
}
...
...
@@ -88,14 +88,14 @@ NSInteger purchaseStockCheckNumber = 0;
if
(
self
.
isTransportIn
)
{
dict
=
@{
@"state"
:
PURCHASE_STATE_RECEIVED
,
@"queryOrders"
:
orderArr
,
@"userUuid"
:
userUtil
.
userId
,
@"billNumberProductLike"
:
billNumberObject
,
@"fetchParts"
:
@"products"
,
@"isProductCenter"
:
@
(
1
),
@"pageNumber"
:
@
(
_currentPage
),
@"pageSize"
:
@
(
20
)};
@"state"
:
PURCHASE_STATE_RECEIVED
,
@"queryOrders"
:
orderArr
,
@"userUuid"
:
userUtil
.
userId
,
@"billNumberProductLike"
:
billNumberObject
,
@"fetchParts"
:
@"products"
,
@"isProductCenter"
:
@
(
1
),
@"pageNumber"
:
@
(
_currentPage
),
@"pageSize"
:
@
(
20
)};
}
else
{
dict
=
@{
@"state"
:
[
NSNull
null
],
...
...
@@ -144,7 +144,7 @@ NSInteger purchaseStockCheckNumber = 0;
[
self
.
dataArr
addObject
:
purchaseBill
];
}
}
NSDictionary
*
pageDict
=
data
[
@"data"
][
@"paging"
];
NSInteger
pageCount
=
[
pageDict
[
@"pageCount"
]
integerValue
];
[
self
.
tableView
reloadData
];
...
...
@@ -195,7 +195,7 @@ NSInteger purchaseStockCheckNumber = 0;
self
.
contentStr
=
@""
;
}
[
self
getData
];
}
#pragma mark - 布局
...
...
@@ -304,7 +304,7 @@ 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
)
{
...
...
@@ -313,7 +313,7 @@ NSInteger purchaseStockCheckNumber = 0;
NSMutableArray
*
arrProduct
=
[
self
.
dicProduct
objectForKey
:
bill
.
billNumber
];
if
(
!
arrProduct
)
{
arrProduct
=
[
NSMutableArray
array
];
[
self
.
dicProduct
setObject
:
arrProduct
forKey
:
bill
.
billNumber
];
[
dicProduct
setObject
:
arrProduct
forKey
:
bill
.
billNumber
];
}
[
arrProduct
addObject
:
detail
];
...
...
@@ -321,51 +321,59 @@ NSInteger purchaseStockCheckNumber = 0;
}
}
NSArray
*
array
=
self
.
dicProduct
.
allKeys
;
NSArray
*
array
=
dicProduct
.
allKeys
;
if
(
array
.
count
==
0
)
{
ShowMessage
(
@"请选择商品!"
);
return
;
}
__weak
TransportPurchaseViewController
*
weakSelf
=
self
;
//判断数量问题
[
self
stockValidWithDic
:
self
.
dicProduct
billNumbers
:
array
complete
:^
{
[
weakSelf
PopViewControllerAnimated
:
YES
];
if
(
weakSelf
.
indexArr
.
count
>
0
)
{
NSMutableArray
*
arr
=
[
NSMutableArray
array
];
for
(
TransportPdtDetail
*
detail
in
weakSelf
.
indexArr
)
{
detail
.
purchasePdtDetail
=
detail
.
uuid
;
detail
.
uuid
=
nil
;
[
arr
addObject
:
detail
];
}
if
(
weakSelf
.
getProchaseProduct
)
{
weakSelf
.
getProchaseProduct
(
arr
);
}
for
(
PurchaseBill
*
bill
in
self
.
dataArr
)
{
if
([
array
containsObject
:
bill
.
billNumber
])
{
if
(
weakSelf
.
blockFirstWarehouse
)
{
weakSelf
.
blockFirstWarehouse
(@[
bill
]);
}
break
;
}
[
IBTLoadingView
showProgressLabel
:
@""
];
[
self
stockValidWithDic
:
dicProduct
billNumbers
:
array
complete
:^
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
//库存足够时,把临时数据放入正式的缓存数据中
for
(
NSString
*
key
in
dicProduct
.
allKeys
)
{
NSMutableArray
*
arrTemp
=
[
dicProduct
objectForKey
:
key
];
NSMutableArray
*
arrData
=
[
weakSelf
.
dicProduct
objectForKey
:
key
];
[
arrData
addObjectsFromArray
:
arrTemp
];
}
[
weakSelf
PopViewControllerAnimated
:
YES
];
NSMutableArray
*
arr
=
[
NSMutableArray
array
];
for
(
TransportPdtDetail
*
detail
in
weakSelf
.
indexArr
)
{
detail
.
purchasePdtDetail
=
detail
.
uuid
;
detail
.
uuid
=
nil
;
[
arr
addObject
:
detail
];
}
if
(
weakSelf
.
getProchaseProduct
)
{
weakSelf
.
getProchaseProduct
(
arr
);
}
for
(
PurchaseBill
*
bill
in
self
.
dataArr
)
{
if
([
array
containsObject
:
bill
.
billNumber
])
{
if
(
weakSelf
.
blockFirstWarehouse
)
{
weakSelf
.
blockFirstWarehouse
(@[
bill
]);
}
break
;
}
}
}];
}
-
(
void
)
stockValidWithDic
:
(
NSMutableDictionary
*
)
dic
billNumbers
:
(
NSArray
*
)
billNumbers
complete
:
(
void
(
^
)(
void
))
complete
{
NSString
*
billNum
=
billNumbers
[
purchaseStockCheckNumber
];
NSMutableArray
*
arrProducts
=
[
dic
objectForKey
:
billNum
];
__weak
TransportPurchaseViewController
*
weakSelf
=
self
;
[
HTTP
purchaseStockWithPurchaseUuid
:
billNum
success
:
^
(
id
succ
)
{
if
(
!
[
succ
[
@"data"
]
isKindOfClass
:[
NSArray
class
]])
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
NSString
*
msg
=
[
NSString
stringWithFormat
:
@"该批次<%@>在总部系统的库存不足!"
,
billNum
];
ShowMessage
(
msg
);
return
;
...
...
@@ -378,6 +386,7 @@ NSInteger purchaseStockCheckNumber = 0;
if
([
detail
.
productCode
isEqualToString
:
model
.
productCode
])
{
if
(
detail
.
baseQty
.
floatValue
>
model
.
qty
.
floatValue
)
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
CLog
(
@"库存不足"
);
purchaseStockCheckNumber
=
0
;
NSString
*
msg
=
[
NSString
stringWithFormat
:
@"该批次<%@>的商品%@在总部系统的库存不足!"
,
billNum
,
detail
.
productName
];
...
...
@@ -395,8 +404,9 @@ NSInteger purchaseStockCheckNumber = 0;
}
else
{
[
weakSelf
stockValidWithDic
:
dic
billNumbers
:
billNumbers
complete
:
complete
];
}
}
failure
:^
(
id
fail
)
{
[
IBTLoadingView
hideHUDWithText
:
@""
];
purchaseStockCheckNumber
=
0
;
}];
}
...
...
@@ -415,13 +425,13 @@ NSInteger purchaseStockCheckNumber = 0;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment