refactor(入库任务): 下发任务至wcs功能优化

This commit is contained in:
Kelvin 2024-11-26 16:16:53 +08:00
parent d6fc38c1b4
commit a53fa45c9a

View File

@ -18,52 +18,6 @@
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['wm:wmsInTask:add']"-->
<!-- >新增-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['wm:wmsInTask:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['wm:wmsInTask:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['wm:wmsInTask:export']"-->
<!-- >导出-->
<!-- </el-button>-->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -90,29 +44,37 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="openTaskDetailDialog(scope.row)"-->
<!-- >详情-->
<!-- </el-button>-->
<template v-if="scope.row.planInStatus !== '1' && scope.row.planTypeCode !== 'ZDHK'">
<el-button
size="mini"
type="text"
v-if="scope.row.planInStatus !== 'YTC'"
@click="handleIssueWcs(scope.row,'CK')"
>推出库位
</el-button>
<el-button
size="mini"
type="text"
v-if="scope.row.planInStatus !== 'YTR' && scope.row.planInStatus !== '0'"
@click="handleIssueWcs(scope.row,'RK')"
>推入库位
</el-button>
</template>
<template v-if="scope.row.planInStatus !== '1'">
<el-button
size="mini"
type="text"
@click="handleIssueWcs(scope.row,'CK')"
>下发
</el-button>
</template>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
:disabled="scope.row.planInStatus === '1'"
@click="handleIssue(scope.row)"
>下发
@click="manualIssue(scope.row)"
>手动入库
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['wm:wmsInTask:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
</template>
</el-table-column>
</el-table>
@ -169,7 +131,7 @@ import {
delWmsInTask,
addWmsInTask,
updateWmsInTask,
issueBatchWmsInTask, issueWmsInTaskToWcs
issueBatchWmsInTask, issueInTaskWcsLTK, issueInTaskWcsDJ
} from "@/api/mes/wm/wmsInTask";
import {listTYPE} from "@/api/md/TYPE";
import {listWmsInPlanDetailsEntity} from "@/api/mes/wm/wmsInPlanDetailsEntity";
@ -218,7 +180,7 @@ export default {
createTime: null,
updateBy: null,
updateTime: null,
isActivy: null,
isActive: null,
isDelete: null,
batch: null,
materialId: null,
@ -272,13 +234,12 @@ export default {
}
return id
},
// WCS
handleIssue(task) {
let warehouseTypeCode = ""
//
if (task.planTypeId === "8") {
warehouseTypeCode = "LTK"
}
/**
* 下发任务至 WCS
* @param task
* @param type 出库或入库
*/
handleIssueWcs(task, type = "RK") {
const param = {
// ID
planId: task.planInId,
@ -287,25 +248,48 @@ export default {
//
cellCode: task.cellCode,
//
warehouseTypeCode,
warehouseTypeCode: "",
//
materialId: task.materialId,
materialCode: task.materialCode,
materialName: task.materialName,
materialCount: task.actualInQuantity,
rfid: "",
rfid: "123456789AAA",
// OR
type: "RK",
type,
}
console.log(task)
issueWmsInTaskToWcs(param).then(res => {
console.log(res)
this.$modal.msgSuccess("下发成功");
})
// issueBatchWmsInTask([task.id.toString()]).then(response => {
// this.$modal.msgSuccess("");
// this.getList();
// });
/** 刀片入库|刀柄入库|拆刀回库 入 立体库 */
if (["DPRK", "DBRK", "CDHK"].includes(task.planTypeCode)) {
param.warehouseTypeCode = "LTK"
issueInTaskWcsLTK(param).then(res => {
if (type === "RK") {
task.planInStatus = "YTR"
this.$modal.msgSuccess("推入库位");
} else if (type === "CK") {
task.planInStatus = "YTC"
this.$modal.msgSuccess("推出库位");
}
//
updateWmsInTask(task).then(res => {
this.getList();
})
})
} else if (["ZDHK", "ZDRK"].includes(task.planTypeCode)) {
/** 整刀回库|组刀入库 入 刀具库 */
param.warehouseTypeCode = "DJ"
issueInTaskWcsDJ(param).then(res => {
this.$modal.msgSuccess("下发成功");
})
}
},
/**
* 手动执行入库任务
*/
manualIssue(task) {
issueBatchWmsInTask([task.id.toString()]).then(response => {
this.$modal.msgSuccess("执行成功");
this.getList();
});
},
//
cancel() {