Commit 90ed2e67 authored by 曹云霄's avatar 曹云霄

debug

parent d3893e9c
...@@ -93,6 +93,11 @@ ...@@ -93,6 +93,11 @@
*/ */
@property (nonatomic,strong) NSIndexPath *selectIndexPath; @property (nonatomic,strong) NSIndexPath *selectIndexPath;
/**
* 排序后的发货单详情
*/
@property (nonatomic,strong) NSArray *sortingArray;
@end @end
...@@ -472,7 +477,7 @@ ...@@ -472,7 +477,7 @@
item = [[RouteAnnotation alloc]init]; item = [[RouteAnnotation alloc]init];
item.coordinate = tempNode.pt; item.coordinate = tempNode.pt;
//判断已送达、未送达情况 //判断已送达、未送达情况
BusbillDtl *model = self.selecteOrderBill.dtls[i]; BusbillDtl *model = self.sortingArray[i];
item.type = [model.state isEqualToString:@"已完成"]?3:5; item.type = [model.state isEqualToString:@"已完成"]?3:5;
item.title = tempNode.name; item.title = tempNode.name;
[_mapView addAnnotation:item]; [_mapView addAnnotation:item];
...@@ -541,7 +546,8 @@ ...@@ -541,7 +546,8 @@
}else{ }else{
//发货单详情 //发货单详情
OrderDetailsViewController *orderDetails = [self.storyboard instantiateViewControllerWithIdentifier:@"OrderDetailsViewController"]; OrderDetailsViewController *orderDetails = [self.storyboard instantiateViewControllerWithIdentifier:@"OrderDetailsViewController"];
orderDetails.orderDetails = self.selecteOrderBill; orderDetails.orderDetails = self.sortingArray;
orderDetails.billNumber = self.selecteOrderBill.billNumber;
WS(weakSelf); WS(weakSelf);
[orderDetails setReturnoffButtonClickBlock:^{ [orderDetails setReturnoffButtonClickBlock:^{
[weakSelf turnoffButtonClickAction]; [weakSelf turnoffButtonClickAction];
...@@ -632,13 +638,11 @@ ...@@ -632,13 +638,11 @@
[weakSelf RemoveMBProgressHUDLoding]; [weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSMutableArray *sortingArray = [NSMutableArray array]; NSMutableArray *sortingArray = [NSMutableArray array];
for (NSDictionary *dict in returnValue[@"data"]) { [returnValue[@"data"] enumerateObjectsUsingBlock:^(id _Nonnull dict, NSUInteger idx, BOOL * _Nonnull stop) {
BusbillDtl *details = [[BusbillDtl alloc]init]; BusbillDtl *details = [[BusbillDtl alloc]initWithDictionary:dict error:nil];
details.customerLng = dict[@"lng"];
details.customerLat = dict[@"lat"];
details.customerName = dict[@"name"];
[sortingArray addObject:details]; [sortingArray addObject:details];
} }];
weakSelf.sortingArray = sortingArray;
[weakSelf startDrawWayPointRoutepointArray:sortingArray]; [weakSelf startDrawWayPointRoutepointArray:sortingArray];
}else }else
{ {
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
@property (weak, nonatomic) IBOutlet UIButton *turnoffButton; @property (weak, nonatomic) IBOutlet UIButton *turnoffButton;
/** /**
* 回调 * 回调
*/ */
...@@ -24,7 +23,7 @@ ...@@ -24,7 +23,7 @@
/** /**
* 发货单详情 * 发货单详情
*/ */
@property (nonatomic,strong) Busbill *orderDetails; @property (nonatomic,strong) NSArray *orderDetails;
/** /**
* 刷新列表数据 * 刷新列表数据
...@@ -36,4 +35,9 @@ ...@@ -36,4 +35,9 @@
*/ */
@property (nonatomic,copy) void(^refreshPinStateBlock)(NSArray *details); @property (nonatomic,copy) void(^refreshPinStateBlock)(NSArray *details);
/**
* 单号
*/
@property (nonatomic,copy) NSString *billNumber;
@end @end
...@@ -33,14 +33,14 @@ ...@@ -33,14 +33,14 @@
{ {
//已完成 //已完成
NSInteger index = 0; NSInteger index = 0;
for (BusbillDtl *model in self.orderDetails.dtls) { for (BusbillDtl *model in self.orderDetails) {
if ([model.state isEqualToString:FINISH]) { if ([model.state isEqualToString:FINISH]) {
index ++; index ++;
} }
} }
NSString *indexString = [NSString stringWithFormat:@"%ld",index?index:1]; NSString *indexString = [NSString stringWithFormat:@"%ld",index?index:1];
NSString *totalCount = [NSString stringWithFormat:@"%ld",self.orderDetails.dtls.count]; NSString *totalCount = [NSString stringWithFormat:@"%ld",self.orderDetails.count];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"本次应送%ld,已完成%ld",self.orderDetails.dtls.count,index]]; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"本次应送%ld,已完成%ld",self.orderDetails.count,index]];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(attributedString.length-([indexString length] + 4 + [totalCount length]), [totalCount length])]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(attributedString.length-([indexString length] + 4 + [totalCount length]), [totalCount length])];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(attributedString.length-[indexString length], [indexString length])]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(attributedString.length-[indexString length], [indexString length])];
self.titleLabel.attributedText = attributedString; self.titleLabel.attributedText = attributedString;
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
OrderDetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderDetailsTableViewCell" forIndexPath:indexPath]; OrderDetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderDetailsTableViewCell" forIndexPath:indexPath];
BusbillDtl *model = self.orderDetails.dtls[indexPath.row]; BusbillDtl *model = self.orderDetails[indexPath.row];
if (![model.customerLng length]&& ![model.customerLat length]) { if (![model.customerLng length]&& ![model.customerLat length]) {
cell.storeTitleLabel.text = [NSString stringWithFormat:@"%@ (暂无GPS数据)",model.customerName]; cell.storeTitleLabel.text = [NSString stringWithFormat:@"%@ (暂无GPS数据)",model.customerName];
}else }else
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
return self.orderDetails.dtls.count; return self.orderDetails.count;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
- (void)arriveButtonClickAction:(UIButton *)sender - (void)arriveButtonClickAction:(UIButton *)sender
{ {
WS(weakSelf); WS(weakSelf);
BusbillDtl *model = self.orderDetails.dtls[sender.tag]; BusbillDtl *model = self.orderDetails[sender.tag];
[self CreateMBProgressHUDLoding:@"加载中"]; [self CreateMBProgressHUDLoding:@"加载中"];
NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(ORDERDETAILSSTATE),model.fid,FINISH]; NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(ORDERDETAILSSTATE),model.fid,FINISH];
NSString *UTF8String = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *UTF8String = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
- (void)refreshDeliveryOrderState - (void)refreshDeliveryOrderState
{ {
NSString *orderState = FINISH; NSString *orderState = FINISH;
for (BusbillDtl *model in self.orderDetails.dtls) { for (BusbillDtl *model in self.orderDetails) {
if (![model.state isEqualToString:FINISH]) { if (![model.state isEqualToString:FINISH]) {
orderState = @"送货中";break; orderState = @"送货中";break;
} }
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
//更新状态 //更新状态
[self uiConfigAction]; [self uiConfigAction];
WS(weakSelf); WS(weakSelf);
NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(REFRESHORDERSTATE),self.orderDetails.billNumber,orderState]; NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(REFRESHORDERSTATE),self.billNumber,orderState];
NSString *UTF8String = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *UTF8String = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:UTF8String WithRequestType:NetworkRequestWithPOST WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:UTF8String WithRequestType:NetworkRequestWithPOST WithParameter:nil WithReturnValueBlock:^(id returnValue) {
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
weakSelf.refreshListDatasBlock(); weakSelf.refreshListDatasBlock();
} }
if (weakSelf.refreshPinStateBlock) { if (weakSelf.refreshPinStateBlock) {
weakSelf.refreshPinStateBlock(self.orderDetails.dtls); weakSelf.refreshPinStateBlock(self.orderDetails);
} }
}else }else
{ {
......
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