OrderGoodsListVC.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. //
  2. // SalesOrderGoodsListVC.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/1/22.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "OrderGoodsListVC.h"
  9. #import "SalesOrderGoodsListModel.h"
  10. #import "SalesOrderGoodsListCell.h"
  11. #import "OrderGoodsDetailVC.h"
  12. @interface SalesOrderGoodsListVC ()<OrderListDelegate,UITableViewDataSource,
  13. UITableViewDelegate>{
  14. }
  15. @end
  16. @implementation OrderGoodsListVC
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. [self loadNavStyle];
  20. [self initUI];
  21. [self loadData];
  22. }
  23. /**
  24. 导航按钮样式
  25. */
  26. -(void)loadNavStyle
  27. {
  28. self.navigationItem.title=@"订单商品列表信息";
  29. //返回
  30. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  31. [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
  32. forState:UIControlStateNormal];
  33. [button addTarget:self action:@selector(goBack)
  34. forControlEvents:UIControlEventTouchUpInside];
  35. button.frame = CGRectMake(0, 0, 15, 18);
  36. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  37. self.navigationItem.leftBarButtonItem = menuButton;
  38. }
  39. -(void)initUI{
  40. [self.view setBackgroundColor:[UIColor whiteColor]];
  41. _vTableView = [[UITableView alloc]
  42. initWithFrame:CGRectMake(0,
  43. 0,
  44. self.view.frame.size.width,
  45. Screen_Height-rectNavHeight-rectStatusHeight)];
  46. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  47. _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  48. _vTableView.backgroundColor = [UIColor whiteColor];
  49. _vTableView.delegate = self;
  50. _vTableView.dataSource=self;
  51. [self.view addSubview: _vTableView];
  52. // _bottomView=[UIView new];
  53. // _bottomView.frame=CGRectMake(0,Screen_Height-rectNavHeight-rectStatusHeight-50, Screen_Width, 50);
  54. // [self.view addSubview:_bottomView];
  55. // UIView *bottomSeparator= [UIView new];
  56. // bottomSeparator.frame=CGRectMake(0,0, Screen_Width, 1);
  57. // bottomSeparator.backgroundColor = LineBackgroundColor;
  58. // [_bottomView addSubview:bottomSeparator];
  59. // _releaseOccupyBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  60. // _releaseOccupyBtn.frame=CGRectMake(Screen_Width-80, 10, 70,30);
  61. // [_releaseOccupyBtn setTitle: @"释放占库" forState: UIControlStateNormal];
  62. // _releaseOccupyBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
  63. // _releaseOccupyBtn.layer.borderColor=[UIColor blackColor].CGColor;
  64. // _releaseOccupyBtn.layer.borderWidth=1;
  65. // _releaseOccupyBtn.layer.cornerRadius=10;
  66. // [_releaseOccupyBtn addTarget:self action:@selector(releaseOccupy) forControlEvents:UIControlEventTouchUpInside];
  67. // [ _releaseOccupyBtn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
  68. // [_bottomView addSubview:_releaseOccupyBtn];
  69. // _occupyBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  70. // _occupyBtn.frame=CGRectMake(CGRectGetMinX(_releaseOccupyBtn.frame)-80, 10, 70,30);
  71. // [_occupyBtn setTitle: @"占库" forState: UIControlStateNormal];
  72. // _occupyBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
  73. // _occupyBtn.layer.borderColor=[UIColor blackColor].CGColor;
  74. // _occupyBtn.layer.borderWidth=1;
  75. // _occupyBtn.layer.cornerRadius=10;
  76. // [_occupyBtn addTarget:self action:@selector(occupy) forControlEvents:UIControlEventTouchUpInside];
  77. // [ _occupyBtn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
  78. // [_bottomView addSubview:_occupyBtn];
  79. //
  80. // UIButton *toSalesBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  81. // toSalesBtn.frame=CGRectMake(CGRectGetMinX(_occupyBtn.frame)-80, 10, 70,30);
  82. // [toSalesBtn setTitle: @"转销售" forState: UIControlStateNormal];
  83. // toSalesBtn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
  84. // toSalesBtn.layer.borderColor=[UIColor blackColor].CGColor;
  85. // toSalesBtn.layer.borderWidth=1;
  86. // toSalesBtn.layer.cornerRadius=10;
  87. // [toSalesBtn addTarget:self action:@selector(tosales) forControlEvents:UIControlEventTouchUpInside];
  88. // [ toSalesBtn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
  89. // [_bottomView addSubview:toSalesBtn];
  90. //
  91. // if([_salesOrderModel.invoiceStatusName isEqualToString:@"完成"]||[_salesOrderModel.invoiceStatusName isEqualToString:@"冲正"]){
  92. // _occupyBtn.layer.borderColor=NavBarUnEnbleItemColor.CGColor;
  93. // [_occupyBtn setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
  94. // [_occupyBtn setEnabled:NO];
  95. // _releaseOccupyBtn.layer.borderColor=NavBarUnEnbleItemColor.CGColor;
  96. // [_releaseOccupyBtn setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
  97. // [_releaseOccupyBtn setEnabled:NO];
  98. //
  99. // toSalesBtn.layer.borderColor=NavBarUnEnbleItemColor.CGColor;
  100. // [toSalesBtn setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
  101. // [toSalesBtn setEnabled:NO];
  102. // }
  103. _dataList=[[NSMutableArray alloc]init];
  104. [self loadData];
  105. }
  106. - (void)goBack
  107. {
  108. [self.navigationController popViewControllerAnimated:YES];
  109. }
  110. -(void)loadData{
  111. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  112. [dict setObject:@"GetSalesOrderDetailListIPhone" forKey:@"Action"];
  113. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  114. [dict setObject:kkUserCode forKey:@"UserCode"];
  115. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  116. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  117. [dict setObject:_salesOrderModel.orderId forKey:@"OrderID"];
  118. _downManager = [[ASIDownManager alloc] init];
  119. [self startLoading];
  120. _downManager.delegate = self;
  121. _downManager.onRequestSuccess = @selector(onOrderGoodsListFinish:);
  122. _downManager.onRequestFail = @selector(onOrderGoodsListFail:);
  123. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  124. }
  125. /**
  126. 加载总数数据成功回调
  127. @param sender <#sender description#>
  128. */
  129. - (void)onOrderGoodsListFinish:(ASIDownManager *)sender {
  130. NSDictionary *dic = [sender.mWebStr JSONValue];
  131. _vTableView.backgroundView = nil;
  132. [self cancel];
  133. // 服务器返回数据是否正确
  134. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  135. // 服务器返回数据状态值
  136. int iStatus = [[dic objectForKey:@"Status"] intValue];
  137. // 服务器返回数据消息
  138. NSString *message=[dic objectForKey:@"Message"];
  139. // 服务器返回数据状态值正确
  140. if (iStatus == 0) {
  141. NSArray * infoArr=[dic objectForKey:@"Result"];
  142. // 返回结果
  143. if(infoArr!=nil&& infoArr.count>0)
  144. {
  145. for (int i = 0; i < infoArr.count; i++) {
  146. NSDictionary * dic=infoArr[i];
  147. SalesOrderGoodsListModel *goodsListModel=[SalesOrderGoodsListModel new];
  148. [goodsListModel ParseDic:dic];
  149. [self.dataList addObject:goodsListModel];
  150. }
  151. [_vTableView reloadData];
  152. }
  153. else{
  154. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  155. UIView *noDataView=[[UIView alloc]init];
  156. noDataView.frame=_vTableView.bounds;
  157. UIImageView *nodataImgView=[[UIImageView alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16,noDataView.frame.size.height/2-16,32,32)];
  158. [nodataImgView setImage:[UIImage imageNamed:@"icon_no_data"]];
  159. [noDataView addSubview:nodataImgView];
  160. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16-12,CGRectGetMaxY(nodataImgView.frame)+3,70, 25)];
  161. label.font=[UIFont systemFontOfSize:NoDataFontOfSize];
  162. label.text = @"无数据";
  163. label.numberOfLines = 2;
  164. label.textColor = [UIColor lightGrayColor];
  165. [noDataView addSubview:label];
  166. // 有刷新数据的时候
  167. if(_dataList == nil || _dataList.count==0){
  168. _vTableView.backgroundView =noDataView;
  169. [self showAlertViewBackText:@"未找到匹配结果"];
  170. }
  171. }
  172. }
  173. // 服务器返回数据状态值异常
  174. else if(iStatus == ActionResultStatusAuthError
  175. ||iStatus == ActionResultStatusNoLogin
  176. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  177. [self cancel];
  178. [self showReLoginDialog:message];
  179. }
  180. else{
  181. [self cancel];
  182. [self showAlertViewText:message];
  183. }
  184. }
  185. }
  186. /**
  187. 加载总数数据失败回调
  188. @param sender <#sender description#>
  189. */
  190. - (void)onOrderGoodsListFail:(ASIDownManager *)sender {
  191. [self cancel];
  192. [self showAlertViewText:@"加载失败"];
  193. }
  194. - (void)onOccupyFinish:(ASIDownManager *)sender {
  195. NSDictionary *dic = [sender.mWebStr JSONValue];
  196. [self cancel];
  197. // 服务器返回数据是否正确
  198. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  199. // 服务器返回数据状态值
  200. int iStatus = [[dic objectForKey:@"Status"] intValue];
  201. // 服务器返回数据消息
  202. NSString *message=[dic objectForKey:@"Message"];
  203. // 服务器返回数据状态值正确
  204. if (iStatus == 0) {
  205. [self showAlertViewText:@"占库成功"];
  206. [ _dataList removeAllObjects];
  207. [_vTableView reloadData];
  208. [self loadData];
  209. }
  210. // 服务器返回数据状态值异常
  211. else if(iStatus == ActionResultStatusAuthError
  212. ||iStatus == ActionResultStatusNoLogin
  213. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  214. [self showReLoginDialog:message];
  215. }
  216. else{
  217. [self showAlertViewText:message];
  218. }
  219. }
  220. }
  221. - (void)onOccupyFail:(ASIDownManager *)sender {
  222. [self cancel];
  223. [self showAlertViewText:@"加载失败"];
  224. }
  225. - (void)onNoOccupyFinish:(ASIDownManager *)sender {
  226. NSDictionary *dic = [sender.mWebStr JSONValue];
  227. [self cancel];
  228. // 服务器返回数据是否正确
  229. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  230. // 服务器返回数据状态值
  231. int iStatus = [[dic objectForKey:@"Status"] intValue];
  232. // 服务器返回数据消息
  233. NSString *message=[dic objectForKey:@"Message"];
  234. // 服务器返回数据状态值正确
  235. if (iStatus == 0) {
  236. [self showAlertViewText:@"释放占库成功"];
  237. [ _dataList removeAllObjects];
  238. [_vTableView reloadData];
  239. [self loadData];
  240. }
  241. // 服务器返回数据状态值异常
  242. else if(iStatus == ActionResultStatusAuthError
  243. ||iStatus == ActionResultStatusNoLogin
  244. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  245. [self showReLoginDialog:message];
  246. }
  247. else{
  248. [self showAlertViewText:message];
  249. }
  250. }
  251. }
  252. - (void)onNoOccupyFail:(ASIDownManager *)sender {
  253. [self cancel];
  254. [self showAlertViewText:@"加载失败"];
  255. }
  256. -(void) btnCheckPressed:(SalesOrderGoodsListCell *)cell{
  257. _salesOrderGoodsListModel= _dataList[cell.position];
  258. _salesOrderGoodsListModel.isCheck=!_salesOrderGoodsListModel.isCheck;
  259. [cell setCheckBackground:_salesOrderGoodsListModel.isCheck];
  260. }
  261. #pragma mark - 委托回调函数
  262. /**
  263. 单元格cell个数
  264. @param tableView <#tableView description#>
  265. @param section <#section description#>
  266. @return <#return value description#>
  267. */
  268. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  269. {
  270. return [_dataList count];
  271. }
  272. /**
  273. <#Description#>
  274. @param tableView <#tableView description#>
  275. @return <#return value description#>
  276. */
  277. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  278. return 1;
  279. }
  280. /**
  281. 高度
  282. @param tableView <#tableView description#>
  283. @param indexPath <#indexPath description#>
  284. @return <#return value description#>
  285. */
  286. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  287. return 305;
  288. }
  289. /**
  290. 每个单元格cell
  291. @param tableView <#tableView description#>
  292. @param indexPath <#indexPath description#>
  293. @return <#return value description#>
  294. */
  295. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  296. {
  297. static NSString *CellIdentifier = @"SalesOrderGoodsListCell";
  298. SalesOrderGoodsListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier ];
  299. if (!cell) {
  300. cell=[[SalesOrderGoodsListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  301. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  302. }
  303. else
  304. //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
  305. {
  306. while ([cell.contentView.subviews lastObject] != nil) {
  307. [( UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
  308. }
  309. }
  310. _salesOrderGoodsListModel= [_dataList objectAtIndex:indexPath.row];
  311. cell.delegate = self;
  312. cell.position=indexPath.row;
  313. [cell setSalesGoodsOrder:_salesOrderGoodsListModel orderStatus:_salesOrderModel.status];
  314. BOOL checked = _salesOrderGoodsListModel.isCheck;
  315. [cell setCheckBackground:checked];
  316. return cell;
  317. }
  318. /**
  319. 点击单元格事件
  320. @param tableView tableView description
  321. @param indexPath indexPath description
  322. */
  323. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  324. {
  325. self.hidesBottomBarWhenPushed=YES;
  326. OrderGoodsDetailVC *detailVc=[[OrderGoodsDetailVC alloc] init];
  327. _salesOrderGoodsListModel= [_dataList objectAtIndex:indexPath.row];
  328. detailVc.goodsListModel = _salesOrderGoodsListModel ;
  329. detailVc.status= _salesOrderModel.status;
  330. [self.navigationController pushViewController:detailVc animated:YES];
  331. }
  332. /**
  333. 修改:2017-9-25
  334. 适配机型
  335. 安全区视图发生变化
  336. */
  337. -(void)viewSafeAreaInsetsDidChange{
  338. self.view.backgroundColor = [UIColor whiteColor];
  339. _vTableView.frame = CGRectMake(0,0,Screen_Width, self.view.safeAreaLayoutGuide.layoutFrame.size.height);
  340. [super viewSafeAreaInsetsDidChange];
  341. }
  342. -(void)occupy{
  343. NSMutableArray *occupyList=[NSMutableArray new];
  344. if(_dataList!=nil&&_dataList.count>0){
  345. for(int i=0;i<_dataList.count;i++){
  346. SalesOrderGoodsListModel *goodsListModel=_dataList[i];
  347. if(goodsListModel.salesDetailType!=2&&(goodsListModel.factOrderQuantity>goodsListModel.factOccupyQuantity+goodsListModel.factToSalesQuantity)){
  348. [occupyList addObject:goodsListModel];
  349. }
  350. }
  351. }
  352. if(occupyList!=nil&&occupyList.count==0){
  353. [self showAlertViewText:@"当前订单明细已经全部占库,无需再次占库"];
  354. }
  355. else{
  356. NSString *detailIdList=@"(";
  357. for(int j=0;j<occupyList.count;j++){
  358. SalesOrderGoodsListModel *occupyModel=occupyList[j];
  359. NSString *detailId= [NSString stringWithFormat:@"%@%@",occupyModel.detailId,@","];
  360. detailIdList= [NSString stringWithFormat:@"%@%@",detailIdList,detailId];
  361. }
  362. NSRange range = NSMakeRange(0,detailIdList.length-1);
  363. detailIdList = [detailIdList substringWithRange:range];
  364. detailIdList= [NSString stringWithFormat:@"%@%@",detailIdList,@")"];
  365. [self saveOccupy:detailIdList];
  366. }
  367. }
  368. -(void)releaseOccupy{
  369. NSMutableArray *selectedNoOccupyList=[NSMutableArray new];
  370. for(int i=0;i<_dataList.count;i++){
  371. SalesOrderGoodsListModel *goodsListModel= _dataList[i];
  372. if(goodsListModel.isCheck){
  373. [selectedNoOccupyList addObject:goodsListModel];
  374. }
  375. }
  376. if(selectedNoOccupyList.count>1){
  377. [self showAlertViewText:@"最多只能一个商品释放占库"];
  378. }
  379. else if(selectedNoOccupyList.count==1){
  380. SalesOrderGoodsListModel *goodsListModel= selectedNoOccupyList[0];
  381. if(goodsListModel.factOccupyQuantity>0){
  382. [self saveReleaseOccupy:goodsListModel.detailId];
  383. }
  384. else{
  385. [self showAlertViewText:@"该商品占库数量为0,不能释放占库"];
  386. }
  387. }
  388. else{
  389. [self showAlertViewText:@"请勾选释放占库商品"];
  390. }
  391. }
  392. -(void)saveReleaseOccupy:(NSString*)detailId{
  393. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  394. [dict setObject:@"SaveReleaseOccupyIphone" forKey:@"Action"];
  395. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  396. [dict setObject:kkUserCode forKey:@"UserCode"];
  397. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  398. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  399. [dict setObject:_salesOrderModel.orderId forKey:@"OrderID"];
  400. [dict setObject:detailId forKey:@"DetailID"];
  401. _downManager = [[ASIDownManager alloc] init];
  402. [self startLoading];
  403. _downManager.delegate = self;
  404. _downManager.onRequestSuccess = @selector(onNoOccupyFinish:);
  405. _downManager.onRequestFail = @selector(onNoOccupyFail:);
  406. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  407. }
  408. -(void)saveOccupy:(NSString*)detailIdList{
  409. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  410. [dict setObject:@"SaveOrderOccupyIphone" forKey:@"Action"];
  411. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  412. [dict setObject:kkUserCode forKey:@"UserCode"];
  413. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  414. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  415. [dict setObject:_salesOrderModel.orderId forKey:@"OrderID"];
  416. [dict setObject:detailIdList forKey:@"DetailIDList"];
  417. NSInteger statusValue =_salesOrderModel.status;
  418. NSString *status= [NSString stringWithFormat:@"%d",statusValue];
  419. [dict setObject:status forKey:@"Status"];
  420. _downManager = [[ASIDownManager alloc] init];
  421. [self startLoading];
  422. _downManager.delegate = self;
  423. _downManager.onRequestSuccess = @selector(onOccupyFinish:);
  424. _downManager.onRequestFail = @selector(onOccupyFail:);
  425. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  426. }
  427. /**
  428. 隐藏进度条
  429. */
  430. - (void)cancel {
  431. [self stopLoading];
  432. }
  433. /**
  434. 转销售
  435. */
  436. - (void)tosales{
  437. NSMutableArray *list=[NSMutableArray new];
  438. for(SalesOrderGoodsListModel *model in _dataList){
  439. if(model.isCheck){
  440. //完全转销售
  441. if(model.salesDetailType == 1){
  442. if(model.factToSalesQuantity>0&&model.factOrderQuantity<=model.factToSalesQuantity){
  443. [self showAlertViewText:[NSString stringWithFormat:@"%@%@",model.goodsName,@"商品已经全部转销售"]];
  444. return;
  445. }
  446. if(model.factOccupyQuantity<=0){
  447. [self showAlertViewText:[NSString stringWithFormat:@"%@%@",model.goodsName,@"商品没有占库数量"]];
  448. }
  449. }
  450. [list addObject:model];
  451. }
  452. }
  453. double factGoodsAmount=0;
  454. if(list.count>0){
  455. NSString *string = @"";
  456. for(int i = 0;i<list.count;i++){
  457. SalesOrderGoodsListModel *model =list[i];
  458. if(i == 0){
  459. string = [NSString stringWithFormat:@"%@",model.detailId];
  460. }else{
  461. string = [NSString stringWithFormat:@"%@,%@",string,model.detailId];
  462. }
  463. factGoodsAmount+=[model.orderPrice doubleValue]*model.factOrderQuantity;
  464. }
  465. // if([string length] > 0){
  466. // NewSaleSlipHomeVC *vc = [[NewSaleSlipHomeVC alloc]init];
  467. // vc.editFLag = 3;
  468. // vc.orderId =_salesOrderModel.orderId;
  469. // vc.customerID =_salesOrderModel.customerID;
  470. // vc.orderDetailIDs = string;
  471. // vc.factGoodsAmount=factGoodsAmount;
  472. // vc.refreshDelegate=self;
  473. // [self.navigationController pushViewController:vc animated:YES];
  474. // }
  475. }else if (list.count == 0) {
  476. [self showAlertViewText:@"请选择商品"];
  477. }
  478. }
  479. -(void)refreshOrderData{
  480. [self.navigationController popViewControllerAnimated:YES];
  481. }
  482. @end