<template>
|
<view class="page">
|
<view class="productfeed-index-bg"/>
|
<u-navbar title="生产投料" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" back-icon-color="#000"/>
|
<view class="productfeed-index-param">
|
<view class="productfeed-index-param-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="productfeed-index-param-view">
|
<view class="productfeed-index-param-item param-extra">
|
<view class="productfeed-index-param-item-left">
|
<text class="item-one">工作站</text>
|
</view>
|
<view class="productfeed-index-param-item-right" @click="toWorkstation()">
|
<text v-if="feedMainInfo.workstationName" class="item-one">{{feedMainInfo.workstationName}}</text>
|
<text v-if="!feedMainInfo.workstationName" class="item-one item-two">请选择</text>
|
<u-icon name="arrow-right" color="#2979ff" size="28"></u-icon>
|
</view>
|
</view>
|
<view class="productfeed-index-param-item param-extra">
|
<view class="productfeed-index-param-item-left">
|
<text class="item-one">工单号</text>
|
</view>
|
<view class="productfeed-index-param-item-right" @click="toOptask()">
|
<text v-if="feedMainInfo.optaskNo" class="item-one">{{feedMainInfo.optaskNo}}</text>
|
<text v-if="!feedMainInfo.optaskNo" class="item-one item-two">请选择</text>
|
<u-icon name="arrow-right" color="#2979ff" size="28"></u-icon>
|
</view>
|
</view>
|
<view class="productfeed-index-param-item">
|
<view class="productfeed-index-param-item-left">
|
<text class="item-one">投料记录</text>
|
</view>
|
<view class="productfeed-index-param-item-right" @click="toFeedRecord()">
|
<text class="item-three">去查看</text>
|
<u-icon name="arrow-right" color="#2979ff" size="28"></u-icon>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="productfeed-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="productfeed-index-scroll-list" scroll-y="true" >
|
<u-cell-group class="productfeed-index-scroll-list-group" :border="false">
|
<view class="content" v-for="(item, index) in list" :key="item.erpPartNo" :index="index">
|
<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="header-item-toolbar" @click="deleteHandle(item)">
|
<view class="header-item-toolbar-del-icon">
|
|
</view>
|
<view class="header-item-toolbar-del-text">
|
删除
|
</view>
|
</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">
|
可用数量:
|
</view>
|
<view class="_content">
|
<text class="_content-text">{{ item.reservedQuantity }}</text>
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
投料数量:
|
</view>
|
<view class="_content _input">
|
<u-input placeholder="请输入投料数量" v-model="item.suppliedQuantity" type="digit"></u-input>
|
<view class="edit_icon"></view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</u-cell-group>
|
</scroll-view>
|
<scan></scan>
|
<view class="productfeed-footer">
|
<u-button class="btn-left" text="清空" size="medium" @click="clearData()">清空</u-button>
|
<u-button class="btn-right" text="投料" size="medium" @click="feedMaterialClick()">投料</u-button>
|
</view>
|
</view>
|
</view>
|
</template>
|
<script>
|
import scan from "@/components/scan/scan.vue";
|
import content_bg from '@/static/custom/product/productBg.png'
|
export default {
|
components: {
|
scan
|
},
|
data() {
|
return {
|
background:{
|
backgroundImage: `url(${content_bg})`,
|
backgroundAttachment: 'fixed',
|
backgroundSize: '100% auto',
|
backgroundRepeat: 'no-repeat',
|
},
|
showCardHead: false,
|
feedMainInfo: {
|
workstationId: null,
|
workstationNo: null,
|
workstationName: null,
|
optaskId: null,
|
optaskNo: null,
|
feedLocId: null,
|
feedLocNo: null,
|
feedLocName: null,
|
partId: null,
|
partNo: null,
|
partName: null,
|
quality: null,
|
ifsBatchNo:null,
|
customerOrderNo:null
|
},
|
query: {
|
current: 1,
|
size: 20
|
},
|
list:[],
|
options: [{
|
text: '删除',
|
style: {
|
backgroundColor: '#dd524d'
|
}
|
}],
|
count: 0,
|
loadStatus: 'loadmore',
|
idIndex:1
|
};
|
},
|
onLoad() {
|
|
},
|
onShow() {
|
|
let that = this
|
|
uni.$off('scan') // 每次进来先 移除全局自定义事件监听器
|
uni.$on('scan', function(data) {
|
console.log('onscan');
|
//扫码成功后的回调,你可以写自己的逻辑代码在这里
|
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.search(data.code);
|
|
if (data.code != "" &&
|
(that.feedMainInfo.workstationId == ""
|
|| that.feedMainInfo.workstationId==null
|
|| that.feedMainInfo.workstationId==undefined
|
|| that.feedMainInfo.workstationId=="undefined"
|
)) {
|
uni.showToast({
|
title: '请先选择工作站,再扫码',
|
icon: 'none'
|
})
|
return
|
}
|
|
that.loadList(data.code);
|
})
|
},
|
onNavigationBarButtonTap(e) {
|
this.goScan()
|
},
|
methods: {
|
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.feedMainInfo.workstationId = scanWorkstationInfo.id
|
this.feedMainInfo.workstationNo = scanWorkstationInfo.workstationNo
|
this.feedMainInfo.workstationName = scanWorkstationInfo.name
|
|
}
|
})
|
}else{
|
this.$u.toast('未扫描到机台号')
|
}
|
},
|
clearData(){
|
this.list = []
|
this.feedMainInfo={
|
workstationId: null,
|
workstationNo: null,
|
workstationName: null,
|
optaskId: null,
|
optaskNo: null,
|
feedLocId: null,
|
feedLocNo: null,
|
feedLocName: null,
|
partId: null,
|
partNo: null,
|
partName: null,
|
quality: null,
|
customerOrderNo:null
|
}
|
},
|
feedMaterialClick(){
|
|
let that = this;
|
|
if(that.feedMainInfo.workstationNo==""||that.feedMainInfo.workstationNo==undefined||that.feedMainInfo.workstationNo=="undefined")
|
{
|
that.$u.toast('请先选择工作站')
|
return
|
}
|
|
if(that.list.length==0)
|
{
|
that.$u.toast('请扫码获取投料信息')
|
return
|
}
|
|
for(let i=0;i<that.list.length;i++)
|
{
|
if(that.list[i].suppliedQuantity>that.list[i].reservedQuantity)
|
{
|
|
that.$u.toast('可用库存数量只有:'+that.list[i].reservedQuantity + ',投料数量超过库存数据,请重新输入投料数量')
|
return
|
}
|
}
|
|
let feedList=[]
|
that.list.map((item) => {
|
|
let suppliedQuantity =0;
|
suppliedQuantity = item.suppliedQuantity!=""?parseFloat(item.suppliedQuantity):0
|
|
let data ={
|
workstationId: that.feedMainInfo.workstationId,
|
//workstationNo : that.feedMainInfo.workstationNo,
|
stockId: item.stockId,
|
joinStockOrderId: item.id,
|
suppliedQuantity: suppliedQuantity,
|
partId: item.partId,
|
partNo: item.partNo,
|
partBatchNo: item.partBatchNo,
|
systemNo: item.systemNo,
|
partName: item.partName,
|
unit: item.partUnit ? item.partUnit : '',
|
//ifsBatchNo:item.ifsBatchNo ,//ifs批次号
|
|
}
|
feedList.push(data)
|
|
});
|
const feedIn = {
|
feeds: feedList,
|
customOrderNo: that.feedMainInfo.customOrderNo,
|
feedingFrom: 'joinStocker',
|
operationTaskId: that.feedMainInfo.optaskId,
|
source: undefined
|
}
|
that.$u.api.pigxFeed.addFeed(feedIn).then(res => {
|
|
if (res.code == 0) {
|
uni.showModal({
|
title: '提示',
|
content: '提交成功',
|
showCancel: false,
|
success: function() {
|
that.list = []
|
|
}
|
})
|
} else {
|
uni.showModal({
|
title: '提示',
|
content: '提交失败',
|
showCancel: false,
|
success: function() {
|
|
}
|
})
|
}
|
|
})
|
},
|
toFeedRecord() {
|
|
if(this.feedMainInfo.workstationNo==""||this.feedMainInfo.workstationNo==undefined||this.feedMainInfo.workstationNo=="undefined")
|
{
|
this.$u.toast('请先选择工作站')
|
return
|
}
|
|
uni.navigateTo({
|
url: '/pages/product/feed/feedRecordList?workstationId='+this.feedMainInfo.workstationId
|
})
|
},
|
setLocation(location) {
|
this.feedMainInfo.feedLocId = location.id
|
this.feedMainInfo.feedLocNo = location.locNo
|
this.feedMainInfo.feedLocName = location.locName
|
},
|
setWorkstation(workstation) {
|
this.feedMainInfo.workstationId = workstation.id
|
this.feedMainInfo.workstationNo = workstation.workstationNo
|
this.feedMainInfo.workstationName = workstation.name
|
},
|
setOptask(task) {
|
this.feedMainInfo.optaskId = task.id
|
this.feedMainInfo.optaskNo = task.optaskNo
|
this.feedMainInfo.partId = task.partId
|
this.feedMainInfo.partNo = task.partNo
|
this.feedMainInfo.partName = task.partName
|
this.feedMainInfo.quality = task.plannedQuantity
|
this.feedMainInfo.customerOrderNo=task.customerOrderNo
|
},
|
toLocation() {
|
|
if(this.feedMainInfo.workstationNo==""||this.feedMainInfo.workstationNo==undefined||this.feedMainInfo.workstationNo=="undefined")
|
{
|
this.$u.toast('请先选择工作站')
|
return
|
}
|
|
uni.navigateTo({
|
url: '/pages/product/feed/locationList?workstationNo='+this.feedMainInfo.workstationNo
|
})
|
},
|
toOptask() {
|
|
|
if(this.feedMainInfo.workstationNo==""||this.feedMainInfo.workstationNo==undefined||this.feedMainInfo.workstationNo=="undefined")
|
{
|
this.$u.toast('请先选择工作站')
|
return
|
}
|
|
|
uni.navigateTo({
|
url: '/pages/product/feed/optaskList?workstationNo='+this.feedMainInfo.workstationNo
|
})
|
},
|
toWorkstation() {
|
uni.navigateTo({
|
url: '/pages/product/feed/workstationList'
|
})
|
},
|
loadList(sanCode) {
|
let that = this
|
if(sanCode!="")
|
{
|
//根据扫入的字符串信息,判断扫的是条形码,还是二维码
|
let batchNo=''
|
if (sanCode.indexOf('lot_batch_no') != -1) {
|
// 二维码
|
const scanContentJson = JSON.parse(
|
sanCode.replace(/\n/g, '').replace(/\s*/g, '')
|
)
|
const partNo= scanContentJson.part_no
|
const ifsBatchNo = scanContentJson.lot_batch_no
|
batchNo=scanContentJson.sn_no
|
if(!(batchNo && batchNo!=null && batchNo!='' && batchNo!='null')){
|
batchNo=''
|
}
|
|
} else {
|
// 条形码
|
batchNo = sanCode
|
|
}
|
|
let params=Object.assign(
|
{ current: 1, size: 50 },
|
{operationTaskId:this.feedMainInfo.optaskId},
|
{partBatchNo:batchNo}
|
)
|
|
//获取配盘物料
|
this.$u.api.pigxFeed.fetchJoinStockOrderList(params).then(res => {
|
let reList = []
|
reList = res.data.records;
|
if(reList.length==0)
|
{
|
uni.showToast({
|
title: "未扫到配盘物料信息",
|
icon: "none"
|
});
|
return
|
}
|
let flag = true
|
for (let i = 0; i < reList.length; i++) {
|
const exist = that.list.find(
|
(el) => el.partBatchNo == reList[i].partBatchNo
|
)
|
if (exist) {
|
flag = false
|
}
|
}
|
if(!flag){
|
uni.showToast({
|
title: "零件批次已存在",
|
icon: "none"
|
});
|
return
|
}else{
|
reList.map((item) => {
|
item.suppliedQuantity = item.reservedQuantity
|
that.list.push(item)
|
});
|
}
|
});
|
|
//根据工作站id查询线边仓
|
/*this.$u.api.pigxFeed.getStockByWorkstationId(params).then(res => {
|
let reList = []
|
reList = res.data.records;
|
if(reList.length==0)
|
{
|
uni.showToast({
|
title: "未扫到相应投料信息",
|
icon: "none"
|
});
|
return
|
}
|
|
reList.map((item) => {
|
item.suppliedQuantity = item.reservedQuantity
|
that.list.push(item)
|
});
|
});*/
|
}
|
|
this.$forceUpdate();
|
|
},
|
deleteHandle(obj) {
|
let that = this
|
uni.showModal({
|
title: '提示',
|
content: '此操作将删除该扫码信息, 是否继续?',
|
success: function(res) {
|
if (res.confirm) {
|
|
that.list.map((item, index) => {
|
if (obj.id == item.id) {
|
that.list.splice(index, 1)
|
}
|
});
|
}
|
}
|
});
|
},
|
search(value) {
|
this.list = [];
|
this.query.current = 1;
|
this.query.username = value;
|
this.loadList();
|
}
|
}
|
};
|
</script>
|
<style lang="scss" scoped>
|
.productfeed-index-bg{
|
background-color: #F6F9FF;
|
background-image: url('~@/static/custom/product/productBg.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;
|
}
|
|
.productfeed-index-param{
|
padding: 40rpx 30rpx 20rpx 30rpx;
|
.productfeed-index-param-title{
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
margin-bottom: 30rpx;
|
.title-label{
|
margin-left: 14rpx;
|
font-size: 34rpx;
|
font-weight: bold;
|
color: #283E65;
|
}
|
}
|
.productfeed-index-param-view{
|
height: 300rpx;
|
background-color: #fff;
|
border-radius: 10rpx;
|
padding:0rpx 23rpx;
|
margin-bottom: 30rpx;
|
.productfeed-index-param-item{
|
height: 100rpx;
|
border: 1px solid #ADC8E4;
|
line-height: 100rpx;
|
display:flex;
|
justify-content: space-between;
|
border: none;
|
.productfeed-index-param-item-left{
|
.item-one{
|
font-size: 30rpx;
|
color: #4F4F4F;
|
}
|
}
|
.productfeed-index-param-item-right{
|
.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;
|
}
|
}
|
}
|
.param-extra{
|
border-bottom: 1px solid #EDEDED;
|
}
|
}
|
}
|
|
.productfeed-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 .productfeed-index-scroll-list{
|
height:calc(100vh - var(--window-top) - var(--window-bottom) - 756rpx);
|
width:100%;
|
}
|
.productfeed-index-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: 332rpx;
|
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/product/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/product/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{
|
position: absolute;
|
background-image: url('~@/static/custom/product/del-icon.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:60rpx;
|
width:140rpx;
|
right:0;
|
top:0;
|
display: flex;
|
justify-content: flex-end;
|
padding-top: 10rpx;
|
padding-right: 18rpx;
|
.header-item-toolbar-del-icon{
|
background-image: url('~@/static/custom/product/icon_dele.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:25rpx;
|
width:22rpx;
|
margin-top: 5rpx;
|
}
|
.header-item-toolbar-del-text{
|
margin-left:7rpx;
|
height: 23rpx;
|
font-size: 24rpx;
|
color: #FFFFFF;
|
}
|
}
|
}
|
|
.content-body{
|
height:200rpx;
|
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/finishProductIn/icon_edit.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height:26rpx;
|
width:26rpx;
|
}
|
::v-deep .uni-input-input{
|
color:#D35651;
|
}
|
}
|
}
|
}
|
}
|
|
.productfeed-footer{
|
padding: 0rpx 30rpx 0rpx 30rpx;
|
margin-bottom: 20rpx;
|
display: flex;
|
justify-content: space-between;
|
.btn-left{
|
width: 310rpx;
|
height: 90rpx;
|
background: #DBE5F3;
|
border: 1px solid #BFCFE4 !important;
|
box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(110,120,135,0.3);
|
border-radius: 16rpx;
|
font-size: 40rpx;
|
font-weight: bold;
|
color: #404761;
|
}
|
.btn-left:after{
|
border:none !important;
|
}
|
.btn-right{
|
width: 310rpx;
|
height: 90rpx;
|
background: #214DED;
|
box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(4,49,212,0.3);
|
border-radius: 16rpx;
|
font-size: 40rpx;
|
font-weight: bold;
|
color: #FEFEFE;
|
}
|
}
|
.scan{
|
width: 60rpx;
|
height: 60rpx;
|
font-size: 60rpx;
|
color: #3281ff;
|
}
|
</style>
|