<template>
|
<view class="overflow">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"></block>
|
<block slot="content">库位盘点</block>
|
</cu-custom>
|
<view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
<text class="fontSize12rpx"> 操作人:{{operator}} </text>
|
</view>
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="库位编号:" prop="Code" required
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<input v-model="warehouse.Code" placeholder="请录入或扫码" disabled
|
class="width padding_left25rpx" style="font-weight: bolder;margin-left: 15rpx;">
|
</input>
|
</u-form-item>
|
</u-col>
|
<!-- <u-select v-model="visibleContainer" :list="containerList" value-name="wareContainerCode" label-name="wareContainerCode" @confirm="handleConfirm"></u-select> -->
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="12">
|
<u-form-item label="物料编号:" style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model="warehouse.materialCode" placeholder="请扫码录入" @focus="warehouse.materialCode=''" @blur="materialBlur" :clearable="false" style="font-weight: bolder;margin-left: 15rpx;"
|
class="width padding_left25rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<view v-show="singlist.length > 0" style="height: 450rpx;margin-bottom: 180rpx;overflow-y: scroll;">
|
<u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex"
|
@click="longpress" @open="open" :options="options">
|
<view class="item u-border-bottom">
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
<view class="title-wrap">
|
<view :class="item.edit?'clickactive':''"
|
class="fontSize32rpx width margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
|
<u-row style="margin-bottom: 15rpx;">
|
<u-col span="11" class="flex">
|
<view class="flex justify-center align-center"
|
style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;">
|
{{eindex+1}}
|
</view>
|
<view class="color_f18202 padding_left10rpx">
|
{{item.wareMaterialCode}} - {{item.batchNo}}
|
</view>
|
</u-col>
|
<u-col span='1' v-if='sign'>
|
<u-icon name='question-circle' color='#f18202'></u-icon>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view style="padding: 5px 0 5px 10px;color: #808080;">
|
SAP:{{item.sap_Location}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<!-- <u-col span="6">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
库存数:{{item.inventoryQuantity}}
|
</view>
|
</u-col> -->
|
<u-col span="6">
|
<input
|
class="border_bottom_f18202 width text-left fontSize32rpx padding_left10rpx"
|
v-model="item.quantity" type="number" @blur="changeNum(item)"
|
placeholder="请输入实盘数量" />
|
</u-col>
|
<!-- 隐藏备注 [Editby shaocx,2023-04-21] -->
|
<!-- <u-col span="6">
|
<input
|
class="border_bottom_f18202 width text-left fontSize32rpx padding_left10rpx"
|
v-model="item.remarks"
|
placeholder="请输入备注" />
|
</u-col> -->
|
</u-row>
|
</view>
|
</view>
|
</view>
|
</u-swipe-action>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom" :closeable='true'>
|
<view class="pop ">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<!-- <scroll-view scroll-y="true" style="height: 50vh;"> -->
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.wareMaterialCode}}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">物料大类</text>
|
<text>{{materlist.wareMaterialCategoryName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料小类</text>
|
<text>{{materlist.wareMaterialTypeName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.wareMaterialName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">库存数量</text>
|
<text>{{materlist.inventoryQuantity}}</text>
|
</view>
|
<view class="flex justify-around transition margin_top10rpx margin_bottom10rpx">
|
<button class="width45 bg-ffe6c9 " @click="issue">问题标记</button>
|
<!-- <button class="width25 bg-grey" @click="reset">重置</button> -->
|
<!-- <button class="width25 bg-f18202 color_F2F2F2" @click="sub">确定</button> -->
|
</view>
|
<view class="" v-if="issueShow">
|
<view class="line flex justify-between">
|
<text class="text-gray">问题描述:</text>
|
<u-input v-model="materlist.remarks"></u-input>
|
</view>
|
<!-- <view
|
class="width margin_auto background_fff padding15 border_radius relative box_sizing transition">
|
<scroll-view scroll-y="true" style="height: 16vh;">
|
<u-upload :action="action" upload-text="送货单照片" :file-list="fileList1"
|
@on-success="successPic" @on-remove="remove">
|
</u-upload>
|
</scroll-view>
|
</view> -->
|
<view class="padding" style="border-top: 1px solid #e4e4e4;">
|
<button class="width bg-grey" @click="subissue">提交问题</button>
|
</view>
|
</view>
|
</view>
|
</u-popup>
|
</view>
|
<button-modal :subShow='true' garmenTitle='盘点完成' @submit='submit' />
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../components/buttonModal.vue'
|
import ModalCode from '../../components/ModalCode.vue'
|
import {getSquareMaterial,issueSubmit,finish,getContainerData} from '@/api/check/check.js'
|
import {getAttrValue} from '@/utils/tool.js'
|
export default {
|
data() {
|
return {
|
visibleContainer: false,
|
containerList: [],
|
detailshow: false,
|
renameFocus: false,
|
modalshow: false,
|
issueShow: false,
|
rescode: 0,
|
resmessage: "",
|
focuM: false,
|
focu: false,
|
sign: false, //问题标识
|
operator: '',
|
singlist: [], //物料详情
|
options: [
|
// {
|
// text: '详情',
|
// style: {
|
// backgroundColor: '#fc9f35'
|
// }},
|
],
|
materlist: [],
|
warehouse: {
|
Code: '',
|
materialCode: '',
|
orderId: ''
|
},
|
containerCode: '',
|
warehouseRules: {
|
Code: [{
|
required: true,
|
message: '容器编号不能为空',
|
trigger: 'blur'
|
}]
|
},
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
onLoad(option) {
|
if(option) {
|
this.warehouse.Code = option.wareContainerCode;
|
this.warehouse.orderId = option.orderId;
|
}
|
this.checkTask();
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
},
|
methods: {
|
//二维码内容处理 chenzhuwen
|
materialBlur() {
|
if(this.warehouse.materialCode==''){
|
return
|
}
|
if(this.warehouse.materialCode.length<50){
|
return
|
}
|
//获取批次
|
let lotNo = getAttrValue(this.warehouse.materialCode,'LOTNO')
|
//物料编号
|
this.warehouse.materialCode = getAttrValue(this.warehouse.materialCode,'PARTSNUMBER')
|
// SAP --- && item.sap_Location == SAP
|
let SAP = getAttrValue(this.warehouse.materialCode,'SAP')
|
//判断当前物料是否在盘点列表中
|
const index = this.singlist.findIndex(item => item.wareMaterialCode == this.warehouse.materialCode && item.batchNo == lotNo);
|
if(index > -1) {
|
this.singlist.unshift(...this.singlist.splice(index,1))
|
}else {
|
this.rescode = 400
|
this.resmessage = '此批次的物料不在盘点列表中'
|
this.$refs.resmodal.show = true
|
}
|
},
|
//验证容器
|
checkTask() {
|
this.containerCode = this.warehouse.Code;
|
this.focu = false
|
if (this.warehouse.Code !== '') {
|
getSquareMaterial(this.warehouse).then((res) => {
|
if (res.code == 200) {
|
if (res.data.length == 0) {
|
this.rescode = 400
|
this.resmessage = '暂无数据'
|
this.$refs.resmodal.show = true
|
return
|
}
|
|
res.data.map(item => {
|
item.quantity = '';
|
item.remarks = '';
|
item.edit = false;
|
item.show = false;
|
})
|
this.singlist = res.data
|
|
} else {
|
this.$refs.resmodal.show = true
|
this.rescode = res.code
|
this.resmessage = res.message
|
}
|
})
|
}else {
|
this.rescode = 400
|
this.resmessage = '库位好不能为空'
|
this.$refs.resmodal.show = true
|
}
|
},
|
//删除详情
|
longpress(index, eindex) {
|
this.singlist.forEach(item => {
|
item.materlist = [{
|
issue: ''
|
}]
|
})
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
},
|
//问题标记
|
issue() {
|
this.issueShow = true
|
},
|
//提交问题
|
subissue() {
|
this.issueShow = false
|
let params = {
|
wareContainerCode: this.materlist.wareContainerCode,
|
wareMaterialCode: this.materlist.wareMaterialCode,
|
batchNo: this.materlist.batchNo,
|
remarks: this.materlist.remarks,
|
orderId: this.materlist.orderId
|
}
|
issueSubmit(params).then((res) => {
|
// if(res.code==200){
|
// this.$refs.resmodal.show = true
|
// this.resmessage = res.message
|
// this.rescode = res.code
|
this.$u.toast(res.data)
|
// }
|
})
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
},
|
//改变组盘数量
|
changeNum(val) {
|
// 盘点允许0
|
// if (val.quantity && val.quantity > 0) {
|
if (val.quantity && val.quantity >= 0) {
|
// val.quantity = Number(val.quantity.toString().match(/^\d+(?:\.\d{0,2})?/)) // 保留两位小数
|
val.edit = true
|
this.$forceUpdate()
|
} else {
|
val.edit = false
|
this.$forceUpdate()
|
}
|
|
},
|
rest() {
|
this.warehouse.Code = ''
|
this.warehouse.materialCode = ''
|
this.singlist = []
|
},
|
//确认
|
submit() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
if(this.singlist.length == 0) {
|
this.$refs.resmodal.show = true
|
this.resmessage = '盘点材料列表为空'
|
this.rescode = res.code
|
return
|
}
|
|
const filterArr = this.singlist.filter(item =>item.edit == true)
|
const index = filterArr.findIndex(item => item.quantity == '' || item.quantity < 0)
|
if(index > -1) {
|
this.$refs.resmodal.show = true
|
this.resmessage = '请填写实盘数量'
|
this.rescode = res.code
|
return
|
}
|
let details = filterArr.reduce((curr,item) => {
|
curr.push({
|
wareMaterialCode: item.wareMaterialCode,
|
batchNo: item.batchNo,
|
checkQuantity: item.quantity,
|
orderId: item.orderId,
|
sap_Location:item.sap_Location
|
})
|
return curr
|
},[])
|
|
let params = {
|
wareContainerCode: this.warehouse.Code,
|
details
|
}
|
finish(params).then((res) => {
|
this.$refs.resmodal.show = true
|
this.resmessage = res.message
|
this.rescode = res.code
|
if (res.code == 200) {
|
uni.navigateTo({
|
url: `./square`
|
})
|
this.rest()
|
}
|
})
|
}
|
})
|
},
|
//容器回库
|
goBack() {
|
uni.navigateTo({
|
url:`/pages/sort/return?containerCode=${this.containerCode}&taskType=2`
|
})
|
}
|
},
|
|
}
|
</script>
|
|
<style lang="scss">
|
|
</style>
|