rev:代码优化

This commit is contained in:
2025-02-15 17:11:44 +08:00
parent a5d2768a90
commit e64d4f3389
20 changed files with 454 additions and 35 deletions

View File

@@ -12,12 +12,12 @@
label-suffix=":"
>
<el-form-item label="机台编码">
<el-form-item label="产线">
<el-input
v-model="query.resource_name"
clearable
size="mini"
placeholder="机台编码"
placeholder="产线"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
@@ -108,7 +108,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机台编码" prop="resource_name">
<el-form-item label="产线" prop="resource_name">
<el-input v-model="form.resource_name" style="width: 250px;" />
</el-form-item>
</el-col>
@@ -171,17 +171,82 @@
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.mfg_order_name }}</el-link>
</template>
</el-table-column>
<el-table-column prop="status" label="工单状态" :min-width="flexWidth('status',crud.data,'工单状态')" :formatter="formatStatusName" />
<el-table-column prop="resource_name" label="机台编码" :min-width="flexWidth('resource_name',crud.data,'机台编码')" />
<el-table-column
prop="status"
label="工单状态"
:min-width="flexWidth('status',crud.data,'工单状态')"
:formatter="formatStatusName"
/>
<el-table-column prop="resource_name" label="产线" :min-width="flexWidth('resource_name',crud.data,'产线')" />
<el-table-column
prop="start_device_code"
label="起点编码"
:min-width="flexWidth('start_device_code',crud.data,'起点编码')"
/>
<el-table-column
prop="next_device_code"
label="终点编码"
:min-width="flexWidth('next_device_code',crud.data,'终点编码')"
/>
<el-table-column prop="product_name" label="产品编码" :min-width="flexWidth('product_name',crud.data,'产品编码')" />
<el-table-column prop="description" label="产品名称" :min-width="flexWidth('description',crud.data,'产品名称')" />
<el-table-column prop="total_qty" label="计划重量" :min-width="flexWidth('total_qty',crud.data,'计划重量')" :formatter="crud.formatNum3" />
<el-table-column
prop="total_qty"
label="计划重量"
:min-width="flexWidth('total_qty',crud.data,'计划重量')"
:formatter="crud.formatNum3"
/>
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<el-table-column prop="realstart_time" label="开始时间" :min-width="flexWidth('realstart_time',crud.data,'实际开始时间')" />
<el-table-column
prop="realstart_time"
label="开始时间"
:min-width="flexWidth('realstart_time',crud.data,'实际开始时间')"
/>
<el-table-column prop="realend_time" label="结束时间" :min-width="flexWidth('realend_time',crud.data,'结束时间')" />
<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">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openEditModal(scope.row)">起点终点确认</el-button>
<el-dialog title="更新信息" :visible.sync="dialogVisible" width="40%" append-to-body>
<el-form ref="form" :model="form" label-width="100px">
<el-form-item label="起点" prop="start_device_code">
<el-select
v-model="form.start_point_code"
style="width: 370px;"
filterable
placeholder="请选择"
@change="showStartStorage"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item label="终点" prop="start_device_code">
<el-select
v-model="form.next_point_code"
style="width: 370px;"
filterable
placeholder="请选择"
@change="showEndStorage"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="updateInfo">确 定</el-button>
</span>
</el-dialog>
<udOperation
:data="scope.row"
:permission="permission"
@@ -205,11 +270,14 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/acs/order/AddDialog'
import deviceCrud from '@/api/acs/device/device'
const defaultForm = {
workorder_id: null,
container_name: null,
resource_name: null,
start_device_code: null,
next_device_code: null,
mfg_order_name: null,
product_name: null,
description: null,
@@ -257,12 +325,19 @@ export default {
dialogShow: false,
openParam: null,
permission: {},
dialogVisible: false,
deviceList: [],
orderDatas: [],
form: {
start_device_code: '',
next_device_code: ''
},
rules: {
mfg_order_name: [
{ required: true, message: '工单号不能为空', trigger: 'blur' }
],
resource_name: [
{ required: true, message: '机台编码不能为空', trigger: 'blur' }
{ required: true, message: '产线不能为空', trigger: 'blur' }
],
total_qty: [
{ required: true, message: '计划重量不能为空', trigger: 'blur' }
@@ -276,6 +351,11 @@ export default {
}
}
},
created() {
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
@@ -293,6 +373,37 @@ export default {
formatStorIsOrNot(row) {
return this.dict.label.IS_OR_NOT[row.is_instor]
},
openEditModal(row) {
this.dialogVisible = true
this.orderDatas = row
// 可以在这里初始化表单数据,比如从服务器获取
},
updateInfo() {
const order = {
workorder_id: this.orderDatas.workorder_id,
start_device_code: this.form.start_point_code,
next_device_code: this.form.next_point_code
}
crudRawfoilworkorder.updateOrder(order).then(res => {
this.crud.toQuery()
this.crud.notify('修改成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {
console.log(err.response.data.message)
})
this.dialogVisible = false
},
update(from, row) {
debugger
row.start_device_code = form.start_device_code
row.next_device_code = form.next_device_code
crudRawfoilworkorder.updateOrder(row).then(res => {
this.crud.toQuery()
this.crud.notify('修改成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {
console.log(err.response.data.message)
})
this.dialogVisible = false
},
start() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
@@ -318,6 +429,102 @@ export default {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
},
showStartStorage(val) {
let obj = {}
obj = this.deviceList.find((item) => {
return item.device_code === val
})
if (obj.device_type === 'storage') {
this.start_flag = true
let storage_obj = {}
deviceCrud.queryStorageExtra(obj.device_code).then(data => {
storage_obj = data
const n1 = storage_obj.minY
const n2 = storage_obj.maxY
const m1 = storage_obj.minZ
const m2 = storage_obj.maxZ
const from_y = []
const from_z = []
for (let i = n1; i <= n2; i++) {
const y = {}
if (i < 10) {
y.id = '0' + i
} else {
y.id = i
}
y.value = i + '列'
from_y.push(y)
}
for (let i = m1; i <= m2; i++) {
const z = {}
if (i < 10) {
z.id = '0' + i
} else {
z.id = i
}
z.value = i + '层'
from_z.push(z)
}
this.fromYList = from_y
this.fromZList = from_z
this.form.from_x = storage_obj.tunnel
})
} else {
this.start_flag = false
this.form.from_x = ''
this.form.from_y = ''
this.form.from_z = ''
}
this.isDisabled = false
},
showEndStorage(val) {
let obj = {}
obj = this.deviceList.find((item) => {
return item.device_code === val
})
if (obj.device_type === 'storage') {
this.end_flag = true
let storage_obj = {}
deviceCrud.queryStorageExtra(obj.device_code).then(data => {
storage_obj = data
const n1 = storage_obj.minY
const n2 = storage_obj.maxY
const m1 = storage_obj.minZ
const m2 = storage_obj.maxZ
const to_y = []
const to_z = []
for (let i = n1; i <= n2; i++) {
const y = {}
if (i < 10) {
y.id = '0' + i
} else {
y.id = i
}
y.value = i + '列'
to_y.push(y)
}
for (let i = m1; i <= m2; i++) {
const z = {}
if (i < 10) {
z.id = '0' + i
} else {
z.id = i
}
z.value = i + '层'
to_z.push(z)
}
this.toYList = to_y
this.toZList = to_z
this.form.to_x = storage_obj.tunnel
})
} else {
this.end_flag = false
this.form.to_x = ''
this.form.to_y = ''
this.form.to_z = ''
}
this.isDisabled = false
}
}
}

View File

@@ -40,6 +40,14 @@ export function forceFinish(data) {
})
}
export function updateOrder(data) {
return request({
url: 'api/order/updateOrder',
method: 'post',
data
})
}
export function getOutBillDtl(params) {
return request({
url: '/api/order/getOutBillDtl',
@@ -48,4 +56,4 @@ export function getOutBillDtl(params) {
})
}
export default { add, edit, del, start, forceFinish, getOutBillDtl }
export default { add, edit, del, start, forceFinish, getOutBillDtl, updateOrder }

View File

@@ -54,8 +54,8 @@
<el-form-item label="物料名称" prop="material_name">
<el-input v-model="form.material_name" style="width: 370px;" />
</el-form-item>
<el-form-item label="点编" prop="resource_name">
<el-input v-model="form.resource_name" style="width: 370px;" />
<el-form-item label="点编" prop="next_device_code">
<el-input v-model="form.next_device_code" style="width: 370px;" />
</el-form-item>
<el-form-item label="顺序号" prop="seq_no">
<el-input v-model="form.seq_no" style="width: 370px;" />
@@ -85,7 +85,7 @@
<el-table-column prop="seq_no" label="序号" :min-width="flexWidth('seq_no',crud.data,'序号')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="resource_name" label="站点编号" :min-width="flexWidth('resource_name',crud.data,'点编号')" />
<el-table-column prop="next_device_code" label="站点编号" :min-width="flexWidth('next_device_code',crud.data,'点编号')" />
<el-table-column prop="require_num" label="配料桶数" :min-width="flexWidth('require_num',crud.data,'配料桶数')" />
<el-table-column prop="remain_num" label="剩余桶数" :min-width="flexWidth('remain_num',crud.data,'剩余桶数')" />
<el-table-column prop="qty" label="物料重量" :min-width="flexWidth('qty',crud.data,'物料重量')" />
@@ -157,7 +157,7 @@ import HandleCommandDialog from '@/views/acs/work/HandleCommandDialog'
const defaultForm = {
material_code: null,
material_name: null,
resource_name: null,
next_device_code: null,
seq_no: 0,
qty: 0,
remain_num: null,