diff --git a/src/config/getData2.js b/src/config/getData2.js index 6e35474..860ca85 100644 --- a/src/config/getData2.js +++ b/src/config/getData2.js @@ -1,49 +1,166 @@ import {post} from '@config/http.js' // import store from '../vuex/store' -/** 设备状态修改 */ +/** + * 分拣管理 + */ -// 1.1查询所有区域信息 -export const handArea = (type) => post('api/andxy2/hand/area', { - type: type -}) -// export const handArea = () => { +// 1.查询分拣工单及明细(定时查询) +export const sortingOrder = (reg) => post('api/hand/sortingOrder', {}) +// export const sortingOrder = () => { // let res = { +// result: [ +// { +// alloy: '', +// is_labeling: '1', +// type: 'order', +// order_status: '06', +// material_uuid: 'cf50d49e01424b2fb37d10ddfeae70f1', +// material_spec: '22.23', +// children: [ +// { +// labeling_template: '15', +// color_type: '6', +// lettering_message: '77', +// type: 'orderDetail', +// order_code: '1', +// order_status: '00', +// cust_code: 'A00001', +// lettering_icon: '1', +// strap_number: '99', +// parent_order_code: '10000037', +// qty: '11', +// is_flag: '0', +// lettering_message2: '88', +// cust_name: 'A00001', +// parent_order_id: '907694f7e2de49bc943a8575ab5b3395', +// order_id: '57fbc012c50d4398b91142086d5445b6', +// cust_id: '092f1d84fddb417a914c8aa20d5bca81' +// } +// ], +// material_name: '直管14', +// wall_thickness: '0.20', +// is_coating: '1', +// jackup_num: '5', +// length: '4000.00', +// end_time: '', +// outer_diameter: '22.23', +// order_code: '10000037', +// start_time: '', +// temper: '', +// feeding_mouth: '3', +// is_strapping: '1', +// qty: '11', +// is_flag: '1', +// is_risking: '1', +// order_id: '907694f7e2de49bc943a8575ab5b3395', +// is_lettering: '1', +// material_code: 'A10014' +// }, +// { +// alloy: '', +// is_labeling: '1', +// type: 'order', +// order_status: '01', +// material_uuid: 'cf50d49e01424b2fb37d10ddfeae70f1', +// material_spec: '22.23', +// children: [ +// { +// labeling_template: '15', +// color_type: '7', +// lettering_message: '', +// type: 'orderDetail', +// order_code: '2', +// order_status: '05', +// cust_code: 'A00001', +// lettering_icon: '2', +// strap_number: '3', +// parent_order_code: '10000038', +// qty: '5555', +// is_flag: '0', +// lettering_message2: '33', +// cust_name: 'A00001', +// parent_order_id: 'fb8f80bee3c9455c8a902e4911acf1ec', +// order_id: '1333a8a35df64432bb0e314d9636d2db', +// cust_id: '092f1d84fddb417a914c8aa20d5bca81' +// }, +// { +// labeling_template: '14', +// color_type: '7', +// lettering_message: '', +// type: 'orderDetail', +// order_code: '1', +// order_status: '04', +// cust_code: 'A00002', +// lettering_icon: '1', +// strap_number: '1', +// parent_order_code: '10000038', +// qty: '5555', +// is_flag: '0', +// lettering_message2: '1', +// cust_name: 'A00002', +// parent_order_id: 'fb8f80bee3c9455c8a902e4911acf1ec', +// order_id: '250354651d614a6dbc445e4089ce0e72', +// cust_id: '4b80d1c012e44027ad09b9f33ca7af0d' +// }, +// { +// labeling_template: '15', +// color_type: '6', +// lettering_message: '55', +// type: 'orderDetail', +// order_code: '3', +// order_status: '05', +// cust_code: 'A00002', +// lettering_icon: '2', +// strap_number: '55', +// parent_order_code: '10000038', +// qty: '5555', +// is_flag: '0', +// lettering_message2: '5', +// cust_name: 'A00002', +// parent_order_id: 'fb8f80bee3c9455c8a902e4911acf1ec', +// order_id: 'e7356f2f443f499e8807bac8cfb3ddce', +// cust_id: '4b80d1c012e44027ad09b9f33ca7af0d' +// } +// ], +// material_name: '直管14', +// wall_thickness: '0.20', +// is_coating: '1', +// jackup_num: '5', +// length: '4000.00', +// end_time: '', +// outer_diameter: '22.23', +// order_code: '10000038', +// start_time: '', +// temper: '', +// feeding_mouth: '3', +// is_strapping: '1', +// qty: '5555', +// is_flag: '1', +// is_risking: '1', +// order_id: 'fb8f80bee3c9455c8a902e4911acf1ec', +// is_lettering: '1', +// material_code: 'A10014' +// } +// ], // code: '1', -// desc: '', -// result: [{region_id: '1', region_name: 'a'}] +// desc: '查询成功' // } // return res // } - -// 1.2根据区域查询设备编号及状态 -export const handPoint = (reg) => post('api/andxy2/hand/point', { - region: reg -}) - -// 1.3修改设备状态 -export const handDeviceStatus = (code, type, no, mtype, quantity, remark) => post('api/andxy2/hand/deviceStatus', { - device_code: code, +// 2.下发刻字、贴标 +export const sendMessage = (type, uuid, ouuid) => post('api/hand/sendMessage', { type: type, - status: no, - material_type: mtype, - quantity: quantity, - remark: remark + orderDetail_uuid: uuid, + order_uuid: ouuid }) - -// 1.4查询物料 -export const handMatrial = () => post('api/andxy2/hand/matrial', {}) - -/** 普通任务 */ - -// 1.1创建任务 -export const handTask = (scode, ncode) => post('api/andxy2/hand/task2', { - start_devicecode: scode, - next_devicecode: ncode +// 3.下发设备信号 +export const deviceOperation = (type) => post('api/hand/deviceOperation', { + type: type }) - -/** 特殊任务 */ -export const spehandTask = (scode, ncode) => post('api/andxy2/hand/task', { - start_devicecode: scode, - next_devicecode: ncode +// 4.工单操作 +export const orderOperation = (type, uuid, ouuid) => post('api/hand/orderOperation', { + type: type, + orderDetail_uuid: uuid, + order_uuid: ouuid }) diff --git a/src/config/http.js b/src/config/http.js index f1f5bbe..0d07950 100644 --- a/src/config/http.js +++ b/src/config/http.js @@ -1,13 +1,9 @@ import axios from 'axios' -// import qs from 'qs' -import { Dialog } from './utils.js' -// import { Dialog, toast } from './utils.js' +import { Dialog, toast } from './utils.js' import store from '../vuex/store' -// import router from './../router' +import router from '@/router' axios.defaults.timeout = 50000 -// axios.defaults.retry = 5 -// axios.defaults.retryDelay = 10000 axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8' axios.interceptors.request.use( @@ -29,49 +25,23 @@ axios.interceptors.request.use( axios.interceptors.response.use( response => { - return Promise.resolve(response) + if (response.status === 200) { + return Promise.resolve(response) + } else { + return Promise.reject(response) + } }, error => { - // let condata = error.config.data.split('&') - // console.log('condata', condata) - // if (condata[1] === '_SRVMETHOD=queryProduceOrderReprot' || condata[1] === '_SRVMETHOD=queryQCRecord' || condata[1] === '_SRVMETHOD=queryEquipWorkTeam') { - // toast(error.message) - // setTimeout(() => { - // router.replace({ - // path: '/login' - // }) - // }, 10000) - // } else { - // if (condata[1] === '_SRVMETHOD=queryEquip') { - // toast(error.message) - // } else { - // Dialog(error.message) - // } - // // Dialog(error.message) - // } - // toast(error.message) - // - 20201215-x - // router.push({ - // path: '/500', - // query: {redirect: router.currentRoute.fullPath} - // }) - // - 20201215-x + if (error && error.response) { + switch (error.response.status) { + case 401: + toast(error.response.data.message) + store.dispatch('setSignOut') + router.push('/login') + break + } + } return Promise.reject(error) - // let config = error.config - // if (!config || !config.retry) return Promise.reject(error) - // config.__retryCount = config.__retryCount || 0 - // if (config.__retryCount >= config.retry) { - // return Promise.reject(error) - // } - // config.__retryCount += 1 - // let backoff = new Promise(resolve => { - // setTimeout(() => { - // resolve() - // }, config.retryDelay || 1) - // }) - // return backoff.then(() => { - // return axios(config) - // }) } ) @@ -79,11 +49,9 @@ export const post = (sevmethod, params) => { return new Promise((resolve, reject) => { axios.post(`${store.getters.baseUrl}/` + sevmethod, params) .then(response => { - // if (response.data.code === '0') { - // Dialog(response.data.desc) - // } resolve(response.data) }, error => { + Dialog(error.message) reject(error.message) }) .catch((error) => { diff --git a/src/pages/Login.vue b/src/pages/Login.vue index 7e84f8c..d598c59 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -33,8 +33,8 @@