Files
hht-tongbo-two/pages/SecondPhase/production/ZjContainer.vue
2024-08-08 19:41:18 +08:00

301 lines
9.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="zd_container">
<!-- <nav-bar title="子卷装箱"></nav-bar> -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">子卷号</span>
</view>
<view class="filter_input_wraper">
<search-box v-model="val1" @handleChange="handleChange" />
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>选择</th>
<th class="th_2">订单号</th>
<th>客户名称</th>
<th>子卷号</th>
<th>子卷规格</th>
<th>子卷重量</th>
<th>子管重量</th>
<th>木箱料号</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td><span class="iconfont icon_minus-filled" @click="toCheck(e, i)">&minus;</span></td>
<td class="td_2">{{e.sale_order_name}}</td>
<td>{{e.customer_description}}</td>
<td>{{e.container_name}}</td>
<td>{{e.paper_tube_description}}</td>
<td>{{e.paper_weight}}</td>
<td>{{e.box_weight}}</td>
<td>{{e.box_type}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submitbar">
<button class="zd-col-6 btn-submit btn-default letter-30" @tap="clearUp">清空</button>
<button class="zd-col-15 btn-submit btn-success letter-30" :class="{'btn-info': !dataList.length}" @tap="toSure">组盘</button>
</view>
<view class="msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="pop-line"></view>
<view class="zd_wrapper-2">
<view class="zd-row filter_item">
<view :class="!disabled ? 'zd-col-18' : 'zd-col-24'">
<input type="text" placeholder="输入关键字搜索" class="filter_input" :class="{'filter_input_disabled': disabled}" :disabled="disabled" v-model="val2">
</view>
<view v-show="!disabled" class="zd-col-5"><button class="btn-submit btn-success" @tap="_queryBoxSpec">查询</button></view>
</view>
</view>
<view class="msg_content msg_content_1 pdb110">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>木箱规格</th>
<th>物料名称</th>
<th>木箱长度</th>
<th>木箱宽度</th>
<th>木箱高度</th>
<th>木箱库存数</th>
<th>最大装卷数</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in popData" :key="'pop' + i" @click="popCheck(e)" :class="{'checked': e.material_code === pkId}">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.box_length}}</td>
<td>{{e.box_width}}</td>
<td>{{e.box_high}}</td>
<td>{{e.ivt_num}}</td>
<td>{{e.num}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submitbar">
<button class="zd-col-6 btn-submit btn-success letter-30" @tap="show = false, pkId = '', pkObj = {}">取消</button>
<button class="zd-col-15 btn-submit btn-success letter-30" :class="{'btn-info': !pkId}" :disabled="disabled1" @tap="popSure">确定</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
<view class="msg_modal" :class="modalShow ? 'popshow1' : 'pophide1'">
<view class="msg_tip">提示</view>
<view class="zd_content pdt26">
<view class="msg_p1">请仔细核对子卷与木箱规格是否匹配</view>
<view class="msg_p2">木箱规格为{{this.pkObj.material_name}},</view>
<view class="msg_p2">子卷规格为{{this.current.paper_tube_description}},</view>
<view class="msg_p1">击确定后将立即生成空木箱出库任务无法更改</view>
</view>
<view class="zd-row submitbar">
<button class="zd-col-6 btn-submit btn-success letter-30" @tap.stop="modalShow = false">取消</button>
<button class="zd-col-15 btn-submit btn-success letter-30" @tap="modalSure">确定</button>
</view>
</view>
<view v-if="modalShow" class="msg_mask msg_mask_1"></view>
<view class="msg_modal" :class="modalShow1 ? 'popshow1' : 'pophide1'">
<view class="msg_tip">提示</view>
<view class="zd_content pdt26">
<view class="msg_p1">请仔细核对当前扫描子卷数与木箱装卷数是否一致</view>
<view class="msg_p2">当前扫描子卷数 {{dataList.length}}该木箱装卷数为{{pkObj.num}}</view>
<view class="msg_p1">点击确定后将立即生成空木箱出库任务无法更改!</view>
</view>
<view class="zd-row submitbar">
<button class="zd-col-6 btn-submit btn-success letter-30" @tap.stop="modalShow1 = false">取消</button>
<button class="zd-col-15 btn-submit btn-success letter-30" @tap="modalSure1">确定</button>
</view>
</view>
<view v-if="modalShow1" class="msg_mask msg_mask_1"></view>
<up-top ref="UT" :scrollTop="top"></up-top>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import UpTop from '@/components/upTop.vue'
import {queryContainerNameBySaleOrder, queryBoxSpec, updateEntityList} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox,
UpTop
},
data() {
return {
title: '',
top: 0,
val1: '',
dataList: [],
popData: [],
show: false,
disabled: false,
val2: '',
pkId: '',
pkObj: {},
paper: '',
modalShow: false,
modalShow1: false,
disabled1: false
};
},
computed: {
current () {
let res = {paper_tube_description: '', sale_order_name: ''}
if (this.dataList.length > 0) {
res = this.dataList[0]
}
return res
}
},
onPageScroll(e) {
this.$refs.UT.topData(e.scrollTop)
},
onLoad (options) {
this.title = options.title
},
methods: {
handleChange (e) {
this._queryContainerNameBySaleOrder(e)
},
async _queryContainerNameBySaleOrder (e) {
let res = await queryContainerNameBySaleOrder(e)
if (res.content.length) {
if (res.content[0].paper_tube_description === null || res.content[0].paper_tube_description === '') {
uni.showToast({
title: '未查询到该子卷规格信息,请检查子卷的分切计划信息!',
icon: 'none',
duration: 5000
})
return
}
if (this.dataList.length >= 1 && res.content[0].paper_tube_description !== this.current.paper_tube_description) {
uni.showToast({
title: `扫描的规格为:${res.content[0].paper_tube_description},与列表中的子卷规格不一致,请检查!`,
icon: 'none',
duration: 5000
})
return
}
if (this.dataList.length >= 1 && res.content[0].sale_order_name !== this.current.sale_order_name) {
uni.showToast({
title: `当前扫描的订单号为:${res.content[0].sale_order_name},与列表中的订单号不一致,请检查!`,
icon: 'none',
duration: 5000
})
return
}
if (res.content[0].status !== '99') {
uni.showToast({
title: `该子卷状态为已分配木箱规格,请检查!`,
icon: 'none'
})
return
}
let flag = false
this.dataList.map(el => {
if (el.container_name === res.content[0].container_name) {
flag = true
}
})
if (flag) {
uni.showToast({
title: `该子卷已存在,请检查!`,
icon: 'none'
})
return
}
this.dataList = [...this.dataList, ...res.content]
}
},
toCheck (e, i) {
this.dataList.splice(i, 1)
},
toSure () {
if (!this.dataList.length) {
return
}
let code = ''
for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].box_type !== '') {
code = this.dataList[i].box_type
break
}
}
this.disabled = code !== ''
this.val2 = code
this._queryBoxSpec()
},
async _queryBoxSpec () {
let res = await queryBoxSpec(this.val2)
if (res.code === 200) {
this.popData = [...res.content]
this.show = true
}
},
clearUp () {
this.val1 = ''
this.dataList = []
this.disabled = false
this.disabled1 = false
this.show = false
this.modalShow = false
},
popCheck (e) {
this.pkId = this.pkId === e.material_code ? '' : e.material_code
this.pkObj = this.pkId === e.material_code ? e : {}
},
async _updateEntityList () {
this.disabled1 = true
try {
let res = await updateEntityList(this.pkId, this.dataList)
uni.showToast({
title: '操作成功!',
icon: 'none'
})
this.clearUp()
} catch (e) {
this.disabled1 = false
}
},
popSure () {
if (this.dataList.length > Number(this.pkObj.num)) {
uni.showToast({
title: '子卷数量超过木箱的最大装卷数!',
icon: 'none',
duration: 5000
})
return
}
if (this.dataList.length < Number(this.pkObj.num)) {
this.modalShow1 = true
return
}
this.modalShow = true
},
modalSure () {
this._updateEntityList()
this.modalShow = false
},
modalSure1 () {
this.modalShow1 = false
this.modalShow = true
}
}
}
</script>