Files
xiMenZi/lms/nladmin-ui/src/views/wms/produceScreen/index.vue

523 lines
18 KiB
Vue
Raw Normal View History

2024-07-24 17:30:23 +08:00
<template>
2024-08-30 17:29:29 +08:00
<div class="container">
<button class="btn-close" :disabled="disabled" @click="toExit" />
<div class="m-content">
<p>{{ screenData.device_name }}</p>
</div>
2024-09-11 14:10:37 +08:00
<div class="button-wraper" :style="screenData.region_points.length <= 2 ? 'justify-content: center' : 'justify-content: space-between'">
<div v-for="(e, i) in screenData.region_points" :key="i" class="button-item" :class="{'button-item_3': screenData.region_points.length <= 3}">
2024-08-30 17:29:29 +08:00
<p v-if="e.type === '1'" class="point_name">{{ e.name }}</p>
<p v-if="e.type === '0'" class="point_name point_name_btn" @click="showPop('IN', e)">{{ e.name }}</p>
<p class="point_value">{{ e.device_code }}</p>
2024-09-05 16:33:48 +08:00
<div v-if="e.type === '1'" class="button" @click="showPop('CONTAINER', e)">呼叫空框</div>
<div v-if="e.type === '1'" class="button" @click="showPop('SCANER', e)">完成入库</div>
2025-03-06 15:19:10 +08:00
<div v-if="e.type === '0'" class="button" @click="showPop('CACHE', e)">缓存物料</div>
2025-01-13 09:54:04 +08:00
<div v-if="e.type === '0'" class="button" @click="showPop('PALLET', e)">当前托盘</div>
2024-09-05 16:33:48 +08:00
<div v-if="e.type === '0'" class="button" @click="showPop('BACK', e)">回库</div>
2024-07-31 16:25:04 +08:00
</div>
2024-08-30 17:29:29 +08:00
</div>
2024-12-16 14:15:07 +08:00
<div v-show="type === 'IN'" class="pop-wraper pop-wraper-2" :class="{'popshow': show, 'pophide': !show}">
2025-01-13 09:54:04 +08:00
<div class="zd-row pop-grid">
<div class="pop-grid_l">
<div class="pop-grid_t">
2024-07-31 16:25:04 +08:00
<el-table
2024-08-30 17:29:29 +08:00
:data="popList"
2025-01-13 09:54:04 +08:00
height="100%"
2024-08-30 17:29:29 +08:00
@current-change="handleCurrentChange"
2024-07-31 16:25:04 +08:00
>
2024-08-30 17:29:29 +08:00
<el-table-column
prop="vehicle_code"
label="载具号"
/>
2024-07-31 16:25:04 +08:00
<el-table-column
2024-08-13 17:28:37 +08:00
prop="order_code"
label="订单号"
2024-07-31 16:25:04 +08:00
/>
<el-table-column
2024-08-13 17:28:37 +08:00
prop="region_code"
label="工序"
2024-07-31 16:25:04 +08:00
/>
<el-table-column
2024-08-30 17:29:29 +08:00
prop="material_qty"
label="物料数量"
2024-07-31 16:25:04 +08:00
/>
<el-table-column
2024-08-30 17:29:29 +08:00
prop="due_date"
label="交期时间"
2024-07-31 16:25:04 +08:00
/>
2024-11-08 13:48:45 +08:00
<el-table-column
prop="priority"
label="优先级"
/>
2024-08-30 17:29:29 +08:00
</el-table>
2025-01-13 09:54:04 +08:00
</div>
<div class="pop-grid_t">
2024-08-30 17:29:29 +08:00
<el-table
:data="popSecList"
2025-01-13 09:54:04 +08:00
height="100%"
2024-08-30 17:29:29 +08:00
>
2024-07-31 16:25:04 +08:00
<el-table-column
2024-08-30 17:29:29 +08:00
prop="order_code"
label="订单号"
2024-07-31 16:25:04 +08:00
/>
<el-table-column
2024-08-21 15:20:57 +08:00
prop="due_date"
2024-08-13 17:28:37 +08:00
label="交期时间"
2024-07-31 16:25:04 +08:00
/>
2024-12-16 14:15:07 +08:00
<el-table-column
prop="material_code"
label="零件号"
/>
2024-07-31 16:25:04 +08:00
<el-table-column
2024-08-30 17:29:29 +08:00
prop="material_qty"
label="物料数量"
2024-07-31 16:25:04 +08:00
/>
<el-table-column
2024-08-30 17:29:29 +08:00
prop="region_code"
label="工序"
2024-07-31 16:25:04 +08:00
/>
2024-11-08 14:20:29 +08:00
<el-table-column
prop="priority"
label="优先级"
/>
2024-07-31 16:25:04 +08:00
</el-table>
2025-01-13 09:54:04 +08:00
</div>
</div>
<div class="pop-grid_r">
2025-01-13 14:26:43 +08:00
<img v-if="imgSrc !== ''" class="img_pallet" :src="imgSrc" alt="">
2025-01-13 09:54:04 +08:00
</div>
2024-07-31 16:25:04 +08:00
</div>
2024-08-30 17:29:29 +08:00
<el-row type="flex" justify="space-around">
<el-col :span="4">
<button class="login_button login_button_dis" @click="show = false">取消</button>
2024-07-31 16:25:04 +08:00
</el-col>
2024-08-30 17:29:29 +08:00
<el-col :span="4">
<button class="login_button" :disabled="disabled" @click="toSure">叫料</button>
2024-07-31 16:25:04 +08:00
</el-col>
</el-row>
2024-08-30 17:29:29 +08:00
</div>
<div v-show="type === 'CONTAINER'" class="pop-wraper pop-wraper-1" :class="{'popshow': show, 'pophide': !show}">
<div class="pop-h1">{{ popData.title }}</div>
2025-01-13 09:54:04 +08:00
<div class="filter-items">
2024-07-31 16:25:04 +08:00
<el-row class="filter-wraper" type="flex" justify="space-between">
2024-08-13 17:28:37 +08:00
<el-col :span="5" class="p-label">托盘类型</el-col>
2024-08-20 13:57:21 +08:00
<el-col :span="18" class="select-wraper">
2025-01-13 09:54:04 +08:00
<el-select v-model="value" :popper-append-to-body="false" placeholder="请选择">
2024-08-20 13:57:21 +08:00
<el-option
2024-08-30 17:29:29 +08:00
v-for="item in options"
2024-08-20 13:57:21 +08:00
:key="item.value"
:label="item.label"
:value="item.value"
class="option-wraper"
/>
</el-select>
</el-col>
2024-07-31 16:25:04 +08:00
</el-row>
2024-08-13 17:28:37 +08:00
</div>
2024-08-30 17:29:29 +08:00
<el-row type="flex" justify="space-around">
<el-col :span="6">
<button class="login_button login_button_dis" @click="show = false">取消</button>
2024-08-13 17:28:37 +08:00
</el-col>
2024-08-30 17:29:29 +08:00
<el-col :span="6">
<button class="login_button" @click="toSure">确定</button>
2024-08-13 17:28:37 +08:00
</el-col>
</el-row>
2024-08-30 17:29:29 +08:00
</div>
<div v-show="type === 'SCANER'" class="pop-wraper" :class="{'popshow': show, 'pophide': !show}">
2024-09-05 16:33:48 +08:00
<el-row class="filter-wraper" type="flex" justify="space-between">
<el-col :span="2" class="p-label">目的地</el-col>
<el-col :span="8" class="select-wraper">
2024-09-10 10:07:19 +08:00
<el-select v-model="value1" placeholder="请选择">
2024-09-02 17:41:32 +08:00
<el-option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value"
class="option-wraper"
/>
</el-select>
</el-col>
2024-09-05 16:33:48 +08:00
<el-col :span="2" class="p-label" />
<el-col :span="2" class="p-label">载具号</el-col>
<el-col :span="8" class="select-wraper">
<input v-model="vcode" type="text" class="set-input">
</el-col>
2024-09-02 17:41:32 +08:00
</el-row>
<div class="pop-grid pop-grid_1">
2024-08-30 17:29:29 +08:00
<el-table
:data="popList"
2025-01-13 09:54:04 +08:00
height="100%"
2024-08-30 17:29:29 +08:00
>
<el-table-column
label="订单号"
>
<template slot-scope="scope">
2024-09-05 16:33:48 +08:00
<div class="select-wraper">
2024-09-06 11:23:21 +08:00
<el-select
v-model="scope.row.order_code"
filterable
allow-create
default-first-option
placeholder="请选择"
>
2024-09-05 16:33:48 +08:00
<el-option
v-for="item in options2"
:key="item.order_code"
:label="item.order_code"
:value="item.order_code"
class="option-wraper"
/>
</el-select>
</div>
2024-08-30 17:29:29 +08:00
</template>
</el-table-column>
2024-12-02 09:01:06 +08:00
<el-table-column
label="物料号"
2024-12-09 13:07:54 +08:00
>
<template slot-scope="scope">
<input v-model="scope.row.material_code" type="text" class="set-input">
</template>
</el-table-column>
2024-08-30 17:29:29 +08:00
<el-table-column
label="数量"
>
<template slot-scope="scope">
2024-09-05 16:46:43 +08:00
<input v-model="scope.row.material_qty" type="text" class="set-input">
2024-08-30 17:29:29 +08:00
</template>
</el-table-column>
<el-table-column
label="操作"
>
2024-12-16 14:15:07 +08:00
<template slot-scope="scope">
<el-button circle type="primary" icon="el-icon-plus" @click.native.prevent="addRow(scope.$index, popList)" />
<el-button circle type="primary" icon="el-icon-minus" @click.native.prevent="delRow(scope.$index, popList)" />
2024-08-30 17:29:29 +08:00
</template>
</el-table-column>
</el-table>
2024-07-31 16:25:04 +08:00
</div>
2024-08-30 17:29:29 +08:00
<el-row type="flex" justify="space-around">
<el-col :span="4">
<button class="login_button login_button_dis" @click="show = false">取消</button>
2024-07-31 16:25:04 +08:00
</el-col>
2024-08-30 17:29:29 +08:00
<el-col :span="4">
<button class="login_button" :disabled="disabled" @click="toSure">确定</button>
2024-08-20 13:57:21 +08:00
</el-col>
</el-row>
2024-08-30 17:29:29 +08:00
</div>
<div v-show="type === 'BACK'" class="pop-wraper" :class="{'popshow': show, 'pophide': !show}">
2025-01-13 09:54:04 +08:00
<div class="zd-row pop-grid">
<div class="pop-grid_r">
2025-01-13 14:26:43 +08:00
<img v-if="imgSrc !== ''" class="img_pallet" :src="imgSrc" alt="">
2025-01-13 09:54:04 +08:00
</div>
<div class="pop-grid_l">
<el-table
:data="popList"
height="100%"
2024-08-30 17:29:29 +08:00
>
2025-01-13 09:54:04 +08:00
<el-table-column
prop="order_code"
label="订单号"
/>
<el-table-column
2025-01-13 12:54:07 +08:00
prop="material_id"
2025-01-13 09:54:04 +08:00
label="零件号"
/>
<el-table-column
label="数量"
>
<template slot-scope="scope">
<input v-model="scope.row.material_qty" type="number" class="set-input">
</template>
</el-table-column>
</el-table>
</div>
2024-08-20 13:57:21 +08:00
</div>
2024-08-30 17:29:29 +08:00
<el-row type="flex" justify="space-around">
<el-col :span="4">
<button class="login_button login_button_dis" @click="show = false">取消</button>
2024-08-20 13:57:21 +08:00
</el-col>
2024-08-30 17:29:29 +08:00
<el-col :span="4">
2025-01-13 09:54:04 +08:00
<button class="login_button" @click="toSure">确定</button>
</el-col>
</el-row>
</div>
<div v-show="type === 'PALLET'" class="pop-wraper" :class="{'popshow': show, 'pophide': !show}">
<div class="zd-row pop-grid">
<div class="pop-grid_l">
2025-01-13 14:26:43 +08:00
<img v-if="imgSrc !== ''" class="img_pallet" :src="imgSrc" alt="">
2025-01-13 09:54:04 +08:00
</div>
<div class="pop-grid_r">
<el-table
:data="popList"
height="100%"
@current-change="handleCurrentChange1"
>
<el-table-column
2025-01-13 12:54:07 +08:00
prop="material_id"
2025-01-13 09:54:04 +08:00
label="图纸查看"
/>
</el-table>
</div>
</div>
<el-row type="flex" justify="space-around">
<el-col :span="4">
<button class="login_button login_button_dis" @click="show = false">取消</button>
</el-col>
<el-col :span="4">
<button class="login_button" @click="toSure">确定</button>
2024-07-31 16:25:04 +08:00
</el-col>
</el-row>
2024-07-24 17:30:23 +08:00
</div>
2025-03-06 15:19:10 +08:00
<div v-show="type === 'CACHE'" class="pop-wraper" :class="{'popshow': show, 'pophide': !show}">
<el-row :gutter="20" class="filter-wraper">
<el-col :span="2" class="p-label">载具号</el-col>
<el-col :span="8" class="select-wraper">
<input v-model="vcode" type="text" class="set-input" disabled>
</el-col>
</el-row>
<div class="pop-grid pop-grid_1">
<el-table
:data="popList"
height="100%"
>
<el-table-column
prop="order_code"
label="订单号"
/>
<el-table-column
prop="material_id"
label="物料号"
/>
</el-table>
</div>
<el-row type="flex" justify="space-around">
<el-col :span="4">
<button class="login_button login_button_dis" @click="show = false">返回</button>
</el-col>
</el-row>
</div>
2024-07-31 16:25:04 +08:00
<div v-show="show" class="modal" />
2025-01-13 09:54:04 +08:00
<div v-show="alertShow" class="pop-wraper pop-wraper-1" :class="{'popshow': alertShow, 'pophide': !alertShow}" style="z-index: 22;">
<div class="pop-h1">提示</div>
<div class="filter-items"><p class="p-text">是否确认回库</p></div>
<el-row type="flex" justify="space-around">
<el-col :span="6">
<button class="login_button login_button_dis" @click="alertShow = false">取消</button>
</el-col>
<el-col :span="6">
<button class="login_button" @click="toSure1">确定</button>
</el-col>
</el-row>
</div>
<div v-show="alertShow" class="modal" style="z-index: 21;" />
2024-07-24 17:30:23 +08:00
</div>
</template>
<script>
2024-08-13 17:28:37 +08:00
import crudProduceScreen from './produceScreen'
2024-09-05 16:33:48 +08:00
// import crudProduceScreen from './mork'
2024-07-24 17:30:23 +08:00
export default {
data() {
return {
2024-07-31 16:25:04 +08:00
show: false,
2024-08-30 17:29:29 +08:00
type: null,
popData: {},
popList: [],
popSecList: [],
currentRow: null,
value: '',
options: [{ value: 'G01', label: 'G01' }, { value: 'R01', label: 'R01' }, { value: 'R02', label: 'R02' }, { value: 'R03', label: 'R03' }, { value: 'S04', label: 'S04' }, { value: 'S06', label: 'S06' }],
2024-09-02 17:41:32 +08:00
value1: '',
2025-02-24 17:56:40 +08:00
options1: [{ value: '1', label: '货架' }, { value: '2', label: '内部' }, { value: '3', label: '外协' }, { value: '4', label: '内部过道' }, { value: '5', label: '其他加工' }],
2024-09-05 16:33:48 +08:00
value2: '',
options2: [],
vcode: '',
2025-01-13 09:54:04 +08:00
disabled: false,
imgSrc: '',
alertShow: false
2024-07-24 17:30:23 +08:00
}
},
2024-08-30 17:29:29 +08:00
computed: {
screenData() {
let res = {}
if (this.$store.state.produceScreen.screenData !== '') {
res = JSON.parse(this.$store.state.produceScreen.screenData)
}
return res
}
2024-08-20 13:57:21 +08:00
},
2024-07-24 17:30:23 +08:00
methods: {
2024-08-30 17:29:29 +08:00
toExit() {
this.disabled = true
2024-09-02 13:41:17 +08:00
crudProduceScreen.loginOut({ username: this.screenData.username, device_code: this.screenData.device_code }).then(res => {
2024-08-30 17:29:29 +08:00
this.disabled = false
localStorage.removeItem('screenData')
this.$router.push('/produceScreen/setup')
}).catch(() => {
this.disabled = false
})
},
showPop(type, e) {
2025-01-13 09:54:04 +08:00
this.imgSrc = ''
2024-08-30 17:29:29 +08:00
this.popData = {}
this.popList = []
this.popSecList = []
2024-09-02 13:58:19 +08:00
this.currentRow = null
2024-08-30 17:29:29 +08:00
this.value = ''
2024-09-02 17:41:32 +08:00
this.value1 = ''
2024-09-05 16:33:48 +08:00
this.vcode = ''
2024-07-31 16:25:04 +08:00
this.type = type
2024-08-30 17:29:29 +08:00
this.popData = e
if (type === 'IN') {
crudProduceScreen.regionOrder(this.screenData.device_code, this.popData.device_code).then(res => {
this.popList = [...res.content]
2024-08-13 17:28:37 +08:00
this.show = true
})
2024-08-30 17:29:29 +08:00
} else if (type === 'CONTAINER') {
this.popData.title = '选择托盘类型'
2024-08-20 13:57:21 +08:00
this.emptyObj = {}
this.val1 = ''
2024-08-13 17:28:37 +08:00
this.show = true
2024-08-30 17:29:29 +08:00
this.emptyObj.device_code = e.name
} else if (type === 'SCANER') {
2024-09-23 14:03:33 +08:00
const arr = []
if (JSON.stringify(this.screenData) !== '{}') {
this.screenData.region_points.map(el => {
if (el.type === '0') {
arr.push(el.device_code)
}
})
}
2024-09-23 14:24:17 +08:00
crudProduceScreen.fabOrders({ deviceCodes: arr }).then(res => {
2024-09-05 16:33:48 +08:00
this.options2 = [...res]
})
2024-09-06 10:11:03 +08:00
crudProduceScreen.getPointVehicle({ device_code: this.popData.device_code }).then(res => {
2024-09-06 10:38:15 +08:00
this.vcode = res
2024-09-06 10:11:03 +08:00
})
2024-12-09 13:07:54 +08:00
this.popList.push({ order_code: '', material_qty: '', material_code: '' })
2024-08-20 13:57:21 +08:00
this.show = true
2024-08-30 17:29:29 +08:00
} else if (type === 'BACK') {
2024-09-23 14:03:33 +08:00
const arr = []
arr.push(this.popData.device_code)
2024-09-23 14:24:17 +08:00
crudProduceScreen.fabOrders({ deviceCodes: arr }).then(res => {
2025-01-20 17:34:32 +08:00
this.imgSrc = '//images.weserv.nl/?url=' + res.path
2025-01-13 09:54:04 +08:00
this.popList = [...res.material]
2024-09-11 16:45:02 +08:00
this.popList.map(el => {
this.$set(el, 'material_qty', 0)
})
2024-08-30 17:29:29 +08:00
this.show = true
})
2025-01-13 09:54:04 +08:00
} else if (type === 'PALLET') {
2025-01-13 12:54:07 +08:00
crudProduceScreen.selectMaterialAndJpg(this.popData.device_code).then(res => {
this.imgSrc = res.vehiclePath
2025-01-13 12:54:07 +08:00
this.popList = [...res.materialList]
2025-01-13 09:54:04 +08:00
})
this.show = true
2025-03-06 15:19:10 +08:00
} else if (type === 'CACHE') {
crudProduceScreen.selectCacheTask({ deviceCode: this.popData.device_code }).then(res => {
this.popList = [...res.materialList]
this.vcode = res.vehicleCode
this.show = true
})
2024-08-13 17:28:37 +08:00
}
},
2024-08-30 17:29:29 +08:00
handleCurrentChange(val) {
2025-01-21 14:28:28 +08:00
this.imgSrc = ''
2025-01-13 09:59:34 +08:00
if (val) {
this.currentRow = val
crudProduceScreen.fabMaterial({ vehicle_code: this.currentRow.vehicle_code }).then(res => {
this.popSecList = [...res]
2025-01-21 14:28:28 +08:00
if (res.length > 0) {
2025-01-21 15:35:02 +08:00
this.imgSrc = res[0].vehicle_path
2025-01-21 14:28:28 +08:00
}
2025-01-13 09:59:34 +08:00
})
}
2024-08-13 17:28:37 +08:00
},
2024-08-30 17:29:29 +08:00
toSure() {
this.disabled = true
if (this.type === 'IN') {
if (this.popSecList.length === 0) {
this.disabled = false
return
}
2024-09-02 13:58:19 +08:00
crudProduceScreen.callMater({ mater: this.popSecList, device_code: this.popData.device_code, vehicle_code: this.currentRow.vehicle_code }).then(res => {
2024-08-30 17:29:29 +08:00
this.disabled = false
this.$message(res.msg)
}).catch(() => {
this.disabled = false
})
} else if (this.type === 'CONTAINER') {
if (!this.value) {
this.disabled = false
this.$message.error('请选择托盘类型!')
return
}
2024-09-02 13:41:17 +08:00
crudProduceScreen.callEmp({ vehicle_type: this.value, device_code: this.popData.device_code }).then(res => {
2024-08-30 17:29:29 +08:00
this.disabled = false
this.$message(res.msg)
}).catch(() => {
this.disabled = false
})
} else if (this.type === 'SCANER') {
2024-09-26 16:51:28 +08:00
if (!this.vcode) {
2024-09-26 16:58:29 +08:00
this.disabled = false
this.$message.error('请填写载具号')
2024-09-26 16:51:28 +08:00
return
}
if (!this.value1) {
2024-09-26 16:58:29 +08:00
this.disabled = false
this.$message.error('请选择目的地')
2024-09-26 16:51:28 +08:00
return
}
const arr = []
this.popList.map(el => {
2024-12-16 14:15:07 +08:00
if (el.order_code !== '' && el.material_qty !== '' && el.material_code !== '') {
2024-09-26 16:51:28 +08:00
arr.push(el)
}
})
crudProduceScreen.sendMater({ device_code: this.popData.device_code, mater: arr, point_code: this.value1, vehicle_code: this.vcode }).then(res => {
2024-08-30 17:29:29 +08:00
this.disabled = false
this.$message(res.msg)
}).catch(() => {
this.disabled = false
})
} else if (this.type === 'BACK') {
2025-01-13 09:54:04 +08:00
this.disabled = false
this.alertShow = true
return
2024-08-20 13:57:21 +08:00
}
2024-08-13 17:28:37 +08:00
this.show = false
2024-08-20 13:57:21 +08:00
},
2025-01-13 09:54:04 +08:00
toSure1() {
this.alertShow = false
this.show = false
crudProduceScreen.sendVehicle({ mater: this.popList, device_code: this.popData.device_code }).then(res => {
this.$message(res.msg)
}).catch(() => {})
},
2024-12-16 14:15:07 +08:00
addRow(index, rows) {
rows.splice(index, 0, { order_code: '', material_qty: '', material_code: '' })
},
delRow(index, rows) {
rows.splice(index, 1)
2025-01-13 09:54:04 +08:00
},
handleCurrentChange1(val) {
2025-01-13 09:59:34 +08:00
if (val) {
2025-01-20 17:34:32 +08:00
this.imgSrc = '//images.weserv.nl/?url=' + val.material_path
2025-01-13 09:59:34 +08:00
}
2024-07-24 17:30:23 +08:00
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
2024-08-30 17:29:29 +08:00
@import './style.scss';
2025-01-13 09:54:04 +08:00
>>>.el-message-box {
background: rgba(45,88,184,0.1);
border: 1px solid #4980BD;
}
.custom-message-box {
background-color: #f56c6c;
}
2024-07-24 17:30:23 +08:00
</style>