<template>
|
<view class="">
|
<!-- <u-navbar back-text="" title="非计划出库-新建"></u-navbar> -->
|
<view class="line">
|
<text class="col7">出库任务单号:</text>
|
<u-input class="ml10" border input-align="center" v-model="taskCode" placeholder="" disabled></u-input>
|
</view>
|
<view class="line space-between" @click="dialogVisible=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="state" mode="single-column" v-model="dialogVisible" @confirm="stateLable">
|
</u-select>
|
</view>
|
<view class="line space-between" @click="pncode">
|
<text class="col7">零件号:</text>
|
<view class="">
|
<text class="ml10 col7">{{pn}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view class="line space-between" @click="bourn">
|
<text class="col7">目的地:</text>
|
<view class="">
|
<text class="ml10 col7">{{destination.productionLineName}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view class="line space-between" @click="dialogType=true">
|
<text class="col7">出库类型:</text>
|
<view class="">
|
<text class="ml10 col7">{{type}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view class="line space-between" @click="ftWorker">
|
<text class="col7">指定叉车工:</text>
|
<view class="">
|
<text class="ml10 col7">{{ftText}}</text>
|
<u-icon name="arrow-right"></u-icon>
|
</view>
|
</view>
|
<view>
|
<u-select :list="ftlist" mode="single-column" v-model="dialogFt" @confirm="ftLable">
|
</u-select>
|
</view>
|
<view class="line">
|
<text class="col7">装箱数量:</text>
|
<u-input class="ml10" border input-align="center" v-model="maxNum" placeholder="" disabled></u-input>
|
</view>
|
<view class="line">
|
<text class="col7" v-if="totalNum">总库存数量:</text>
|
<text class="col7" v-else>总空器具数量:</text>
|
<u-input class="ml10" border v-model="total" input-align="center" placeholder="" disabled></u-input>
|
</view>
|
|
<view class="line">
|
<text class="col7">出库数量:</text>
|
<u-input class="ml10" v-model="outNum" @blur="doInput(outNum)" placeholder="手动输入数量"></u-input>
|
</view>
|
<view class="line">
|
<text class="col7" v-if="totalNum">有效库存数量:</text>
|
<text class="col7" v-else>有效空器具数量:</text>
|
<u-input class="ml10" border v-model="valid" input-align="center" placeholder="" disabled></u-input>
|
</view>
|
<view>
|
<u-select :list="stateType" mode="single-column" v-model="dialogType" @confirm="stateLable">
|
</u-select>
|
</view>
|
<view class="fix">
|
<u-button type="success" @click="add">保存</u-button>
|
</view>
|
<Dialogdata ref="diapop" :flag.sync="dialogShow" @lower="lower">
|
<view slot="con">
|
<view class="title">
|
<text>零件号</text>
|
</view>
|
<view class="search">
|
<u-search placeholder="搜索零件编号" @blur="searchcode" v-model="keyword" input-align="center"
|
@clear="clear" bg-color="#fff" shape="square" :show-action="false"></u-search>
|
</view>
|
<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>
|
<u-loadmore :status="status" />
|
</view>
|
</Dialogdata>
|
<Dialogdata :flag.sync="dialogShowGoal" @lower="lowerbourn">
|
<view slot="con">
|
<view class="title">
|
<text>目的地</text>
|
</view>
|
<view class="search">
|
<u-search placeholder="搜索目的地" @clear="clearbourn" @search="searchbourn" v-model="keyword2"
|
input-align="center" bg-color="#fff" shape="square" :show-action="false"></u-search>
|
</view>
|
<view class="line3" v-for="(item,index) in destination" :key='index' @click="pickerB(item, $event)">
|
<text style="color:#000">{{item.productionName}}</text>
|
</view>
|
<u-loadmore :status="status" />
|
</view>
|
</Dialogdata>
|
</view>
|
</template>
|
<script>
|
import {
|
code,
|
add,
|
ProductionLine,
|
SearchItemAllNum,
|
SearchItemCanUseNum,
|
EmptyContainerPlace,
|
UserSearch
|
} from '../../../api/putOut.js'
|
import {
|
part
|
} from '../../../api/putIn.js'
|
import Dialogdata from '@/components/dialog.vue'
|
export default {
|
components: {
|
Dialogdata
|
},
|
data() {
|
return {
|
dialogVisible: false, //出库口弹窗
|
dialogType: false, //出库类型弹窗
|
dialogShow: false, //零件号弹窗
|
dialogShowGoal: false, //目的地弹窗
|
dialogFt: false, //叉车工弹窗
|
taskCode: '', //出库任务号
|
pn: '', //零件号
|
totalNum: true, //空器具切换
|
// timeout: null,
|
keyword: '',
|
keyword2: '',
|
userCarId: 0, //叉车工id
|
destination: [], //目的地列表
|
outNum: '', //出库数量
|
maxNum: '', //装箱数量
|
number: '', //下线数量
|
partName: '', //零件编号
|
stateText: '', //出库口
|
//ftText: '', //叉车工
|
ftText: uni.getStorageSync('admin'), //叉车工
|
type: '', //出库类型
|
value: '',
|
shipping: '',
|
valid: '', //有效库存数量
|
total: '', //总库存数量
|
list: [],
|
ftlist: [{
|
value: 17,
|
label: ''
|
}], //叉车工列表
|
status: 'loading',
|
state: [{
|
num: 68,
|
label: '1号口'
|
},{
|
num: 51,
|
label: '2号口'
|
}, {
|
num: 64,
|
label: '3号口'
|
}, {
|
num: 67,
|
label: '4号口'
|
}, {
|
num: 34,
|
label: '5号口'
|
}, {
|
num: 30,
|
label: '6号口'
|
}, {
|
num: 19,
|
label: '7号口'
|
}, {
|
num: 12,
|
label: '8号口'
|
}, {
|
num: 997,
|
label: '冲压出口'
|
}, {
|
num: 999,
|
label: '焊装出口'
|
}],
|
stateType: [{
|
value: '1',
|
label: '焊装出库'
|
},
|
{
|
value: '2',
|
label: '调件出库'
|
},
|
{
|
value: '3',
|
label: '分拣出库'
|
},
|
{
|
value: '4',
|
label: '返修出库'
|
},
|
{
|
value: '5',
|
label: '空器具出库'
|
}
|
],
|
};
|
},
|
created() {
|
this.code()
|
this.stateLable()
|
this.totalNum = true
|
this.pn = uni.getStorageSync("pn")
|
this.destination.productionName = uni.getStorageSync("productionLineName").productionName
|
this.destination.productionLineCode = uni.getStorageSync("productionLineCode").productionLineCode
|
this.type = uni.getStorageSync("type")
|
},
|
|
methods: {
|
//正则
|
doInput(val) {
|
if (val > this.valid) {
|
uni.showToast({
|
title: '出库数量不能大于有效库存',
|
icon: 'none'
|
});
|
return;
|
}
|
},
|
lower(e) {
|
let params = {
|
page: e,
|
itemName: this.keyword,
|
onePageNum: 10
|
}
|
part(params).then((res) => {
|
let arr = []
|
if (this.page != 1) {
|
if (res.data.length == 0) {
|
this.status = 'nomore'
|
return
|
} else {
|
this.list = this.list.concat(res.data)
|
}
|
} else {
|
this.list = res.data
|
}
|
})
|
},
|
lowerbourn(e) {
|
this.keyword2 = ''
|
let params = {
|
page: e,
|
productionName: this.keyword2,
|
onePageNum: 10
|
}
|
ProductionLine(params).then((res) => {
|
if (this.page != 1) {
|
|
if (res.data.length == 0) {
|
this.status = 'nomore'
|
return
|
}
|
this.destination = this.destination.concat(res.data)
|
} else {
|
this.destination = res.data
|
}
|
})
|
},
|
//指定叉车工
|
ftWorker() {
|
let params = {
|
page: 1,
|
roleName: '叉车',
|
onePageNum: 10
|
}
|
UserSearch(params).then((res) => {
|
this.ftlist = []
|
res.data.forEach(item => {
|
this.ftlist.push({
|
value: item.id,
|
label: item.userName
|
})
|
})
|
})
|
setTimeout(() => {
|
this.dialogFt = true
|
}, 100)
|
},
|
//叉车工回显
|
ftLable(e) {
|
this.ftText = e[0].label
|
this.userCarId = e[0].value
|
},
|
//出库口回显
|
stateLable(e) {
|
this.totalNum = true
|
if (e) {
|
this.state.forEach(item => {
|
if (item.label == e[0].label) {
|
this.stateText = e[0].label
|
}
|
})
|
this.stateType.forEach(item => {
|
if (item.label == e[0].label) {
|
this.type = e[0].label
|
}
|
})
|
uni.setStorageSync('type', this.type);
|
if (this.type == "空器具出库") {
|
let params = {
|
itemName: this.pn
|
}
|
EmptyContainerPlace(params).then((res) => {
|
this.totalNum = false
|
res.forEach(item => {
|
if (item.titel == "总空器具数") {
|
this.total = item.value
|
}
|
if (item.titel == "有效空器具数") {
|
this.valid = item.value
|
}
|
})
|
})
|
} else {
|
this.totalNum = true
|
this.SearchItemAllNum()
|
this.SearchItemCanUseNum()
|
}
|
}
|
|
},
|
//清空零件号
|
clear() {
|
this.keyword = ''
|
this.pncode()
|
},
|
//出库
|
add() {
|
this.state.forEach(item => {
|
if (this.stateText == item.label) {
|
this.shipping = item.num
|
}
|
})
|
if (this.outNum > this.valid) {
|
uni.showToast({
|
title: '出库数量不能大于有效库存',
|
icon: 'none'
|
});
|
|
} else {
|
this.date =
|
`${new Date().getFullYear()}-${new Date().getMonth()+1}-${new Date().getDate()} ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()} `
|
let params = {
|
outOrderCode: this.taskCode,
|
orderStatus: '新建',
|
doTime: this.date,
|
itemName: this.pn,
|
tranLine: this.shipping,
|
itemDes: this.partName,
|
orderType: this.type,
|
userCarId: this.userCarId,
|
// checkOutNum: this.outNum,
|
totalOutNum: this.outNum,
|
//userName: uni.getStorageSync('admin'),
|
userName: this.ftText,
|
productionLineCode: this.destination.productionLineCode,
|
isErp: 0
|
}
|
add(params).then((res) => {
|
if (res.code == 1) {
|
this.$u.toast(res.msg)
|
} else {
|
uni.navigateTo({
|
url: './manual'
|
});
|
}
|
})
|
}
|
},
|
//零件列表
|
pncode() {
|
this.keyword = ''
|
let params = {
|
page: 1,
|
itemName: this.keyword,
|
onePageNum: 10
|
}
|
part(params).then((res) => {
|
if (res.code == 0) {
|
if (res.data.length == 0) {
|
this.status = 'nomore'
|
return
|
} else {
|
this.list = res.data
|
}
|
}
|
})
|
this.dialogShow = true
|
},
|
searchcode() {
|
let params = {
|
page: 1,
|
itemName: this.keyword,
|
onePageNum: 20
|
}
|
// clearTimeout(this.timeout)
|
// this.timeout = setTimeout(() => {
|
part(params).then((res) => {
|
if (res.code == 0) {
|
this.status = 'nomore'
|
this.list = res.data
|
}
|
})
|
// },200)
|
|
},
|
//零件号回显
|
picker(val, event) {
|
this.pn = val.itemName
|
uni.setStorageSync('pn', this.pn);
|
if(this.type == "空器具出库"){
|
let params = {
|
itemName: this.pn
|
}
|
EmptyContainerPlace(params).then((res) => {
|
this.totalNum = false
|
res.forEach(item => {
|
if (item.titel == "总空器具数") {
|
this.total = item.value
|
}
|
if (item.titel == "有效空器具数") {
|
this.valid = item.value
|
}
|
})
|
})
|
}
|
else{
|
this.SearchItemCanUseNum()
|
this.SearchItemAllNum()
|
}
|
this.maxNumber()
|
this.dialogShow = false
|
},
|
//获取装箱数量
|
maxNumber() {
|
let params = {
|
page: '1',
|
itemName: this.pn,
|
onePageNum: 10
|
}
|
part(params).then((res) => {
|
this.maxNum = res.data[0].maxNum
|
})
|
},
|
// 获取有效数量
|
SearchItemCanUseNum() {
|
let params = {
|
itemName: this.pn
|
}
|
SearchItemCanUseNum(params).then((res) => {
|
this.valid = res
|
})
|
},
|
// 获取总库存数量
|
SearchItemAllNum() {
|
let params = {
|
itemName: this.pn
|
}
|
SearchItemAllNum(params).then((res) => {
|
this.total = res
|
})
|
},
|
//目的地列表
|
bourn() {
|
let params = {
|
page: 1,
|
productionName: this.keyword2,
|
onePageNum: 10
|
}
|
ProductionLine(params).then((res) => {
|
if (res.code == 0) {
|
if (res.data.length == 0) {
|
this.status = 'nomore'
|
return
|
} else {
|
this.destination = res.data
|
}
|
|
}
|
})
|
this.dialogShowGoal = true
|
},
|
searchbourn() {
|
let params = {
|
page: 1,
|
productionName: this.keyword2,
|
onePageNum: 20
|
}
|
ProductionLine(params).then((res) => {
|
if (res.code == 0) {
|
this.status = 'nomore'
|
this.destination = res.data
|
}
|
})
|
this.dialogShowGoal = true
|
},
|
clearbourn() {
|
this.keyword2 = ''
|
this.bourn()
|
},
|
//目的地回显
|
pickerB(val, event) {
|
let params = {
|
page: 1,
|
// productionName: this.keyword2
|
onePageNum: 20
|
}
|
ProductionLine(params).then((res) => {
|
if (res.code == 0) {
|
res.data.forEach(item => {
|
this.destination.productionLineName = val.productionName
|
this.destination.productionLineCode = val.productionCode
|
uni.setStorageSync('productionLineName', this.destination
|
.productionLineName)
|
uni.setStorageSync('productionLineCode', this.destination
|
.productionLineCode)
|
this.dialogShowGoal = false
|
})
|
}
|
})
|
},
|
// 出库任务单号
|
code() {
|
let params = {}
|
code(params).then((res) => {
|
this.taskCode = res
|
})
|
},
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.search {
|
background-color: #f2f2f2;
|
padding: 5px;
|
}
|
|
.title {
|
display: flex;
|
height: 2.2rem;
|
font-size: 1rem;
|
align-items: center;
|
justify-content: center;
|
/* padding-right: 9px; */
|
}
|
|
.fix {
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
height: 45px;
|
padding: 0 3px;
|
}
|
|
.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;
|
}
|
|
.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;
|
}
|
</style>
|