<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>
|
<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="12">
|
<u-form-item label="容器编号:" prop="containerCode" class="uFormItem" required>
|
<u-input v-model="warehouse.containerCode" placeholder="请录入或扫码" @confirm="containerBlur"
|
style="font-weight: bolder; margin-left: 15rpx; font-size: 34rpx"
|
class="width padding_left30rpx">
|
</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="placeCode" class="uFormItem" required>
|
<u-input v-model="warehouse.placeCode" placeholder="请录入或扫码"
|
style="font-weight: bolder; margin-left: 15rpx; font-size: 34rpx"
|
class="width padding_left30rpx">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</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 }}-{{ item.materialName }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="8">
|
<view class="" style="padding: 10rpx 0 10rpx 10rpx; color: #808080">
|
容器编号:{{ item.containerCode }}
|
</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="12">
|
<view class="" style="padding: 10rpx 0 10rpx 10rpx; color: #808080">
|
批次:{{ item.batch }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="" style="padding: 10rpx 0 10rpx 10rpx; color: #808080">
|
库存状态: {{ item.stockStatusName }}
|
</view>
|
</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 {
|
bindContainerStock,
|
placeBind,
|
} from "@/api/putIn/localBind.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: "",
|
placeCode: "",
|
},
|
checkStatus: "",
|
singlist: [], //详情列表
|
rescode: 0,
|
resmessage: "",
|
options: [
|
{
|
text: "打印",
|
style: {
|
backgroundColor: "#fc9f35",
|
},
|
},
|
],
|
detailshow: false,
|
materlist: {},
|
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
},
|
onLoad() {
|
this.operator = JSON.parse(uni.getStorageSync("userInfo")).name;
|
},
|
created() {
|
},
|
methods: {
|
//解析物料码
|
//回库
|
rest() {
|
uni.navigateTo({
|
//url:`/pages/sort/return?containerCode=${this.warehouse.containerCode}`
|
url: `/pages/index/index`,
|
});
|
this.resetForm();
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
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();
|
}
|
},
|
|
containerBlur() {
|
if (this.warehouse.containerCode == "") {
|
return;
|
}
|
////debugger
|
bindContainerStock(this.warehouse).then((res) => {
|
this.singlist = res.result.stockList || [];
|
});
|
},
|
resetForm() {
|
this.warehouse.placeCode = "";
|
this.warehouse.containerCode = "";
|
this.singlist = []
|
},
|
//确认解绑
|
submit() {
|
var count = 0;
|
if (this.warehouse.placeCode) {
|
count++;
|
}
|
if (this.warehouse.containerCode) {
|
count++;
|
}
|
if (count != 2) {
|
this.rescode = 400;
|
this.resmessage = "请补扫库位编号或容器编号!";
|
this.$refs.resmodal.show = true;
|
return;
|
}
|
const params = {
|
placeCode: this.warehouse.placeCode,
|
containerCode: this.warehouse.containerCode,
|
};
|
uni.showModal({
|
title: "提示",
|
content: "库位绑定",
|
showCancel: true,
|
cancelColor: "#333333",
|
success: (res) => {
|
if (res.confirm) {
|
// 绑定
|
placeBind(params).then((res) => {
|
this.resmessage = "绑定成功";
|
this.rescode = 200;
|
this.$refs.resmodal.show = true;
|
this.resetForm();
|
});
|
}
|
},
|
});
|
},
|
},
|
};
|
</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;
|
}
|
}
|
|
|
</style>
|