366 lines
9.4 KiB
Vue
366 lines
9.4 KiB
Vue
<template>
|
||
<view>
|
||
<u-navbar back-text="返回" title="跨组织收料" :background="background"></u-navbar>
|
||
<u-form>
|
||
<u-form-item :border-bottom="false">
|
||
<p>单号 : </p>
|
||
<u-input class="uni-input1" v-model="receiveRequestName" placeholder="请扫描单号"
|
||
:focus="focusReceiveRequestName" @confirm="serachMaterialList" />
|
||
</u-form-item>
|
||
</u-form-item>
|
||
|
||
<u-form-item>
|
||
<p>条码:</p>
|
||
<u-input :border="true" v-model="barCode" placeholder="请扫描条码" :focus="focusBarCode"
|
||
@confirm="getBarcodeInfo" />
|
||
</u-form-item>
|
||
|
||
<view class="uni-padding-wrap uni-common-mt">
|
||
<uni-segmented-control :current="current" :values="items" :style-type="styleType"
|
||
:active-color="activeColor" @clickItem="onClickItem" />
|
||
</view>
|
||
|
||
<view v-if="current === 0">
|
||
<uni-z-table :style="{'height': tabH+'px'}" :tableData="requestData" :columns="matColumns"
|
||
:showBottomSum="true" :rowNumbers="true" :pagination="true">
|
||
</uni-z-table>
|
||
</view>
|
||
|
||
<view v-if="current === 1">
|
||
<uni-card :is-shadow="false">
|
||
<view v-for="item in barCodeInfoList">
|
||
<u-form>
|
||
<u-form-item>
|
||
工厂:{{item.SITENAME}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
条码编号:{{item.MATERIALPACKINGNAME}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
来源类型:{{item.SOURCETYPE}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
物料编号:{{item.MATERIALSPECNAME}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
物料描述:{{item.DESCRIPTION}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
库存状态:{{item.STOCKSTATE}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
条码数量:{{item.MATERIALQUANTITY}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
制造日期 :{{item.MAKEDATE}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
有效日期 :{{item.EXPIRINGDATE}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
批号:{{item.CHARGE}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
供应商描述:{{item.SUPPLIERNAME}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
是否释放:{{ISRELEASE}}
|
||
</u-form-item>
|
||
<u-form-item>
|
||
绑定单号(未释放):{{item.LASTEVENTBILLNO}}
|
||
</u-form-item>
|
||
</u-form>
|
||
</view>
|
||
</uni-card>
|
||
</view>
|
||
|
||
<view v-if="current === 2">
|
||
<uni-z-table :style="{'height': tabH+'px'}" :tableData="barCodeData" :columns="scanedColums"
|
||
:showBottomSum="true" :rowNumbers="true" :pagination="true">
|
||
</uni-z-table>
|
||
</view>
|
||
</u-form>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
items: ['材料列表', '条码信息','已扫描条码'], //分栏器的选项卡
|
||
tabH: 800, //表格的宽度
|
||
ischecked: true, //默认出库
|
||
background: {
|
||
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
|
||
}, //返回按钮的样式
|
||
//分栏器的样式
|
||
styles: [{
|
||
value: 'button',
|
||
text: '按钮',
|
||
checked: true
|
||
},
|
||
{
|
||
value: 'text',
|
||
text: '文字'
|
||
}
|
||
],
|
||
colors: ['#007aff', '#4cd964', '#dd524d'],
|
||
current: 0,
|
||
colorIndex: 0,
|
||
activeColor: '#007aff',
|
||
styleType: 'text',
|
||
//---------------------分割线上方都是引用的外部的组件使用的样式,下方才是是使用的数据
|
||
texts:[],//显示入库条码
|
||
scanedData:[],//已扫描列表
|
||
receiveRequestName: "", //单据号
|
||
requestData: [], //材料列表
|
||
barCodeData: [], //已扫描条码信息
|
||
barCodeInfoList:[],//条码信息
|
||
shipRequestDetailName: "", //行号
|
||
barCode: "", //条码
|
||
focusBarCode: false, //条码的焦点是否被选中
|
||
focusReceiveRequestName: true, //单号的焦点一来就默认选中
|
||
ISRELEASE: "", //是否释放
|
||
siteName:"",
|
||
userId:"",
|
||
//对应的材料列表的表格
|
||
matColumns: [{
|
||
title: '序号',
|
||
field: "RECEIVEREQUESTDETAILNAME",
|
||
width: 120,
|
||
sort: true,
|
||
align: "left"
|
||
},
|
||
{
|
||
title: '物料编号',
|
||
field: "MATERIALSPECNAME",
|
||
width: 280,
|
||
sort: true,
|
||
align: "left"
|
||
},
|
||
{
|
||
title: '物料描述',
|
||
field: "DESCRIPTION",
|
||
width: 300,
|
||
sort: true,
|
||
align: "left"
|
||
},
|
||
{
|
||
title: '应收数量',
|
||
field: "REQUESTQUANTITY",
|
||
width: 150,
|
||
sort: true,
|
||
align: "right"
|
||
},
|
||
{
|
||
title: '实收数量',
|
||
field: "RECEIVEDQUANTITY",
|
||
width: 150,
|
||
sort: true,
|
||
align: "right"
|
||
},
|
||
{
|
||
title: '待收数量',
|
||
field: "DRQTY",
|
||
width: 150,
|
||
sort: true,
|
||
align: "right"
|
||
}
|
||
],
|
||
|
||
//对应已扫描条码的表格
|
||
scanedColums:[
|
||
{
|
||
title: '序号',
|
||
field: "ROWNO",
|
||
width: 120,
|
||
sort: true,
|
||
align: "right"
|
||
},
|
||
{
|
||
title: '条码编号',
|
||
field: "PACKINGCODE",
|
||
width: 280,
|
||
sort: true,
|
||
align: "left"
|
||
},
|
||
{
|
||
title: '物料编号',
|
||
field: "MATERIALSPECNAME",
|
||
width: 280,
|
||
sort: true,
|
||
align: "left"
|
||
},
|
||
|
||
{
|
||
title: '数量',
|
||
field: "QTY",
|
||
width: 150,
|
||
sort: true,
|
||
align: "right"
|
||
}
|
||
],
|
||
|
||
|
||
|
||
}
|
||
},
|
||
mounted() {
|
||
this.tabH = this.$GetRemainingHeight(4, 0); //定义表格的高度
|
||
let that=this
|
||
uni.getStorage({
|
||
key:"sitename",
|
||
success(res) {
|
||
that.siteName=res.data
|
||
}
|
||
})
|
||
uni.getStorage({
|
||
key:"userid",
|
||
success(res) {
|
||
that.userId=res.data
|
||
}
|
||
})
|
||
},
|
||
methods: {
|
||
|
||
|
||
|
||
//分栏器的点击事件
|
||
onClickItem(e) {
|
||
if (this.current !== e.currentIndex) {
|
||
this.current = e.currentIndex //获取当前选中的index
|
||
}
|
||
},
|
||
//焦点初始化,让页面所有的焦点同时只能存在一个
|
||
initfocus() {
|
||
this.focusReceiveRequestName = false
|
||
this.focusBarCode = false
|
||
},
|
||
//获取焦点的公共方法
|
||
getfocus(nextfocus) {
|
||
this.initfocus()
|
||
this[nextfocus]
|
||
this.$nextTick(() => { //vue是数据全部修改后才进行的视图更新,哪nextTick函数就是为了拿到最新的数据,还不懂的可以去百度
|
||
this[nextfocus] = true
|
||
})
|
||
},
|
||
|
||
//扫描单据号-----------回车搜索
|
||
serachMaterialList() {
|
||
if (this.receiveRequestName == "") {
|
||
this.$showMessage("请先扫描单号");
|
||
//this.$playFail()
|
||
this.getfocus('focusReceiveRequestName')
|
||
} else {
|
||
this.getMateriallist() //获取材料信息
|
||
this.getScanedList()//已扫描条码
|
||
}
|
||
},
|
||
|
||
//扫描条码回车事件
|
||
getBarcodeInfo() {
|
||
if (this.receiveRequestName == "") {
|
||
this.$showMessage("请先扫描单号");
|
||
this.$playFail()
|
||
this.getfocus('focusReceiveRequestName') //获取焦点
|
||
return
|
||
}
|
||
if (this.barCode == "") {
|
||
this.$showMessage("请扫描条码");
|
||
this.$playFail()
|
||
this.getfocus('focusBarCode')
|
||
return
|
||
}
|
||
this.requsetIn() //调用条码查询
|
||
},
|
||
|
||
//获取材料列表
|
||
getMateriallist() {
|
||
this.$MyRequest('/accrossorgreceive/getinfo', {
|
||
receiveRequestName: this.receiveRequestName
|
||
}).then(res => {
|
||
console.log(res)
|
||
if (res.data.success) {
|
||
this.requestData = res.data.resultObj //接后端返回的物料参数,并展示在表格里面
|
||
this.$playSuccess()
|
||
console.log(this.receiveRequestName)
|
||
this.getfocus('focusBarCode')
|
||
} else {
|
||
this.$showMessage(res.data.message) //单号有问题的话重新聚焦在单号输入框
|
||
this.$playFail(receiveRequestName)
|
||
this.receiveRequestName=""
|
||
this.getfocus('focusReceiveRequestName')
|
||
}
|
||
}).catch(err => {
|
||
this.$showMessage(err)
|
||
this.receiveRequestName = ""
|
||
this.getfocus('focusReceiveRequestName') //请求失败的话重新聚焦在单号输入框
|
||
})
|
||
},
|
||
|
||
//获取已扫描条码
|
||
getScanedList(){
|
||
this.$MyRequest('/accrossorgreceive/getdetailinfio',{
|
||
receiveRequestName:this.receiveRequestName
|
||
}).then(res=>{
|
||
if(res.data.success)
|
||
{ this.barCodeData=res.data.resultObj}else{
|
||
console.log("无已扫描列表数据")
|
||
}
|
||
}).catch(err=>{
|
||
console.log(err)
|
||
this.$showMessage(err)
|
||
})
|
||
},
|
||
|
||
|
||
//入库申请
|
||
requsetIn() {
|
||
this.$MyRequest('/accrossorgreceive/dbInstockapply', {
|
||
siteName:this.siteName,
|
||
billNo: this.receiveRequestName,
|
||
barCode: this.barCode,
|
||
userId: this.userId
|
||
}).then(res => {
|
||
if (res.data.success) {
|
||
console.log(res)
|
||
this.barCodeInfoList = res.data.resultObj
|
||
if (this.barCodeInfoList[0]["ISRELEASE"] == 1) //处理后端返回的ISRELEASE,为1的时候设置为释放
|
||
this.ISRELEASE = "释放"
|
||
else this.ISRELEASE = "未释放"
|
||
this.current=1
|
||
setTimeout(()=>{
|
||
this.onClickItem(event)
|
||
},2000)
|
||
this.barCode = "" //清空条码
|
||
this.$showMessage(res.data.message)
|
||
this.getfocus('focusBarCode') //焦点回到条码
|
||
|
||
this.getScanedList()//已扫描条码
|
||
this.getMateriallist()//再获取一次材料列表
|
||
|
||
} else {
|
||
this.$showMessage(res.data.message)
|
||
this.$playFail()
|
||
this.barCode = "" //清空条码
|
||
this.getfocus('focusBarCode') //获取焦点回到条码
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
this.$showMessage(err)
|
||
this.$playFail()
|
||
this.barCode = ""
|
||
this.getfocus('focusBarCode') //重新获取焦点
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.uni-input1{
|
||
border:1px solid red;
|
||
|
||
}
|
||
</style>
|