VWED_server/docs/sc/文件操作分拨单.md

144 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

```markdown
## 文件操作
### 根据文件名读取脚本目录下的文件内容
* 方法说明
根据文件名,读取脚本目录下的文件内容。
```python
def read_file_to_string(file_name: str) -> Optional[str]
```
* 输入参数
* file_namestr 类型,表示目标文件的名称(带后缀,例如 a.txt )。
* 输出参数
* 读取文件成功时,返回值为表示文件内容的字符串。
* 读取文件失败时,返回值为 None 。
* 异常
本方法不会抛出异常。
## 分拨单
### 标记分拨点满
* 方法说明
标记分拨点货满,不需要放货
```python
def distribute_mark_full(loc: str) -> bool
```
* 输入参数
* locstr 类型,表示库位的 id
* 输出参数
* 成功时,返回 True
* 失败时,返回 False
**注意:此功能暂未实现,需要后续开发**
### 标记分拨点缺货
* 方法说明
标记分拨点缺货,可以放货
```python
def distribute_mark_not_full(loc: str) -> bool
```
* 输入参数
* locstr 类型,表示库位的 id
* 输出参数
* 成功时,返回 True
* 失败时,返回 False
**注意:此功能暂未实现,需要后续开发**
### 报告放货完成
* 方法说明
报告当前库位放货完成,可离开
```python
def distribute_task_done(vehicle_id: str) -> bool
```
* 输入参数
* vehicle_idstr 类型,表示机器人的 id
* 输出参数
* 成功时,返回 True
* 失败时,返回 False
**注意:此功能暂未实现,需要后续开发**
### 增加分拨点
* 方法说明
向正在运行的分拨任务,添加分拨点
```python
def append_to_loc_list(task_record_id: str, to_loc_list: str, block_no: str = "") -> bool
```
* 输入参数
* task_record_idstr 类型,必填,任务实例的 Id
* to_loc_list添加分拨点的参数字符串数据格式如下
```json
[
{
"toLoc": "LM7", //必填分拨点
"postAction":"" //非必填,分拨点完成的回调
}
]
```
* block_nostr 类型,天风任务块编号("b8"),可不填,默认对应任务下正在运行的分拨单,如果涉及多个需要指定块编号
* 返回值,成功 `True`, 失败 `False`
* 案例
```python
loc = [{
"toLoc": "LM7"
}]
append_to_loc_list("6e32d7f2-99fa-42d4-8c4d-cd267190d694", json.dumps(loc), "b8")
# 说明向在天风任务块编号是b8的任务id为6e32d7f2-99fa-42d4-8c4d-cd267190d694的分拨单添加一个分拨点LM7
```
**注意:此功能暂未实现,需要后续开发**
### 删除分拨点
* 方法说明
向正在运行的分拨任务,删除分拨点
```python
def delete_to_loc_list(task_record_id: str, to_locs: str, block_no: str = "") -> bool
```
* 输入参数
* task_record_idstr 类型,必填,任务实例的 Id
* to_locsstr 类型,删除分拨点的参数,字符串,数据格式如下:
```json
["LM41"]
```
* block_nostr 类型,天风任务块编号("b8"),可不填,默认对应任务下正在运行的分拨单,如果涉及多个需要指定块编号
* 返回值,成功 `True`, 失败 `False`
* 案例
```python
del_loc = ["LM41"]
delete_to_loc_list("276ccf58-c429-4e33-ad7b-4bcbe9d56e27", json.dumps(del_loc), "b8")
# 说明向在天风任务块编号是b8的任务id为6e32d7f2-99fa-42d4-8c4d-cd267190d694的分拨单删除一个分拨点LM41
```
**注意:此功能暂未实现,需要后续开发**
```