新增工单页面批量选择工单物料进行出库

This commit is contained in:
psh
2024-04-09 16:05:41 +08:00
parent e31579cea6
commit 3b0b5bc2cf
16 changed files with 663 additions and 26 deletions

View File

@@ -0,0 +1,219 @@
<template>
<el-dialog
title="物料选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="物料编码">
<el-input
v-model="query.productname"
clearable
size="mini"
placeholder="物料编码"
disabled="false"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:cell-style="{'text-align':'center'}"
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="point_code" label="所在点位" width="120px" />
<el-table-column prop="productName" label="物料编码" />
<el-table-column prop="palletSN" label="子托盘号" min-width="120" show-overflow-tooltip />
<el-table-column prop="qty" label="数量" width="100" show-overflow-tooltip />
</el-table>
<!--分页组件-->
<pagination />
<!-- <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span> -->
<el-button
type="primary"
@click="submitSelectedRows">
原材料出库
</el-button>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { mount } from 'sortablejs'
export default {
name: 'WorkOrderDetailDialog',
components: { rrOperation, pagination },
dicts: ['is_used', 'vehicle_type'],
cruds() {
return CRUD({ title: '点位详情', url: 'api/pointDetail', optShow: {}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: false
},
productname: {
type: String,
default: ''
},workorder_code: {
type: String,
default: ''
}
},
data() {
return {
dialogVisible: false,
tableRadio: null,
tableData: []
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
},
productname(newVal) {
// 监听传递的值变化,并在变化时执行赋值操作
this.query.productname = newVal;
this.executeQuery();
},
workorder_code(newVal) {
// 监听传递的值变化,并在变化时执行赋值操作
this.workorder_code = newVal;
}
},
methods: {
clickChange(item) {
this.tableRadio = item
},
open() {
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},executeQuery() {
this.crud.toQuery();
},submitSelectedRows() {
const selectedRows = this.$refs.table.selection;
if (selectedRows.length === 0) {
this.$message.error('请至少选择一行数据');
return;
}
// 获取选中行的 point_code
const pointCodes = selectedRows.map(row => row.point_code);
// 弹出输入回温时间和回温模式的对话框
this.$prompt('请输入回温时间', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /\d+/,
inputErrorMessage: '回温时间必须为数字'
}).then(({ value: time }) => {
this.$prompt('请输入回温模式0-普通模式1-快速模式)', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value: mode }) => {
// 提交数据给后台接口
this.$axios.post('/api/pointDetail/add', {
pointCodes,
time,
mode,
workorder_code: this.workorder_code // 使用workorder_code属性
}).then(response => {
// 提交成功处理
this.$message.success('提交成功!');
// 关闭当前对话框
this.dialogVisible = false;
}).catch(error => {
// 提交失败处理
this.$message.error('提交失败,请重试');
});
}).catch(() => {
// 用户点击了取消按钮
this.$message({
type: 'info',
message: '已取消提交操作'
});
});
}).catch(() => {
// 用户点击了取消按钮
this.$message({
type: 'info',
message: '已取消提交操作'
});
});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,183 @@
<template>
<div>
<el-dialog
title="物料选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="工单编号">
<el-input
v-model="query.workorder_code"
clearable
size="mini"
placeholder="工单编号"
disabled="false"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:cell-style="{'text-align':'center'}"
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
@current-change="clickChange"
>
<el-table-column prop="workorder_code" label="工单编号" width="120px" />
<el-table-column prop="matnr" label="物料编码" />
<el-table-column prop="maktx" label="物料名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="mtype" label="产品类别" width="100" show-overflow-tooltip />
<el-table-column prop="mtytxt" label="产品类别描述" width="100" show-overflow-tooltip />
<el-table-column prop="bdmng" label="数量" width="100" show-overflow-tooltip />
<el-table-column prop="meins" label="计量单位" width="100" show-overflow-tooltip />
<!-- <el-table-column prop="real_qty" label="实际数量" width="100" show-overflow-tooltip /> -->
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-add"
@click="doOperate(scope.row)"
>原材料出库</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
<!-- <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span> -->
</el-dialog>
<PointDetailDialog :dialog-show.sync="pointDetailDialog" :workorder_code="workorder_code" :productname="productname" @tableChanged="tableChanged" />
</div>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import PointDetailDialog from '@/views/wms/pdm/workerorder/PointDetailDialog.vue'
import { mount } from 'sortablejs'
export default {
name: 'WorkOrderDetailDialog',
components: { PointDetailDialog,rrOperation, pagination },
dicts: ['is_used', 'vehicle_type'],
cruds() {
return CRUD({ title: '生产工单', url: 'api/pdmBdWorkorderDetail', optShow: {}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: true
},
message: {
type: String,
default: ''
}
},
data() {
return {
dialogVisible: false,
tableRadio: null,
tableData: [],
workorder_code:null,
pointDetailDialog:false,
productname: null,
workorder_code: null
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
},
message(newVal) {
// 监听传递的值变化,并在变化时执行赋值操作
this.query.workorder_code = newVal;
this.executeQuery();
}
},
methods: {
clickChange(item) {
this.tableRadio = item
},
open() {
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},executeQuery() {
this.crud.toQuery();
},
doOperate(row) {
this.productname=row.matnr
this.workorder_code=row.workorder_code
this.pointDetailDialog = true
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -263,17 +263,17 @@
<el-table-column prop="plan_qty" label="计划数量" :min-width="flexWidth('plan_qty',crud.data,'计划数量')" />
<el-table-column prop="real_qty" label="实际数量" :min-width="flexWidth('real_qty',crud.data,'实际数量')" />
<!-- <el-table-column prop="region_code" label="区域编码" :min-width="flexWidth('region_code',crud.data,'区域编码')" />-->
<el-table-column prop="region_name" label="区域名称" :min-width="flexWidth('region_name',crud.data,'区域名称')" />
<!-- <el-table-column prop="region_name" label="区域名称" :min-width="flexWidth('region_name',crud.data,'区域名称')" />
<el-table-column prop="point_code" label="设备编码" :min-width="flexWidth('point_code',crud.data,'设备编码')" />
<el-table-column prop="point_name" label="设备名称" :min-width="flexWidth('point_name',crud.data,'设备名称')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
<el-table-column prop="point_name" label="设备名称" :min-width="flexWidth('point_name',crud.data,'设备名称')" /> -->
<!-- <el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_name',crud.data,'物料标识')" />
<el-table-column prop="vehicle_type" label="载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 20)">
<template slot-scope="scope">
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_name',crud.data,'物料标识')" /> -->
<!-- <el-table-column prop="vehicle_type" label="载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 20)"> -->
<!-- <template slot-scope="scope">
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
prop="planproducestart_date"
label="计划开始时间"
@@ -294,21 +294,21 @@
label="实际结束时间"
:min-width="flexWidth('realproduceend_date',crud.data,'实际结束时间')"
/>
<el-table-column
<!-- <el-table-column
prop="standing_time"
label="回温时间(小时)"
:min-width="flexWidth('standing_time',crud.data,'回温时间(小时)')"
/>
<el-table-column prop="is_needmove" label="是否自动搬运" :min-width="flexWidth('is_needmove',crud.data,'是否自动搬运')">
/> -->
<!-- <el-table-column prop="is_needmove" label="是否自动搬运" :min-width="flexWidth('is_needmove',crud.data,'是否自动搬运')">
<template slot-scope="scope">
{{ scope.row.is_needmove ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column prop="is_urgent" label="是否加急" :min-width="flexWidth('is_urgent',crud.data,'是否加急')">
</el-table-column> -->
<!-- <el-table-column prop="is_urgent" label="是否加急" :min-width="flexWidth('is_urgent',crud.data,'是否加急')">
<template slot-scope="scope">
{{ scope.row.is_urgent ? '是' : '否' }}
</template>
</el-table-column>
</el-table-column> -->
<!-- <el-table-column prop="workorder_type" label="工单类型" :min-width="flexWidth('workorder_type',crud.data,'工单类型')" />-->
<!--<el-table-column
prop="passback_status"
@@ -322,10 +322,12 @@
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
<el-button
type="text"
icon="el-icon-add"
:disabled="scope.row.workorder_status!=='1'"
@click="doOperate(scope.row)"
>原材料出库</el-button>
</template>
</el-table-column>
</el-table>
@@ -333,6 +335,7 @@
<pagination />
</div>
<MaterialDialog :dialog-show.sync="materialDialog" @tableChanged="tableChanged" />
<WorkOrderDetailDialog :dialog-show.sync="workOrderDetailDialog" :message="message" @tableChanged="tableChanged" />
</div>
</template>
@@ -347,6 +350,7 @@ import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import crudMdBaseWorkShop from '@/views/wms/basedata/workshop/mdBaseWorkshop'
import MaterialDialog from '@/views/wms/sch/group/MaterialDialog.vue'
import WorkOrderDetailDialog from '@/views/wms/pdm/workerorder/WorkOrderDetailDialog.vue'
import item from '@/layout/components/Sidebar/Item.vue'
const defaultForm = {
@@ -380,7 +384,7 @@ const defaultForm = {
export default {
name: 'PdmBdWorkorder',
dicts: ['vehicle_type', 'pdm_workorder_status'],
components: { MaterialDialog, pagination, crudOperation, rrOperation, udOperation },
components: { WorkOrderDetailDialog,MaterialDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -425,7 +429,9 @@ export default {
regionList: [],
pointList: [],
regionCodeParam: null,
materialDialog: false
materialDialog: false,
workOrderDetailDialog: false,
message: null
}
},
created() {
@@ -492,6 +498,10 @@ export default {
this.crud.query.more_order_status = value.toString()
}
this.crud.toQuery()
},
doOperate(row) {
this.message=row.workorder_code
this.workOrderDetailDialog = true
}
}
}