ProductSearchViewController.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. //
  2. // ProductSearchViewController.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/16.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "ProductSearchViewController.h"
  9. #import "GoodsSearchCell.h"
  10. #import "SBJsonWriter.h"
  11. #import "ShopCartViewController.h"
  12. #import "ScanViewController.h"
  13. #import "GoodsDetailViewController.h"
  14. @interface ProductSearchViewController (){
  15. MBProgressHUD *HUD;
  16. }
  17. @end
  18. @implementation ProductSearchViewController
  19. #pragma mark - 公共函数
  20. /**
  21. viewDidLoad函数
  22. */
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
  26. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
  27. [self initUI];
  28. _orderArr=[NSMutableArray new];
  29. _goodsModel=[GoodsSearchModel new];
  30. _orderTempFilterArry=[NSMutableArray new];
  31. }
  32. #pragma mark -委托回调函数
  33. //购物车加载完成函数
  34. - (void)onCartLoadFinish:(ASIDownManager *)sender {
  35. NSDictionary *dic = [sender.mWebStr JSONValue];
  36. [HUD hide:YES];
  37. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  38. int iStatus = [[dic objectForKey:@"Status"] intValue];
  39. NSString *message=[dic objectForKey:@"Message"];
  40. if (iStatus == 0) {
  41. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"操作成功" preferredStyle:UIAlertControllerStyleAlert];
  42. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"继续操作" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  43. }];
  44. UIColor *cancelColor=[UIColor blackColor];
  45. UIColor *sureColor=[UIColor redColor];
  46. [cancelAction setValue:cancelColor forKey:@"titleTextColor"];
  47. UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"去购物车"
  48. style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  49. self.cNav.visibleViewController.hidesBottomBarWhenPushed=YES;
  50. ShopCartViewController *detailVC=[[ShopCartViewController alloc] init];
  51. [self.cNav setNavigationBarHidden:NO animated:YES];
  52. [self.cNav pushViewController:detailVC animated:YES];
  53. }];
  54. [otherAction setValue:sureColor forKey:@"titleTextColor"];
  55. [alertController addAction:otherAction];
  56. [alertController addAction:cancelAction];
  57. [self presentViewController:alertController animated:YES completion:nil];
  58. }
  59. else if(iStatus==ActionResultStatusAuthError
  60. ||iStatus==ActionResultStatusNoLogin
  61. ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
  62. [self showReLoginDialog:message];
  63. return;
  64. }
  65. else {
  66. [self showAlertViewText:message];
  67. }
  68. }
  69. }
  70. /**
  71. 修改:2017-9-25
  72. 适配机型
  73. 安全区视图发生变化
  74. */
  75. -(void)viewSafeAreaInsetsDidChange{
  76. _tbView.frame=CGRectMake(0,CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame), SCREENWIDTH,self.view.superview.frame.size.height-CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame));
  77. [super viewSafeAreaInsetsDidChange];
  78. }
  79. //购物车加载失败函数
  80. - (void)onCartLoadFail:(ASIDownManager *)sender {
  81. [self cancel];
  82. [self showAlertViewText:@"请求失败"];
  83. }
  84. //文本编辑回調函数
  85. -(void)textValueChange:(GoodsSearchCell*)cell txtField:(UITextField*)txtfield
  86. {
  87. [_goodsModel updateCellSaleText:txtfield checkeId:cell.lblInventoryId.text];
  88. }
  89. //弹出消息回调
  90. -(void)alertMessage:(NSString*)message{
  91. [self showAlertViewText:message];
  92. return;
  93. }
  94. //文本编辑回车事件回调函数
  95. - (BOOL)textFieldShouldReturn:(UITextField *)textField{
  96. if(textField ==_onlyCodeTxt){
  97. if(textField.text.length==0)
  98. {
  99. [self showAlertViewText:@"商品编码和唯一编码不能都为空"];
  100. return YES;
  101. }
  102. [self.view endEditing:YES];
  103. [self reloadData];
  104. }
  105. return YES;
  106. }
  107. //扫描回调函数
  108. -(void)reloadDataWithOnlyCode:(NSString *)code
  109. {
  110. _onlyCodeTxt.text=code;
  111. [self reloadScanData];
  112. }
  113. //加载数据完成函数
  114. - (void)onLoadFinish:(ASIDownManager *)sender {
  115. NSDictionary *dic = [sender.mWebStr JSONValue];
  116. [self cancel];
  117. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  118. int iStatus = [[dic objectForKey:@"Status"] intValue];
  119. NSString *message=[dic objectForKey:@"Message"];
  120. _tbView.backgroundView=nil;
  121. if (iStatus == 0) {
  122. NSArray * approvArr=[dic objectForKey:@"Result"];
  123. if(approvArr!=nil)
  124. {
  125. [_orderArr removeAllObjects];
  126. _orderArr=[[NSMutableArray alloc]initWithArray:approvArr];
  127. if(_orderArr.count==0){
  128. UIView *noDataView = [[UIView alloc]init];
  129. noDataView.frame = _tbView.bounds;
  130. UIImageView *nodataImgView = [[UIImageView alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16,noDataView.frame.size.height/2-16,32,32)];
  131. [nodataImgView setImage:[UIImage imageNamed:@"icon_no_data"]];
  132. [noDataView addSubview:nodataImgView];
  133. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16-12,CGRectGetMaxY(nodataImgView.frame)+3,70, 25)];
  134. label.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  135. label.text = @"无数据";
  136. label.numberOfLines = 2;
  137. label.textColor = [UIColor lightGrayColor];
  138. [noDataView addSubview:label];
  139. _tbView.backgroundView=noDataView;
  140. [_tbView reloadData];
  141. [self showAlertViewText:@"未找到匹配结果"];
  142. return;
  143. }
  144. _separatorView.hidden=NO;
  145. [_goodsModel parseWorkFlowArr:_orderArr];
  146. if(_goodsModel.workflowArr!=nil&&_goodsModel.workflowArr.count>0){
  147. _orderFilterArry=[[NSMutableArray alloc] initWithArray:_goodsModel.workflowArr copyItems:YES];
  148. }
  149. _filterHeight=50;
  150. _vFilterZeroCanSalesQuantity.frame=CGRectMake(0, CGRectGetMaxY(_separatorView.frame), Screen_Width, _filterHeight);
  151. [_btnFilterZeroCanSalesQuantity setBackgroundImage:[UIImage imageNamed:@"unck_round"] forState:UIControlStateNormal];
  152. _isFilterCanSalesQuantity=NO;
  153. if(IsiPhoneX){
  154. _tbView.frame=CGRectMake(0,CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame), Screen_Width,self.view.superview.frame.size.height-CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame));
  155. }
  156. else{
  157. _tbView.frame=CGRectMake(0,CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame), Screen_Width,self.view.frame.size.height-CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame)-105);
  158. }
  159. [_tbView reloadData];
  160. }
  161. }
  162. else if(iStatus==ActionResultStatusAuthError
  163. ||iStatus==ActionResultStatusNoLogin
  164. ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
  165. [self showReLoginDialog:message];
  166. return;
  167. }
  168. else {
  169. [_tbView reloadData];
  170. [self showAlertViewText:message];
  171. }
  172. }
  173. }
  174. //tableviewcell的高度
  175. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  176. {
  177. OrderSearchFrame *infoFrame=_goodsModel.workflowArr[indexPath.row];
  178. return infoFrame.cellHeight;
  179. }
  180. //tableview的分区数
  181. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  182. return 1;
  183. }
  184. //tableview的行数
  185. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  186. return [_goodsModel.workflowArr count];
  187. }
  188. //获取tableviewcell
  189. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  190. static NSString *CellIdentifier = @"GoodsSearchCell";
  191. GoodsSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  192. cell=[[ GoodsSearchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  193. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  194. cell.delegate=self;
  195. OrderSearchFrame *infoFrame=_goodsModel.workflowArr[indexPath.row];
  196. [cell parseOrderInfo:infoFrame];
  197. return cell;
  198. }
  199. //行点击事件
  200. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  201. {
  202. self.hidesBottomBarWhenPushed=YES;
  203. GoodsDetailViewController *detailVC=[[GoodsDetailViewController alloc] init];
  204. // NSDictionary *dic= _orderArr[indexPath.row];
  205. OrderSearchFrame *infoFrame=_goodsModel.workflowArr[indexPath.row];
  206. GoodsSearchItemModel *searchItemModel= infoFrame.searchModel;
  207. int orderIdValue=[searchItemModel.inventoryID intValue];
  208. NSString *orderId= [NSString stringWithFormat:@"%d",orderIdValue];
  209. detailVC.inventoryId=orderId;
  210. self.cNav.visibleViewController.hidesBottomBarWhenPushed=YES;
  211. [self.cNav pushViewController:detailVC animated:YES];
  212. }
  213. //scrollview的委托函数
  214. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  215. {
  216. [self.view endEditing:YES];
  217. }
  218. //scrollview的开始拖拽函数
  219. - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
  220. [self.view endEditing:YES];
  221. }
  222. //数据加载失败函数
  223. - (void)onLoadFail:(ASIDownManager *)sender {
  224. [self cancel];
  225. [self showAlertViewText:@"加载失败"];
  226. }
  227. //初始化UI函数
  228. -(void)initUI{
  229. self.view.backgroundColor=[UIColor whiteColor];
  230. UIView *searchView = [[UIView alloc] init];
  231. searchView.frame = CGRectMake(15,10,Screen_Width-70,35);
  232. searchView.backgroundColor = [UIColor colorWithRed:232.0/255.0 green:233.0/255.0 blue:235.0/255.0 alpha:1];
  233. searchView.layer.cornerRadius = 10;
  234. searchView.layer.masksToBounds = YES;
  235. UILabel* lblOnlyCode=[[UILabel alloc] init];
  236. lblOnlyCode.frame=CGRectMake(10, 5,80, 25);
  237. lblOnlyCode.text=@"唯一编码:";
  238. lblOnlyCode.font=orderTextFont;
  239. [searchView addSubview:lblOnlyCode];
  240. _onlyCodeTxt=[[UITextField alloc] init];
  241. _onlyCodeTxt.frame=CGRectMake(CGRectGetMaxX(lblOnlyCode.frame), 5, 150, 25);
  242. _onlyCodeTxt.textColor=[UIColor blackColor];
  243. _onlyCodeTxt.placeholder=@"请输入或扫描唯一编码";
  244. _onlyCodeTxt.font=orderTextFont;
  245. _onlyCodeTxt.delegate=self;
  246. [searchView addSubview:_onlyCodeTxt];
  247. _scanBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  248. _scanBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  249. _scanBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
  250. _scanBtn.frame=CGRectMake(Screen_Width-40,15, 25, 25);
  251. UIImage *backgroundImg = [UIImage imageNamed:@"icon_scan"];
  252. [_scanBtn setBackgroundImage:backgroundImg forState:UIControlStateNormal];
  253. [_scanBtn addTarget:self action:@selector(goScan) forControlEvents:UIControlEventTouchUpInside];
  254. [self.view addSubview:searchView];
  255. [self.view addSubview:_scanBtn];
  256. _separatorView = [[UIView alloc] init];
  257. _separatorView.frame = CGRectMake(0,CGRectGetMaxY(searchView.frame)+10,Screen_Width,10);
  258. _separatorView.backgroundColor = LineBackgroundColor;
  259. [self.view addSubview:_separatorView];
  260. _vFilterZeroCanSalesQuantity=[[UIView alloc]init];
  261. _filterHeight=0;
  262. _vFilterZeroCanSalesQuantity.frame=CGRectMake(0, CGRectGetMaxY(_separatorView.frame), Screen_Width, _filterHeight);
  263. [self.view addSubview:_vFilterZeroCanSalesQuantity];
  264. _btnFilterZeroCanSalesQuantity=[UIButton buttonWithType:UIButtonTypeCustom];
  265. _btnFilterZeroCanSalesQuantity.frame=CGRectMake(Screen_Width/2-70,11,16,16);
  266. [_btnFilterZeroCanSalesQuantity setBackgroundImage:[UIImage imageNamed:@"unck_round"] forState:UIControlStateNormal];
  267. [_btnFilterZeroCanSalesQuantity addTarget:self action:@selector(filterZeroCanSalesQuantity)
  268. forControlEvents:UIControlEventTouchUpInside];
  269. _isFilterCanSalesQuantity=NO;
  270. [_vFilterZeroCanSalesQuantity addSubview:_btnFilterZeroCanSalesQuantity];
  271. _lblFilterZeroCanSalesQuantity=[UILabel new];
  272. _lblFilterZeroCanSalesQuantity.frame=CGRectMake(CGRectGetMaxX(_btnFilterZeroCanSalesQuantity.frame)+3,7, 120, 25);
  273. _lblFilterZeroCanSalesQuantity.text=@"过滤零可售量";
  274. _lblFilterZeroCanSalesQuantity.font=orderTextFont;
  275. _lblFilterZeroCanSalesQuantity.textColor=[UIColor blackColor];
  276. UITapGestureRecognizer *tapRecognizerCustomerArea=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(filterZeroCanSalesQuantity)];
  277. _lblFilterZeroCanSalesQuantity.userInteractionEnabled=YES;
  278. [_lblFilterZeroCanSalesQuantity addGestureRecognizer:tapRecognizerCustomerArea];
  279. _middleSeparatorView = [[UIView alloc] init];
  280. _middleSeparatorView.frame = CGRectMake(0,40,Screen_Width,10);
  281. _middleSeparatorView.backgroundColor = LineBackgroundColor;
  282. [_vFilterZeroCanSalesQuantity addSubview:_middleSeparatorView];
  283. [_vFilterZeroCanSalesQuantity addSubview:_lblFilterZeroCanSalesQuantity];
  284. _tbView=[UITableView new];
  285. if(IsiPhoneX){
  286. _tbView.frame=CGRectMake(0,CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame), Screen_Width,self.view.superview.frame.size.height-CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame));
  287. }
  288. else{
  289. _tbView.frame=CGRectMake(0,CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame), Screen_Width,self.view.frame.size.height-CGRectGetMaxY(_vFilterZeroCanSalesQuantity.frame)-105);
  290. }
  291. _tbView.delegate=self;
  292. _tbView.separatorStyle=UITableViewCellSeparatorStyleNone;
  293. _tbView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  294. _tbView.dataSource=self;
  295. _tbView.userInteractionEnabled=YES;
  296. [self.view addSubview:_tbView];
  297. }
  298. /**
  299. 键盘弹出
  300. @param note <#note description#>
  301. */
  302. -(void)keyboardWillShow:(NSNotification *)note
  303. {
  304. CGRect keyBoardRect=[note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
  305. _tbView.contentInset = UIEdgeInsetsMake(0, 0, keyBoardRect.size.height, 0);
  306. }
  307. /**
  308. 键盘隐藏
  309. @param note <#note description#>
  310. */
  311. -(void)keyboardWillHide:(NSNotification *)note
  312. {
  313. _tbView.contentInset = UIEdgeInsetsZero;
  314. }
  315. -(void)filterZeroCanSalesQuantity{
  316. if(_goodsModel.workflowArr!=nil&&_goodsModel.workflowArr.count>0){
  317. [_goodsModel.workflowArr removeAllObjects];
  318. }
  319. if(_orderTempFilterArry!=nil&&_orderTempFilterArry.count){
  320. [_orderTempFilterArry removeAllObjects];
  321. }
  322. if(_tbView!=nil){
  323. [_tbView reloadData];
  324. }
  325. if(!_isFilterCanSalesQuantity){
  326. [_btnFilterZeroCanSalesQuantity setBackgroundImage:[UIImage imageNamed:@"ck_round"] forState:UIControlStateNormal];
  327. _isFilterCanSalesQuantity=YES;
  328. if(_orderFilterArry!=nil&&_orderFilterArry.count>0){
  329. for(OrderSearchFrame *frame in _orderFilterArry){
  330. GoodsSearchItemModel *searchModel= frame.searchModel;
  331. NSString *balanceQuantity= searchModel.balanceQuantity;
  332. double balanceQuantityValue= [balanceQuantity doubleValue];
  333. if(balanceQuantityValue!=0){
  334. [_orderTempFilterArry addObject:frame];
  335. }
  336. }
  337. _goodsModel.workflowArr=[[NSMutableArray alloc] initWithArray:_orderTempFilterArry copyItems:YES];
  338. [_tbView reloadData];
  339. }
  340. }
  341. else{
  342. [_btnFilterZeroCanSalesQuantity setBackgroundImage:[UIImage imageNamed:@"unck_round"] forState:UIControlStateNormal];
  343. _isFilterCanSalesQuantity=NO;
  344. _goodsModel.workflowArr=[[NSMutableArray alloc] initWithArray:_orderFilterArry copyItems:YES];
  345. [_tbView reloadData];
  346. }
  347. }
  348. //扫描函数
  349. -(void)goScan{
  350. ScanViewController * rt = [[ScanViewController alloc]init];
  351. rt.rootVC=self;
  352. self.cNav.visibleViewController.hidesBottomBarWhenPushed=YES;
  353. [self.cNav pushViewController:rt animated:YES];
  354. }
  355. //加入购物车函数
  356. -(void)joinCart:(GoodsSearchItemModel *)searchItem{
  357. NSString *salesQuantity= searchItem.salesQuantity;
  358. if(salesQuantity!=nil){
  359. double salesQuantityValue= salesQuantity.doubleValue;
  360. if(salesQuantityValue==0){
  361. [self showAlertViewText:@"商品的数量不能为0"];
  362. return;
  363. }
  364. else if(salesQuantityValue>MAXIMUM_QUANTITY){
  365. [self showAlertViewText:@"商品超过最大数量9999999999.999999"];
  366. return;
  367. }
  368. self.mDownManager = [[ASIDownManager alloc] init];
  369. _mDownManager.delegate = self;
  370. _mDownManager.OnImageDown = @selector(onCartLoadFinish:);
  371. _mDownManager.OnImageFail = @selector(onCartLoadFail:);
  372. HUD = [[MBProgressHUD alloc] initWithView:self.view];
  373. [self.view addSubview:HUD];
  374. HUD.dimBackground = YES;
  375. HUD.labelText = @"正在加入购物车";
  376. [HUD show:YES];
  377. NSString *urlStr = ServerURL;
  378. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  379. [dict setObject:@"SaveOrderShoppingCart" forKey:@"Action"];
  380. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  381. [dict setObject:kkUserCode forKey:@"UserCode"];
  382. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  383. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  384. [dict setObject:@"1" forKey:@"SaveFlag"]; // 1为新建;2为编辑
  385. NSMutableArray *goodsArr=[NSMutableArray new];
  386. NSDictionary *dic=[NSDictionary new];
  387. NSString *code=searchItem.code;
  388. NSString *onlyCode=searchItem.onlyCode;
  389. NSString *brandName=searchItem.brandName;
  390. NSString *gradeName=searchItem.gradeName;
  391. NSString *specification=searchItem.specification;
  392. NSString *colorNumber=searchItem.colorNumber;
  393. NSString *warehouseName=searchItem.warehouseName;
  394. NSString *positionNumber=searchItem.positionNumber;
  395. NSString *balanceQuantity=searchItem.balanceQuantity;
  396. NSString *inventoryID=searchItem.inventoryID;
  397. NSString *salesQuantity=searchItem.salesQuantity;
  398. NSString *salesPrice=searchItem.salesPrice;
  399. NSString *remarks=searchItem.remarks;
  400. dic=@{@"Code":code,@"OnlyCode":onlyCode,@"BrandName":brandName,@"GradeName":gradeName,@"Specification":specification,@"ColorNumber":colorNumber,@"WarehouseName":warehouseName,@"PositionNumber":positionNumber,@"BalanceQuantity":balanceQuantity,@"InventoryID":inventoryID,@"SalesQuantity":salesQuantity,@"SalesPrice":salesPrice,@"Remarks":remarks};
  401. [goodsArr addObject:dic];
  402. SBJsonWriter *write = [[SBJsonWriter alloc] init];
  403. NSString *value = [write stringWithObject:goodsArr];
  404. [dict setObject:value forKey:@"ShoppingCartData"];
  405. [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  406. }
  407. }
  408. //加载扫描函数
  409. -(void)reloadScanData
  410. {
  411. [self startLoading];
  412. NSString *urlStr = ServerURL;
  413. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  414. [dict setObject:@"GetInventoryByScan" forKey:@"Action"];
  415. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  416. [dict setObject:kkUserCode forKey:@"UserCode"];
  417. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  418. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  419. [dict setObject:@"" forKey:@"Code"];
  420. [dict setObject:_onlyCodeTxt.text forKey:@"OnlyCode"];
  421. [dict setObject:@"" forKey:@"ColorNumber"];
  422. [dict setObject:@"" forKey:@"WarehouseCode"];
  423. [dict setObject:@"" forKey:@"Specification"];
  424. self.mDownManager = [[ASIDownManager alloc] init];
  425. _mDownManager.delegate = self;
  426. _mDownManager.OnImageDown = @selector(onLoadFinish:);
  427. _mDownManager.OnImageFail = @selector(onLoadFail:);
  428. [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  429. }
  430. //加载扫描函数
  431. -(void)reloadData
  432. {
  433. [self startLoading];
  434. NSString *urlStr = ServerURL;
  435. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  436. [dict setObject:@"GetInventoryIphone" forKey:@"Action"];
  437. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  438. [dict setObject:kkUserCode forKey:@"UserCode"];
  439. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  440. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  441. [dict setObject:@"" forKey:@"Code"];
  442. [dict setObject:_onlyCodeTxt.text forKey:@"OnlyCode"];
  443. [dict setObject:@"" forKey:@"ColorNumber"];
  444. [dict setObject:@"" forKey:@"WarehouseCode"];
  445. [dict setObject:@"" forKey:@"Specification"];
  446. self.mDownManager = [[ASIDownManager alloc] init];
  447. _mDownManager.delegate = self;
  448. _mDownManager.OnImageDown = @selector(onLoadFinish:);
  449. _mDownManager.OnImageFail = @selector(onLoadFail:);
  450. [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  451. }
  452. //进度条取消函数
  453. - (void)cancel {
  454. [self stopLoading];
  455. }
  456. @end