<template>
|
<view class="page">
|
<view class="warehouse-materialreturn-bg"/>
|
<u-navbar title="扫码退料" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" back-icon-color="#000"/>
|
<view class="warehouse-materialreturn-param">
|
<view class="warehouse-materialreturn-param-view">
|
<view class="warehouse-materialreturn-param-item">
|
<view class="warehouse-materialreturn-param-item-left">
|
<text class="item-one">工作站</text>
|
</view>
|
<view class="warehouse-materialreturn-param-item-right">
|
<text class="item-one" @click="toWorkstation">{{tailHandle.workstationName}}</text>
|
<view class="scan" style="margin-right: 24rpx;" @click="goScan">
|
</view>
|
<u-icon name="arrow-right" color="#687792" size="28" @click="toWorkstation"></u-icon>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="materialreturn-index-body-title">
|
<view>
|
<u-line style="border:5rpx solid #264DE9" length="33rpx" direction="col" color="#264DE9" :hair-line="false"></u-line>
|
</view>
|
<view class="title-label">机台物料</view>
|
</view>
|
<view class="wrap">
|
<scroll-view class="warehouse-materialreturn-scroll-list" scroll-y="true">
|
<u-cell-group class="warehouse-materialreturn-scroll-list-group" :border="false">
|
<div class="tip" style="text-align:center;" v-if="list.length==0">-暂无物料-</div>
|
<view class="content" v-for="(item, index) in list" :key="item.id" :index="index" @click="selectRow(item)">
|
<view class="content-header">
|
<view class="header-item">
|
<view class="content-header-icon-one"></view>
|
<view class="content-header-title">{{ item.partBatchNo }}</view>
|
</view>
|
<view class="header-item">
|
<view class="content-header-icon-two"></view>
|
<view class="content-header-title-ne">{{ item.partName }}</view>
|
</view>
|
<view :class="[item.isSelected?'header-item-toolbar-selected':'header-item-toolbar-unselected']">
|
|
</view>
|
</view>
|
<view class="content-body">
|
<view class="row-list">
|
<view class="_label">
|
零件编号:
|
</view>
|
<view class="_content">
|
{{ item.partNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
erp批 号:
|
</view>
|
<view class="_content">
|
{{ item.ifsBatchNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
可用数量:
|
</view>
|
<view class="_content">
|
<text class="_content-text">{{ item.availableStockQuantity+'('+item.unit+')' }}</text>
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label s1">
|
退料数量:
|
</view>
|
<view class="_content _input">
|
<u-input placeholder="请输入退料数量" v-model="item.returnValue" type="digit"></u-input>
|
<view class="edit_icon"></view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</u-cell-group>
|
</scroll-view>
|
|
<view class="materialReturn-form-footer">
|
<u-button class="btn" type="primary" @click="goSubmit">退回</u-button>
|
</view>
|
<scan></scan>
|
<u-modal v-model="showConfirm" :title="''" content="是否确认将尾料扣除,此操作不可逆!" @confirm="confirm" :show-cancel-button="true">
|
<view class="slot-content">
|
<view @click="showPicker=true" style="padding: 20rpx;">
|
<view>
|
<text style="margin-right: 20rpx;">退料库位</text>
|
<text style="color: #e6db74;">{{active}}</text>
|
</view>
|
</view>
|
</view>
|
</u-modal>
|
<u-picker v-model="showPicker" mode="selector" :range="arr" range-key="locName" @confirm="confirmPicker"></u-picker>
|
</view>
|
</view>
|
</template>
|
<script>
|
import scan from "@/components/scan/scan.vue";
|
import content_bg from '@/static/custom/materialReturn/backBg.png'
|
export default {
|
components: {
|
scan
|
},
|
data() {
|
return {
|
background:{
|
backgroundImage: `url(${content_bg})`,
|
backgroundAttachment: 'fixed',
|
backgroundSize: '100% auto',
|
backgroundRepeat: 'no-repeat',
|
},
|
showPicker:false,
|
tailHandle:{
|
workstationId: null,
|
workstationNo: null,
|
workstationName: null
|
},
|
list:[{partNo:'88.118.1/A0138298',partName:'地铁及轨道用软电缆和软线 /1000V 1×35 A0',partBatchNo:'231115000002N',ifsBatchNo:'231115000002N',availableStockQuantity:56.3,unit:'米',returnValue:56.6},
|
{partNo:'BS-1704',partName:'三层共挤输液用膜',partBatchNo:'231115000002N',ifsBatchNo:'231115000002N',availableStockQuantity:72.3,unit:'米',returnValue:84},
|
{partNo:'BS-1704',partName:'三层共挤输液用膜',partBatchNo:'231115000002N',ifsBatchNo:'231115000002N',availableStockQuantity:72.3,unit:'米',returnValue:84}
|
],
|
showConfirm:false,
|
arr:[],
|
active:'点击选择库位',
|
obj:{}
|
};
|
},
|
onLoad() {
|
|
},
|
onShow() {
|
let that = this
|
uni.$off('scan') // 每次进来先 移除全局自定义事件监听器
|
uni.$on('scan', function(data) {
|
//扫码成功后的回调,你可以写自己的逻辑代码在这里
|
console.log('扫码结果:', data.code);
|
// console.log(data.code.replace(/\n/g,'').replace(/\s*/g,''))
|
// console.log('扫码结果1:', JSON.parse(data.code.replace(/\n/g,"").replace(/\s*/g,'')));
|
|
that.loadList(data.code);
|
that.$forceUpdate();
|
})
|
},
|
onNavigationBarButtonTap(e) {
|
this.goScan()
|
},
|
methods: {
|
confirmPicker(val) {
|
this.obj = {}
|
this.active = this.arr[val[0]].locName
|
this.obj = this.arr[val[0]]
|
},
|
goScan(){
|
//let scanresult={"part_no":"88.118.1/A0044193","package_code":"TP092022101200001","unit_meas":"跦","wdr":"*","lot_batch_no":"*","qty_arrived":12}
|
//this.scanHandle(JSON.stringify(scanresult))
|
|
uni.scanCode({
|
scanType: ['qrCode'],
|
success: res => {
|
try {
|
console.log('扫码结果:', res);
|
this.scanHandle(res.result)
|
} catch (e) {}
|
}
|
});
|
},
|
//根据机台号,查询机台信息,再查询物料信息
|
scanHandle(workstationNo){
|
if(workstationNo!=''){
|
this.$u.api.pigxFeed.fetchWorkstationList({workstationNo:workstationNo}).then(resp => {
|
|
if (!resp.data.records || resp.data.records.length == 0) {
|
this.$u.toast('【'+workstationNo+'】,未查询到机台信息')
|
}else{
|
let workstationList=resp.data.records
|
let scanWorkstationInfo=workstationList[0]
|
this.tailHandle.workstationId = scanWorkstationInfo.id
|
this.tailHandle.workstationNo = scanWorkstationInfo.workstationNo
|
this.tailHandle.workstationName = scanWorkstationInfo.name
|
this.list=[]
|
this.$u.api.returnMaterial.getFeedingStockByWorkstationNo({workstationNo:scanWorkstationInfo.workstationNo}).then(res => {
|
let reList = []
|
reList = res.data;
|
if(reList.length!=0)
|
{
|
// 按可用数量排个序
|
reList.sort(this.compare('availableStockQuantity'))
|
reList.forEach((item)=>{
|
this.list.push({
|
locationId:item.locationId,
|
locNo:item.locNo,
|
partBatchNo:item.partBatchNo,
|
partId:item.partId,
|
partNo:item.partNo,
|
partName:item.partName,
|
availableStockQuantity:item.availableStockQuantity,
|
unit:item.unit,
|
ifsBatchNo:item.ifsBatchNo,
|
id:item.id,
|
systemNo:item.systemNo,
|
isSelected:false
|
})
|
})
|
}
|
})
|
}
|
})
|
}else{
|
this.$u.toast('未扫描到机台号')
|
}
|
},
|
selectRow(stock){
|
stock.isSelected=!stock.isSelected
|
if(stock.isSelected) {
|
stock.returnValue = stock.availableStockQuantity
|
} else {
|
stock.returnValue = ''
|
}
|
/*this.list.forEach((item,index)=>{
|
if(item.id ==stock.id){
|
this.list.splice(index,1)
|
return;
|
}
|
})*/
|
//if(stock.isSelected){
|
//展示在列表最上方
|
// this.list.unshift(stock)
|
//}else{
|
//展示在列表最下方
|
// this.list.push(stock)
|
//}
|
|
},
|
setWorkstation(workstation) {
|
this.list=[]
|
this.tailHandle.workstationId = workstation.id
|
this.tailHandle.workstationNo = workstation.workstationNo
|
this.tailHandle.workstationName = workstation.name
|
this.$u.api.returnMaterial.getFeedingStockByWorkstationNo({workstationNo:workstation.workstationNo}).then(res => {
|
let reList = []
|
reList = res.data;
|
if(reList.length!=0)
|
{
|
// 按可用数量排个序
|
reList.sort(this.compare('availableStockQuantity'))
|
reList.forEach((item)=>{
|
this.list.push({
|
locationId:item.locationId,
|
locNo:item.locNo,
|
partBatchNo:item.partBatchNo,
|
partId:item.partId,
|
partNo:item.partNo,
|
partName:item.partName,
|
availableStockQuantity:item.availableStockQuantity,
|
unit:item.unit,
|
ifsBatchNo:item.ifsBatchNo,
|
id:item.id,
|
systemNo:item.systemNo,
|
isSelected:false
|
})
|
})
|
}
|
});
|
},
|
toWorkstation() {
|
uni.navigateTo({
|
url: '/pages/product/tailHandle/workstationList'
|
})
|
},
|
loadList(sanCode) {
|
let that = this
|
if(sanCode!="")
|
{
|
//根据扫入的字符串信息,判断扫的是条形码,还是二维码
|
let snNo
|
if (sanCode.indexOf('sn_no') != -1) {
|
// 二维码
|
const scanContentJson = JSON.parse(
|
sanCode.replace(/\n/g, '').replace(/\s*/g, '')
|
)
|
snNo=scanContentJson.sn_no
|
|
} else {
|
// 条形码
|
snNo = sanCode
|
}
|
//根据sn号选中物料
|
let exsitMaterial=this.list.find((item)=>{
|
return item.partBatchNo==snNo
|
})
|
if(exsitMaterial){
|
exsitMaterial.isSelected=true
|
/*this.list.forEach((item,index)=>{
|
if(item.id ==exsitMaterial.id){
|
this.list.splice(index,1)
|
return;
|
}
|
})*/
|
//展示在列表最上方
|
//this.list.unshift(exsitMaterial)
|
|
}
|
}
|
},
|
goSubmit(){
|
let stockIds = []
|
this.list.forEach((item) => {
|
if(item.isSelected){
|
stockIds.push(item)
|
}
|
})
|
if(stockIds.length>0){
|
this.showConfirm=true
|
this.$u.api.returnMaterial.getReturnLocations({workstationId:this.tailHandle.workstationId}).then((res) => {
|
console.log(res);
|
console.log(stockIds);
|
this.arr = res.data
|
})
|
} else {
|
this.$u.toast('请选择需发放的物料!')
|
}
|
},
|
confirm(){
|
let stockIds = []
|
if(this.active === '点击选择库位') {
|
this.$u.toast('请选择库位')
|
this.showConfirm = true
|
} else {
|
this.list.forEach((item) => {
|
if(item.isSelected){
|
stockIds.push({
|
id:item.id,
|
partBatchNo:item.partBatchNo,
|
partId:item.partId,
|
returnLocationId:this.obj.id,
|
returnQuantity:item.returnValue,
|
systemNo:item.systemNo,
|
workstationId:this.tailHandle.workstationId
|
})
|
}
|
})
|
if(stockIds.length>0){
|
this.$u.api.returnMaterial.returnMaterial(stockIds).then(res => {
|
let reData = res.data;
|
this.$u.toast('退料成功!')
|
this.getWorkstationMaterial(this.tailHandle.workstationNo)
|
})
|
}
|
}
|
},
|
getWorkstationMaterial(workstationNo){
|
this.list=[]
|
this.$u.api.returnMaterial.getFeedingStockByWorkstationNo({workstationNo:workstationNo}).then(res => {
|
let reList = []
|
reList = res.data;
|
if(reList.length!=0)
|
{
|
// 按可用数量排个序
|
reList.sort(this.compare('availableStockQuantity'))
|
reList.forEach((item)=>{
|
this.list.push({
|
locationId:item.locationId,
|
locNo:item.locNo,
|
partBatchNo:item.partBatchNo,
|
partId:item.partId,
|
partNo:item.partNo,
|
partName:item.partName,
|
availableStockQuantity:item.availableStockQuantity,
|
unit:item.unit,
|
ifsBatchNo:item.ifsBatchNo,
|
id:item.id,
|
systemNo:item.systemNo,
|
isSelected:false
|
})
|
})
|
}
|
});
|
},
|
compare(pro){
|
return function(obj1, obj2) {
|
const val1 = obj1[pro]
|
const val2 = obj2[pro]
|
if (val2 < val1) {
|
// 正序
|
return 1
|
} else if (val2 > val1) {
|
return -1
|
} else {
|
return 0
|
}
|
}
|
}
|
}
|
};
|
</script>
|
<style lang="scss" scoped>
|
.warehouse-materialreturn-bg{
|
background-color: #F6F9FF;
|
background-image: url('~@/static/custom/materialReturn/backBg.png');
|
// background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0));
|
padding: 0 20rpx;
|
background-attachment: fixed;
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
position: fixed;
|
top: 0;
|
bottom: 0;
|
width: 100%;
|
z-index: -1;
|
}
|
|
.warehouse-materialreturn-param{
|
padding: 50rpx 30rpx 0rpx 30rpx;
|
.warehouse-materialreturn-param-view{
|
height: 100rpx;
|
background: rgba(255,255,255,0.61);
|
box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(110,120,135,0.09);
|
border-radius: 10rpx;
|
padding:0rpx 23rpx;
|
margin-bottom: 30rpx;
|
.warehouse-materialreturn-param-item{
|
height: 100rpx;
|
border: 1px solid #ADC8E4;
|
line-height: 100rpx;
|
display:flex;
|
justify-content: space-between;
|
border: none;
|
.warehouse-materialreturn-param-item-left{
|
.item-one{
|
font-size: 30rpx;
|
color: #4F4F4F;
|
}
|
}
|
.warehouse-materialreturn-param-item-right{
|
display: flex;
|
align-items: center;
|
.item-one{
|
font-size: 30rpx;
|
color: #333333;
|
margin-right: 6rpx;
|
}
|
.item-two{
|
font-size: 30rpx;
|
color: #A6B4CC;
|
margin-right: 6rpx;
|
}
|
.item-three{
|
font-size: 30rpx;
|
color: #214DED;
|
margin-right: 6rpx;
|
}
|
.scan{
|
background-image: url('~@/static/custom/materialReturn/scan.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:32rpx;
|
width:32rpx;
|
}
|
}
|
}
|
.param-extra{
|
border-bottom: 1px solid #E8EBEE;
|
}
|
}
|
}
|
|
.materialreturn-index-body-title{
|
padding: 0rpx 30rpx 0rpx 30rpx;
|
margin-bottom: 32rpx;
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
.title-label{
|
margin-left: 14rpx;
|
font-size: 34rpx;
|
font-weight: bold;
|
color: #283E65;
|
}
|
}
|
|
.wrap .warehouse-materialreturn-scroll-list{
|
height:calc(100vh - var(--window-top) - var(--window-bottom) - 494rpx);
|
width:100%;
|
}
|
|
.warehouse-materialreturn-scroll-list-group{
|
::v-deep .u-cell-item-box {
|
background-color:rgba(250,252,255,0.36) !important;
|
padding:0rpx 30rpx ;
|
}
|
.content {
|
font-size: 12px;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
border-radius: 10rpx;
|
margin: 0rpx 0rpx 24rpx;
|
height: 382rpx;
|
padding: 10rpx 20rpx;
|
box-shadow:0rpx 6rpx 12rpx 2rpx rgba(127, 127, 127, 0.1) !important;
|
position:relative;
|
.content-header{
|
.header-item{
|
height: 50rpx;
|
display: flex;
|
align-items:center;
|
.content-header-icon-one{
|
background-image: url('~@/static/custom/materialReturn/label-icon-1.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:28rpx;
|
width:28rpx;
|
}
|
.content-header-icon-two{
|
background-image: url('~@/static/custom/materialReturn/label-icon-2.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:28rpx;
|
width:28rpx;
|
}
|
.content-header-title{
|
margin-left: 11rpx;
|
font-size: 26rpx;
|
font-weight: bold;
|
color: #333333;
|
}
|
.content-header-title-ne{
|
margin-left: 11rpx;
|
font-size: 26rpx;
|
color: #333333;
|
}
|
}
|
.header-item-toolbar-selected{
|
position: absolute;
|
background-image: url('~@/static/custom/materialReturn/selected-btn-1.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:50rpx;
|
width:50rpx;
|
right:20rpx;
|
top:12rpx;
|
display: flex;
|
justify-content: flex-end;
|
padding-top: 10rpx;
|
padding-right: 18rpx;
|
}
|
.header-item-toolbar-unselected{
|
position: absolute;
|
background-image: url('~@/static/custom/materialReturn/unselected-btn-1.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:50rpx;
|
width:50rpx;
|
right:20rpx;
|
top:12rpx;
|
display: flex;
|
justify-content: flex-end;
|
padding-top: 10rpx;
|
padding-right: 18rpx;
|
}
|
}
|
|
.content-body{
|
height:250rpx;
|
background: #F5F9FF;
|
border-radius: 10rpx;
|
padding: 25rpx 23rpx;
|
.row-list {
|
height: 50rpx;
|
display: flex;
|
flex-direction: row;
|
padding: 0px;
|
align-items: center;
|
justify-content: space-between;
|
}
|
.row-list ._label {
|
display: flex;
|
color: #666666;
|
font-size:26rpx;
|
align-items: center;
|
width: 170rpx;
|
}
|
|
.row-list ._content {
|
text-align: right;
|
color: #909399;
|
font-size: 24rpx;
|
._content-text{
|
color:#214ded;
|
}
|
}
|
.row-list ._input {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
border-bottom: 1px solid #4FA0FF;
|
height: 56rpx;
|
.edit_icon{
|
background-image: url('~@/static/custom/materialReturn/icon_edit.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:26rpx;
|
width:26rpx;
|
}
|
::v-deep .uni-input-input{
|
color:#D35651;
|
}
|
}
|
|
.row-list .s1 {
|
display: flex;
|
color: #214DED;
|
font-size:26rpx;
|
align-items: center;
|
width: 170rpx;
|
}
|
}
|
}
|
}
|
|
.materialReturn-form-footer{
|
display: flex;
|
margin-top: 10rpx;
|
margin-bottom: 10rpx;
|
margin-left: 20rpx;
|
margin-right: 20rpx;
|
padding-bottom: 14rpx;
|
.btn {
|
flex: 1;
|
margin: 10rpx;
|
background: #214DED;
|
box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(4,49,212,0.3);
|
font-weight: bold;
|
color: #FEFEFE;
|
font-family: PingFang SC;
|
}
|
}
|
</style>
|