<template>
|
<view class="has-foot">
|
<form>
|
<view class="flex padding-sm justify-center">
|
<view class="text-orange text-center">请按下列步骤进行 “塑料粒子灌桶入库” </view>
|
</view>
|
<!-- step1:上新料 -->
|
<view class="cu-form-group">
|
<view class="title">1.新料(袋装)接驳站点:</view>
|
<input placeholder="请扫描接驳站点条码" v-model="bagStaBarcode" ></input>
|
</view>
|
<view class="cu-bar btn-group top margin-top">
|
<button class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="queryBagLocItem">1.呼叫新料(袋装)</button>
|
</view>
|
<!-- step2:上空桶 -->
|
<view class="cu-form-group margin-top">
|
<view class="title">2.空桶接驳站点:</view>
|
<input placeholder="请扫描接驳站点条码" v-model="palletStaBarcode"></input>
|
</view>
|
<view class="cu-bar btn-group top margin-top">
|
<button class="cu-btn text-blue line-blue shadow" :disabled="repeatClick" @click="callEmptyPallet">2.呼叫空桶</button>
|
</view>
|
<!-- step3:入库 -->
|
<view class="cu-form-group margin-top">
|
<view class="title">3.待入库物料编码:</view>
|
<input placeholder="" v-model="matNr"></input>
|
<text class='cuIcon-search text-blue' @click="search"></text>
|
</view>
|
<view class="flex solid-bottom padding-sm justify-between">
|
<text class="text-grey margin-left">{{ makTx }}</text>
|
</view>
|
<view class="cu-form-group">
|
<view class="title"> 待入库桶号:</view>
|
<input placeholder="" v-model="palletBarcode"></input>
|
<text class='cuIcon-search text-blue' @click="search"></text>
|
</view>
|
<view class="flex solid-bottom padding-sm justify-between">
|
<view class="text-grey margin-left" > 待入库物料数量:1桶</view>
|
</view>
|
<view class="flex solid-bottom padding-sm justify-between">
|
<view class="text-grey margin-left" > 待入库库区:2#-1F 桶装新料储位</view>
|
</view>
|
<view class="cu-bar btn-group top margin-top">
|
<button class="cu-btn bg-green shadow-blur" :disabled="repeatClick" @click="fullInStock">3.装桶完成,点击入库</button>
|
</view>
|
</form>
|
|
<!-- 新料库存信息弹窗 -->
|
<view class="cu-modal" :class="modalName=='bagModal'?'show':''" @click="closeModal">
|
<view class="cu-dialog" @click.stop>
|
<view class="cu-bar bg-white justify-between">
|
<view class="title text-bold">新料(袋装)库存信息</view>
|
<view class="content" @click="closeModal">
|
<text class="cuIcon-close text-grey"></text>
|
</view>
|
</view>
|
<view class="padding-lr" style="max-height: 70vh; overflow-y: auto;">
|
<block v-for="(item, index) in bagList" :key="index">
|
<view class="cu-list menu-avatar margin-bottom-sm">
|
<view class="cu-item flex align-start">
|
<view class="content flex-1 text-left">
|
<text class="text-grey padding-right-xs">库位:{{item.locId}} </text>
|
<text class="text-grey padding-right-xs">物料:{{item.makTx}} </text>
|
<text class="text-grey padding-right-xs">托盘号:{{item.palletId}} </text>
|
<text class="text-orange">数量:{{item.anfme}} </text>
|
</view>
|
<view class="action">
|
<button class="cu-btn bg-blue shadow-blur sm" @click.stop="callBagByAGV(item)">上料</button>
|
</view>
|
</view>
|
</view>
|
</block>
|
</view>
|
</view>
|
</view>
|
|
<!-- <view class="cu-list det menu sm-border padding">
|
<block v-for="(item, index) in list" :key="index">
|
<view class="cu-bar bg-white solid-bottom margin-top-sm">
|
<view class="action">
|
<view class="index">
|
{{index+1}}
|
</view>
|
<view class="text-blue">
|
{{`${item.maktx}`}}
|
</view>
|
</view>
|
<view class="action" >
|
<text @click="remove(index)" class="cuIcon-close text-red" style="font-size: 24px;"></text>
|
</view>
|
</view>
|
|
<view class="cu-item">
|
<view class="content">
|
<text class="text-black">ASN:</text>
|
</view>
|
<view class="action">
|
<text class="text-grey ">{{item.asnCode}}</text>
|
</view>
|
</view>
|
<view class="cu-item">
|
<view class="content">
|
<text class="text-black">批次:</text>
|
</view>
|
<view class="action">
|
<text class="text-grey ">{{item.batch}}</text>
|
</view>
|
</view>
|
|
|
<view class="cu-item">
|
<view class="content">
|
<text class="text-black">收货数量:</text>
|
</view>
|
<view class="action">
|
<text class="text-grey ">{{item.anfme}}</text>
|
</view>
|
</view>
|
|
</block>
|
</view> -->
|
|
</view>
|
</template>
|
|
<script>
|
import {
|
request
|
} from '../../common/request.js'
|
import {
|
mapState,
|
mapMutations,
|
mapActions,
|
mapGetters
|
} from 'vuex';
|
export default {
|
data() {
|
return {
|
// barcode: '',
|
areaName: '',
|
locCode: '',
|
container: '',
|
list: [],
|
bagList: [],
|
range: [],
|
curCode: '',
|
whAreaId:'',
|
repeatClick: false,
|
palletBarcode: '',
|
palletTypeId: '',
|
palletTypeRange: [],
|
bagStaBarcode: '',
|
modalName: '',
|
palletStaBarcode: '',
|
matNr: '',
|
makTx: '',
|
transferStationNo: '',
|
}
|
},
|
computed: {
|
...mapState('user', ['dynamicFields']),
|
},
|
mounted() {
|
this.getRece()
|
this.getPalletType()
|
this.whAreaId = uni.getStorageSync('whAreaId')
|
},
|
methods: {
|
selChange(val) {
|
uni.setStorageSync('whAreaId', val)
|
},
|
async search() {
|
let that = this
|
const {
|
code,
|
data,
|
msg
|
} = await request('/staBind/list', {
|
sta: this.barcode
|
})
|
if (code === 200) {
|
if(data.list.length >0){
|
that.container = data.barcode
|
that.list = data.list
|
}
|
that.range = data.warehouseAreasList.map(item => ({
|
value: item.id,
|
text: item.name
|
}));
|
that.whAreaId = data.area
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: "none",
|
})
|
}
|
},
|
|
remove(index) {
|
this.list.splice(index, 1);
|
},
|
clear() {
|
this.list = []
|
this.container = ''
|
this.barcode = ''
|
},
|
|
open() {
|
this.$refs.popup.open()
|
},
|
|
close() {
|
this.$refs.popup.close()
|
},
|
|
popupSubmit() {
|
this.$refs.popup.close()
|
},
|
itemChange(el) {
|
this.curCode = el
|
},
|
|
// 选择新料(袋装)库存,送至灌桶站点
|
async queryBagLocItem() {
|
if(this.bagStaBarcode === '' || this.bagStaBarcode === null){
|
uni.showToast({
|
title: "新料 (袋装) 接驳站点不能为空!!!",
|
icon: "none",
|
})
|
return ;
|
}
|
this.repeatClick = true
|
try{
|
const { code, data, msg } = await request('/inventory/details', {
|
wareHouseAreaId: '2--1-5' // TODO:固定待后续替换
|
})
|
if (code === 200) {
|
if(data && data.length > 0){
|
// 展示查询到的数据
|
this.bagList = data
|
// 打开弹窗
|
this.modalName = 'bagModal'
|
} else {
|
uni.showToast({
|
title: '未查到新料(袋装)库存',
|
icon: 'none'
|
})
|
}
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: 'none',
|
})
|
}
|
} catch (error) {
|
console.error('请求错误:', error)
|
uni.showToast({
|
title: '查询失败:' + (error.message || '未知错误'),
|
icon: 'none'
|
})
|
}finally{
|
this.repeatClick = false
|
}
|
},
|
|
// 关闭弹窗
|
closeModal() {
|
this.modalName = null
|
},
|
|
// 为新料(袋装)上料呼叫 AGV
|
async callBagByAGV(item) {
|
console.log('AGV上料:新料(袋装), 数据:', item)
|
if(this.item === '' || this.item === null){
|
uni.showToast({
|
title: "请先选择库位出库",
|
icon: "none",
|
})
|
return ;
|
}
|
this.repeatClick = true
|
try{
|
const { code, data, msg } = await request('/check/non/order', {
|
transferStationNo: this.transferStationNo || this.bagStaBarcode,
|
locNo: item.locId
|
})
|
if (code === 200) {
|
uni.showToast({
|
title: '新料(袋装)上料中',
|
icon: 'success'
|
})
|
// 更新物料编码、物料名称
|
this.matNr = item.matNr || '',
|
this.makTx = '待入库物料名称:' + (item.makTx || '')
|
this.closeModal()
|
// // 从列表中移除该项
|
// const index = this.bagList.findIndex(i => i.palletId === item.palletId)
|
// if (index > -1) {
|
// this.bagList.splice(index, 1)
|
// }
|
// // 如果列表为空,关闭弹窗
|
// if (this.bagList.length === 0) {
|
// this.closeModal()
|
// }
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: 'none'
|
})
|
}
|
} catch (error) {
|
console.error('AGV 呼叫失败:', error)
|
uni.showToast({
|
title: 'AGV 呼叫失败',
|
icon: 'none'
|
})
|
} finally {
|
this.repeatClick = false
|
}
|
},
|
|
// 呼叫空桶
|
async callEmptyPalletFromBag() {
|
// 使用袋装接驳站点信息调用空托出库接口
|
if(this.palletTypeId === '' || this.palletTypeId === null){
|
uni.showToast({
|
title: "请先选择容器类型",
|
icon: "none",
|
})
|
return ;
|
}
|
this.repeatClick = true
|
try{
|
const { code, data, msg } = await request(
|
'/callForEmptyContainers',
|
{
|
staNo: this.bagBarcode,
|
type: this.palletTypeId
|
}
|
)
|
if (code === 200) {
|
uni.showToast({
|
title: '呼叫空托盘中,请稍作等待'
|
})
|
this.bagBarcode = ''
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: 'none',
|
position: 'top'
|
})
|
}
|
}finally{
|
this.repeatClick = false
|
}
|
},
|
|
// 满桶入库
|
async fullInStock() {
|
console.log('满桶入库:新料(袋装), 数据:', item)
|
if(this.item === '' || this.item === null){
|
uni.showToast({
|
title: "请先选择库位出库",
|
icon: "none",
|
})
|
return ;
|
}
|
this.repeatClick = true
|
try{
|
const { code, data, msg } = await request('/AGV/task/start', {
|
staNo: this.bagBarcode,
|
palletBarcode: item.palletId
|
})
|
if (code === 200) {
|
uni.showToast({
|
title: '新料(袋装)上料中',
|
icon: 'success'
|
})
|
// 更新物料编码、物料名称
|
this.matNr = item.matnrCode || ''
|
this.makTx = ' 待入库物料名称:' + (item.makTx || '')
|
|
// 从列表中移除该项
|
const index = this.bagList.findIndex(i => i.palletId === item.palletId)
|
if (index > -1) {
|
this.bagList.splice(index, 1)
|
}
|
// 如果列表为空,关闭弹窗
|
if (this.bagList.length === 0) {
|
this.closeModal()
|
}
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: 'none'
|
})
|
}
|
} catch (error) {
|
console.error('AGV 呼叫失败:', error)
|
uni.showToast({
|
title: 'AGV 呼叫失败',
|
icon: 'none'
|
})
|
} finally {
|
this.repeatClick = false
|
}
|
},
|
|
async callEmptyPallet() {
|
if(this.staBarcode === '' || this.palletBarcode === null){
|
uni.showToast({
|
title: "接驳站点不能为空",
|
icon: "none",
|
})
|
return ;
|
}
|
if(this.palletTypeId === '' || this.palletTypeId === null){
|
uni.showToast({
|
title: "请选择容器类型",
|
icon: "none",
|
})
|
return ;
|
}
|
this.repeatClick = true
|
try{
|
const { code, data, msg } = await request(
|
'/callForEmptyContainers',
|
{
|
staNo: this.palletBarcode,
|
type: this.palletTypeId
|
}
|
)
|
if (code === 200) {
|
uni.showToast({
|
title: '呼叫空托盘中,请稍作等待'
|
})
|
this.palletBarcode = ''
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: 'none',
|
position: 'top'
|
})
|
}
|
}finally{
|
this.repeatClick = false
|
}
|
},
|
|
async getPalletType() {
|
const { code, data, msg } = await request(
|
'/info/palletType/list',
|
{},
|
'get'
|
)
|
if (code === 200) {
|
this.palletTypeRange = data.map((item) => ({
|
value: item.value,
|
text:
|
item.group === null
|
? item.label
|
: item.group + '-- ' + item.label
|
}))
|
}
|
},
|
|
palletTypeChange(val) {
|
uni.setStorageSync('palletTypeId', val.value)
|
},
|
|
async confirm() {
|
if(this.barcode === '' || this.barcode ===null){
|
uni.showToast({
|
title: "接驳站点不能为空",
|
icon: "none",
|
})
|
return ;
|
}
|
if(this.whAreaId === '' || this.whAreaId ===null){
|
uni.showToast({
|
title: "目标库区不能为空",
|
icon: "none",
|
})
|
return ;
|
}
|
this.repeatClick = true
|
const {
|
code,
|
data,
|
msg
|
} = await request('/AGV/task/start',{
|
sta: this.barcode,
|
area: this.whAreaId
|
}
|
)
|
if (code === 200) {
|
uni.showToast({
|
title: '启动成功'
|
})
|
this.clear()
|
} else {
|
uni.showToast({
|
title: msg,
|
icon: "none",
|
})
|
}
|
this.repeatClick = false
|
},
|
|
async getRece() {
|
const {
|
code,
|
data,
|
msg
|
} = await request('/areas/receipt', {}, 'get')
|
if (code === 200) {
|
this.range = data.map(item => ({
|
value: item.id,
|
text: item.warehouseId$ + "-- " + item.name
|
}));
|
}
|
},
|
}
|
}
|
</script>
|
|
<style>
|
.index {
|
border: 1px solid #e54d42;
|
color: #e54d42;
|
border-radius: 50%;
|
display: block;
|
width: 50rpx;
|
height: 50rpx;
|
line-height: 48rpx;
|
text-align: center;
|
margin-right: 20rpx;
|
font-size: 30rpx;
|
}
|
|
.text-blue {
|
color: #0081ff !important;
|
|
}
|
|
.item {
|
position: relative;
|
display: flex;
|
min-height: 80upx;
|
align-items: center;
|
}
|
|
.uni-file-picker {
|
width: 100%;
|
margin-bottom: 10px;
|
}
|
|
.uni-select__selector {
|
z-index: 999;
|
}
|
|
.tj {
|
height: auto;
|
padding: 6px 8px;
|
display: inline-block;
|
border-radius: 6px;
|
}
|
|
.item {
|
display: flex;
|
justify-content: center;
|
}
|
|
.item .cu-btn {
|
font-size: 26upx;
|
}
|
</style>
|