import http from './request.js';
import {
session,
} from "@/comm/utils.js"
const addLog = (item) => {
http.addLog(item)
}
// 判断ip是否可以连接上
export const checkIpLinkSuccess = (ip) => {
var url = `http://${ip}:4405/api/mt/battery`;
console.log("url", url)
return new Promise((resolve, reject) => {
uni.request({
url: url,
method: "GET",
header: {
"Content-Type": "application/json;charset=UTF-8"
},
timeout: 5000,
success: (result) => {
//console.log("result", result)
if (result.statusCode != 200) {
if (result.statusCode == 404) {
return reject({
errMsg: "地址不对,请检查该地址:" + url
});
}
resolve({
code: -1,
msg: "访问失败,状态码:" + result.statusCode
});
}
var ret = result.data
if (typeof ret == 'string') {
try {
try {
try {
ret = JSON.parse(ret.replace(/\\"/g, '"'));
} catch (ex) {
ret = JSON.parse(ret.replace(/\\/g, '\\\\'))
}
} catch (ex) {
ret = JSON.parse(ret.replace(/\\"/g, "'").replace(
/[\r\n]/g,
'
').replace(/[\t]/g, ' '));
}
} catch (ex) {
resolve({
code: -1,
msg: '将【json string】转换为【json object】失败'
});
}
}
if (ret.code == 0) {
resolve({
code: 0,
data: ret.data
});
} else {
resolve({
code: ret.code,
msg: ret.msg || ""
});
}
},
fail: (err) => {
console.log("err", err)
return reject(err);
}
})
})
}
/**
* GET 4405/api/shell/version
* 获取软件版本信息:
* @param
* @returns
*/
export const getShellVersion = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/shell/version`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 4405/api/shell/version
* 更新软件版本
* @param
* @returns
*/
export const uploadShellVersion = async (ip, path) => {
var header = {
'Content-Type': 'application/octet-stream'
};
var url = `http://${ip}:4405/api/shell/version`;
const buf = await FilePath.readArrayBuffer({
path: filePath
});
const flag = 3
const flagBuf = new ArrayBuffer(4);
const view = new DataView(flagBuf);
view.setUint32(0, flag, false); // 大端
// 2.3 拼接 POST 体:flag(4B) + 压缩包
const body = new ArrayBuffer(4 + buf.byteLength);
const whole = new Uint8Array(body);
whole.set(new Uint8Array(flagBuf), 0);
whole.set(new Uint8Array(buf), 4);
return http.request({
method: "POST",
url,
header,
dataType: 'arraybuffer', // 关键:让 data 按二进制走
data: body,
})
}
export const shellUpgrade = async (ip, filePath, cbSuccess, cbProgress, cbFail) => {
var url = `http://${ip}:4405/api/shell/upgrade`;
const uploadTask = uni.uploadFile({
url,
name: "upload",
filePath: filePath,
formData: {
'upgrade_flag': 3
},
success: (result) => {
console.log(result)
const now = new Date()
const date = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`
if (result.statusCode != 200) {
http.addLog({
date,
method: "POST",
url,
param: {
upload: filePath,
upgrade_flag: 3
},
statusCode: result.statusCode,
data: ""
})
if (result.statusCode == 404) {
cbFail("地址不对,请检查该地址:" + url);
} else
cbFail("访问失败,状态码:" + result.statusCode);
} else {
var ret = result.data
if (typeof ret == 'string') {
try {
try {
try {
ret = JSON.parse(ret.replace(/\\"/g, '"'));
} catch (ex) {
ret = JSON.parse(ret.replace(/\\/g, '\\\\'))
}
} catch (ex) {
ret = JSON.parse(ret.replace(/\\"/g, "'").replace(
/[\r\n]/g,
'
').replace(/[\t]/g, ' '));
}
} catch (ex) {
cbFail('将【json string】转换为【json object】失败');
}
}
http.addLog({
date,
method: "POST",
url,
param: {
upload: filePath,
upgrade_flag: 3
},
statusCode: result.statusCode,
data: JSON.stringify(ret)
})
if (ret.code == 0) {
cbSuccess(ret.data);
} else {
cbFail(ret.msg || ret.message || "");
}
}
},
fail: (result) => {
console.log(result)
cbFail(result);
},
})
uploadTask.onProgressUpdate((res) => {
cbProgress(res, uploadTask)
});
}
/**
* GET 4405/api/error/list
* 获取实时错误
* @param
* @returns
*/
export const getErrorList = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/error/list?_timestamp=${new Date().getTime()}`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 4405/api/mt/clear_fault
* 清除实时错误
* @param
* @returns
*/
export const clearFault = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/mt/clear_fault`;
return http.request({
method: "POST",
url,
header,
})
}
/**
* GET 4405/api/error/history
* 获取历史错误
* @param
* @returns
*/
export const getErrorHistory = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/error/history?_timestamp=${new Date().getTime()}`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 4405/api/error/download_error
* 下载历史错误日志:
* @param
* @returns
*/
export const downloadError = (ip, path, cbSuccess, cbProgress, cbFail) => {
var url = `http://${ip}:4405/api/error/download_error?path=${encodeURI(path)}`;
console.log(url)
// var header = {
// "Content-Type": "application/json;charset=UTF-8"
// };
// return http.request({
// method: "GET",
// url,
// header,
// })
// return
const downloadTask = uni.downloadFile({
url: url,
header: {
'content-type': 'application/octet-stream',
},
success: (result) => {
console.log("downloadFile", result)
const now = new Date()
const date = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`
if (result.statusCode === 200) {
http.addLog({
date,
method: `GET`,
url: url,
param: {},
statusCode: result.statusCode,
data: result
})
cbSuccess(result.tempFilePath)
} else {
http.addLog({
date,
method: `GET`,
url: url,
param: {},
statusCode: result.statusCode,
data: result.data
})
cbFail(result.data || '下载未知错误!');
}
},
fail: (result) => {
console.log("downloadTaskFile fail", result)
const now = new Date()
const date = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`
http.addLog({
date,
method: `GET`,
url: url,
param: {},
statusCode: -1,
data: result
})
cbFail('下载文件失败!');
}
})
downloadTask.onProgressUpdate((res) => {
cbProgress(res, downloadTask)
});
return downloadTask
}
/**
* POST 4405/api/mt/error/tar_log
* 打包下载日志
* @param
* @returns
*/
export const tarErrorLog = (ip, start_time, end_time) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/error/tar_log`;
return http.request({
method: "POST",
url,
header,
data: {
start_time,
end_time
}
})
}
/**
* GET 4405/api/error/query_task_status
* 查询打包后的日志目录(查到后使用4405/api/error/download_error接口下载)
* @param
* @returns
*/
export const queryErrorTaskStatus = (ip, task_list) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url =
`http://${ip}:4405/api/error/query_task_status?_timestamp=${new Date().getTime()}&task_list=${encodeURI(JSON.stringify(task_list))}`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/get_agv_state
* 查询车辆信息
* @param
* @returns
*/
export const getAgvState = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/get_agv_state`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 4405/api/mt/batter
* // 查询车辆信息
* @param
* @returns
*/
export const mtBattery = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/mt/battery`;
return http.request({
method: "GET",
url,
header,
timeout: 5000,
})
}
/**
* GET 4405/api/shell/version
* 查询shell版本
* @param
* @returns
*/
export const shellVersion = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:4405/api/shell/version`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/add_station
* 添加站台
* @param
* stationID, //站台ID
* name, //站台名
* @returns
*/
export const addStation = (ip, param) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
const {
stationID,
name
} = param
var url = `http://${ip}:5000/api/add_station/`;
return http.request({
method: "POST",
url,
header,
data: {
stationID,
name,
},
})
}
/**
* GET 5000/api/update_station
* 查询站点
* @param
* @returns
*/
export const stations = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/stations`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/update_station
* 修改站点信息
* @param
* @returns
*/
export const updateStation = (ip, param) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
const {
stationID,
name,
x,
y,
angle
} = param
var url = `http://${ip}:5000/api/update_station/`;
return http.request({
method: "POST",
url,
header,
data: {
stationID,
name,
x: Number(x),
y: Number(y),
angle
}
})
}
/**
* POST 5000/api/delete_station
* 删除站点信息
* @param
* stationID 站点id集合
* @returns
*/
export const delStation = (ip, stationID = []) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/delete_station/`;
return http.request({
method: "POST",
url,
header,
data: {
stationID
}
})
}
/**
* POST 5000/api/add_task
* 添加任务
* @param
* taskGroupID #任务组ID
* taskGroupName #任务组名
* cycleTime #循环次数
* taskButton #绑定按钮
* taskList [{
* stationID
* actionType 任务状态1取货,2卸货,3导航
* wait 等待时间
}]
* taskGroupNameID #任务组名
* @returns
*/
export const addTask = (ip, param) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
const {
taskGroupID,
taskGroupName,
cycleTime,
taskButton,
tasktype,
taskList
} = param
var url = `http://${ip}:5000/api/add_task/`;
return http.request({
method: "POST",
url,
data: {
taskGroupID,
taskGroupName,
cycleTime,
taskButton,
tasktype,
taskList
}
})
}
/**
* GET 5000/api/tasks
* 查询任务
* @param
* @returns
*/
export const tasks = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/tasks`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/update_task
* 修改任务
* @param
* taskGroupID #任务组ID
* taskGroupName #任务组名
* cycleTime #循环次数
* taskButton #绑定按钮
* taskList [{
* actionType 任务状态1取货,2卸货,3导航
"dest": {
"angle": 1,
"name": "Work1212",
"stationID": 6,
"x": 2,
"y": 2,
"_checked": false
},
"taskID": 1,
"wait": 10
}]
* taskGroupNameID #任务组名
* @returns
*/
export const updateTask = (ip, param) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
const {
taskGroupID,
taskGroupName,
cycleTime,
taskButton,
tasktype,
taskList
} = param
var url = `http://${ip}:5000/api/update_task/`;
return http.request({
method: "POST",
url,
header,
data: {
taskGroupID,
taskGroupName,
cycleTime,
tasktype,
taskButton,
taskList
}
})
}
/**
* POST 5000/api/delete_station
* 删除任务
* @param
* [{
* taskGroupID 任务组ID
* taskID 任务ID
}]
* @returns
*/
export const delTask = (ip, list = []) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/delete_task/`;
return http.request({
method: "POST",
url,
header,
data: {
data: list
}
})
}
/**
* POST 5000/api/add_taskGroupCmd
* 开始任务
* @param
* taskGroupID
* taskGroupCmdID由于前端生成uuid,创建后需要存储起来,后续在查询当前任务时候做判断使用
* taskGroupCmd 1 # 1.开始任务 2.结束任务
* @returns
*/
export const addTaskGroupCmd = (ip, taskGroupID, taskGroupCmdID, taskGroupCmd = 1) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/add_taskGroupCmd/`;
return http.request({
method: "POST",
url,
header,
data: {
taskGroupID,
taskGroupCmd,
taskGroupCmdID,
}
})
}
/**
* POST 5000/api/cancel_task
* 取消任务
* @param
* taskGroupID
* taskGroupCmdID 正在执行任务的cmdId
* taskList[{
* taskID,
* is_cancel
}]
* @returns
*/
export const cancelTask = (ip, taskGroupID, taskGroupCmdID, taskList = []) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/cancel_task/`;
return http.request({
method: "POST",
url,
header,
data: {
taskGroupID,
taskGroupCmdID,
taskList
}
})
}
/**
* GET 5000/api/taskGroupStatus
* 查询任务状态
* @param
* @returns
*/
export const taskGroupStatus = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/taskGroupStatus/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/getAllScene
* 获取场景列表
* @param
* @returns
*/
export const getAllScene = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/getAllScene/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/getMapUrl
* 通过场景获取地图文件地址
* @param
* @returns
*/
export const getMapUrl = (ip, id) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/getMapUrl/`;
return http.request({
method: "POST",
url,
header,
data: {
sceneId: id,
},
})
}
/**
* POST 5000/api/get_task_log
* 获取任务记录
* @param
* start_time #开始时间时间戳
* end_time #结束时间时间戳
* @returns
*/
export const getTaskLog = (ip, start_time = "", end_time = "") => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/get_task_log/`;
return http.request({
method: "POST",
url,
header,
data: {
start_time,
end_time
}
})
}
/**
* GET 5000/api/teaching_mode
* 示教查询
* @param
* @returns
*/
export const getTeachingMode = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/teaching_mode/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/split_teaching_mode
* 切分后的示教查询
* @param
* @returns
*/
export const splitTeachingMode = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/split_teaching_mode/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/get_current_teaching_data
* 获取记录的示教数据
* @param
* @returns
*/
export const getCurrentTeachingData = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/get_current_teaching_data/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/teaching_mode_flag
* 开始/停止示教
* @param
* mode # 公共示教类型: Public, 站台示教类型Stations
* src_dst 如果mode为站台示教才有值否则为空字符串, 传入起点 + _ + 终点的格式 例如 "loc1_loc2"
* name 示教名称
* teaching_flag # 1 开始示教, 0 停止示教
* main_road 1,# 1主路,0支路
* "bidirection": "1", # 1为双向,0为单向,停止示教的时候传值即可( 即"teaching_flag": 0)
* mode_type # 0默认1双向2智能
* @returns
*/
export const teachingModeFlag = (ip, param) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
const {
mode,
src_dst,
name,
teaching_flag,
main_road,
bidirection,
mode_type
} = param
var url = `http://${ip}:5000/api/teaching_mode_flag/`;
return http.request({
method: "POST",
url,
header,
data: {
mode,
src_dst,
name,
teaching_flag,
main_road,
bidirection,
mode_type
}
})
}
/**
* POST 5000/api/delete_teaching_mode
* 删除示教
* @param
* 数组[]
* mode: 公共示教类型: Public, 站台示教类型Stations
*name: #示教名称,
* src_dst: #起点终点,
* @returns
*/
export const delTeachingMode = (ip, list) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/delete_teaching_mode/`;
return http.request({
method: "POST",
url,
header,
data: {
data: list
}
})
}
/**
* POST 5000/api/delete_teaching_mode_data
* 删除示教数据
* @param
* polygon_points [(0, 0), (0, 3), (3, 3), (3, 0)] #删除区域的四个点
* @returns
*/
export const delTeachingModeData = (ip, polygonPoints) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/delete_teaching_mode_data/`;
return http.request({
method: "POST",
url,
header,
data: {
polygon_points: polygonPoints
}
})
}
/**
* POST 5000/api/update_split_teaching_data
* 修改切分示教数据属性
* @param
* edge_name # 必传id
* bidirection # 非必传,修改单双向传递
* main_road # 非必传,修改主路支路传递
* name # 必传
* @returns
*/
export const updateSplitTeachingData = (ip, param) => {
const {
edge_name,
name,
main_road,
bidirection
} = param
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/update_split_teaching_data/`;
return http.request({
method: "POST",
url,
header,
data: {
edge_name,
name,
main_road,
bidirection
}
})
}
/**
* POST 5000/api/delete_split_teaching_data
* 删除切分示教数据
* @param
* edge_name # 必传id
* name # 必传
* @returns
*/
export const deleteSplitTeachingData = (ip, edge_name, name) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/delete_split_teaching_data/`;
return http.request({
method: "POST",
url,
header,
data: {
edge_name,
name,
}
})
}
/**
* POST 5000/api/check_agv_location_distance_error
* 判断库位和车距离是否过大
* @param
* location_name 库位
* @returns
*/
export const checkAgvLocationDistanceError = (ip, location_name) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/check_agv_location_distance_error/`;
return http.request({
method: "POST",
url,
header,
data: {
location_name
}
})
}
/**
* POST 5000/api/create_scene
* 创建/结束场景
* @param
* scene_id 场景名称
* scene_flag 1开始场景,0结束场景
* @returns
*/
export const createScene = (ip, scene_id, scene_flag) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/create_scene/`;
return http.request({
method: "POST",
url,
header,
data: {
scene_id,
scene_flag
}
})
}
/**
* POST 5000/api/add_map
* 开始地图操
* @param
* scene_id 场景名称
* map_type #新图create扩展extend
* @returns
*/
export const addMap = (ip, scene_id, map_type = "create") => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/add_map/`;
return http.request({
method: "POST",
url,
header,
data: {
scene_id,
map_type
}
})
}
/**
* POST 5000/api/stop_map
*结束地图操
* @param
* scene_id 场景名称
* @returns
*/
export const stopMap = (ip, scene_id) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/stop_map/`;
return http.request({
method: "POST",
url,
header,
data: {
scene_id,
}
})
}
/**
* GET 6000/api/laser_data
* 返回激光实时数据及底图
* @param
* map_id 地图标识
* @returns
*/
export const getMapLaserData = (ip, mapId) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/laser_data?map_id=${mapId?mapId:-1}`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 6000/api/get_map_server_phase
* 获取构图程序阶段
* @param
* @returns
* "data": 1, # 1:未启动2:启动中3:启动完成4:构图保存中5:构图保存完成6:构图保存失败
*/
export const getMapServerPhase = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/get_map_server_phase/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/update_scene_id
* 修改场景名称
* @param
* old_scene_id 需要修改场景名称
* new_scene_id 修改后的场景名称
* @returns
*/
export const updateScene = (ip, old_scene_id, new_scene_id) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/update_scene_id/`;
return http.request({
method: "POST",
url,
header,
data: {
old_scene_id,
new_scene_id
}
})
}
/**
* POST 5000/api/delete_scene
* 删除场景
* @param
* scene_id 场景名称
* @returns
*/
export const delScene = (ip, scene_id) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/delete_scene/`;
return http.request({
method: "POST",
url,
header,
data: {
scene_id,
}
})
}
/**
* POST 5000/api/handoff_scene
* 切换场景
* @param
* old_scene_id 当前场景名称
* new_scene_id 需要切换的场景名称
* @returns
*/
export const handoffScene = (ip, old_scene_id, new_scene_id) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/handoff_scene/`;
return http.request({
method: "POST",
url,
header,
data: {
old_scene_id,
new_scene_id
}
})
}
/**
* GET 5000/api/save_db_data
* 获取DB数据
* @param
* @returns
*/
export const getDBData = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/get_db_data/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/save_db_data
* 保存DB数据
* @param
* @returns
*/
export const saveDBData = (ip, data) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/save_db_data/`;
return http.request({
method: "POST",
url,
header,
data: {
data
}
})
}
/**
* GET 5000/api/save_db_data_status
* 获取DB数据保存状态:
* @param
* @returns 1保存中 2保存成功 3保存失败
*/
export const getSaveDBDataStatus = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/save_db_data_status/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/cancel_save_db_data
* 取消保存DB数据:
* @param
* @returns
*/
export const cancelSaveDBData = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/cancel_save_db_data/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/check_mapserver_is_start
* 判断构图程序是否启动
* @param
* @returns
*/
export const checkMapServerIsStart = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/check_mapserver_is_start/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/start_or_stop_mapserver
* 开启或者关闭构图程序: 1开启2关闭
* @param status 1开启2关闭
* @returns
*/
export const startOrStopMapServer = (ip, status) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/start_or_stop_mapserver/`;
return http.request({
method: "POST",
url,
header,
data: {
status
}
})
}
/**
* GET 5000/api/check_mapserver_is_ok
* 构图程序是否准备到位
* @param
* @returns
*/
export const checkMapServerIsOk = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/check_mapserver_is_ok/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/check_save_map_is_ok
* 结束构图是否保存完成
* @param
* @returns
*/
export const checkSaveMapIsOk = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/check_save_map_is_ok/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* GET 5000/api/get_pallet_size/
* 获取托盘尺寸:
* @param
* @returns
*/
export const getPalletSize = (ip) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/get_pallet_size/`;
return http.request({
method: "GET",
url,
header,
})
}
/**
* POST 5000/api/save_pallet_size/
* 设置托盘尺寸:
* @param length 2,#长度/单位m
* @param width 2,#长度/单位m
* @returns
*/
export const savePalletSize = (ip, length, width) => {
var header = {
"Content-Type": "application/json;charset=UTF-8"
};
var url = `http://${ip}:5000/api/save_pallet_size/`;
return http.request({
method: "POST",
url,
header,
data: {
length,
width
}
})
}