Commit f603834e authored by 曹云霄's avatar 曹云霄

送货,路径规划开发

parent be364872
This diff is collapsed.
......@@ -25,6 +25,7 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];//保持屏幕常亮
[self detectionNetwork];
[self setIQKeyboardManager];
[self startBaiduMapManager];
......
......@@ -38,7 +38,8 @@
- (void)showSheetViewWithMessage:(NSString *)message complete:(void(^)())finish;
#pragma mark -获取当前时间之前或之后的时间
- (NSString *)getTimeby:(NSInteger)day;
......
......@@ -43,9 +43,9 @@
self.navigationController.navigationBar.barTintColor = MainColor;
[self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor whiteColor]}];
[self detectionUpdateVersion];
// [self detectionUpdateVersion];
//版本更新
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectionUpdateVersion) name:UPLOADVERSION object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectionUpdateVersion) name:UPLOADVERSION object:nil];
}
......@@ -146,7 +146,7 @@
hud.mode = MBProgressHUDModeText;
hud.label.text = Text;
hud.contentColor = MainColor;
hud.offset = CGPointMake(0.f, MBProgressMaxOffset);
// hud.offset = CGPointMake(0.f, MBProgressMaxOffset);
[hud hideAnimated:YES afterDelay:2.0f];
}
......@@ -222,7 +222,7 @@
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:dict[@"url"]]];
}]];
//是否强制更新
if (![dict[@"forceupdate"] isEqualToString:@"yes"]) {
if (![dict[@"forceupdate"] isEqualToString:@"1"]) {
[alertVC addAction:[UIAlertAction actionWithTitle:@"以后再说" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[alertVC dismissViewControllerAnimated:YES completion:nil];
}]];
......@@ -238,6 +238,22 @@
}
#pragma mark - 获取当前时间之前或者之后的时间(之前传入负数)
- (NSString *)getTimeby:(NSInteger)day
{
NSDate*nowDate = [NSDate date];
NSDate* theDate;
if(day!=0){
NSTimeInterval oneDay = 24*60*60*1; //1天的长度
theDate = [nowDate initWithTimeIntervalSinceNow: oneDay*day];
}else{
theDate = nowDate;
}
NSDateFormatter *date_formatter = [[NSDateFormatter alloc] init];
[date_formatter setDateFormat:@"yyyy-MM-dd"];
NSString *the_date_str = [date_formatter stringFromDate:theDate];
return the_date_str;
}
@end
......@@ -26,8 +26,17 @@
if ([self.passWordTextField.text length]) {
[self changeColor:self.passWordTextField];
}
self.versionInformation.text = [self getAppVersion];
}
- (NSString*)getAppVersion {
NSString *ver = [[[NSBundle mainBundle] infoDictionary]
objectForKey:@"CFBundleShortVersionString"];
return [NSString stringWithFormat:@"版本%@",ver];
}
- (void)viewWillDisappear:(BOOL)animated
{
[UIApplication sharedApplication].statusBarHidden = NO;
......
......@@ -21,7 +21,6 @@
@property (nonatomic,strong) DeliveryTrackingViewController *DeliveryVC;
/**
* UISegmentedControl
*/
......
//
// OrderDetailsViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/9/12.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface OrderDetailsViewController : BaseViewController
@end
//
// DeliveryTrackingViewController.m
// OrderDetailsViewController.m
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Created by 曹云霄 on 16/9/12.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "DeliveryTrackingViewController.h"
#import "OrderDetailsViewController.h"
@interface DeliveryTrackingViewController ()
@interface OrderDetailsViewController ()
@end
@implementation DeliveryTrackingViewController
@implementation OrderDetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
......
//
// CoordinateAcquisitionViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface CoordinateAcquisitionViewController : BaseViewController
@end
//
// CoordinateAcquisitionViewController.m
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "CoordinateAcquisitionViewController.h"
#import "SearchViewController.h"
#import <BaiduMapAPI_Map/BMKMapComponent.h>
#import <BaiduMapAPI_Location/BMKLocationComponent.h>
#import "CustomBMKAnnotationView.h"
#import "UserPaopaoView.h"
#define USERLOCATIONID @"userlocation"
@interface CoordinateAcquisitionViewController ()<UITextFieldDelegate,BMKMapViewDelegate,BMKLocationServiceDelegate>
@property (strong, nonatomic) BMKLocationService *locService;
@property (strong, nonatomic) BMKMapView* mapView;
@property (nonatomic,strong) BMKLocationViewDisplayParam *displayLocation;
/**
* 选择客户
*/
@property (weak, nonatomic) IBOutlet UITextField *inputUserInformationField;
/**
* 采集
*/
@property (weak, nonatomic) IBOutlet UIButton *collectCoordinateButton;
/**
* 保存用户大头针对象
*/
@property (nonatomic,strong) BMKPointAnnotation *userPointAnnotation;
/**
* 当前选中的客户
*/
@property (nonatomic,strong) Customer *currentUser;
@end
@implementation CoordinateAcquisitionViewController
#pragma mark - lazy
- (BMKLocationViewDisplayParam *)displayLocation
{
if (!_displayLocation) {
_displayLocation = [[BMKLocationViewDisplayParam alloc]init];
_displayLocation.locationViewImgName = @"location";
_displayLocation.locationViewOffsetX = 0;
_displayLocation.locationViewOffsetY = 0;
_displayLocation.isAccuracyCircleShow = false;
_displayLocation.isRotateAngleValid = false;
}
return _displayLocation;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self uiConfigAction];
[self startpositionAction];
}
-(void)viewWillAppear:(BOOL)animated {
[_mapView viewWillAppear];
_mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放
_locService.delegate = self;
}
-(void)viewWillDisappear:(BOOL)animated {
[_mapView viewWillDisappear];
_mapView.delegate = nil; // 不用时,置nil
_locService.delegate = nil;
}
#pragma mark -UI
- (void)startpositionAction
{
self.locService = [[BMKLocationService alloc]init];
[self.locService startUserLocationService];
self.mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0, self.view.mj_w, self.view.mj_h-44-64)];
[self.view insertSubview:_mapView atIndex:0];
self.mapView.zoomLevel = 16;
self.locService.pausesLocationUpdatesAutomatically = NO;
self.locService.distanceFilter = 10;
self.mapView.userTrackingMode = BMKUserTrackingModeFollow;
}
/**
*用户位置更新后,会调用此函数
*@param userLocation 新的用户位置
*/
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
{
[_mapView updateLocationData:userLocation];
double latitude = userLocation.location.coordinate.latitude;
double longitude = userLocation.location.coordinate.longitude;
[UserInforMation manager].latitude = latitude;
[UserInforMation manager].longitude = longitude;//记录用户经纬度
[self displayAnnotationWithLatitude:latitude andLongitude:longitude title:USERLOCATIONID];
}
/**
*在地图View停止定位后,会调用此函数
*@param mapView 地图View
*/
- (void)didStopLocatingUser
{
NSLog(@"定位停止");
}
/**
*定位失败后,会调用此函数
*@param mapView 地图View
*@param error 错误号,参考CLError.h中定义的错误号
*/
- (void)didFailToLocateUserWithError:(NSError *)error
{
// [self SHOWPrompttext:@"定位失败"];
NSLog(@"定位失败");
}
#pragma mark -自定义用户大头针
- (void)displayAnnotationWithLatitude: (CGFloat)latitude andLongitude: (CGFloat)longitude title:(NSString *)title
{
[self.mapView removeAnnotation:self.userPointAnnotation];
[self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(latitude,longitude) animated:YES];
BMKPointAnnotation *pointAnnotation = [[BMKPointAnnotation alloc]init];
self.userPointAnnotation = pointAnnotation;
pointAnnotation.coordinate = CLLocationCoordinate2DMake(latitude, longitude);
pointAnnotation.title = title;
[self.mapView addAnnotation:pointAnnotation];
}
/**
*根据anntation生成对应的View
*@param mapView 地图View
*@param annotation 指定的标注
*@return 生成的标注View
*/
- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation
{
CustomBMKAnnotationView *annottionView = (CustomBMKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:USERLOCATIONID];
if (!annottionView) {
annottionView = [[CustomBMKAnnotationView alloc]userSignInitialize:annotation reuseIdentifier:USERLOCATIONID];
}
[annottionView setSelected:YES animated:YES];
UserPaopaoView *paopaoView = [[UserPaopaoView alloc] signUserInitialize:[UIView new] withCoord:annotation.coordinate];
paopaoView.frame = CGRectMake(0, 0, ScreenSize.width-150, 70);
annottionView.paopaoView = paopaoView;
return annottionView;
}
#pragma mark - UI
- (void)uiConfigAction
{
[self.collectCoordinateButton addCorners];
[self.inputUserInformationField addCorners];
[self.inputUserInformationField addLines];
UIView *leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, 40)];
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 10, 20, 20)];
imageView.image = LOADIMAGENAME(@"search");
[leftView addSubview:imageView];
self.inputUserInformationField.leftViewMode = UITextFieldViewModeAlways;
self.inputUserInformationField.leftView = leftView;
self.collectCoordinateButton.backgroundColor = [self.inputUserInformationField.text length]?RGBA(250, 71, 76, 1):[UIColor lightGrayColor];
self.collectCoordinateButton.enabled = [self.inputUserInformationField.text length]?YES:NO;
}
#pragma mark - <UITextFieldDelegate>
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
WS(weakSelf);
SearchViewController *searchVC = [self.getStoryboardWithName instantiateViewControllerWithIdentifier:@"SearchViewController"];
[searchVC setSelectCustomer:^(Customer *model) {
weakSelf.currentUser = model;
textField.text = [NSString stringWithFormat:@"【%@】%@",model.code,model.name];
weakSelf.collectCoordinateButton.backgroundColor = [weakSelf.inputUserInformationField.text length]?RGBA(250, 71, 76, 1):[UIColor lightGrayColor];
weakSelf.collectCoordinateButton.enabled = [weakSelf.inputUserInformationField.text length]?YES:NO;
}];
[self.navigationController pushViewController:searchVC animated:YES];
return NO;
}
#pragma mark - 采集数据
- (IBAction)CoordinateAcquisitionButtonClick:(UIButton *)sender {
WS(weakSelf);
[self showSheetViewWithMessage:@"请确认是否上传该采集点数据?" complete:^{
[weakSelf CreateMBProgressHUDLoding:@"上传采集点数据中"];
Customer *uploadLocation = [[Customer alloc]init];
uploadLocation.fid = self.currentUser.fid;
uploadLocation.code = self.currentUser.code;
uploadLocation.lat = [NSString stringWithFormat:@"%lf",[UserInforMation manager].latitude];
uploadLocation.lng = [NSString stringWithFormat:@"%lf",[UserInforMation manager].longitude];
uploadLocation.address = self.currentUser.address;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(UPLOADLOCATION) WithRequestType:NetworkRequestWithPOST WithParameter:uploadLocation WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf SuccessMBProgressView:@"上传成功" timeDelay:1.0f finish:nil];
}else
{
[weakSelf SHOWPrompttext:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:error.localizedDescription];
}];
}];
}
#pragma mark - 刷新按钮
- (IBAction)refreshLocationButton:(UIButton *)sender {
[self.mapView setCenterCoordinate:self.userPointAnnotation.coordinate animated:YES];
[_locService startUserLocationService];
}
#pragma mark - 释放
- (void)dealloc {
if (_mapView) {
_mapView = nil;
}
}
@end
//
// DeliveryTrackingViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface DeliveryTrackingViewController : BaseViewController
@end
//
// MainViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface MainViewController : BaseViewController
@end
//
// MainViewController.m
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "MainViewController.h"
#import "CoordinateAcquisitionViewController.h"
#import "DeliveryTrackingViewController.h"
@interface MainViewController ()
/**
* 当前控制器
*/
@property (nonatomic,strong) BaseViewController *currentVC;
@property (nonatomic,strong) CoordinateAcquisitionViewController *coordinateVC;
@property (nonatomic,strong) DeliveryTrackingViewController *DeliveryVC;
/**
* UISegmentedControl
*/
@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentControl;
@end
@implementation MainViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupController];
}
#pragma mark - 设置控制器
- (void)setupController
{
_coordinateVC = [self.getStoryboardWithName instantiateViewControllerWithIdentifier:@"CoordinateAcquisitionViewController"];
[self addChildViewController:_coordinateVC];
_DeliveryVC = [self.getStoryboardWithName instantiateViewControllerWithIdentifier:@"DeliveryTrackingViewController"];
[self addChildViewController:_DeliveryVC];
[self.view addSubview:_coordinateVC.view];
self.currentVC = self.coordinateVC;
}
#pragma mark - 切换内容控制器
- (void)changeViewControllerWithNewController:(BaseViewController *)newController
{
[self transitionFromViewController:self.currentVC toViewController:newController duration:0.3 options:UIViewAnimationOptionTransitionNone animations:nil completion:^(BOOL finished) {
if (finished) {
[self.view addSubview:newController.view];
self.currentVC = newController;
}
}];
}
- (IBAction)UISegmentedControlClickAction:(UISegmentedControl *)sender {
if (sender.selectedSegmentIndex) {
//送货跟踪
[self changeViewControllerWithNewController:self.DeliveryVC];
}
else
{ //坐标采集
[self changeViewControllerWithNewController:self.coordinateVC];
}
}
@end
//
// OrderDetailsViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/9/12.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface OrderDetailsViewController : BaseViewController
/**
* 关闭
*/
@property (weak, nonatomic) IBOutlet UIButton *turnoffButton;
/**
* 回调
*/
@property (nonatomic,copy) void(^ReturnoffButtonClickBlock)();
/**
* 发货单详情
*/
@property (nonatomic,strong) Busbill *orderDetails;
/**
* 刷新列表数据
*/
@property (nonatomic,copy) void(^refreshListDatasBlock)();
@end
//
// OrderDetailsViewController.m
// Palmwms
//
// Created by 曹云霄 on 16/9/12.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "OrderDetailsViewController.h"
#import "OrderDetailsTableViewCell.h"
#define FINISH @"1"
@interface OrderDetailsViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *orderDetailsTableview;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@end
@implementation OrderDetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self uiConfigAction];
}
#pragma mark - UI
- (void)uiConfigAction
{
//已完成
NSInteger index = 0;
for (BusbillDtl *model in self.orderDetails.dtls) {
if ([model.state isEqualToString:FINISH]) {
index ++;
}
}
NSString *indexString = [NSString stringWithFormat:@"%ld",index?index:1];
NSString *totalCount = [NSString stringWithFormat:@"%ld",self.orderDetails.dtls.count];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"本次应送%ld,已完成%ld",self.orderDetails.dtls.count,index]];
[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])];
self.titleLabel.attributedText = attributedString;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
OrderDetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderDetailsTableViewCell" forIndexPath:indexPath];
BusbillDtl *model = self.orderDetails.dtls[indexPath.row];
cell.storeTitleLabel.text = model.customerName;
if ([model.state isEqualToString:FINISH]) {
[cell.arriveButton setTitle:@"送货完成" forState:UIControlStateNormal];
[cell.arriveButton setTitleColor:RGBA(129, 196, 56, 1) forState:UIControlStateNormal];
[cell.arriveButton setBackgroundColor:[UIColor whiteColor]];
cell.arriveButton.enabled = NO;
}else
{
[cell.arriveButton setTitle:@"送货到达" forState:UIControlStateNormal];
[cell.arriveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[cell.arriveButton setBackgroundColor:[UIColor redColor]];
cell.arriveButton.enabled = YES;
}
cell.arriveButton.tag = indexPath.row;
[cell.arriveButton addTarget:self action:@selector(arriveButtonClickAction:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.orderDetails.dtls.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 60;
}
#pragma mark - 确认送达
- (void)arriveButtonClickAction:(UIButton *)sender
{
WS(weakSelf);
BusbillDtl *model = self.orderDetails.dtls[sender.tag];
[self CreateMBProgressHUDLoding:@"加载中"];
NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(ORDERDETAILSSTATE),model.fid,@"1"];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:urlString WithRequestType:NetworkRequestWithPOST WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
model.state = @"1";
[sender setTitle:@"送货完成" forState:UIControlStateNormal];
[sender setTitleColor:RGBA(129, 196, 56, 1) forState:UIControlStateNormal];
[sender setBackgroundColor:[UIColor whiteColor]];
sender.enabled = NO;
if (weakSelf.refreshListDatasBlock) {
weakSelf.refreshListDatasBlock();
}
[weakSelf refreshDeliveryOrderState];
}else{
[weakSelf SHOWPrompttext:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:error.localizedDescription];
}];
}
#pragma mark - 更新送货单状态
- (void)refreshDeliveryOrderState
{
for (BusbillDtl *model in self.orderDetails.dtls) {
if (![model.state isEqualToString:FINISH]) {
return;
}
}
WS(weakSelf);
NSString *urlString = [NSString stringWithFormat:SERVERREQUESTURL(REFRESHORDERSTATE),self.orderDetails.billNumber,@"1"];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:urlString WithRequestType:NetworkRequestWithPOST WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (weakSelf.refreshListDatasBlock) {
weakSelf.refreshListDatasBlock();
}
}else
{
[weakSelf SHOWPrompttext:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf SHOWPrompttext:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf SHOWPrompttext:error.localizedDescription];
}];
}
#pragma mark - 关闭
- (IBAction)turnoffButtonClickAction:(UIButton *)sender {
if (self.ReturnoffButtonClickBlock) {
self.ReturnoffButtonClickBlock();
}
}
@end
//
// OrderListViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/9/13.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface OrderListViewController : BaseViewController
/**
* 订单title
*/
@property (weak, nonatomic) IBOutlet UILabel *orderTitleLabel;
/**
* 订单tableview
*/
@property (weak, nonatomic) IBOutlet UITableView *orderTableView;
/**
* 关闭回调
*/
@property (nonatomic,copy) void(^ReturnoffButtonClickBlock)();
/**
* 选中发货单
*/
@property (nonatomic,copy) void(^SelectOrderClickBlock)(Busbill *order,NSIndexPath *indexPath);
/**
* 数据源列表
*/
@property (nonatomic,strong) NSArray *datasArray;
/**
* indexpath
*/
@property (nonatomic,strong) NSIndexPath *indexPath;
@end
//
// OrderListViewController.m
// Palmwms
//
// Created by 曹云霄 on 16/9/13.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "OrderListViewController.h"
#import "OrderListTableViewCell.h"
#define FINISH @"已完成"
@interface OrderListViewController ()<UITableViewDataSource,UITableViewDelegate>
@end
@implementation OrderListViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self uiConfigAction];
}
#pragma mark - UI
- (void)uiConfigAction
{
NSInteger index = 0;
for (Busbill *model in self.datasArray) {
if ([model.state isEqualToString:FINISH]) {
index ++;
}
}
NSString *indexString = [NSString stringWithFormat:@"%ld",index?index:1];
NSString *totalCount = [NSString stringWithFormat:@"%ld",self.datasArray.count];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"今日订单%ld,已完成订单%ld",self.datasArray.count,index]];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(attributedString.length-([indexString length] + 6 + totalCount.length), totalCount.length)];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(attributedString.length-[indexString length], [indexString length])];
self.orderTitleLabel.attributedText = attributedString;
//选中状态
[self.orderTableView selectRowAtIndexPath:self.indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
OrderListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderListTableViewCell" forIndexPath:indexPath];
Busbill *model = self.datasArray[indexPath.row];
cell.orderBillStateLabel.text = model.state;
cell.orderTitleLabel.text = [NSString stringWithFormat:@"单号:%@",model.billNumber];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.datasArray.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.SelectOrderClickBlock) {
self.SelectOrderClickBlock(self.datasArray[indexPath.row],indexPath);
}
}
#pragma mark - 关闭
- (IBAction)turnoffButtonClickAction:(UIButton *)sender {
if (self.ReturnoffButtonClickBlock) {
self.ReturnoffButtonClickBlock();
}
}
@end
//
// SearchViewController.h
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface SearchViewController : BaseViewController
/**
* 选中客户
*/
@property (nonatomic,copy) void(^selectCustomer)(Customer *model);
@end
//
// SearchViewController.m
// Palmwms
//
// Created by 曹云霄 on 16/8/25.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "SearchViewController.h"
#define PAGENUMBER 12
#define QUERYUSER @"queryuser"
@interface SearchViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
/**
* 输入框
*/
@property (weak, nonatomic) IBOutlet UITextField *userInputTextField;
/**
* tableview
*/
@property (weak, nonatomic) IBOutlet UITableView *userTableView;
/**
* 查询对象
*/
@property (nonatomic,strong) CustomerQueryDefintion *queryModel;
/**
* 返回对象
*/
@property (nonatomic,strong) CustomerQueryResult *result;
/**
* 数据源
*/
@property (nonatomic,strong) NSMutableArray *datasArray;
/**
* 记录上一次选择的cell下标
*/
@property (nonatomic,strong) NSIndexPath *selectIndexPath;
@end
@implementation SearchViewController
#pragma mark - lazy
- (CustomerQueryDefintion *)queryModel
{
if (!_queryModel) {
_queryModel = [[CustomerQueryDefintion alloc]init];
//排序
QueryOrder *order = [[QueryOrder alloc]init];
order.field = @"id";
order.direction = QUERYORDERDIRECTION_ASC;
_queryModel.orders = (NSArray<QueryOrder> *)@[order];
_queryModel.pageSize = PAGENUMBER;
_queryModel.pageNumber = PAGENUMBER - PAGENUMBER;
}
return _queryModel;
}
- (NSMutableArray *)datasArray
{
if (!_datasArray) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self uiConfigAction];
[self setupRefreshing];
}
#pragma mark - UI
- (void)uiConfigAction
{
[self customBackButton:@selector(backButtonClick)];
[self.userInputTextField addCorners];
[self.userInputTextField addLines];
UIView *leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, 40)];
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 10, 20, 20)];
imageView.image = LOADIMAGENAME(@"search");
[leftView addSubview:imageView];
self.userInputTextField.leftViewMode = UITextFieldViewModeAlways;
self.userInputTextField.leftView = leftView;
self.userTableView.tableFooterView = [UIView new];
[self.userTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:QUERYUSER];
//确认选择
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc]initWithTitle:@"确认" style:UIBarButtonItemStyleDone target:self action:@selector(rightButtonClickAction:)];
rightButton.tintColor = [UIColor whiteColor];
self.navigationItem.rightBarButtonItem = rightButton;
self.navigationItem.rightBarButtonItem.enabled = false;
}
#pragma mark - 设置刷新
- (void)setupRefreshing
{
WS(weakSelf);
self.userTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[weakSelf.userTableView.mj_footer resetNoMoreData];
[weakSelf queryUserisRemoveAll:YES];
}];
[self.userTableView.mj_header beginRefreshing];
MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (weakSelf.result.paging.page >= weakSelf.result.paging.pageCount - 1) {
[weakSelf.userTableView.mj_footer endRefreshingWithNoMoreData];
}else
{
[weakSelf queryUserisRemoveAll:NO];
}
}];
self.userTableView.mj_footer = footer;
footer.automaticallyHidden = YES;
}
#pragma mark - 查询客户
- (void)queryUserisRemoveAll:(BOOL)boolValue
{
WS(weakSelf);
[self CreateMBProgressHUDLoding:@"查询中"];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(QUERY) WithRequestType:0 WithParameter:self.queryModel WithReturnValueBlock:^(id returnValue) {
[weakSelf endRefreshingForTableView:weakSelf.userTableView];
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (boolValue) {
[self.datasArray removeAllObjects];
}
CustomerQueryResult *result = [[CustomerQueryResult alloc]initWithDictionary:returnValue[@"data"] error:nil];
for (Customer *dict in result.records) {
[self.datasArray addObject:dict];
}
[self.userTableView reloadData];
}else
{
[weakSelf SHOWPrompttext:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf SHOWPrompttext:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:error.localizedDescription];
}];
}
#pragma mark - <UITableViewDataSource>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:QUERYUSER forIndexPath:indexPath];
Customer *dict = self.datasArray[indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"【%@】%@",dict.code,dict.name];
cell.tintColor = [UIColor redColor];
cell.accessoryType = (self.selectIndexPath == indexPath)?UITableViewCellAccessoryCheckmark:UITableViewCellAccessoryNone;
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.datasArray.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.selectIndexPath) {
UITableViewCell *selectCell = [tableView cellForRowAtIndexPath:self.selectIndexPath];
selectCell.accessoryType = UITableViewCellAccessoryNone;
self.navigationItem.rightBarButtonItem.enabled = false;
if (self.selectIndexPath == indexPath) {
self.selectIndexPath = nil;return;
}
}
//更新记录,选中点击的cell
self.selectIndexPath = indexPath;
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
self.navigationItem.rightBarButtonItem.enabled = true;
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
#pragma mark - 确认选择
- (void)rightButtonClickAction:(UIBarButtonItem *)item
{
if (self.selectCustomer) {
self.selectCustomer(self.datasArray[self.selectIndexPath.row]);
}
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - 返回
- (void)backButtonClick
{
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - <UITextFieldDelegate>
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
self.queryModel.codeEqualsOrNameLike = [textField.text length]?textField.text:nil;
[self.userTableView.mj_header beginRefreshing];
return YES;
}
@end
......@@ -21,6 +21,10 @@
*/
- (instancetype)userSignInitialize:(id<BMKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier;
/**
* 汽车
*/
- (instancetype)carSignInitialize:(id<BMKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier;
@end
......@@ -17,7 +17,19 @@
{
if ([self initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]) {
self.image = [UIImage imageNamed:@"location"];
self.image = [UIImage imageNamed:@"store"];
}
return self;
}
/**
* 汽车
*/
- (instancetype)carSignInitialize:(id<BMKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier
{
if ([self initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]) {
self.image = [UIImage imageNamed:@"car"];
}
return self;
}
......
......@@ -17,5 +17,4 @@
- (instancetype)signUserInitialize:(UIView *)customer withCoord:(CLLocationCoordinate2D)coord;
@end
//
// OrderDetailsTableViewCell.h
// Palmwms
//
// Created by 曹云霄 on 16/9/12.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderDetailsTableViewCell : UITableViewCell
/**
* 到达
*/
@property (weak, nonatomic) IBOutlet UIButton *arriveButton;
/**
* 店名
*/
@property (weak, nonatomic) IBOutlet UILabel *storeTitleLabel;
/**
* 店铺地址
*/
@property (weak, nonatomic) IBOutlet UILabel *storeAddressLabel;
@end
//
// OrderDetailsTableViewCell.m
// Palmwms
//
// Created by 曹云霄 on 16/9/12.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "OrderDetailsTableViewCell.h"
@implementation OrderDetailsTableViewCell
- (void)awakeFromNib {
// Initialization code
}
#pragma mark - 送货到达
- (IBAction)arriveButtonClickAction:(UIButton *)sender {
}
@end
//
// OrderListTableViewCell.h
// Palmwms
//
// Created by 曹云霄 on 16/9/13.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderListTableViewCell : UITableViewCell
/**
* 订单title
*/
@property (weak, nonatomic) IBOutlet UILabel *orderTitleLabel;
/**
* 订单状态
*/
@property (weak, nonatomic) IBOutlet UILabel *orderBillStateLabel;
@end
//
// OrderListTableViewCell.m
// Palmwms
//
// Created by 曹云霄 on 16/9/13.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "OrderListTableViewCell.h"
@implementation OrderListTableViewCell
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
{
"images" : [
{
"idiom" : "universal",
"filename" : "arrow.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "arrow@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "car.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "car@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "car@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "finishstore.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "finishstore@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "finishstore@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "orderbill.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "orderbill@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "orderbill@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "orederDetails.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "orederDetails@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "orederDetails@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "location.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "location@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "location@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "store.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "store@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "store@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "turnoff.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "turnoff@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "turnoff@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "warehouse.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "warehouse@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "warehouse@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -4,22 +4,20 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>物流移动平台</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>物流移动平台</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
......@@ -29,6 +27,10 @@
</dict>
<key>NSLocationAlwaysUsageDescription</key>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
......
This diff is collapsed.
//
// palmwms_objc_json_client.m
// Palmwms
//
// Created by 曹云霄 on 16/8/24.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "palmwms_objc_json_client.h"
@implementation ExceptionCode
@synthesize code;
@synthesize message;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation RsResponse
@synthesize code;
@synthesize message;
@synthesize data;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation BusbillDtl
@synthesize fid;
@synthesize billNumber;
@synthesize customerUuid;
@synthesize customerCode;
@synthesize customerName;
@synthesize customerLng;
@synthesize customerLat;
@synthesize state;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end
@implementation QueryDefinition
@synthesize orders;
@synthesize pageNumber;
......@@ -62,6 +106,64 @@ NSString * const QUERYORDERDIRECTION_DESC = @"desc";
}
@end
@implementation Depot
@synthesize fid;
@synthesize code;
@synthesize lng;
@synthesize lat;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end
@implementation QueryResultPaging
@synthesize page;
@synthesize pageSize;
@synthesize pageCount;
@synthesize recordCount;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation Distance
@synthesize fid;
@synthesize startCustomerCode;
@synthesize endCustomerCode;
@synthesize distance;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end
@implementation Driver
......@@ -150,11 +252,9 @@ NSString * const QUERYORDERDIRECTION_DESC = @"desc";
@end
@implementation QueryResultPaging
@synthesize page;
@synthesize pageSize;
@synthesize pageCount;
@synthesize recordCount;
@implementation QueryOrder
@synthesize field;
@synthesize direction;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
......@@ -164,9 +264,14 @@ NSString * const QUERYORDERDIRECTION_DESC = @"desc";
@end
@implementation QueryOrder
@synthesize field;
@synthesize direction;
@implementation Busbill
@synthesize fid;
@synthesize billNumber;
@synthesize pickingDate;
@synthesize driverInfo;
@synthesize busInfo;
@synthesize state;
@synthesize dtls;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
......@@ -174,12 +279,18 @@ NSString * const QUERYORDERDIRECTION_DESC = @"desc";
}
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end
@implementation RsResponse
@synthesize code;
@synthesize message;
@synthesize data;
@implementation CustomerQueryDefintion
@synthesize codeEqualsOrNameLike;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
......@@ -189,9 +300,40 @@ NSString * const QUERYORDERDIRECTION_DESC = @"desc";
@end
@implementation ExceptionCode
@synthesize code;
@synthesize message;
@implementation DepotQueryDefintion
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation DistanceQueryDefintion
@synthesize codeEqualsOrNameLike;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation DistanceQueryResult
@synthesize records;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation DepotQueryResult
@synthesize records;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
......@@ -212,8 +354,41 @@ NSString * const QUERYORDERDIRECTION_DESC = @"desc";
@end
@implementation CustomerQueryDefintion
@synthesize codeEqualsOrNameLike;
@implementation BusbillQueryResult
@synthesize records;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation BusbillQueryDefintion
@synthesize driverCode;
@synthesize date;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation BusbillDtlQueryResult
@synthesize records;
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
return YES;
}
@end
@implementation BusbillDtlQueryDefintion
+(BOOL)propertyIsOptional:(NSString*)propertyName
{
......
//
// NSDate+FormatterAdditions.h
// JobTalk
//
// Created by Xummer on 14-5-16.
// Copyright (c) 2014年 BST. All rights reserved.
//
#import <Foundation/Foundation.h>
// https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSDate%2BSSToolkitAdditions.h
/**
Provides extensions to `NSDate` for various common tasks.
*/
@interface NSDate (FormatterAdditions)
///---------------
/// @name ISO 8601
///---------------
/**
Returns a new date represented by an ISO8601 string.
@param iso8601String An ISO8601 string
@return Date represented by the ISO8601 string
*/
+ (NSDate *)dateFromISO8601String:(NSString *)iso8601String;
/**
Returns a string representation of the receiver in ISO8601 format.
@return A string representation of the receiver in ISO8601 format.
*/
- (NSString *)ISO8601String;
/**
@param dateFormatter a date formatter, like @"%Y-%m-%dT%H:%M:%SZ".
@return A string representation of the receiver in dateFormatter.
*/
- (NSString *)stringWithFormatter:(NSString *)dateFormatter;
- (NSString *)chatAttachmentFormatterString;
- (NSString *)YMDHMSFormatterString;
- (NSString *)chatMsgFormatterString;
- (NSString *)localYMDString;
- (NSString *)briefTimeForTimeLine;
// yyyy-MM-dd HH:mm:ss
- (NSString *)httpParameterString;
// yyyy-MM-dd
- (NSString *)yearMonthDayString;
// yymmddhhmmssSSS
- (NSString *)mobileIDDateString;
- (NSDate *)endOfTheDay;
///--------------------
/// @name Time In Words
///--------------------
/**
Returns a string representing the time interval from now in words (including seconds).
The strings produced by this method will be similar to produced by Twitter for iPhone or Tweetbot in the top right of
the tweet cells.
Internally, this does not use `timeInWordsFromTimeInterval:includingSeconds:`.
@return A string representing the time interval from now in words
*/
- (NSString *)briefTimeInWords;
/**
Returns a string representing the time interval from now in words (including seconds).
The strings produced by this method will be similar to produced by ActiveSupport's `time_ago_in_words` helper method.
@return A string representing the time interval from now in words
@see timeInWordsIncludingSeconds:
@see timeInWordsFromTimeInterval:includingSeconds:
*/
- (NSString *)timeInWords;
/**
Returns a string representing the time interval from now in words.
The strings produced by this method will be similar to produced by ActiveSupport's `time_ago_in_words` helper method.
@param includeSeconds `YES` if seconds should be included. `NO` if they should not.
@return A string representing the time interval from now in words
@see timeInWordsIncludingSeconds:
@see timeInWordsFromTimeInterval:includingSeconds:
*/
- (NSString *)timeInWordsIncludingSeconds:(BOOL)includeSeconds;
/**
Returns a string representing a time interval in words.
The strings produced by this method will be similar to produced by ActiveSupport's `time_ago_in_words` helper method.
@param intervalInSeconds The time interval to convert to a string
@param includeSeconds `YES` if seconds should be included. `NO` if they should not.
@return A string representing the time interval in words
@see timeInWords
@see timeInWordsIncludingSeconds:
*/
+ (NSString *)timeInWordsFromTimeInterval:(NSTimeInterval)intervalInSeconds includingSeconds:(BOOL)includeSeconds;
@end
@interface NSDate (DateFormatterAdditions)
- (NSString *)timeStampStr;
+ (NSString *)curTimeStamp;
/** 返回网络请求需要的时间(巡店项目等) */
+ (NSString *)httpRequestTimeString;
@end
@interface NSDate (DateCalculate)
- (NSDate *)dateAddHourse: (NSUInteger)hourse;
@end
@interface NSNumber (DateFormatterAdditions)
- (NSDate *)dateValue;
- (NSDate *)overZeroDateValue;
@end
@interface NSString (DateFormatterAdditions)
- (NSTimeInterval)timeStamp;
- (NSDate *)dateValue;
- (NSDate *)overZeroDateValue;
@end
This diff is collapsed.
//
// NSDictionary+Category.h
// ALand
//
// Created by Z on 16/3/21.
// Copyright © 2016年 Z. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (Category)
/**
* 字典转换为json字符串
*
* @return
*/
- (NSString *)JSONString;
/**
* 删除NULL
*
* @return NSDictionary
*/
- (NSDictionary *)deleteNull;
@end
//
// NSDictionary+Category.m
// ALand
//
// Created by Z on 16/3/21.
// Copyright © 2016年 Z. All rights reserved.
//
#import "NSDictionary+Category.h"
@implementation NSDictionary (Category)
- (NSString *)JSONString {
NSError *parseError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&parseError];
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
- (NSDictionary *)deleteNull{
NSMutableDictionary *mutableDic = [[NSMutableDictionary alloc] init];
for (NSString *keyStr in self.allKeys) {
if ([[self objectForKey:keyStr] isEqual:[NSNull null]] || ![self objectForKey:keyStr]) {
[mutableDic setObject:@"" forKey:keyStr];
}
else{
[mutableDic setObject:[self objectForKey:keyStr] forKey:keyStr];
}
}
return mutableDic;
}
@end
//
// UIImage+Rotate.h
// IphoneMapSdkDemo
//
// Created by wzy on 14-11-14.
// Copyright (c) 2014年 Baidu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (Rotate)
///设置图片旋转角度
- (UIImage*)imageRotatedByDegrees:(CGFloat)degrees;
@end
//
// UIImage+Rotate.m
// IphoneMapSdkDemo
//
// Created by wzy on 14-11-14.
// Copyright (c) 2014年 Baidu. All rights reserved.
//
#import "UIImage+Rotate.h"
@implementation UIImage (Rotate)
- (UIImage*)imageRotatedByDegrees:(CGFloat)degrees
{
CGFloat width = CGImageGetWidth(self.CGImage);
CGFloat height = CGImageGetHeight(self.CGImage);
CGSize rotatedSize;
rotatedSize.width = width;
rotatedSize.height = height;
UIGraphicsBeginImageContext(rotatedSize);
CGContextRef bitmap = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2);
CGContextRotateCTM(bitmap, degrees * M_PI / 180);
CGContextRotateCTM(bitmap, M_PI);
CGContextScaleCTM(bitmap, -1.0, 1.0);
CGContextDrawImage(bitmap, CGRectMake(-rotatedSize.width/2, -rotatedSize.height/2, rotatedSize.width, rotatedSize.height), self.CGImage);
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
@end
//
// UIView+cornerRadius.h
// Lighting
//
// Created by 曹云霄 on 16/8/26.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (cornerRadius)
/**
* 圆角
*/
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;
@end
//
// UIView+cornerRadius.m
// Lighting
//
// Created by 曹云霄 on 16/8/26.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "UIView+cornerRadius.h"
@implementation UIView (cornerRadius)
- (void)setCornerRadius:(CGFloat)cornerRadius
{
self.layer.cornerRadius = cornerRadius;
}
- (CGFloat)cornerRadius
{
return self.layer.cornerRadius;
}
@end
......@@ -52,6 +52,11 @@
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self
///**
// * 服务器正式地址
// */
//#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://122.228.134.82:8180/palmwms-web/app/%@",URL]
/**
* 服务器开发地址
*/
......@@ -80,7 +85,7 @@
/**
百度地图KEY
*/
#define BAIDUMAPKEY @"jcdvG3LHQF9NQ2wTncWibQKv6w7zsD70"
#define BAIDUMAPKEY @"qwaIDu5SBOWbjeDKeG46V2ax9nWWrglr"
/**
保存账号密码serviceName
......
......@@ -25,6 +25,9 @@
#import "BaseViewController.h"
#import "SSKeychain.h"
#import "SSKeychainQuery.h"
#import "NSDate+FormatterAdditions.h"
#import "UIView+Corners.h"
#import "UIView+cornerRadius.h"
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
......
......@@ -33,4 +33,43 @@
#define UPLOADVERSION @"uploadVersion"
/**
* 查询配送单
*/
#define QUERYORDERBILL @"busbill/query"
/**
* 查询配送单详情
*/
#define ORDERDETAILS @"busbill/getByBillnumber?billNumber="
/**
* 查询仓库
*/
#define QUERYDEPOT @"depot/getByCode?code="
/**
* 更新送货单详情店铺状态
*/
#define ORDERDETAILSSTATE @"busbillDtl/updateState?id=%@&state=%@"
/**
* 上传店铺坐标
*/
#define UPLOADLOCATION @"customer/saveCoordinate"
/**
* 更新送货单状态
*/
#define REFRESHORDERSTATE @"busbill/updateState?billNumber=%@&state=%@"
#endif /* urlInformation_h */
......@@ -7,6 +7,8 @@
//
#import <Foundation/Foundation.h>
#import "BMKGeocodeType.h"
@class newData,newDriver;
@interface UserInforMation : NSObject
......@@ -44,6 +46,27 @@
*/
@property (nonatomic,assign) double longitude;
/**
* 仓库纬度
*/
@property (nonatomic,assign) double depotLatitude;
/**
* 仓库经度
*/
@property (nonatomic,assign) double depotLongitude;
/**
* 司机位置信息层次
*/
@property (nonatomic,strong) BMKAddressComponent *driverAddress;
/**
* 司机位置全称
*/
@property (nonatomic,copy) NSString *address;
@end
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