refactor(入库任务): 对接wcs

This commit is contained in:
Kelvin 2024-11-25 15:13:07 +08:00
parent 9fc52d5c90
commit bc0ac9d95c
3 changed files with 89 additions and 40 deletions

View File

@ -1,4 +1,4 @@
import request from '@/utils/request' import request, {requestWcs} from '@/utils/request'
// 查询入库任务列表 // 查询入库任务列表
export function listWmsInTask(query) { export function listWmsInTask(query) {
@ -46,7 +46,15 @@ export function delWmsInTask(id) {
// 批量执行入库任务 // 批量执行入库任务
export function issueBatchWmsInTask(data) { export function issueBatchWmsInTask(data) {
return request({ return request({
url: '/wm/wmsInTask/open/issueBatch', url: '/wm/wmsInTask/open/issueBatch/' + data,
method: 'post',
})
}
// 下发任务至 WCS
export function issueWmsInTaskToWcs(data) {
return requestWcs({
url: '/ToolDeliveryInfo',
method: 'post', method: 'post',
data data
}) })

View File

@ -20,6 +20,13 @@ const service = axios.create({
timeout: 30000 timeout: 30000
}) })
const serviceWcs = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: "http://192.168.8.60:1880",
// 超时
timeout: 30000
})
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
// 是否需要设置 token // 是否需要设置 token
@ -113,11 +120,9 @@ service.interceptors.response.use(res => {
let {message} = error; let {message} = error;
if (message == "Network Error") { if (message == "Network Error") {
message = "后端接口连接异常"; message = "后端接口连接异常";
} } else if (message.includes("timeout")) {
else if (message.includes("timeout")) {
message = "系统接口请求超时"; message = "系统接口请求超时";
} } else if (message.includes("Request failed with status code")) {
else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常"; message = "系统接口" + message.substr(message.length - 3) + "异常";
} }
Message({ Message({
@ -131,9 +136,15 @@ service.interceptors.response.use(res => {
// 通用下载方法 // 通用下载方法
export function download(url, params, filename) { export function download(url, params, filename) {
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", }) downloadLoadingInstance = Loading.service({
text: "正在下载数据,请稍候",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
})
return service.post(url, params, { return service.post(url, params, {
transformRequest: [(params) => { return tansParams(params) }], transformRequest: [(params) => {
return tansParams(params)
}],
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, headers: {'Content-Type': 'application/x-www-form-urlencoded'},
responseType: 'blob' responseType: 'blob'
}).then(async (data) => { }).then(async (data) => {
@ -156,3 +167,5 @@ export function download(url, params, filename) {
} }
export default service export default service
export const requestWcs = serviceWcs

View File

@ -102,8 +102,8 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
:disabled="scope.row.planInStatus === '1'" :disabled="scope.row.planInStatus === '1'"
@click="handleIssue(scope.row.id)" @click="handleIssue(scope.row)"
>执行 >下发
</el-button> </el-button>
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
@ -169,7 +169,7 @@ import {
delWmsInTask, delWmsInTask,
addWmsInTask, addWmsInTask,
updateWmsInTask, updateWmsInTask,
issueBatchWmsInTask issueBatchWmsInTask, issueWmsInTaskToWcs
} from "@/api/mes/wm/wmsInTask"; } from "@/api/mes/wm/wmsInTask";
import {listTYPE} from "@/api/md/TYPE"; import {listTYPE} from "@/api/md/TYPE";
import {listWmsInPlanDetailsEntity} from "@/api/mes/wm/wmsInPlanDetailsEntity"; import {listWmsInPlanDetailsEntity} from "@/api/mes/wm/wmsInPlanDetailsEntity";
@ -272,12 +272,40 @@ export default {
} }
return id return id
}, },
// // WCS
handleIssue(id) { handleIssue(task) {
issueBatchWmsInTask([id.toString()]).then(response => { let warehouseTypeCode = ""
this.$modal.msgSuccess("执行成功"); //
this.getList(); if (task.planTypeId === "8") {
}); warehouseTypeCode = "LTK"
}
const param = {
// ID
planId: task.planInId,
// ID
taskId: task.id,
//
cellCode: task.cellCode,
//
warehouseTypeCode,
//
materialId: task.materialId,
materialCode: task.materialCode,
materialName: task.materialName,
materialCount: task.actualInQuantity,
rfid: "",
// OR
type: "RK",
}
console.log(task)
issueWmsInTaskToWcs(param).then(res => {
console.log(res)
this.$modal.msgSuccess("下发成功");
})
// issueBatchWmsInTask([task.id.toString()]).then(response => {
// this.$modal.msgSuccess("");
// this.getList();
// });
}, },
// //
cancel() { cancel() {