<template>
|
<view class="overflow">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"> </block>
|
<block slot="content">
|
<p>盘点</p>
|
</block>
|
</cu-custom>
|
<u-form labelPosition="left" label-width="180rpx" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx background_fff padding_left25rpx">
|
<u-col span="10">
|
<u-form-item required label="盘点单号:" prop="orderNo" class="uFormItem">
|
<u-input v-model.trim="warehouse.orderNo" class="width" :clearable="false" placeholder="请输入盘点单号"
|
@focus="focu = true" :focus="true" @confirm="checkTask(1)"></u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="2" @tap="containerFocus">
|
<span class="fontSize15rpx">选择</span>
|
<u-icon name="arrow-right" size="14" class="fontSize15rpx"></u-icon>
|
</u-col>
|
<view class="boxList" v-show="modalshow" @click="modalshow = false" @touchmove.stop>
|
<view class="innerWrap">
|
<ul v-for="(item, eindex) in wolist" :key="eindex">
|
<li @click="confirm2(eindex)">{{ item.text }}</li>
|
</ul>
|
</view>
|
</view>
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx background_fff padding_left25rpx">
|
<u-col span="12">
|
<u-form-item required label-width="230rpx" label="容器编号/库位:" prop="containerCode" class="uFormItem">
|
<u-input v-model="warehouse.containerCode" placeholder="请录入或扫码" @focus="warehouse.containerCode = ''"
|
@blur="checkTaskSncode" class="width" :clearable="false">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx background_fff padding_left25rpx">
|
<u-col span="12">
|
<u-form-item prop="SNCode" label="物料跟踪码:" class="uFormItem" label-width="180rpx">
|
<u-input v-model="warehouse.SNCode" @focus="warehouse.SNCode = ''" placeholder="请录入或扫码" @confirm="checkTaskSncode"
|
:clearable="false">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx background_fff padding_left25rpx">
|
<u-col span="12">
|
<u-form-item label="物料编号:" prop="materialCode" class="uFormItem">
|
<u-input v-model="warehouse.materialCode" placeholder="请扫码录入" @focus="warehouse.materialCode = ''"
|
@confirm="checkTask" :clearable="false" class="width">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
<modal-code ref="resmodal" :rescode="rescode" :resmessage="resmessage" />
|
<view class="margin_top10rpx" v-if="singlist.length > 0" style="margin-bottom: 200rpx">
|
<!-- <view>
|
<view class="text88 color_f18202 bg_ffffff">
|
盘点详情 容器总数: ??? 已盘点数: ???
|
</view>
|
</view> -->
|
|
<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 padding10 border_radius margin_bottom10rpx relative box_sizing transition">
|
<u-row>
|
<u-col span="12" class="flex">
|
<view class="flex justify-center align-center circkle06">
|
{{ eindex + 1 }}
|
</view>
|
<view class="color_f18202 padding_left10rpx">
|
{{ item.materialCode }}-{{ item.materialName }}
|
</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="12">
|
<view class="Wb_box">
|
<text class="el_batchNo padding_left25rpx">
|
跟踪码:
|
</text>
|
<text class="el_batchVal">{{ item.snCode }}</text>
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="Wb_box">
|
<text class="el_batchNo padding_left25rpx">
|
库区名称:
|
</text>
|
<text class="el_batchVal">{{ item.areaName }}</text>
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="Wb_box">
|
<text class="el_batchNo padding_left25rpx">
|
库区编号:
|
</text>
|
<text class="el_batchVal"> {{ item.areaCode }}</text>
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="Wb_box">
|
<text class="el_batchNo padding_left25rpx">
|
容器编号:
|
</text>
|
<text class="el_batchVal">{{ item.containerCode }}</text>
|
</view>
|
</u-col>
|
<u-col span="6">
|
|
<view class="Wb_box">
|
<text class="el_batchNo padding_left25rpx">
|
库位编号:
|
</text>
|
<text class="el_batchVal">{{ item.placeCode }}</text>
|
</view>
|
<!-- <view class="Wb_box">
|
<text class="el_batchNo padding_left25rpx"> 计划数: </text>
|
<text class="el_batchVal">{{ item.quantity }}</text>
|
</view> -->
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
</u-col>
|
<u-col span="6" class="flex">
|
<view class="color_80 padding_left25rpx">实盘数:</view>
|
<input class="border_bottom_f18202 text-left color_f18202 fontSize32rpx inputGray"
|
v-model="item.checkQuantity" type="number" @blur="changeNum(item)" 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 :issueShow="true" issueTitle="盘点上架" subTitle="确认" restTiltle="单据完成" @reset="finishOrderValid"
|
@submit="submit" @issue="goBack" />
|
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from "../../components/buttonModal.vue";
|
import ModalCode from "../../components/ModalCode.vue";
|
import { issueSubmit, finish, finishOrderSubmit, finishOrderSubmitValid } from "@/api/check/check.js";
|
import { getAttrValue } from "@/utils/tool.js";
|
import { query, material, Status,materialSNcode } from "@/api/check/check.js";
|
export default {
|
data() {
|
return {
|
detailshow: false,
|
renameFocus: false,
|
modalshow: false,
|
issueShow: false,
|
rescode: 0,
|
resmessage: "",
|
focuM: false,
|
focu: false,
|
sign: false, //问题标识
|
operator: "",
|
singlist: [ ], //物料详情
|
options: [
|
{
|
text: '删除',
|
style: {
|
backgroundColor: '#fc4b4b'
|
}
|
}
|
],
|
materlist: [],
|
warehouse: {
|
containerCode: "",
|
materialCode: "",
|
orderNo: "",
|
SNCode: "",
|
},
|
warehouseRules: {
|
orderNo: [
|
{
|
required: true,
|
message: "盘点单号不能为空",
|
trigger: "blur",
|
},
|
],
|
// containerCode: [
|
// {
|
// required: true,
|
// message: "容器编号/库位不能为空",
|
// trigger: "blur",
|
// },
|
// ]
|
},
|
timerSm: null,
|
titlePage: "",
|
wolist: [],
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
},
|
onPullDownRefresh() {
|
this.$nextTick(function () {
|
uni.stopPullDownRefresh(); //停止当前页面下拉刷新
|
});
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules);
|
},
|
onLoad(options) {
|
if (options) {
|
this.titlePage = String(options.id);
|
}
|
},
|
mounted() {
|
// this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
|
},
|
methods: {
|
//类型选择
|
confirm2(index) {
|
this.warehouse.orderNo = this.wolist[index].text;
|
this.checkTask();
|
},
|
//类型
|
getVehicleType() {
|
Status({
|
//查看符合条件的盘点单
|
page: 1,
|
PageSize: 50,
|
CheckStageForPdaDoing: true,
|
}).then((res) => {
|
const dataT = res.result.items;
|
if (dataT && dataT.length == 0) {
|
// this.rescode = 400;
|
// this.resmessage = "暂无数据";
|
// this.$refs.resmodal.show = true;
|
return;
|
}
|
dataT.forEach((item) => {
|
item.text = item.orderNo;
|
item.id = item.orderNo;
|
});
|
this.wolist = dataT;
|
});
|
},
|
//类型聚焦事件
|
containerFocus() {
|
uni.hideKeyboard();
|
// this.getVehicleType();
|
this.modalshow = true;
|
this.getVehicleType();
|
},
|
//二维码内容处理 chenzhuwen
|
materialBlur() {
|
this.timerSm = setTimeout(() => {
|
clearTimeout(this.timerSm);
|
this.timerSm = null;
|
if (this.warehouse.materialCode == "") {
|
return;
|
}
|
if (
|
this.warehouse.materialCode &&
|
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;
|
}
|
//获取批次 盘点 扫码不校验批次,只校验 编号和SAP - 5-16
|
// let lotNo = getAttrValue(this.warehouse.materialCode,'LOTNO')
|
let SAP = getAttrValue(this.warehouse.materialCode, "SAP");
|
|
//物料编号
|
this.warehouse.materialCode = getAttrValue(
|
this.warehouse.materialCode,
|
"PARTSNUMBER"
|
);
|
//判断当前物料是否在盘点列表中
|
const index = this.singlist.findIndex(
|
(item) => item.wareMaterialCode == this.warehouse.materialCode
|
);
|
if (index > -1) {
|
this.singlist[index].edit = 1;
|
this.singlist.unshift(...this.singlist.splice(index, 1));
|
} else {
|
this.rescode = 400;
|
this.resmessage = "此批次的物料不在盘点列表中";
|
this.$refs.resmodal.show = true;
|
}
|
}, 300);
|
},
|
|
checkTask() {
|
this.$refs.warehouseRef.validate((valid) => {
|
if (valid) {
|
if (this.warehouse.orderNo && this.warehouse.containerCode) {
|
material({
|
page: 1,
|
PageSize: 50,
|
orderNo: this.warehouse.orderNo,
|
ContainerCodeAndPlaceCodeForpda: this.warehouse.containerCode,
|
materialCode: this.warehouse.materialCode,
|
SNCode: this.warehouse.SNCode,
|
checkStatus: 1
|
}).then((res) => {
|
if (res.code == 200) {
|
if (res.result && res.result.items.length == 0) {
|
this.rescode = 400;
|
this.resmessage = "暂无数据";
|
this.$refs.resmodal.show = true;
|
return;
|
}
|
res.result.items.map((item) => {
|
item.checkQuantity = "";
|
item.edit = false;
|
item.show = false;
|
});
|
this.singlist = res.result.items;
|
} else {
|
this.$refs.resmodal.show = true;
|
this.rescode = res.code;
|
this.resmessage = res.message;
|
}
|
});
|
}
|
}
|
});
|
},
|
|
|
checkTaskSncode() {
|
if(!this.warehouse.orderNo){
|
uni.showToast({
|
title: "请扫盘点单号",
|
icon: "none",
|
duration: 2000,
|
});
|
return
|
}
|
if(!this.warehouse.containerCode){
|
uni.showToast({
|
title: "请扫容器编号/库位",
|
icon: "none",
|
duration: 2000,
|
});
|
return
|
}
|
materialSNcode({
|
SNCode: this.warehouse.SNCode,
|
orderNo: this.warehouse.orderNo,
|
ContainerCodeAndPlaceCodeForpda: this.warehouse.containerCode
|
}).then((res) => {
|
if (res.code == 200) {
|
if (res.result && res.result.items.length == 0) {
|
this.rescode = 400;
|
this.resmessage = "暂无数据";
|
this.$refs.resmodal.show = true;
|
return;
|
}
|
res.result.items.map((item) => {
|
item.checkQuantity = "";
|
item.edit = false;
|
item.show = false;
|
});
|
// var arrList = res.result.items;
|
// arrList.forEach((item) => {
|
// var arrNo = this.singlist.findIndex((v) => v.snCode == item.snCode);
|
// if (arrNo == -1) {
|
// this.singlist.unshift(item);
|
// }
|
// });
|
this.singlist = res.result.items;
|
} else {
|
this.$refs.resmodal.show = true;
|
this.rescode = res.code;
|
this.resmessage = res.message;
|
}
|
});
|
},
|
//删除详情
|
longpress(index, eindex) {
|
|
uni.showModal({
|
title: '提示',
|
content: '是否确认删除?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
this.singlist[index].cardNum = true
|
if (eindex == 0) { //删除
|
this.singlist.splice(index, 1)
|
} else {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
}
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
|
// 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.edit = true;
|
this.$forceUpdate();
|
} else {
|
val.edit = false;
|
this.$forceUpdate();
|
}
|
},
|
rest() {
|
this.warehouse.containerCode = "";
|
this.warehouse.materialCode = "";
|
this.warehouse.orderNo = "";
|
this.warehouse.SNCode = "";
|
this.singlist = [];
|
},
|
//确认
|
submit() {
|
this.$refs.warehouseRef.validate((valid) => {
|
if (valid) {
|
if (this.singlist.length <= 0) {
|
this.$u.toast("请扫码添加物料明细!");
|
return;
|
}
|
if (!this.warehouse.containerCode) {
|
this.$u.toast("容器编号/库位不存在了!");
|
return;
|
}
|
// let arrD = this.singlist.filter((v) => v.quantity > 0);
|
// if (arrD.length <= 0) {
|
// this.$u.toast("请至少填写一个物料的盘点数量!");
|
// return;
|
// }
|
|
this.singlist.forEach(item => {
|
if (item.checkQuantity == '' || item.checkQuantity <= 0) {
|
item.checkQuantity = 0
|
}
|
})
|
|
// let details = arrD.reduce((curr, item) => {
|
// curr.push({
|
// checkQuantity: item.quantity
|
// });
|
// return curr;
|
// }, []);
|
|
let params = {
|
containerCode: this.warehouse.containerCode,
|
"Details": this.singlist,
|
};
|
|
uni.showModal({
|
title: "提示",
|
content: "是否确认盘点?",
|
showCancel: true,
|
cancelColor: "#333333",
|
success: (res) => {
|
if (res.confirm) {
|
finish(params).then((res) => {
|
if (res.code == 200) {
|
this.$refs.resmodal.show = true;
|
this.resmessage = "盘点成功";
|
this.rescode = res.code;
|
this.rest();
|
}
|
});
|
}
|
},
|
});
|
}
|
});
|
},
|
|
//容器回库
|
goBack() {
|
// ActionType 传 0 组盘上架 1 上架 ,2 容器上架,3 容器组盘上架 4 盘点上架
|
uni.navigateTo({
|
url: `/pages/putaway/putaway?containerCode=${this.warehouse.containerCode}&actionType=4`,
|
});
|
},
|
|
//pda单据完成验证:单据是否有未盘点的明细
|
finishOrderValid() {
|
if (!this.warehouse.orderNo) {
|
uni.showToast({
|
title: "请选择盘点单号!",
|
icon: "none",
|
duration: 2000,
|
});
|
return;
|
}
|
uni.showModal({
|
title: "提示",
|
content: "是否确认单据完成?",
|
showCancel: true,
|
cancelColor: "#333333",
|
success: (res) => {
|
if (res.confirm) {
|
finishOrderSubmitValid({
|
orderNo: this.warehouse.orderNo,
|
}).then((res) => {
|
if (res.code == 200) {
|
if (res.result == 1) {
|
this.finishOrder();
|
} else if (res.result == 200) {
|
this.confirmJk();
|
}else{
|
this.$u.toast("校验单据是否有未盘点的明细失败");
|
}
|
}
|
});
|
}
|
},
|
});
|
},
|
|
// 单据完成
|
finishOrder() {
|
uni.showModal({
|
title: "提示",
|
content: "单据有未盘点的明细,是否继续完成单据?",
|
showCancel: true,
|
cancelColor: "#333333",
|
success: (res) => {
|
if (res.confirm) {
|
this.confirmJk()
|
}
|
},
|
});
|
},
|
|
//单据完成接口
|
confirmJk() {
|
finishOrderSubmit({
|
orderNo: this.warehouse.orderNo,
|
}).then((res) => {
|
if (res.code == 200) {
|
this.$refs.resmodal.show = true;
|
this.resmessage = "单据完成成功";
|
this.rescode = res.code;
|
this.rest();
|
}
|
});
|
},
|
|
//已盘点
|
goBackJp() {
|
if (this.warehouse.orderNum == "") {
|
this.$u.toast("请输入单号!");
|
return;
|
}
|
uni.navigateTo({
|
url: `/pages/check/outDetail?id=${this.titlePage}&orderNum=${this.warehouse.orderNum}&type=LKPD`,
|
});
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss">
|
.overflow {
|
padding-bottom: 100px;
|
}
|
|
.boxList {
|
transition: all ease 2s;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
top: 0;
|
right: 0;
|
width: 100%;
|
height: 100%;
|
z-index: 999;
|
background: rgba(0, 0, 0, 0.6);
|
|
.innerWrap {
|
max-height: 50%;
|
overflow-y: auto;
|
background: white;
|
position: absolute;
|
bottom: 0;
|
left: 0;
|
width: 100%;
|
|
ul {
|
padding: 0;
|
margin: 0;
|
|
li {
|
padding: 0;
|
margin: 0;
|
border-bottom: 1px solid #e4e7ed;
|
list-style-type: none;
|
display: flex;
|
flex-direction: row;
|
line-height: 1;
|
justify-content: center;
|
align-items: center;
|
font-size: 13px;
|
padding: 14px 0;
|
flex-direction: column;
|
}
|
}
|
}
|
}
|
</style>
|