# 安装服务工单接口文档

## 目录

- [1. 工单管理](#1-工单管理)
  - [1.1 获取工单列表](#11-获取工单列表)
  - [1.2 导出工单](#12-导出工单)
  - [1.3 删除工单](#13-删除工单)
  - [1.4 驳回工单](#14-驳回工单)
  - [1.5 接单处理](#15-接单处理)
  - [1.6 每日填写](#16-每日填写)
  - [1.7 完成工单](#17-完成工单)
  - [1.8 验收工单](#18-验收工单)
- [2. 基础数据](#2-基础数据)
  - [2.1 获取下拉选项](#21-获取下拉选项)
  - [2.2 获取客户联系人](#22-获取客户联系人)
  - [2.3 获取客户列表](#23-获取客户列表)
  - [2.4 获取产品列表](#24-获取产品列表)
- [3. 新增工单](#3-新增工单)
  - [3.1 新增服务工单](#31-新增服务工单)
  - [3.2 获取发货单信息](#32-获取发货单信息)
- [4. 编辑工单](#4-编辑工单)
  - [4.1 获取工单详情](#41-获取工单详情)
  - [4.2 更新工单信息](#42-更新工单信息)
- [5. 工单派单](#5-工单派单)
  - [5.1 派单处理](#51-派单处理)
- [6. 每日填写](#6-每日填写)
  - [6.1 获取每日填写记录](#61-获取每日填写记录)
  - [6.2 提交每日填写](#62-提交每日填写)
- [7. 文件上传](#7-文件上传)

## 1. 工单管理

### 1.1 获取工单列表

#### 接口说明

获取安装服务工单列表数据

#### 请求信息

- 接口名: GetDataByName
- 请求方式: POST

#### 请求参数示例

```json
{
  "name": "getInstallationOrderList",
  "page": 1,
  "offset": 1,
  "pagecount": 10,
  "returntype": "Map",
  "parammaps": {
    "serviceStaffIds": 2,
    "customerName": "222",
    "statusName": "未接单",
    "projectId": 371,
    "orderNo": "0002",
    "orderStartTime": "2025-02-01",
    "orderEndTime": "2025-02-15",
    "completeStartTime": "2025-02-05",
    "completeEndTime": "2025-02-20",
    "contractNo": "2222",
    "deliveryNo": "2222"
  }
}
```

#### 响应示例

```json
{
  "code": 200,
  "data": {
    "code": 0,
    "list": [
      {
        "contractNo": "",
        "createId": 161,
        "createName": "乔灏",
        "customerId": 2057,
        "customerName": "定边县滩羊场  (陕西携农1牧、携农2牧)",
        "deliveryNo": "",
        "dispatcherId": 161,
        "dispatcherName": "乔灏",
        "estimatedCompleteTime": "2025-02-11 16:00:00",
        "goodsId": "1",
        "goodsName": "智能脖环（含配重，带子）",
        "id": 110,
        "installedQuantity": 0,
        "orderNo": "FW250218002",
        "orderTime": "2025-02-18 14:23:39",
        "projectId": "370",
        "projectName": "脖环佩戴",
        "remainingTime": -8,
        "remark": "",
        "serviceStaffIds": "149",
        "serviceStaffNames": "李锦全",
        "statusName": "未接单",
        "totalQuantity": 10,
        "uninstalledQuantity": 10
      }
    ],
    "message": "ok",
    "pageNum": 1,
    "pageSize": 10,
    "pages": 1,
    "total": 1
  },
  "msg": "ok"
}
```

### 1.2 导出工单

#### 接口说明

导出安装服务工单数据

#### 请求信息

- 接口名: /api/installation/export
- 请求方式: POST

#### 请求参数

同获取工单列表的请求参数

#### 响应格式

Excel 文件流

### 1.3 删除工单

#### 接口说明

删除安装服务工单

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "deleteInstallationOrderById",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    },
    {
      "name": "insertInstallationOrderProcessLog",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "operationType": "delete",
        "operationUserId": "操作人ID",
        "operationUserName": "操作人姓名",
        "beforeStatus": "操作前状态",
        "afterStatus": "操作前状态",
        "operationContent": "删除服务工单"
      }
    }
  ]
}
```

### 1.4 驳回工单

#### 接口说明

驳回安装服务工单

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "rejectInstallationOrder",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "rejectReason": "驳回原因"
      }
    },
    {
      "name": "insertInstallationOrderProcessLog",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "operationType": "reject",
        "operationUserId": "操作人ID",
        "operationUserName": "操作人姓名",
        "beforeStatus": "操作前状态",
        "afterStatus": "接单驳回",
        "operationContent": "驳回原因:xxx"
      }
    }
  ]
}
```

### 1.5 接单处理

#### 接口说明

接单处理安装服务工单

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "acceptInstallationOrder",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "acceptId": "接单人ID",
        "acceptName": "接单人姓名"
      }
    },
    {
      "name": "insertInstallationOrderProcessLog",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "operationType": "accept",
        "operationUserId": "操作人ID",
        "operationUserName": "操作人姓名",
        "beforeStatus": "操作前状态",
        "afterStatus": "处理中",
        "operationContent": "接单处理"
      }
    }
  ]
}
```

### 1.6 每日填写

#### 接口说明

填写每日安装进度

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "deleteInstallationDailyWriteByDates",
      "type": "e",
      "parammaps": {
        "datas": "日期列表",
        "orderId": "工单ID"
      }
    },
    {
      "name": "submitInstallationDailyWrite",
      "resultmaps": {
        "list": [
          {
            "installDate": "安装日期",
            "goodsName": "产品名称",
            "goodsId": "产品ID",
            "todayQuantity": "当日数量",
            "remark": "备注"
          }
        ]
      },
      "children": [
        {
          "name": "insertInstallationDailyWrite",
          "type": "e",
          "parammaps": {
            "orderId": "工单ID",
            "installUserId": "安装人ID",
            "installUserName": "安装人姓名",
            "goodsName": "@submitInstallationDailyWrite.goodsName",
            "installDate": "@submitInstallationDailyWrite.installDate",
            "goodsId": "@submitInstallationDailyWrite.goodsId",
            "todayQuantity": "@submitInstallationDailyWrite.todayQuantity",
            "remark": "@submitInstallationDailyWrite.remark"
          }
        }
      ]
    },
    {
      "name": "refreshInstallationOrderDetailQuantity",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    },
    {
      "name": "refreshInstallationOrderProcessByOrderId",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    }
  ]
}
```

### 1.7 完成工单

#### 接口说明

完成安装服务工单

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "completeInstallationOrder",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    },
    {
      "name": "insertInstallationOrderProcessLog",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "operationType": "complete",
        "operationUserId": "操作人ID",
        "operationUserName": "操作人姓名",
        "beforeStatus": "操作前状态",
        "afterStatus": "已完成未验收",
        "operationContent": "完成服务工单"
      }
    }
  ]
}
```

### 1.8 验收工单

#### 接口说明

验收安装服务工单

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "insertContacts",
      "type": "e",
      "parammaps": {
        "customerId": "客户ID",
        "contactName": "联系人姓名",
        "telephone": "联系电话"
      }
    },
    {
      "name": "insertInstallationOrderImages",
      "resultmaps": {
        "list": [
          {
            "imageId": "图片ID",
            "imageType": "check_image"
          }
        ]
      },
      "children": [
        {
          "name": "insertInstallationOrderImages",
          "type": "e",
          "parammaps": {
            "orderId": "工单ID",
            "imageId": "@insertInstallationOrderImages.imageId",
            "imageType": "@insertInstallationOrderImages.imageType"
          }
        }
      ]
    },
    {
      "name": "checkInstallationOrder",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "checkUserId": "验收人ID",
        "checkUserName": "验收人姓名",
        "contactId": "联系人ID",
        "checkDate": "验收日期"
      }
    }
  ]
}
```

## 2. 基础数据

### 2.1 获取下拉选项

#### 接口说明

获取服务人员、项目等下拉选项数据

#### 请求信息

- 接口名: GetDataByNames
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "getUsersSelect",
      "offset": 0,
      "pagecount": 0,
      "parammaps": {
        "enable": "1"
      }
    },
    {
      "name": "getDictListSelect",
      "offset": 0,
      "pagecount": 0,
      "parammaps": {
        "pid": "79"
      }
    },
    {
      "name": "getInstallationOrderToDoNum",
      "offset": 0,
      "pagecount": 0,
      "parammaps": {}
    }
  ]
}
```

### 2.2 获取客户联系人

#### 接口说明

获取客户联系人列表

#### 请求信息

- 接口名: GetDataByName
- 请求方式: POST

#### 请求参数

```json
{
  "name": "getContacts",
  "returntype": "Map",
  "offset": 0,
  "pagecount": 0,
  "parammaps": {
    "customerId": "客户ID"
  }
}
```

### 2.3 获取客户列表

#### 接口说明

搜索获取客户列表数据

#### 请求信息

- 接口名: GetDataByName
- 请求方式: POST

#### 请求参数示例

```json
{
  "name": "getCustomerNameFuzzy",
  "returntype": "Map",
  "parammaps": {
    "inputvalue": "5"
  }
}
```

#### 响应示例

```json
{
  "code": 200,
  "data": {
    "code": 0,
    "list": [
      {
        "id": 2092,
        "name": "广东省惠州市龙门县龙城街道甘乡甘南路50-1号"
      },
      {
        "id": 1590,
        "name": "长富5牧"
      }
    ],
    "message": "ok",
    "pageSize": 0,
    "total": 2
  },
  "msg": "ok"
}
```

### 2.4 获取产品列表

#### 接口说明

搜索获取产品列表数据

#### 请求信息

- 接口名: GetDataByName
- 请求方式: POST

#### 请求参数示例

```json
{
  "name": "getGoodsListByCode",
  "returntype": "Map",
  "parammaps": {
    "goodsCode": ""
  }
}
```

#### 响应示例

```json
{
  "code": 200,
  "data": {
    "code": 0,
    "list": [
      {
        "categoryId": 14,
        "goodsId": 1,
        "goodsModel": "KI",
        "goodsName": "智能脖环（含配重，带子）",
        "goodsUnit": "套",
        "id": 1,
        "label": "套"
      }
    ],
    "message": "ok",
    "pageSize": 0,
    "total": 2
  },
  "msg": "ok"
}
```

## 3. 新增工单

### 3.1 新增服务工单

#### 接口说明

新增安装服务工单

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "insertInstallationOrder",
      "type": "e",
      "parammaps": {
        "ordererId": "下单人ID",
        "ordererName": "下单人姓名",
        "projectId": "项目ID",
        "serviceStaffIds": "服务人员ID列表",
        "serviceStaffNames": "服务人员姓名列表",
        "estimatedCompleteTime": "预计完成时间",
        "deliveryNo": "发货单号",
        "contractNo": "合同号",
        "customerId": "客户ID",
        "customerName": "客户名称",
        "remark": "备注"
      }
    },
    {
      "name": "insertInstallationOrderDetail",
      "resultmaps": {
        "list": [
          {
            "goodsId": "产品ID",
            "goodsCode": "产品编号",
            "goodsName": "产品名称",
            "goodsSpecification": "产品规格",
            "goodsModel": "产品型号",
            "goodsUnit": "产品单位",
            "quantity": "数量"
          }
        ]
      },
      "children": [
        {
          "name": "insertInstallationOrderDetail",
          "type": "e",
          "parammaps": {
            "orderId": "@insertInstallationOrder.LastInsertId",
            "goodsId": "@insertInstallationOrderDetail.goodsId",
            "goodsCode": "@insertInstallationOrderDetail.goodsCode",
            "goodsName": "@insertInstallationOrderDetail.goodsName",
            "goodsSpecification": "@insertInstallationOrderDetail.goodsSpecification",
            "goodsModel": "@insertInstallationOrderDetail.goodsModel",
            "goodsUnit": "@insertInstallationOrderDetail.goodsUnit",
            "quantity": "@insertInstallationOrderDetail.quantity"
          }
        }
      ]
    }
  ]
}
```

### 3.2 获取发货单信息

#### 接口说明

根据发货单号获取发货单信息

#### 请求信息

- 接口名: GetDataByName
- 请求方式: POST

#### 请求参数

```json
{
  "name": "getDeliveryOrderByNo",
  "offset": 0,
  "pagecount": 0,
  "parammaps": {
    "deliveryNo": "发货单号"
  }
}
```

## 4. 编辑工单

### 4.1 获取工单详情

#### 接口说明

获取工单详细信息

#### 请求信息

- 接口名: GetDataByNames
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "getInstallationOrderById",
      "offset": 0,
      "pagecount": 0,
      "parammaps": {
        "orderId": "工单ID"
      }
    },
    {
      "name": "getInstallationOrderDetailByOrderId",
      "offset": 0,
      "pagecount": 0,
      "parammaps": {
        "orderId": "工单ID"
      }
    }
  ]
}
```

### 4.2 更新工单信息

#### 接口说明

更新工单基本信息和产品明细

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "updateInstallationOrder",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "projectId": "项目ID",
        "serviceStaffIds": "服务人员ID列表",
        "serviceStaffNames": "服务人员姓名列表",
        "estimatedCompleteTime": "预计完成时间",
        "customerId": "客户ID",
        "customerName": "客户名称",
        "remark": "备注"
      }
    },
    {
      "name": "deleteInstallationOrderDetailByOrderId",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    },
    {
      "name": "insertInstallationOrderDetail",
      "resultmaps": {
        "list": [
          {
            "goodsId": "产品ID",
            "goodsCode": "产品编号",
            "goodsName": "产品名称",
            "goodsSpecification": "产品规格",
            "goodsModel": "产品型号",
            "goodsUnit": "产品单位",
            "quantity": "数量"
          }
        ]
      },
      "children": [
        {
          "name": "insertInstallationOrderDetail",
          "type": "e",
          "parammaps": {
            "orderId": "工单ID",
            "goodsId": "@insertInstallationOrderDetail.goodsId",
            "goodsCode": "@insertInstallationOrderDetail.goodsCode",
            "goodsName": "@insertInstallationOrderDetail.goodsName",
            "goodsSpecification": "@insertInstallationOrderDetail.goodsSpecification",
            "goodsModel": "@insertInstallationOrderDetail.goodsModel",
            "goodsUnit": "@insertInstallationOrderDetail.goodsUnit",
            "quantity": "@insertInstallationOrderDetail.quantity"
          }
        }
      ]
    }
  ]
}
```

## 5. 工单派单

### 5.1 派单处理

#### 接口说明

派单给服务人员处理

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "dispatchInstallationOrder",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "dispatcherId": "派单人ID",
        "dispatcherName": "派单人姓名",
        "serviceStaffIds": "服务人员ID列表",
        "serviceStaffNames": "服务人员姓名列表"
      }
    },
    {
      "name": "insertInstallationOrderProcessLog",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID",
        "operationType": "dispatch",
        "operationUserId": "操作人ID",
        "operationUserName": "操作人姓名",
        "beforeStatus": "操作前状态",
        "afterStatus": "未接单",
        "operationContent": "派单处理"
      }
    }
  ]
}
```

## 6. 每日填写

### 6.1 获取每日填写记录

#### 接口说明

获取工单每日填写记录

#### 请求信息

- 接口名: GetDataByName
- 请求方式: POST

#### 请求参数

```json
{
  "name": "getInstallationDailyWriteByOrderId",
  "offset": 0,
  "pagecount": 0,
  "parammaps": {
    "orderId": "工单ID"
  }
}
```

### 6.2 提交每日填写

#### 接口说明

提交每日安装进度

#### 请求信息

- 接口名: ExecDataByConfig
- 请求方式: POST

#### 请求参数

```json
{
  "common": {
    "returnmap": "0"
  },
  "data": [
    {
      "name": "deleteInstallationDailyWriteByDates",
      "type": "e",
      "parammaps": {
        "datas": "日期列表",
        "orderId": "工单ID"
      }
    },
    {
      "name": "submitInstallationDailyWrite",
      "resultmaps": {
        "list": [
          {
            "installDate": "安装日期",
            "goodsName": "产品名称",
            "goodsId": "产品ID",
            "todayQuantity": "当日数量",
            "remark": "备注"
          }
        ]
      },
      "children": [
        {
          "name": "insertInstallationDailyWrite",
          "type": "e",
          "parammaps": {
            "orderId": "工单ID",
            "installUserId": "安装人ID",
            "installUserName": "安装人姓名",
            "goodsName": "@submitInstallationDailyWrite.goodsName",
            "installDate": "@submitInstallationDailyWrite.installDate",
            "goodsId": "@submitInstallationDailyWrite.goodsId",
            "todayQuantity": "@submitInstallationDailyWrite.todayQuantity",
            "remark": "@submitInstallationDailyWrite.remark"
          }
        }
      ]
    },
    {
      "name": "refreshInstallationOrderDetailQuantity",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    },
    {
      "name": "refreshInstallationOrderProcessByOrderId",
      "type": "e",
      "parammaps": {
        "orderId": "工单ID"
      }
    }
  ]
}
```

## 7. 文件上传

#### 接口说明

上传图片文件

#### 请求信息

- 接口名: /authdata/uploaderimage
- 请求方式: POST
- Content-Type: multipart/form-data

#### 请求参数

| 参数名 | 类型 | 说明     |
| ------ | ---- | -------- |
| file   | File | 图片文件 |

#### 响应示例

```json
{
  "execresult": {
    "LastInsertId": 15625,
    "RowsAffected": 1,
    "result": {
      "Locker": {}
    }
  },
  "filename": "186569a22092815a3e84c3dd22681b9f.jpg",
  "hash": "186569a22092815a3e84c3dd22681b9f",
  "origin": "8dc780517656a754a174becb9a44f63.jpg",
  "size": 113678
}
```
