定点作业、出库确认、作业管理
This commit is contained in:
16
utils/api.js
16
utils/api.js
@@ -1,16 +0,0 @@
|
||||
import request from './request.js'
|
||||
// 登录
|
||||
export const handLogin = (user, password) => request({
|
||||
url:'mobile/auth/login',
|
||||
data: {
|
||||
username: user,
|
||||
password: password
|
||||
}
|
||||
})
|
||||
|
||||
// 测试状态码报错接口
|
||||
export const handRequest = () => request({
|
||||
url:'getInfo/4',
|
||||
data: {}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import request from './request.js'
|
||||
import request1 from './request1.js'
|
||||
|
||||
// 版本更新测试
|
||||
export const pdaUpdate = () => request({
|
||||
@@ -252,6 +251,153 @@ export const bindVehicle = (code, type, vcode) => request({
|
||||
vehicle_code: vcode
|
||||
}
|
||||
})
|
||||
/**
|
||||
* 定点作业
|
||||
*/
|
||||
// 查询设备
|
||||
// export const queryDevice = () => request({
|
||||
// url:'api/pda/queryDevice',
|
||||
// data: {}
|
||||
// })
|
||||
export const queryDevice = () => {
|
||||
let res = [
|
||||
{
|
||||
"region_code": "68",
|
||||
"region_name": "构华",
|
||||
"deviceArr": [
|
||||
{
|
||||
"point_code": "9",
|
||||
"point_name": "京产"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"region_code": "8",
|
||||
"region_name": "构华片资",
|
||||
"deviceArr": [
|
||||
{
|
||||
"point_code": "19",
|
||||
"point_name": "京产开向准"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
return res
|
||||
}
|
||||
// 定点作业-确认
|
||||
export const taskConfirm = (code1, code2) => request({
|
||||
url:'api/pda/taskConfirm',
|
||||
data: {
|
||||
point_code1: code1,
|
||||
point_code2: code2
|
||||
}
|
||||
})
|
||||
/**
|
||||
* 作业管理
|
||||
*/
|
||||
// 查询未完成指令
|
||||
// export const pdaInsts = (keyword, scode, ncode) => request({
|
||||
// url:'api/pda/insts',
|
||||
// data: {
|
||||
// keyword: keyword,
|
||||
// start_devicecode: scode,
|
||||
// next_devicecode: ncode
|
||||
// }
|
||||
// })
|
||||
export const pdaInsts = () => {
|
||||
let res = {
|
||||
"code": "1",
|
||||
"desc": "in",
|
||||
"result": [
|
||||
{
|
||||
"inst_uuid": "51",
|
||||
"task_no": "ADB001",
|
||||
"start_devicecode": "46",
|
||||
"next_devicecode": "2",
|
||||
"inst_status": "0",
|
||||
"priority": "一级",
|
||||
"create_time": "1976-04-07 02:36:18",
|
||||
"carrier": "890000008",
|
||||
"instruction_code": '0000',
|
||||
"carno": '1号车',
|
||||
"inst_step": '1'
|
||||
},
|
||||
{
|
||||
"inst_uuid": "5",
|
||||
"task_no": "ADB001",
|
||||
"start_devicecode": "46",
|
||||
"next_devicecode": "2",
|
||||
"inst_status": "0",
|
||||
"priority": "一级",
|
||||
"create_time": "1976-04-07 02:36:18",
|
||||
"carrier": "890000008",
|
||||
"instruction_code": '0000',
|
||||
"carno": '1号车',
|
||||
"inst_step": '1'
|
||||
},
|
||||
{
|
||||
"inst_uuid": "1",
|
||||
"task_no": "ADB001",
|
||||
"start_devicecode": "46",
|
||||
"next_devicecode": "2",
|
||||
"inst_status": "2",
|
||||
"priority": "一级",
|
||||
"create_time": "1976-04-07 02:36:18",
|
||||
"carrier": "890000008",
|
||||
"instruction_code": '0000',
|
||||
"carno": '1号车',
|
||||
"inst_step": '1'
|
||||
}
|
||||
]
|
||||
}
|
||||
return res
|
||||
}
|
||||
// 指令操作
|
||||
export const pdaInst = (type, uuid) => request({
|
||||
url:'api/pda/inst',
|
||||
data: {
|
||||
type: type,
|
||||
inst_uuid: uuid
|
||||
}
|
||||
})
|
||||
/**
|
||||
* 出库确认
|
||||
*/
|
||||
// 根据载具编码查询配盘信息
|
||||
// export const queryGroupInfoByVehicle = (code) => request({
|
||||
// url:'api/pda/queryGroupInfoByVehicle',
|
||||
// data: {
|
||||
// vehicle_code: code
|
||||
// }
|
||||
// })
|
||||
export const queryGroupInfoByVehicle = (code) => {
|
||||
let res = {
|
||||
"point_code": "001",
|
||||
"material_code": "100001",
|
||||
"material_name": "垃圾了付定金",
|
||||
"pcsn": "20202020",
|
||||
"material_qty": "20.0"
|
||||
}
|
||||
return res
|
||||
}
|
||||
// 回库
|
||||
export const vehicleGoBack = (code, vcode, num) => request({
|
||||
url:'api/pda/vehicleGoBack',
|
||||
data: {
|
||||
point_code: code,
|
||||
vehicle_code: vcode,
|
||||
residue_num: num
|
||||
}
|
||||
})
|
||||
// 出库确认
|
||||
export const fullVehicleOutConfirm = (code, vcode, num) => request({
|
||||
url:'api/pda/fullVehicleOutConfirm',
|
||||
data: {
|
||||
point_code: code,
|
||||
vehicle_code: vcode,
|
||||
residue_num: num
|
||||
}
|
||||
})
|
||||
/**
|
||||
* 任务流转
|
||||
*/
|
||||
@@ -314,27 +460,3 @@ export const queryPoints = (type) => request({
|
||||
// ]
|
||||
// return res
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//1.3余料回库
|
||||
export const vehicleGoBack = (code, vcode, num) => request({
|
||||
url:'api/pda/vehicleGoBack',
|
||||
data: {
|
||||
point_code: code,
|
||||
vehicle_code: vcode,
|
||||
residue_num: num
|
||||
}
|
||||
})
|
||||
// 1.4满托出库确认
|
||||
export const fullVehicleOutConfirm = (code, vcode, num) => request({
|
||||
url:'api/pda/fullVehicleOutConfirm',
|
||||
data: {
|
||||
point_code: code,
|
||||
vehicle_code: vcode,
|
||||
residue_num: num
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
import store from '@/vuex/store'
|
||||
const request1 = (params) => {
|
||||
let _self = this;
|
||||
let url = params.url;
|
||||
let method = params.method || 'POST';
|
||||
let data = params.data || {};
|
||||
// data.token = "default-access_token"
|
||||
// if (!params.token) {
|
||||
// let token = uni.getStorageSync('token');
|
||||
// if (!token) {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/login/login'
|
||||
// });
|
||||
// } else {
|
||||
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
|
||||
// }
|
||||
// }
|
||||
let token = ''
|
||||
if (store.getters.saveToken !== '') {
|
||||
token = store.getters.saveToken
|
||||
}
|
||||
let defaultOpot = {
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Terminal-Type': 'innerH5',
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
}
|
||||
let header = {}
|
||||
method = method.toUpperCase()
|
||||
if (method == 'POST') {
|
||||
header = {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
'Authorization': token
|
||||
}
|
||||
// data = qs.stringify(data)
|
||||
}
|
||||
const requestUrl = url;
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: requestUrl,
|
||||
method: method,
|
||||
header: Object.assign({}, defaultOpot, header),
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
})
|
||||
.then(res => { // 成功
|
||||
if (res.length === 1) {
|
||||
uni.showModal({
|
||||
content: 'request:fail',
|
||||
showCancel: false
|
||||
})
|
||||
reject('request:fail')
|
||||
} else if (res[1] && res[1].statusCode === 400) {
|
||||
uni.showModal({
|
||||
content: res[1].data.message,
|
||||
showCancel: false
|
||||
})
|
||||
reject(res[1].data.message)
|
||||
} else if (res[1] && res[1].statusCode === 401) {
|
||||
uni.showModal({
|
||||
content: res[1].data.message,
|
||||
showCancel: false
|
||||
})
|
||||
store.dispatch('delUserInfo')
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
} else if (res[1] && res[1].statusCode === 200) {
|
||||
let {
|
||||
data: dataType
|
||||
} = res[1]
|
||||
resolve(dataType)
|
||||
// switch (dataType.code * 1) { // 拦截返回参数
|
||||
// case 0:
|
||||
// resolve(dataType)
|
||||
// break;
|
||||
// case 1003:
|
||||
// uni.showModal({
|
||||
// title: '登录已过期',
|
||||
// content: '很抱歉,登录已过期,请重新登录',
|
||||
// confirmText: '重新登录',
|
||||
// success: function(res) {
|
||||
// if (res.confirm) {
|
||||
// uni.navigateTo({
|
||||
// // 切记这儿需要哈pages.json保持一致;不能有.vue后缀
|
||||
// url: '/pages/login/login'
|
||||
// });
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// break;
|
||||
// case -1:
|
||||
// uni.showModal({
|
||||
// title: '请求数据失败',
|
||||
// content: '获取数据失败!',
|
||||
// confirmText: '确定',
|
||||
// showCancel: false,
|
||||
// success: function(res) {
|
||||
// if (res.confirm) {} else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// break
|
||||
// }
|
||||
}else {
|
||||
uni.showModal({
|
||||
content: res[1].data.message,
|
||||
showCancel: false
|
||||
})
|
||||
reject(res[1].data.message)
|
||||
}
|
||||
})
|
||||
.catch(err => { // 错误
|
||||
reject(err)
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
})
|
||||
})
|
||||
}
|
||||
export default request1
|
||||
116
utils/utils.js
Normal file
116
utils/utils.js
Normal file
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* yy-mm-dd
|
||||
*/
|
||||
export const dateFtt = date => {
|
||||
if (date == null) {
|
||||
return ''
|
||||
}
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
||||
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
/**
|
||||
* yy-mm-dd hh:mm:ss
|
||||
*/
|
||||
export const dateTimeFtt = date => {
|
||||
if (date == null) {
|
||||
return ''
|
||||
}
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
||||
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
||||
let hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
|
||||
let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
||||
let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
||||
return `${year}-${month}-${day} ${hh}:${mm}:${ss}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串形式的日期转换成日期对象
|
||||
*/
|
||||
export const dateNew = date => {
|
||||
if (date === undefined || date === 'undefined') {
|
||||
return new Date()
|
||||
}
|
||||
return new Date(Date.parse(date))
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数加法
|
||||
*/
|
||||
export const accAdd = (arg1, arg2) => {
|
||||
var r1, r2, m, c
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
c = Math.abs(r1 - r2)
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c)
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
return (arg1 + arg2) / m
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数减法
|
||||
*/
|
||||
export const accSubtract = (arg1, arg2) => {
|
||||
var r1, r2, m, c
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
c = Math.abs(r1 - r2)
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c)
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
return (arg1 - arg2) / m
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数乘法
|
||||
*/
|
||||
export const accMul = (arg1, arg2) => {
|
||||
var m = 0
|
||||
var s1 = arg1.toString()
|
||||
var s2 = arg2.toString()
|
||||
try { m += s1.split('.')[1].length } catch (e) {}
|
||||
try { m += s2.split('.')[1].length } catch (e) {}
|
||||
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
|
||||
}
|
||||
Reference in New Issue
Block a user