<template>
|
<view class="overflow" style="padding-bottom: 100px">
|
<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>
|
<!-- form -->
|
<u-form labelPosition="left" label-width="150rpx" :model="warehouse" ref="warehouseRef">
|
<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_Code"
|
ref="materialRef" placeholder="请扫码录入"
|
:focus="true"
|
@blur="analysisMaterialCode" style="font-weight: bolder;margin-left: 15rpx;"
|
class="width padding_left25rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="12">
|
<u-form-item label="物料编号:" prop="materialCode" required
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model="warehouse.materialCode" placeholder="请录入或扫码"
|
style="font-weight: bolder;margin-left: 15rpx;font-size: 34rpx;"
|
class="width padding_left30rpx"
|
@confirm="containerBlur">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="12">
|
<u-form-item label="目标库位:" prop="targetContainerCode" required
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model="warehouse.targetContainerCode" placeholder="请录入或扫码"
|
style="font-weight: bolder;margin-left: 15rpx;font-size: 34rpx;"
|
class="width padding_left30rpx"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
|
<u-col span="12">
|
<u-form-item label="物料单据:" prop="materialSlip"
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model="warehouse.materialSlip" placeholder="请录入或扫码"
|
style="font-weight: bolder;margin-left: 15rpx;font-size: 34rpx;"
|
class="width padding_left30rpx"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
|
<u-col span="12">
|
<u-form-item label="单据备注:" prop="headerTxt"
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<u-input v-model="warehouse.headerTxt" placeholder="请录入或扫码"
|
style="font-weight: bolder;margin-left: 15rpx;font-size: 34rpx;"
|
class="width padding_left30rpx"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<!-- <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="请扫码录入" @blur="materialBlur" :clearable="false" style="font-weight: bolder;margin-left: 15rpx;"
|
@focus="warehouse.materialCode=''"
|
class="width padding_left25rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row> -->
|
</u-row>
|
</u-form>
|
<!-- 列表 -->
|
<view>
|
<u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex" :options="options"
|
@click="longpress" @open="open" @close="close"
|
style="margin-bottom: 8rpx;">
|
<view class="item u-border-bottom">
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
<view class="title-wrap">
|
<view :class="item.checked ? 'bg_item' : ''"
|
class="fontSize32rpx width margin_auto background_fff padding10 border_radius margin_bottom10rpx relative box_sizing transition">
|
<u-row>
|
<u-col span="12" class="flex align-center">
|
<view>
|
<u-checkbox v-model="item.checked" size="28px"></u-checkbox>
|
</view>
|
<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.materialCode}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="8">
|
<view class="" style="padding: 10rpx 0 10rpx 10rpx;color: #808080;">
|
批次:{{item.batchNo}}
|
</view>
|
</u-col>
|
<u-col span="4">
|
<view class="" style="padding: 10rpx 0 10rpx 10rpx;color: #808080;">
|
数量:{{item.quantity}}
|
</view>
|
</u-col>
|
</u-row>
|
|
<u-row>
|
<u-col span="4">
|
库位:{{item.containerCode}}
|
</u-col>
|
<u-col span="5">
|
SAP位置:{{item.sap_Location}}
|
</u-col>
|
<u-col span="3">
|
<view class="" style="padding: 10rpx 0 10rpx 10rpx;color: #808080;">
|
<u-input class="border_bottom_f18202 width text-left fontSize32rpx padding_left10rpx"
|
v-model="item.unBindQuantity" type="number" @blur="changeNum(item)"
|
placeholder="请输入移库数量" ></u-input>
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
检验状态: {{item.checkStatusName}}
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
</view>
|
</u-swipe-action>
|
</view>
|
<modal-code :rescode='rescode' :resmessage='resmessage' ref="resmodal"/>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom">
|
<!-- <view class="pop "> -->
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.materialCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.materialName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">批次</text>
|
<text>{{materlist.batchNo}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">PO</text>
|
<text>{{materlist.purchaseNo}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">行号</text>
|
<text>{{materlist.lineNumber}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">供应商</text>
|
<text>{{materlist.supplierNo}}{{materlist.supplierName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">数量</text>
|
<text>{{materlist.unBindQuantity}}</text>
|
</view>
|
<!-- </view> -->
|
<view class="margin_top140rpx">
|
<!-- <button-modal :subShow='true' garmenTitle='打印' @submit='init' @reset='rest' /> -->
|
|
<button-modal :cleaningShow='true' allTitle='蓝牙打印' cleaningTitle='斑马打印' @allsubmit="init(1)" @submit='init(2)'/>
|
|
</view>
|
</u-popup>
|
<!-- 底部确定按钮 -->
|
<button-modal :empTytowerShow='true' cleaningTitle="返回" garmenTitle='移库' @submit='submit' @reset='rest' />
|
</view>
|
</template>
|
<script>
|
import {getContainerMaterial, inventoryTransfer} from '@/api/putIn/untie.js'
|
import BluePrint from '@/pages/print/bluePrint.js'
|
import ButtonModal from '../../components/buttonModal.vue'
|
import ModalCode from '../../components/ModalCode.vue'
|
import {getAttrValue} from '@/utils/tool.js'
|
import {addPrintRecord} from '../../api/print.js'
|
import printComp from '@/mixins/printLabelSingle.js'
|
import printBanma from '@/mixins/printBanma.js'
|
|
export default {
|
mixins: [printComp,printBanma],
|
data() {
|
return {
|
operator: '',
|
warehouse: {
|
containerCode: '',
|
materialCode: '',
|
targetContainerCode:'',
|
materialSlip:"",
|
headerTxt:"",
|
isUseForMove:true //表示是 移库 【Editby shaocx,2023-05-14】
|
},
|
singlist:[], //详情列表
|
rescode: 0,
|
resmessage: '',
|
options: [{
|
text: '打印',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
}
|
],
|
detailshow: false,
|
materlist: {}
|
}
|
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onLoad() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
},
|
onReady() {
|
|
},
|
methods: {
|
//解析物料码
|
analysisMaterialCode() {
|
////debugger
|
if(!this.warehouse.materialCode_Code) {
|
// uni.showModal({
|
// title: '提示',
|
// content: '物料编号不能为空',
|
// showCancel: false
|
// })
|
this.warehouse.materialCode='';
|
return
|
}
|
if(this.warehouse.materialCode_Code.length > 50) {
|
this.warehouse.materialCode = getAttrValue(this.warehouse.materialCode_Code,'PARTSNUMBER')
|
//请求后台
|
this.containerBlur();
|
}
|
},
|
//回库
|
rest() {
|
uni.navigateTo({
|
//url:`/pages/sort/return?containerCode=${this.warehouse.containerCode}`
|
url:`/pages/index/index`
|
})
|
|
},
|
//获取print date print time
|
getCurrentDate() {
|
let date = new Date();
|
let year = date.getFullYear(); //年
|
let month = date.getMonth() + 1; //月
|
month = month >= 10 ? month : '0' + month;
|
let day = date.getDate(); //日
|
day = day >= 10 ? day : '0' + day;
|
let hour = date.getHours() //时
|
hour = hour >= 10 ? hour : '0' + hour;
|
let min = date.getMinutes(); //分
|
min = min >= 10 ? min : '0' + min;
|
let second = date.getSeconds(); //秒
|
second = second >= 10 ? second : '0' + second;
|
return {
|
date: `${day}.${month}.${year}`,
|
time: `${hour}:${min}:${second}`,
|
formate:`${year}/${month}/${day}`
|
}
|
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
},
|
close(index) {
|
this.singlist[index].show = false;
|
},
|
//物料详情
|
longpress(index, eindex) {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
},
|
//标签重新打印
|
init(param) {
|
const arr = ['materialCode','unBindQuantity'];
|
const arrzw = ['物料编号','本次下架数量']
|
let isAllow = ''
|
Object.keys(this.materlist).forEach(item => {
|
if(arr.includes(item)) {
|
if(!this.materlist[item]) {
|
isAllow = arr.indexOf(item)
|
// this.rescode = 400
|
// this.resmessage = `${arrzw[isAllow]}为空,不能继续打印`
|
// this.resmessage = `${item}为空,不能继续打印`
|
// this.$refs.resmodal.show = true
|
return
|
}
|
}
|
})
|
if(isAllow!=''){
|
this.detailshow = false
|
this.rescode = 400
|
this.resmessage = `${arrzw[isAllow]}为空,不能继续打印`
|
this.$refs.resmodal.show = true
|
return
|
}
|
if(this.materlist.unBindQuantity <= 0 || this.materlist.unBindQuantity > this.materlist.quantity){
|
this.detailshow = false
|
this.rescode = 400
|
this.resmessage = `数量不符合规范,不能继续打印`
|
this.$refs.resmodal.show = true
|
return
|
}
|
|
|
this.materlist.quantityLable = this.materlist.unBindQuantity // 打印标贴数量
|
|
if(param==1){
|
this.printComp('','PO')
|
}else{
|
this.printBanma()
|
}
|
|
},
|
materialBlur() {
|
if(this.warehouse.materialCode==''){
|
return
|
}
|
if(this.warehouse.materialCode.length < 50) {
|
return
|
}
|
// 错误码提示
|
let str = this.warehouse.materialCode.replace(/\s/g,'')
|
if(str.indexOf('LOTNO') == -1 || str.indexOf('PARTSNUMBER') == -1){
|
uni.showToast({
|
title:'二维码格式错误',
|
icon:'none',
|
duration: 2000
|
})
|
return
|
}
|
// //debugger
|
//获取批次
|
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.materialCode == 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
|
}
|
},
|
containerBlur() {
|
if(this.warehouse.materialCode == '' || this.singlist.length > 0) {
|
return
|
}
|
////debugger
|
getContainerMaterial(this.warehouse).then(res => {
|
if(res.data==null || res.data.length == 0) {
|
this.rescode = 400
|
this.resmessage = '该物料'+this.warehouse.materialCode+'没有找到库存'
|
this.$refs.resmodal.show = true
|
return
|
}
|
//给所有的材料一个未选中的状态
|
res.data.map(item => {
|
item.checked = false,
|
item.unBindQuantity = ''
|
})
|
this.singlist = res.data;
|
})
|
},
|
//解绑数量失焦事件
|
changeNum(option) {
|
// if(option.unBindQuantity > 0) {
|
// option.unBindQuantity = Number(option.unBindQuantity.toString().match(/^\d+(?:\.\d{0,2})?/)) // 保留两位小数
|
// }
|
|
//判断是否勾选,如果勾选了,就要对数量校验
|
if(!option.checked){
|
return
|
}
|
if(option.unBindQuantity == '') {
|
this.rescode = 400
|
this.resmessage = '移库数量不能为空'
|
this.$refs.resmodal.show = true
|
}
|
|
if(option.unBindQuantity <= 0) {
|
this.rescode = 400
|
this.resmessage = '移库数量必须大于0'
|
this.$refs.resmodal.show = true
|
}
|
|
if(option.unBindQuantity > option.quantity) {
|
this.rescode = 400
|
this.resmessage = '移库数量不能大于库存数量'
|
this.$refs.resmodal.show = true
|
}
|
},
|
//确认解绑
|
submit() {
|
if(this.warehouse.targetContainerCode==''){
|
this.rescode = 400
|
this.resmessage = '目标库位不能为空'
|
this.$refs.resmodal.show = true
|
return
|
}
|
const filterArr = this.singlist.filter(item => item.checked);
|
//判断选中的里面是否存在解绑的数量不符合规范的
|
const index = filterArr.findIndex(item => item.unBindQuantity == '' || item.unBindQuantity <= 0 || item.unBindQuantity > item.quantity)
|
if(index > -1) {
|
this.rescode = 400
|
this.resmessage = '移库数量不符合要求'
|
this.$refs.resmodal.show = true
|
return
|
}
|
|
const warehousOrderDetails = filterArr.reduce((curr,item) => {
|
curr.push({
|
containerCode:item.containerCode,
|
targetContainerCode:this.warehouse.targetContainerCode,
|
materialCode:item.materialCode,
|
batchNo: item.batchNo,
|
quantity: Number(item.unBindQuantity),
|
remarks: '',
|
sap_Location:item.sap_Location,
|
id:item.id||'',
|
materialSlip:this.warehouse.materialSlip,
|
headerTxt:this.warehouse.headerTxt
|
})
|
return curr;
|
},[])
|
const params = warehousOrderDetails
|
|
uni.showModal({
|
title: '提示',
|
content: '是否确认移库?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
inventoryTransfer(params).then(res => {
|
this.singlist = [];
|
this.warehouse.containerCode = ''
|
this.warehouse.materialSlip = ''
|
this.warehouse.headerTxt = ''
|
this.rescode = 200
|
this.resmessage = '移库成功'
|
this.$refs.resmodal.show = true
|
|
//重新加载数据
|
this.containerBlur();
|
})
|
} else if (res.cancel) {
|
}
|
})
|
});
|
}
|
}
|
}
|
</script>
|
<style lang="scss">
|
.content {
|
height: 500rpx;
|
overflow-y: scroll;
|
width: 100%;
|
padding: 15rpx;
|
box-sizing: border-box;
|
.content-item {
|
padding: 15rpx;
|
background-color: #fff;
|
margin-bottom: 15rpx;
|
border-radius: 8rpx;
|
font-size: 16px;
|
}
|
}
|
.bg_item {
|
background: #FFEBCD !important;
|
}
|
</style>
|