<template>
|
<view class="">
|
<view class="line2 flex">
|
<view class="col7">
|
器具编号:
|
</view>
|
<u-input focus placeholder='扫码获取器具编号' maxlength='999' v-model="containerCode" @confirm="split"></u-input>
|
</view>
|
<view class="line2 flex">
|
<view class="col7">
|
器具类型:
|
</view>
|
<u-input placeholder='扫码获取器具编号' v-model="palletType"></u-input>
|
</view>
|
<view class="line2 flex">
|
<view class="col7">
|
仓库名称::
|
</view>
|
<text>立体库</text>
|
</view>
|
<view class="line2 flex">
|
<view class="col7">
|
组盘单号:
|
</view>
|
<text>{{cvi}}</text>
|
</view>
|
<view class="line space-between" @click="dialogstate=true">
|
<text class="col7">制件状态:</text>
|
<view class="">
|
<text class="ml10 col7">{{stateText}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view>
|
<u-select :list="stateList" mode="single-column" v-model="dialogstate" @confirm="stateLable">
|
</u-select>
|
</view>
|
<view class="line pl2 col7 space-between" @click="show=true">
|
<text class="col7">入库类型:</text>
|
<view class="">
|
<text class="ml10">{{type}}</text>
|
<u-icon name="arrow-down"></u-icon>
|
</view>
|
</view>
|
<view>
|
<u-select :list="selector" mode="single-column" v-model="show" @confirm="confirm"></u-select>
|
</view>
|
<view class="line pl2 space-between">
|
<text>装箱明细列表:</text>
|
<button type="default" class="btn" @click="addMaterial">添加物料</button>
|
</view>
|
<!-- <view v-if="flag"> -->
|
<view class="line pl2 space-between" v-if="arr.length!==0">
|
<text class="col7">零件</text>
|
<u-button type="error" class="btn" @click="delPart">删除</u-button>
|
</view>
|
<view class="line2 pl2" v-for="(item,index) in arr" :key="index">
|
|
<view class="" style="display: flex;">
|
<view class="" style="width: 100%;">
|
<view>
|
<text class="col7">零件名称:</text>
|
<text class="ml10">{{item.partDes}}</text>
|
</view>
|
<view>
|
<text class="col7">零件编号:</text>
|
<text class="ml10">{{item.partName}}</text>
|
</view>
|
</view>
|
|
<u-col span="6">
|
|
<view>
|
<text class="col7">生产日期:</text>
|
<!-- <text
|
class="ml10">{{item.nowDate?$moment(item.nowDate).format('YYYY-MM-DD HH:mm:ss'):'---'}}</text> -->
|
<uni-datetime-picker type="datetime" :clear-icon="false" v-model="item.nowDate" @maskClick="maskClick" />
|
</view>
|
<view style="display: flex;">
|
<text class="col7">下线数量:</text>
|
<u-input placeholder="输入下线数量" class="ml10" v-model="item.number"
|
@blur="item.number<item.maxnumber?item.number:item.number=item.maxnumber">
|
</u-input>
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
<view class="space-between">
|
<text>
|
生产计划单:
|
</text>
|
<u-input type="select" :value="item.inOrderCode" @click="planclick(item,index) " placeholder="请选择计划单号"
|
style="margin-left: 10px;" />
|
<u-popup height="350px" mode="bottom" v-model="showPlan">
|
<view class="" style="text-align: center;border-bottom:1px solid #eaeaea">
|
<text>生产计划单号</text>
|
</view>
|
<view class="">
|
<view class="line3" v-for="(item,index) in actionSheetList" :key="index"
|
@click="pickerPop(item, $event)">
|
<text style="color:#000">{{item}}</text>
|
</view>
|
</view>
|
<u-empty text="暂无数据" mode="list" v-if='actionSheetList.length==0'></u-empty>
|
</u-popup>
|
</view>
|
<view>
|
查看照片
|
</view>
|
<u-upload style="margin-bottom:45px;" max-count="1" :action="action" :file-list="item.list">
|
</u-upload>
|
</view>
|
<!-- </view> -->
|
<view class="fix" style="background-color: #fff;z-index: 99;padding-top: 2px;">
|
<u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="onPrint">打印</u-button>
|
<u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="save">暂存</u-button>
|
<u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="last">上一条</u-button>
|
<u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="add">保存并返回</u-button>
|
</view>
|
<Dialogdata :flag.sync="dialogShow" @lower="lower">
|
<view slot="con">
|
<view class="title">
|
<text style="width: 35%;">选择物料</text>
|
<view class="">
|
<view v-if="plan" @click="allPart" class="slot-right"
|
style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33">
|
显示全部
|
</view>
|
<view v-if='!plan' @click="addMaterial" class="slot-right"
|
style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33">
|
只显示计划
|
</view>
|
</view>
|
</view>
|
<view class="search">
|
<u-search placeholder="搜索零件编号" @clear="clearcode" @blur="searchPart" v-model="keyword"
|
input-align="center" bg-color="#fff" shape="square" :show-action="false"></u-search>
|
</view>
|
<view class="">
|
<view class="line3" v-for="(item,index) in list" :key="index" @click="picker(item, $event)">
|
<text style="color:#000">{{item.itemName}}</text>
|
<text class="col7 ml10">{{item.itemDes}}</text>
|
</view>
|
</view>
|
<u-empty text="暂无数据" mode="list" v-if='list.length==0'></u-empty>
|
<u-loadmore :status="status" v-if='list.length>=6' />
|
</view>
|
</Dialogdata>
|
</view>
|
</template>
|
<script>
|
import {
|
tray,
|
part,
|
add,
|
getCode,
|
delPart,
|
addAll,
|
delPartAll,
|
InOrder,
|
print,
|
InType,
|
set,
|
AddOrUpdate,
|
printSet,
|
ItemStorage,
|
itemSearch
|
} from '../../../api/putIn.js'
|
import mixBule from '@/mixins/Blue.js'
|
import Dialogdata from '@/components/dialog.vue'
|
export default {
|
components: {
|
Dialogdata
|
},
|
mixins: [mixBule],
|
data() {
|
return {
|
containerCode: '', //器具编号
|
materialCode:'',
|
palletType: '', //器具类型
|
dialogstate: false, //制件状态弹窗
|
show: false, //入库类型弹窗
|
dialogShow: false, //添加物料弹窗
|
status: 'loading',
|
stateList: [{
|
value: '1',
|
label: '合格'
|
},
|
{
|
value: '2',
|
label: '焊装待返修'
|
},
|
{
|
value: '3',
|
label: '冲压待返修'
|
}
|
], //制件状态列表
|
arr: [], //添加零件列表
|
action: this.$myHOST + '/ContainerVsItem/UpLoadImageFiles',
|
plan: true, //计划全部切换
|
selector: [], //入库类型
|
actionSheetList: [], //计划单号列表
|
cvi: '', //组盘单号
|
stateText: '', //制件状态回显
|
type: '', //入库类型回显
|
keyword: '', //搜索零件
|
showPlan: false, //计划单号弹窗
|
event: '', //跳转标识
|
containerType: '', //器具类型
|
value:'',
|
}
|
},
|
|
//默认返回
|
onBackPress(options) {
|
// 这里可以自定义返回逻辑,比如下面跳转其他页面
|
if (options.from == 'navigateBack') {
|
uni.navigateTo({
|
url: './jimo'
|
});
|
}
|
if (options.from == 'backbutton') {
|
uni.navigateTo({
|
url: './jimo'
|
});
|
}
|
// return true 表示禁止默认返回
|
return true
|
},
|
onLoad(options) {
|
if (options.event) {
|
this.event = options.event
|
let list = JSON.parse(options.list)
|
this.containerCode = list.containerName
|
this.tray()
|
this.cvi = list.cviCode
|
this.type = list.inType
|
this.stateText = list.isBad == 0 ? '合格' : isBad == 1 ? '焊装待返修' : '冲压待返修'
|
this.setDetail()
|
}
|
|
},
|
created() {
|
if (this.event !== 10) {
|
this.getCode()
|
this.putType()
|
this.value = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate() + " " + new Date().getHours()+":"+new Date().getMinutes() + ":" + new Date().getSeconds()
|
//暂存的数据
|
let savelist = uni.getStorageSync('savelist')
|
if (savelist) {
|
savelist.forEach(item => {
|
this.containerCode = item.containerCode
|
this.palletType = item.palletType
|
this.cvi = item.cvi
|
this.stateText = item.stateText
|
this.type = item.InType
|
this.arr = item.arrlist
|
})
|
}
|
}
|
},
|
methods: {
|
// 处理扫码返回的数据
|
split(event) {
|
if (event.includes('器具编号')) {
|
// 扫码枪扫码
|
var that = this
|
let str = JSON.stringify(decodeURI(event))
|
let arr = str.split('器具编号:')[1]
|
let index = arr.indexOf('投产时间')
|
that.containerCode = arr.slice(0, index).trim()
|
that.tray()
|
} else if (event.includes('anceType')) {
|
//扫二维码带出所有数据
|
let json = eval("(" + event + ")")
|
this.containerCode = json[0].value
|
this.palletType = json[0].anceType
|
this.cvi = json[0].code
|
this.stateText = json[0].stateText
|
this.type = json[0].type
|
this.arr = json[0].arr
|
} else {
|
//输入器具
|
this.tray()
|
}
|
},
|
// 搜索托盘
|
tray() {
|
let params = {
|
page: '1',
|
containerName: this.containerCode,
|
onePageNum: 20
|
}
|
tray(params).then((res) => {
|
if (res.code == 0) {
|
res.data.forEach((item) => {
|
if (this.containerCode == item.containerName) {
|
this.containerCode = item.containerName
|
this.palletType = item.palletType
|
this.containerType = item.containerType
|
}
|
})
|
}
|
})
|
},
|
//获取组盘编号
|
getCode() {
|
getCode().then((res) => {
|
if (!this.event) {
|
this.cvi = res
|
}
|
})
|
},
|
//点击卡片的物料明细
|
setDetail() {
|
let params = {
|
page: 1,
|
containerName: this.containerCode,
|
onePageNum: 10
|
}
|
set(params).then((res) => {
|
this.set = res.data
|
res.data.forEach((item, index) => {
|
this.arr.push({
|
partDes: item.itemDes,
|
createLine: item.createLine,
|
partName: item.itemName,
|
nowDate: item.updateTime,
|
number: item.itemNum,
|
maxnumber: item.itemNum,
|
inOrderCode: item.inOrderCode,
|
image: item.image,
|
list: [{
|
url: this.$myHOST + '/' + item.image
|
}]
|
})
|
if (item.image == null) {
|
this.arr.forEach(item => {
|
item.image = null
|
delete item.list
|
})
|
}
|
})
|
})
|
},
|
//制件状态回显
|
stateLable(e) {
|
this.stateText = e[0].label
|
},
|
//入库类型
|
putType() {
|
// this.show = true
|
let params = {
|
page: 1,
|
onePageNum: 20
|
}
|
this.selector = []
|
InType(params).then((res) => {
|
if (res.code == 0) {
|
res.data.forEach(item => {
|
this.selector.push({
|
value: item.id,
|
label: item.inType
|
})
|
})
|
}
|
})
|
},
|
//入库类型回显
|
confirm(e) {
|
this.type = e[0].label
|
},
|
//计划物料列表(plan为true)
|
InOrder(e) {
|
let pages = 1
|
if (e) {
|
pages = e
|
}
|
let params = {
|
page: pages,
|
isFinish: 0,
|
enable: 1,
|
itemName: this.keyword,
|
onePageNum: 10
|
}
|
InOrder(params).then((res) => {
|
if (res.code == 0) {
|
if (pages != 1) {
|
if (res.data.length == 0) {
|
this.status = 'nomore'
|
return
|
}
|
this.list = this.list.concat(res.data)
|
} else {
|
this.list = res.data
|
}
|
|
}
|
})
|
},
|
//全部物料列表(plan为false)
|
part(e) {
|
let pages = 1
|
if (e) {
|
pages = e
|
}
|
let params = {
|
page: pages,
|
itemName: this.keyword,
|
onePageNum: 10,
|
useContainerType: this.containerType
|
}
|
part(params).then((res) => {
|
if (res.code == 0) {
|
if (pages != 1) {
|
if (res.data.length == 0) {
|
this.status = 'nomore'
|
return
|
}
|
this.list = this.list.concat(res.data)
|
} else {
|
this.list = res.data
|
}
|
}
|
})
|
},
|
// 添加物料
|
addMaterial() {
|
this.dialogShow = true
|
this.keyword = ''
|
this.plan = true
|
this.InOrder()
|
},
|
//显示全部物料
|
allPart() {
|
this.keyword = ''
|
this.status = 'loading'
|
this.list = []
|
this.plan = !this.plan
|
this.part()
|
},
|
//触底事件
|
lower(e) {
|
if (!this.plan) {
|
this.part(e)
|
} else {
|
this.InOrder(e)
|
}
|
},
|
//搜索零件
|
searchPart() {
|
if (this.keyword) {
|
if (!this.plan) {
|
this.part()
|
} else {
|
this.InOrder()
|
}
|
}
|
},
|
//清除搜索条件
|
clearcode() {
|
if (!this.plan) {
|
this.part()
|
} else {
|
this.InOrder()
|
}
|
},
|
//物料回显
|
picker(val, event) {
|
let params = {
|
page: 1,
|
itemName: val.itemName,
|
onePageNum: 10
|
}
|
part(params).then((res) => {
|
if (res.code == 0) {
|
if (this.arr.length !== 0) {
|
let l = this.arr.map((a) => {
|
return a.partName
|
})
|
if (l.includes(val.itemName)) {
|
uni.showToast({
|
title: '不能重复添加',
|
duration: 2000,
|
icon: 'none',
|
})
|
return
|
}
|
}
|
this.arr.push({
|
partDes: val.itemDes,
|
partName: val.itemName,
|
number: this.plan ? val.totalNum : val.maxNum,
|
maxnumber: this.plan ? val.totalNum : val.maxNum,
|
//nowDate: val.updateTime?val.updateTime:new Date(),
|
nowDate: val.updateTime?val.updateTime:this.value,
|
cviCode: this.cvi,
|
inOrderCode: val.inOrderCode,
|
image: res.data[0].image,
|
createLine: val.createLine,
|
itemName: val.itemName,
|
list: [{
|
url: `${this.$myHOST}/${res.data[0].image}`
|
}]
|
})
|
if (res.data[0].image == null) {
|
this.arr.forEach(item => {
|
delete item.list
|
})
|
}
|
this.materialCode = val.itemName
|
this.dialogShow = false
|
}
|
})
|
},
|
//生产点击事件
|
planclick(item, index) {
|
this.planCode(item.itemName)
|
this.showPlan = true
|
this.$forceUpdate()
|
},
|
//计划单号回显
|
pickerPop(val, event) {
|
this.arr.forEach(item => {
|
item.inOrderCode = val
|
})
|
this.showPlan = false
|
},
|
//生产计划单号
|
planCode(e) {
|
this.actionSheetList = []
|
let params = {
|
page: 1,
|
itemName: e,
|
onePageNum: 20
|
}
|
InOrder(params).then((res) => {
|
if (res.code == 0) {
|
res.data.forEach(item => {
|
this.actionSheetList.push(item.inOrderCode)
|
})
|
}
|
})
|
},
|
//删除零件
|
delPart() {
|
// this.arr = []
|
if (this.arr.length != 0) {
|
this.arr = []
|
this.$u.toast('删除成功')
|
}
|
},
|
//重置
|
reset() {
|
this.lastsave()
|
uni.removeStorageSync('savelist')
|
this.keyword = ''
|
this.arr = []
|
this.plan = true
|
this.actionSheetList = []
|
this.containerCode = ''
|
this.palletType = ''
|
this.stateText = ''
|
this.type = ''
|
},
|
// 组盘新增
|
add() {
|
let eindex = 0
|
// try {
|
this.arr.forEach(item => {
|
let params = {
|
page: 1,
|
itemName: item.partName,
|
onePageNum: 10,
|
isMoreDay: '是'
|
}
|
ItemStorage(params).then((res) => {
|
if (res.code == 0) {
|
if (res.data.length !== 0) {
|
uni.showModal({
|
title: ` ${params.itemName}零件超出入库上限`,
|
content: res.msg,
|
showCancel: false,
|
});
|
return
|
} else {
|
eindex++
|
this.arrList = []
|
this.arr.forEach(item => {
|
this.arrList.push({
|
itemName: item.partName,
|
itemNum: item.number,
|
inOrderCode: item.inOrderCode,
|
image: item.image
|
})
|
})
|
let params = {
|
cviCode: this.cvi,
|
inType: this.type,
|
enable: '1',
|
createUser: uni.getStorageSync('admin'),
|
// inOrderCode: this.productionCode,
|
isBad: this.stateText == "合格" ? 0 : 1,
|
containerName: this.containerCode,
|
itemList: JSON.stringify(this.arrList)
|
}
|
if (eindex == this.arr.length) {
|
addAll(params).then((res) => {
|
if (res.code == 1) {
|
uni.showModal({
|
title: res.msg,
|
content: res.msg,
|
showCancel: false,
|
});
|
} else {
|
this.reset()
|
uni.navigateTo({
|
url: './jimo'
|
});
|
}
|
})
|
}
|
|
}
|
} else {
|
uni.showModal({
|
title: '提示',
|
content: res.msg,
|
showCancel: false,
|
});
|
}
|
})
|
})
|
},
|
//暂存
|
save() {
|
let savelist = [{
|
containerCode: this.containerCode,
|
palletType: this.palletType,
|
cvi: this.cvi,
|
stateText: this.stateText,
|
InType: this.type,
|
arrlist: this.arr
|
}]
|
uni.setStorageSync('savelist', savelist)
|
},
|
//存储本次组盘数据
|
lastsave() {
|
let lastlist = [{
|
containerCode: this.containerCode,
|
palletType: this.palletType,
|
cvi: this.cvi,
|
stateText: this.stateText,
|
InType: this.type,
|
arrlist: this.arr
|
}]
|
uni.setStorageSync('lastlist', lastlist)
|
},
|
//上一条
|
last() {
|
//暂存的数据
|
if (uni.getStorageSync('lastlist')) {
|
uni.getStorageSync('lastlist').forEach(item => {
|
this.containerCode = item.containerCode
|
this.palletType = item.palletType
|
this.cvi = item.cvi
|
this.stateText = item.stateText
|
this.type = item.InType
|
this.arr = item.arrlist
|
})
|
} else {
|
this.$u.toast('暂无上一条')
|
}
|
},
|
//打印
|
onPrint() {
|
this.singlist = ({
|
createLine: this.arr[0].createLine,
|
itemDes: `${this.arr.length>=1?this.arr[0].partDes:'无'},${this.arr.length>=1?this.arr[0].partName:'无'},${this.arr.length>=1?this.arr[0].number:'无'}`,
|
itemName: `${this.arr.length>=2?this.arr[1].partDes:'无'},${this.arr.length>=2?this.arr[1].partName:'无'},${this.arr.length>=2?this.arr[1].number:'无'}`,
|
itemNum: `${this.arr.length>=3?this.arr[2].partDes:'无'},${this.arr.length>=3?this.arr[2].partName:'无'},${this.arr.length>=3?this.arr[2].number:'无'}`,
|
//updateTime: this.arr[0].nowDate?this.$moment(this.arr[0].nowDate).format('YYYY-MM-DD HH:mm:ss'):new Date().toLocaleDateString()
|
updateTime:this.arr[0].nowDate,
|
})
|
if (!uni.getStorageSync("deviceId")) {
|
uni.showToast({
|
title: '请连接打印机',
|
icon: 'error',
|
duration: 2000
|
})
|
return
|
}
|
setTimeout(() => {
|
this.writeBLECharacteristicValue()
|
}, 500)
|
},
|
}
|
};
|
</script>
|
|
<style scoped>
|
.search {
|
background-color: #f2f2f2;
|
padding: 5px;
|
height: 2.7rem;
|
position: relative;
|
top: 1rpx;
|
width: 100%;
|
}
|
|
.title {
|
display: flex;
|
height: 2.2rem;
|
font-size: 1rem;
|
align-items: center;
|
justify-content: flex-end;
|
padding-right: 9px;
|
position: a;
|
top: 0;
|
width: 100%;
|
}
|
|
.fix {
|
display: flex;
|
justify-content: space-around;
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
height: 45px;
|
.btn {
|
width: 30%;
|
|
}
|
}
|
|
.line {
|
height: 50px;
|
border-bottom: 1px solid #eaeaea;
|
padding-left: 3rem;
|
font-size: 1rem;
|
padding-right: 10px;
|
display: flex;
|
align-items: center;
|
}
|
|
.line2 {
|
line-height: 2.3rem;
|
padding: 8px 10px 8px 3rem;
|
font-size: 0.93rem;
|
border-bottom: 1px solid #eaeaea;
|
}
|
|
.line3 {
|
line-height: 1.8rem;
|
padding: 8px 3px;
|
font-size: 0.93rem;
|
border-bottom: 1px solid #eaeaea;
|
text-align: center;
|
}
|
|
.pl2 {
|
padding-left: 2rem !important;
|
}
|
|
.col7 {
|
color: #777;
|
}
|
|
.ml10 {
|
margin-left: 10px;
|
}
|
|
.tr {
|
text-align: right;
|
}
|
|
.btn {
|
font-size: 0.8rem;
|
position: absolute !important;
|
right: 10px;
|
height: 30px !important;
|
}
|
|
.center {
|
display: flex;
|
align-items: center;
|
justify-content: flex-end;
|
}
|
|
.space-between {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
::v-deep .u-drawer-content {
|
/* padding-top: 5rem; */
|
}
|
|
.flex {
|
display: flex;
|
}
|
</style>
|