nrwms_web/src/views/business-data/pickDetail/index.vue

506 lines
15 KiB
Vue
Raw Normal View History

2024-02-18 15:46:31 +08:00
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 查询操作-->
<el-form ref="form" :inline="true" :model="form" label-width="70px">
<el-form-item label="物料编码">
<!-- <el-input v-model="query.itemCode" clearable placeholder="请输入物料编码" style="width: 140px;"-->
<!-- class="filter-item"-->
<!-- @keyup.enter.native="crud.toQuery"/>-->
2024-02-18 15:46:31 +08:00
<el-select v-model="query.itemCode" placeholder="物料代码" style="width: 140px;" class="filter-item">
<el-option
v-for="item in this.itemListData"
:key="item.code"
:label="item.code"
:value="item.code"
@keyup.enter.native="crud.toQuery"
>
2024-02-18 15:46:31 +08:00
<span style="float: left">{{ item.code }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物料名称">
<el-input
v-model="query.itemName"
clearable
placeholder="请输入物料名称"
style="width: 140px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
2024-02-18 15:46:31 +08:00
</el-form-item>
<el-form-item label="任务号">
<el-input
v-model="query.po"
clearable
placeholder="请输入任务号"
style="width: 140px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
2024-02-18 15:46:31 +08:00
</el-form-item>
<date-range-picker v-model="query.createTime" class="date-item" style="width: 100px" />
<!-- 搜索-->
<rrOperation :crud="crud" />
2024-02-18 15:46:31 +08:00
<!-- 重置-->
<el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">
</el-button>
</el-form>
<div class="statusButton" style="border-bottom: solid lightgray 1px;">
<el-radio-group v-model="radio3" size="small" @change="clickChange">
2024-02-18 15:46:31 +08:00
<el-radio-button label="全部"> 全部</el-radio-button>
<el-radio-button label="打开"> 打开</el-radio-button>
<el-radio-button label="已分配">已分配</el-radio-button>
<el-radio-button label="拣货完成"> 拣货完成</el-radio-button>
</el-radio-group>
</div>
<!-- 业务操作-->
<crudOperation :permission="permission" :table-key="tableKey">
2024-02-18 15:46:31 +08:00
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-edit"
size="mini"
2024-03-12 16:06:53 +08:00
:disabled="crud.selections.length !== 1 || this.crud.selections[0].orderQty<=this.crud.selections[0].allocatedQty"
2024-02-18 15:46:31 +08:00
@click="allocate(crud.selections)"
>
分配
</el-button>
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-edit"
size="mini"
:loading="crud.delAllLoading"
:disabled="show_cancelfp"
@click="cancelAllocate(crud.selections)"
>
取消分配
</el-button>
<el-button
slot="right"
class="filter-item"
type="danger"
icon="el-icon-edit"
size="mini"
:loading="crud.delAllLoading"
2024-03-14 09:39:08 +08:00
:disabled="crud.selections.length !== 1 || this.crud.selections[0].allocatedQty<=this.crud.selections[0].pickedQty"
2024-02-18 15:46:31 +08:00
@click="getPickTask(crud.selections[0].id)"
>
拣货确认
</el-button>
</crudOperation>
<el-table
ref="table"
v-loading="crud.loading"
border
:data="crud.data"
size="small"
style="width: 100%;"
height="58vh"
@selection-change="selectionChangeHandlerTwo"
>
<el-table-column type="selection" width="50" />
2024-02-18 15:46:31 +08:00
<el-table-column
prop="date"
align="center"
label="序号"
:resizable="false"
type="index"
width="50"
/>
<el-table-column prop="pick.relatedBill1" width="120" label="系统单号" />
2024-02-18 15:46:31 +08:00
<el-table-column :show-overflow-tooltip="true" prop="itemName" label="物料编码">
<template slot-scope="scope">
<div>{{ scope.row.item.code }}</div>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="itemCode" label="物料名称">
<template slot-scope="scope">
<div>{{ scope.row.item.name }}</div>
</template>
</el-table-column>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
{{ dict.label.pick_status[scope.row.status] }}
</template>
</el-table-column>
<el-table-column prop="propC1" label="中标批次名称" />
<el-table-column prop="propC2" label="成品物料编码" />
<el-table-column prop="propC3" :show-overflow-tooltip="true" label="序列号" />
<el-table-column prop="orderQty" label="订单数量" />
<el-table-column prop="allocatedQty" label="分配数量" />
<el-table-column prop="pickedQty" label="拣货数量" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="propC4" label="出库方式" />
<el-table-column prop="propC5" label="目标点位" />
<el-table-column prop="createBy" label="创建人" />
<el-table-column prop="createTime" width="150px" label="创建时间" />
<el-table-column label="操作" width="150px" fixed="right" align="center">
2024-02-18 15:46:31 +08:00
<template slot-scope="scope">
<el-button
size="mini"
:disabled="scope.row.status!='OPEN'"
type="primary"
icon="el-icon-edit"
@click="editPick(scope.row)"
/>
2024-02-18 15:46:31 +08:00
<template>
<el-popconfirm
title="确定删除吗?"
icon="el-icon-delete"
icon-color="red"
2024-02-18 15:46:31 +08:00
@confirm="deletePick(scope.row)"
>
<el-button
slot="reference"
:disabled="scope.row.status!='OPEN'"
size="mini"
type="danger"
icon="el-icon-delete"
/>
2024-02-18 15:46:31 +08:00
</el-popconfirm>
</template>
</template>
</el-table-column>
</el-table>
<!--拣货确认界面-->
<PickTask ref="pickTask" />
2024-02-18 15:46:31 +08:00
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="580px"
>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="120px">
2024-02-18 15:46:31 +08:00
<el-form-item label="物料" prop="item">
<el-select
v-model="form.item"
filterable
placeholder="请选择物料"
value-key="id"
style="width: 405px;"
@focus="getItem"
>
2024-02-18 15:46:31 +08:00
<el-option
v-for="item in items"
:key="item.id"
:label="item.code"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="订单数量">
<el-input v-model="form.orderQty" style="width: 135px;" />
</el-form-item>
<el-form-item label="中标批次名称">
<el-input v-model="form.propC1" style="width: 135px;" />
</el-form-item>
<el-form-item label="成品物料编码">
<el-input v-model="form.propC2" style="width: 135px;" />
</el-form-item>
<el-form-item label="序列号">
<el-input v-model="form.propC3" style="width: 135px;" />
</el-form-item>
<el-form-item label="操作方式">
<el-select
v-model="form.propC4"
size="small"
placeholder="操作方式"
class="filter-item"
style="width: 135px"
>
<el-option
v-for="item in dict.bill_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="目标点位">
<el-input v-model="form.propC5" style="width: 135px;" />
2024-02-18 15:46:31 +08:00
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" :rows="3" type="textarea" style="width: 370px;" />
2024-02-18 15:46:31 +08:00
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU"></el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU"></el-button>
</div>
</el-dialog>
<!--表格渲染-->
<!--分页组件-->
<div style="float: right;">
<pagination />
2024-02-18 15:46:31 +08:00
</div>
</div>
</div>
</template>
<script>
import crudPickDetail from '@/api/pickDetail'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
2024-02-18 15:46:31 +08:00
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { getItems, getItemsList } from '@/api/item'
import PickTask from '@/views/business-data/pickDetail/pickTicketTask.vue'
import DateRangePicker from '@/components/DateRangePicker/index.vue'
2024-03-12 16:06:53 +08:00
import DonMessage from "@/utils/message";
2024-02-18 15:46:31 +08:00
const defaultForm = {
id: null,
pick: null,
2024-02-18 15:46:31 +08:00
item: null,
lineNo: null,
po: null,
status: 'OPEN',
orderQty: 0,
allocatedQty: 0,
pickedQty: 0,
shippedQty: 0,
weight: 0,
volume: 0,
remark: null,
propC1: null,
propC2: null,
propC3: null,
propC4: null,
propC5: null,
propC6: null,
propD1: null,
propD2: null,
deptId: null,
sourceName: null,
sourceId: null,
createBy: null,
updateBy: null,
createTime: null,
updateTime: null
}
export default {
name: 'PickDetail',
components: { DateRangePicker, PickTask, pagination, crudOperation, rrOperation, udOperation },
2024-02-18 15:46:31 +08:00
mixins: [presenter(), header(), form(defaultForm), crud()],
dicts: ['pick_status', 'bill_type'],
2024-02-18 15:46:31 +08:00
cruds() {
return CRUD({
title: '出库明细',
url: 'api/pickDetail',
idField: 'id',
sort: 'id,desc',
crudMethod: { ...crudPickDetail },
2024-02-18 15:46:31 +08:00
optShow: {
add: true,
edit: false,
del: false,
reset: false,
download: true
}
})
},
data() {
return {
show_jh: true,
show_cancelfp: true,
radio3: '全部',
items: [],
permission: {
add: ['admin', 'pickDetail:add'],
edit: ['admin', 'pickDetail:edit'],
del: ['admin', 'pickDetail:del']
},
tableKey: 'api/pickDetail',
2024-02-18 15:46:31 +08:00
rules: {
item: [
{ required: true, message: '物料必填', trigger: 'blur' }
2024-02-18 15:46:31 +08:00
]
},
queryTypeOptions: [
{ key: 'itemCode', display_name: '物料编码' },
{ key: 'itemName', display_name: '物料名称' },
{ key: 'po', display_name: '任务号' },
{ key: 'status', display_name: '状态' }
2024-02-18 15:46:31 +08:00
],
itemListData: []
}
},
mounted() {
// 初始化数据
this.getItem()
this.itemDataGet()
2024-02-18 15:46:31 +08:00
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
getItem() {
getItems({}).then(res => {
this.items = res.content.map(function(obj) {
2024-02-18 15:46:31 +08:00
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
selectionChangeHandlerTwo(val) {
this.crud.selections = val
if (this.crud.selections.length === 0) {
this.show_jh = true
this.show_fp = true
this.show_cancelfp = true
return
2024-02-18 15:46:31 +08:00
}
const status = []
2024-02-18 15:46:31 +08:00
for (let i = 0; i < val.length; i++) {
status.push(this.crud.selections[i].status)
}
if (this.isAllEqual(status) && status[0] == 'OPEN') {
this.show_jh = true
this.show_fp = false
return
2024-02-18 15:46:31 +08:00
}
if (this.isAllEqual(status) && status[0] == 'ALLOCATE') {
this.show_jh = true
this.show_fp = true
this.show_cancelfp = false
2024-02-18 15:46:31 +08:00
}
// 拣货
2024-02-18 15:46:31 +08:00
if (this.crud.selections.length == 1 && this.crud.selections[0].orderQty == this.crud.selections[0].allocatedQty) {
this.show_jh = false
this.show_fp = true
return
2024-02-18 15:46:31 +08:00
}
},
allocate(datas) {
this.$confirm(`选中的${datas.length}条数据分配确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = []
2024-02-18 15:46:31 +08:00
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
crudPickDetail.allocate(ids).then(res => {
2024-03-12 16:06:53 +08:00
this.crud.notify(res.message, res.status)
this.crud.toQuery()
2024-02-18 15:46:31 +08:00
}).catch(() => {
2024-03-12 16:06:53 +08:00
this.crud.toQuery()
2024-02-18 15:46:31 +08:00
})
}).catch(() => {
this.$refs.table.clearSelection()
this.crud.notify('取消成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
2024-02-18 15:46:31 +08:00
},
cancelAllocate(datas) {
this.$confirm(`选中的${datas.length}条数据取消分配确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = []
2024-02-18 15:46:31 +08:00
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
crudPickDetail.cancelAllocate(ids).then(res => {
this.crud.notify(res.message, res.status)
this.crud.toQuery()
2024-02-18 15:46:31 +08:00
}).catch(() => {
})
}).catch(() => {
this.$refs.table.clearSelection()
this.crud.notify('取消成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
2024-02-18 15:46:31 +08:00
},
getPickTask(id) {
this.$refs.pickTask.dialog = true
this.$refs.pickTask.queryPickTask(id)
},
shuaxin() {
this.crud.toQuery()
2024-02-18 15:46:31 +08:00
},
clickChange(lab) {
if (lab === '全部') {
this.crud.resetQuery()
this.crud.toQuery()
} else if (lab === '打开') {
2024-02-18 15:46:31 +08:00
this.query.status = 'OPEN'
this.crud.toQuery()
} else if (lab === '已分配') {
2024-02-18 15:46:31 +08:00
this.query.status = 'ALLOCATE'
this.crud.toQuery()
} else if (lab === '拣货完成') {
2024-02-18 15:46:31 +08:00
this.query.status = 'PICK_ALL'
this.crud.toQuery()
2024-02-18 15:46:31 +08:00
}
},
resetQuery() {
this.radio3 = '全部'
2024-02-18 15:46:31 +08:00
this.crud.resetQuery()
},
editPick(data) {
this.crud.toEdit(data)
},
deletePick(data) {
this.crud.doDelete(data)
}, isAllEqual(array) {
if (array.length > 0) {
return !array.some(function(value, index) {
return value !== array[0]
})
2024-02-18 15:46:31 +08:00
} else {
return true
2024-02-18 15:46:31 +08:00
}
},
// 物料数据
2024-02-18 15:46:31 +08:00
itemDataGet() {
getItemsList().then(res => {
this.itemListData = res
2024-02-18 15:46:31 +08:00
}).catch(e => {
this.$message({
showClose: true,
message: '物料加载失败',
type: 'error'
})
2024-02-18 15:46:31 +08:00
})
}
}
}
</script>
<style scoped>
</style>