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

Devices Repair

Last Updated on : 2022-02-17 05:46:55download

Problem Reporting - Create Repair Work Orders

Interface Description

Maintenance personnel who check and confirm that the device has a problem and needs to be repaired or replaced can use this method to create a repair work order entry.

TuyaCommercialLightingRepair.getRepairManager().createRepairOrder(
  long projectId,
  String devId,
  String ticketContent, 
  String ticketPic, 
  String problemClassification, 
  ITuyaResultCallback<String> callback);

Parameter Description

Parameter Name Type Required Description
devId String false device id
ticketContent String true Work Order Description
ticketPic String true Work order image address, split
problemClassification String false problem description

Sample Code

TuyaCommercialLightingRepair.getRepairManager().createRepairOrder(
                10000,
                "devId",
                "xxx device status exception",
                uploadFile.getFileId(),
                123,
                new ITuyaResultCallback<String>() {
                    @Override
                    public void onSuccess(String result) {
                        Toast.makeText(this, "Upload successful", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onError(String errorCode, String errorMessage) {
                        Toast.makeText(this, "Failed to report", Toast.LENGTH_SHORT).show();
                    }
                }
        );

Get the device exception type

Interface Description

Get a list of device exception types used for reporting

TuyaCommercialLightingRepair.getRepairManager().getRepairFaultTypeList(
  long projectId, 
  ITuyaResultCallback<ArrayList<RepairFaultTypeBean>> callback);

Parameter description

parameter name type required description
projectId long true project id

Sample Code

    ArrayList<RepairFaultTypeBean> faultList = null;
        TuyaCommercialLightingRepair.getRepairManager().getRepairFaultTypeList(10000, new ITuyaResultCallback<ArrayList< RepairFaultTypeBean>>() {
            @Override
            public void onSuccess(ArrayList<RepairFaultTypeBean> result) {
                faultList = result;
            }

            @Override
            public void onError(String errorCode, String errorMessage) {
                Toast.makeText(this, "Failed to get", Toast.LENGTH_SHORT).show();
            }
        });

Upload repair work order media file

Interface Description

When media information needs to be submitted to the cloud

TuyaCommercialLightingRepair.getRepairUploader().uploadFile(
    @FileType 
    int fileType, 
    File file, 
    ITuyaResultCallback<FileUploadResult> callback);

Parameter Description

parameter name type required description
fileType int true Media file type 0: Image 1: Video
file File true source file

Sample code

             File mediaFile = new File("xxx.png")
                 final FileUploadResult uploadFile = null;
        TuyaCommercialLightingRepair.getRepairUploader().uploadFile(1, mediaFile, new ITuyaResultCallback<FileUploadResult>() {
            @Override
            public void onSuccess(FileUploadResult result) {
                Toast.makeText(this, "Upload successful", Toast.LENGTH_SHORT).show();
                uploadFile = result;
            }

            @Override
            public void onError(String errorCode, String errorMessage) {
                Toast.makeText(this, "Upload failed", Toast.LENGTH_SHORT).show();
            }
        });

Get device configuration details (group, linkage scenario schedule gateway)

Interface Description

Maintenance personnel can view various types of information associated with abnormal devices to facilitate debugging during maintenance.

TuyaCommercialLightingRepair.getRepairManager().getDeviceConfigInfo(
  long projectId, 
  String devId, 
  ITuyaResultCallback<DeviceConfigInfoBean> callback);

Parameter Description

parameter name type required description
devId String false device id

Sample Code

 TuyaCommercialLightingRepair.getRepairManager().getDeviceConfigInfo(10000, "123", new ITuyaResultCallback<DeviceConfigInfoBean>() {
            @Override
            public void onSuccess(DeviceConfigInfoBean result) {
                showDevConfigInfo(result);
            }

            @Override
            public void onError(String errorCode, String errorMessage) {
                Toast.makeText(this, "Failed to get", Toast.LENGTH_SHORT).show();
            }
        });

Get work order list

Interface Description

Get all repair work orders associated with the current repairer account

TuyaCommercialLightingRepair.getRepairManager().getRepairList(
  long projectId, 
  int offsetKey, 
  int limit, 
  int ticketStatus, 
  ITuyaResultCallback<RepairListBean> callback);

Parameter Description

Parameter Name Type Required Description
ticketStatus int false Work Order Status 1 Incomplete 2 Completed
limit int false The number of pages per page
offsetKey String false Number of pages

Sample Code

TuyaCommercialLightingRepair.getRepairManager().getRepairList(10000, 1, 10, 1, new ITuyaResultCallback<RepairListBean>() {
            @Override
            public void onSuccess(RepairListBean result) {
                showList(result.getResult());
            }

            @Override
            public void onError(String errorCode, String errorMessage) {
                Toast.makeText(this, "failed", Toast.LENGTH_SHORT).show();
            }
        });

Get work order operation example

Interface Description

Get a work order operation instance based on the work order number

ILightingRepair lightingRepair = TuyaCommercialLightingRepair.newRepairInstance(
  long projectId,
  String ticketNo)

Parameter Description

Parameter Name Type Required Description
ticketNo String false work order number

Sample Code

ILightingRepair iLightingRepair = TuyaCommercialLightingRepair.newRepairInstance(10000, "123");

Get work order details

Interface Description

Get work order detail description information from the work order instance

ILightingRepair lightingRepair = TuyaCommercialLightingRepair.newRepairInstance(
  long projectId,
  String ticketNo)

lightingRepair.getRepairOrderDetail(
  ITuyaResultCallback<RepairOrderDetailBean> callback
);

Parameter Description

Parameter Name Type Required Description
projectId long true project id

Sample Code

            ILightingRepair iLightingRepair = TuyaCommercialLightingRepair.newRepairInstance(10000, "123");

            RepairOrderDetailBean orderBean = null;
      iLightingRepair.getRepairOrderDetail(new ITuyaResultCallback<RepairOrderDetailBean>() {
            @Override
            public void onSuccess(RepairOrderDetailBean result) {
                orderBean = result;
            }

            @Override
            public void onError(String errorCode, String errorMessage) {
                Toast.makeText(this, "failed", Toast.LENGTH_SHORT).show();
            }
        });

Complete repair work order

Interface Description

Submit the repair results for the current work order instance

ILightingRepair lightingRepair = TuyaCommercialLightingRepair.newRepairInstance(
  long projectId,
  String ticketNo)


lightingRepair.finishRepairOrder(
  String devId, 
  String feedbackContent, 
  String feedbackPic, 
  ITuyaResultCallback<RepairFinishResultBean> callback);

Parameter Description

Parameter Name Type Required Description
devId String true device id
feedbackContent String true feedbackContent
feedbackPic String true feedbackPic

Sample Code

 ILightingRepair iLightingRepair = TuyaCommercialLightingRepair.newRepairInstance(10000, "123");

        iLightingRepair.finishRepairOrder(
                "replaceDeviceId",
                "message",
                "123,123",
                new ITuyaResultCallback<RepairFinishResultBean>() {
                    @Override
                    public void onSuccess(RepairFinishResultBean result) {
                        Toast.makeText(this, "success", Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onError(String errorCode, String errorMessage) {
                        Toast.makeText(this, "failed", Toast.LENGTH_SHORT).show();
                    }
                }
        );