English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Devices Repair

Last Updated on : 2021-09-15 01:54:15download

After logging in, users can find the equipment that needs to be reported for repair in the space. You can use the TuyaLightingRepairManager management class to create repair work orders and view the list of repair work orders, and the TuyaLightingRepairUploadService to upload pictures and video files for equipment repair work orders.

TuyaLightingRepairManager

Class Description
TuyaLightingRepairManager RepairRepairManager class, create a repair work order, get repair work order list, get repair work order details, get equipment configuration information
TuyaLightingRepairUploadService Repair work order feedback material upload class, repair feedback image, video upload

Create a repair work order

Interface description

The device details page fault report can create repair work orders to report to the cloud.

- (void)createRepairOrder:(long long)projectId
                    devId:(NSString *)devId
            ticketContent:(nullable NSString *)ticketContent
                ticketPic:(nullable NSString *)ticketPic
    problemClassification:(nullable NSString *)problemClassification
                  success:(nullable TYSuccessID)success
                failure:(nullable TYFailureError)failure;

Parameter Description

Parameter Description
projectId project id
devId device id
ticketContent Work order description
ticketPic Work order image address(,split)
problemClassification problem description
success success callback
failure failure callback

Sample Code

Objc:

    [[TuyaLightingRepairManager new] createRepairOrder:homeId devId:self.devId ticketContent:self.textView.text ticketPic:fileIds problemClassification:self.selectModel.code success:^(id result) {
        NSLog(@"get success");
    } failure:^(NSError *error) {
        NSLog(@"get failure: %@", error);
    }];

Query the list of reported problem types

Interface Description

Get a list of reported problem types for repair work orders from the cloud

- (void)getRepairFaultTypeList:(long long)projectId
                       success:(void(^)(NSArray<TuyaLightingRepairFaultTypeModel *> *typeAry))success
                       failure:(TYFailureError)failure;

Parameter Description

Parameter Description
projectId project id
success success callback
failure failure callback

Sample Code

Objc:

    [[TuyaLightingRepairManager new] getRepairFaultTypeList:self.projectId success:^(id result) {
        NSLog(@"get success");
    } failure:^(NSError *error) {
        NSLog(@"get failure: %@", error);
    }];

Query the list of repair work orders

Interface Description

Get the list of repair work orders for the current user from the cloud, with support for pagination.

- (void)getRepairList:(long long)projectId
         ticketStatus:(NSInteger)ticketStatus
                limit:(NSInteger)limit
            offsetKey:(NSString *)offsetKey
              success:(void(^)(NSArray<TuyaLightingRepairOrderModel *> *orderList, NSString * _Nonnull nextOffsetKey, BOOL end))success
              failure:(TYFailureError)failure;

Parameter Description

Parameters Description
projectId project id
ticketStatus Work order status 1 not completed 2 completed
limit how many items to load per page
offsetKey the first page
success success callback
failure failure callback

Sample Code

Objc:

    [[TuyaLightingRepairManager new] getRepairList:self.projectId ticketStatus:self.orderStatus limit:self.limit offsetKey:self. nextOffsetKey success:^(NSArray<TYLampRepairOrderModel *> * _Nonnull orderList, NSString * _Nonnull nextOffsetKey, BOOL end) {
        NSLog(@"get success");
    } failure:^(NSError *error) {
        NSLog(@"get failure: %@", error);
    }];

Get device configuration information

Interface Description

The user gets the configuration information of the device from the cloud by the device ID in the device details page.

- (void)getDeviceConfigInfo:(long long)projectId
                      devId:(NSString *)devId
                    success:(void(^)(TuyaLightingRepairDeviceConfigModel *model))success
                    failure:(TYFailureError)failure;

Parameter Description

Parameter Description
projectId project id
devId deviceId
success success callback
failure failure callback

Sample Code

Objc:

    [[TuyaLightingRepairManager new] getDeviceConfigInfo:homeId devId:self.devId success:^(TYLampRepairDeviceConfigModel * model) {
        NSLog(@"get success");
    } failure:^(NSError *error) {
        NSLog(@"get failure: %@", error);
    }];

Get the specified work order object under the project

Interface Description

Create the specified work order object by project ID.

+ (nullable instancetype)createByTicketNum:(NSString *)ticketNum projectId:(long long)projectId;

Parameter Description

Parameters Description
ticketNum workItemId
projectId project ID
success success callback
failure failure callback

Sample Code

Objc:

TuyaLightingRepair *repair = [TuyaLightingRepair createByTicketNum:ticketNum projectId:projectId];

Get repair work order details

Interface Description

The user gets the work order details information from the cloud by the device ID on the work order details page.

- (void)getRepairOrderDetail:(void(^)(TuyaLightingRepairOrderDetailModel *orderDetail))success
                     failure:(TYFailureError)failure;

Parameter Description

Parameter Description
success success callback
failure failure callback

Example Code

Objc:

    [repair getRepairOrderDetail:^(TuyaLightingRepairOrderDetailModel * _Nonnull orderDetail) {

    } failure:^(NSError *error) {

    }];

Submit feedback on repair work order results

Interface Description

Submits repair work order result feedback to the cloud, supporting material such as images, videos, and text to be reported.

- (void)finishRepairOrder:(NSString *)devId
          feedbackContent:(NSString *)feedbackContent
              feedbackPic:(NSString *)feedbackPic
                  success:(TYSuccessDict)success
                  failure:(TYFailureError)failure;

Parameter Description

Parameter Description
devId device id
feedbackContent feedbackContent
feedbackPic feedback image
success success callback
failure failure callback

Sample Code

Objc:

    [repair finishRepairOrder:@""
              feedbackContent:@""
                  feedbackPic:@""
                      success:^(NSDictionary *dict) {

    } failure:^(NSError *error) {

    }];

Upload images (internally it will be compressed to jpeg format)

Interface description

+ (void)uploadImage:(UIImage *)image
            success:(void(^)(TYLampUploadFileModel *))success
            failure:(TYFailureError)failure;

Parameter Description

Parameters Description
image Image
success success callback
failure failure callback

Sample Code

Objc:

    [TuyaLightingUploadFileManager uploadImage:obj.displayImage success:^(TYLampUploadFileModel * model) {
        NSLog(@"get success");
    } failure:^(NSError *error) {
        NSLog(@"get failure: %@", error);
    }];

Upload a video file (video is only supported in MP4 format)

Interface Description

Repair work order results feedback submitted to the cloud process, picture, video upload interface, support multiple materials asynchronous upload.

+ (void)uploadVideoFile:(NSString *)filePath
                success:(void(^)(TYLampUploadFileModel *))success
                failure:(TYFailureError)failure;

Parameter Description

Parameters Description
filePath file path name
success success callback
failure failure callback

Sample Code

Objc:

    [TuyaLightingUploadFileManager uploadVideoFile:obj.filePath success:^(TYLampUploadFileModel * model) {
        NSLog(@"get success");
    } failure:^(NSError *error) {
        NSLog(@"get failure: %@", error);
    }];