<template>
|
<default-header-page-layout ref="page" title="储位管理">
|
<view
|
class="page-frame with-action-user-row"
|
:style="{ height: pageBodyHeight + 'px' }"
|
v-if="pageBodyHeight"
|
>
|
<action-user-row />
|
<view class="with-action-user-row-page-content">
|
<selectItem
|
:selectData="areaData"
|
:value.sync="form.areaNo"
|
label="库区编码"
|
labelField="areaName"
|
valueField="areaNo"
|
/>
|
|
<selectItemWc2
|
:selectData="placeList"
|
:value.sync="form.placeNo"
|
label="库位编码"
|
labelField="placeNo"
|
valueField="placeNo"
|
@getPropData="getPropData"
|
:msg="msg.placeNoInfo"
|
@confirmHc="getStockPageHandle"
|
/>
|
|
<!-- 托盘编码 -->
|
<scan-input-form-item
|
class="forma-item"
|
label="托盘编码"
|
:disabled="true"
|
v-model="form.containterCode"
|
:msg="msg.containter"
|
:msg-type="msgType.containter"
|
@search="onSearchContainter"
|
@clear="onClearContainter"
|
:hasScan="false"
|
:hasSearch="false"
|
/>
|
<scan-input-form-item
|
placeholder="请选择"
|
:clearable="false"
|
:hasScan="false"
|
:hasSearch="false"
|
@click.native="ctVisible = true"
|
class="forma-item"
|
label="托盘类型"
|
v-model="form.containerType"
|
/>
|
<EasyPicker
|
:visible.sync="ctVisible"
|
:list="ContainerType"
|
labelField="value"
|
valueField="code"
|
@select="getTypeVal"
|
/>
|
|
<view
|
class="scan-input-form-item-compontent"
|
style="background-color: white; display: flex"
|
>
|
<view class="p-form-label"> 是否锁定解锁:</view>
|
<u-radio-group v-model="form.islock">
|
<u-radio label="是" name="1"></u-radio>
|
<u-radio style="margin-left: 10px" label="否" name="0"></u-radio>
|
</u-radio-group>
|
</view>
|
<br />
|
<!-- 冻结原因 -->
|
<scan-input-form-item
|
v-if="form.islock"
|
class="forma-item"
|
label="锁机制原因"
|
v-model="form.lockReason"
|
:hasScan="false"
|
:hasSearch="false"
|
@clear="onClearContainter"
|
/>
|
|
<view
|
class="scan-input-form-item-compontent"
|
style="background-color: white; display: flex"
|
>
|
<view class="p-form-label"> 是否空托:{{ titleContainer }}</view>
|
</view>
|
<br />
|
<materialList
|
:materialData="materialData"
|
@delMaterialData="delMaterialData"
|
/>
|
</view>
|
</view>
|
<template v-slot:footer>
|
<view class="bottom-btns-row">
|
<template>
|
<!-- <div class="btn-frame">
|
<u-button text="重置" @click="onClearContainter"></u-button>
|
</div> -->
|
<div class="btn-frame">
|
<u-button
|
text="置为空托"
|
@click="oneTouchUnBindHandle(1)"
|
></u-button>
|
</div>
|
<!-- 库位解锁 -->
|
<div class="btn-frame">
|
<u-button text="锁定" @click="placebatchUpdate(1)"></u-button>
|
</div>
|
<div class="btn-frame" style="margin:0 5px;">
|
<u-button text="解锁" @click="placebatchUpdate(2)"></u-button>
|
</div>
|
<div class="btn-frame">
|
<u-button
|
type="primary"
|
text="清除库存"
|
@click="oneTouchUnBindHandle(2)"
|
></u-button>
|
</div>
|
</template>
|
</view>
|
</template>
|
</default-header-page-layout>
|
</template>
|
|
<script>
|
import DefaultHeaderPageLayout from "@/components/DefaultHeaderPageLayout.vue";
|
import ActionUserRow from "@/components/ActionUserRow.vue";
|
import ScanInputFormItem from "@/components/ScanInputFormItem.vue";
|
import selectItem from "@/components/selectItem.vue";
|
import selectItemWc2 from "@/components/selectItemWithSearchWc2.vue";
|
import placeInfo from "./modules/placeInfo.vue";
|
import containerInfo from "./modules/containerInfo.vue";
|
import { $alert, getDicList } from "@/static/js/utils/index.js";
|
import { palceList } from "@/service/mixins/mixins.js";
|
import { getForContainerCode } from "@/api/bind.js";
|
import EasyPicker from "@/components/EasyPicker.vue";
|
import {
|
oneTouchUnBindHandle,
|
StockPageForPdaCwgl,
|
placebatchUpdate,
|
} from "@/api/containerHandle.js";
|
import { getAreaInfo } from "@/api/common.js";
|
import materialList from "./modules/materialList.vue";
|
import { parseDic } from "@/static/js/utils/index.js";
|
let initInterVal = null;
|
export default {
|
name: "containerHandle",
|
components: {
|
DefaultHeaderPageLayout,
|
ActionUserRow,
|
ScanInputFormItem,
|
placeInfo,
|
selectItem,
|
containerInfo,
|
materialList,
|
EasyPicker,
|
selectItemWc2,
|
},
|
data() {
|
return {
|
ContainerType: [],
|
ctVisible: false,
|
pageBodyHeight: 0,
|
containter: null,
|
form: {
|
containterCode: "",
|
areaNo: "",
|
placeNo: "",
|
sorting: "",
|
containerTypeCode: 0,
|
containerType: "",
|
},
|
msg: {
|
containter: "",
|
placeNoInfo: "",
|
},
|
msgType: {
|
containter: "info",
|
},
|
containerInfo: {},
|
areaData: [],
|
containerPlaceInfo: {},
|
materialData: [],
|
visibleSort1: false,
|
isSorting: [
|
{
|
label: "是",
|
value: "1",
|
},
|
{
|
label: "否",
|
value: "0",
|
},
|
],
|
titleContainer: "",
|
};
|
},
|
|
mixins: [palceList],
|
watch: {
|
"form.areaNo": {
|
handler(val, oldVal) {
|
if (val != "") {
|
this.form.placeNo = "";
|
this.placeList = [];
|
// 获取库存
|
this.getPalceList({
|
areaCode: val,
|
});
|
}
|
},
|
},
|
},
|
|
methods: {
|
parseDic,
|
// 选择托盘类型返回值
|
getTypeVal(val, valObj, index) {
|
this.form.containerTypeCode = valObj.code;
|
this.form.containerType = valObj.value;
|
},
|
radioChange1(val, b) {
|
this.form.islock = b.label; // 更新冻结状态
|
this.visibleSort1 = false; // 关闭选择器
|
},
|
radioChange2(val, b) {
|
this.form.emptyContainer = b.label;
|
this.visibleSort1 = false; // 关闭选择器
|
},
|
/* 2托盘编码搜索库存 */
|
async onSearchContainter() {
|
if (!this.form.containterCode) {
|
this.msgType.containter = "error";
|
this.msg.containter = "请输入托盘编码!";
|
return false;
|
}
|
try {
|
let { result } = await getForContainerCode({
|
code: this.form.containterCode,
|
});
|
this.materialData = [];
|
this.containerInfo = result;
|
if (result?.materialContainers.length == 0) {
|
uni.showToast({
|
title: "托盘上没有物料或者托盘不存在!",
|
icon: "none",
|
});
|
return;
|
}
|
this.materialData = result?.materialContainers;
|
} catch (e) {
|
console.log(e);
|
}
|
},
|
//1获取库存
|
async getStockPageHandle(val) {
|
this.form.containterCode = "";
|
this.msg.placeNoInfo = "";
|
this.materialData = [];
|
var placeNo = this.form.placeNo || val;
|
if (!placeNo) {
|
uni.showToast({
|
title: "请选择或扫描库位!",
|
icon: "none",
|
});
|
return;
|
}
|
let { result } = await StockPageForPdaCwgl({
|
placeNo: placeNo,
|
});
|
this.$nextTick(() => {
|
var placeStatus2 =
|
parseDic(
|
this.$store,
|
"place_status",
|
result?.placeOutput.placeStatus
|
) || "";
|
this.msg.placeNoInfo = `${
|
result?.placeOutput.islock == 1 ? "锁定" : "未锁定"
|
}, 库位状态:${placeStatus2}`;
|
this.materialData = result?.materialStockOutput || [];
|
this.titleContainer = result?.placeOutput.emptyContainer==1?"是": "否";
|
});
|
},
|
|
/* 清除托盘编码 */
|
onClearContainter() {
|
this.form = {
|
containterCode: "",
|
areaNo: "",
|
placeNo: "",
|
};
|
this.materialData = [];
|
this.msg.placeNoInfo = "";
|
this.form.placeNo = "";
|
this.titleContainer = "";
|
},
|
|
// 获取库区数据
|
async getAreaList() {
|
try {
|
let { result } = await getAreaInfo();
|
this.areaData = result;
|
} catch (e) {
|
console.log(e);
|
}
|
},
|
//库位模糊查询
|
async getPropData(PlaceNo) {
|
await this.getPalceList({
|
areaCode: this.form.areaNo,
|
PlaceNo: PlaceNo,
|
});
|
},
|
|
// 托盘处理
|
async oneTouchUnBindHandle(type) {
|
var content = `库位编码:${this.form.placeNo},是否确认一键清除?`;
|
// 置为空托
|
if (type == 1) {
|
content = `库位编码:${this.form.placeNo},是否确认置为空托货位?`;
|
}
|
uni.showModal({
|
title: "提示",
|
content: content,
|
showCancel: true,
|
confirmText: "确定",
|
cancelText: "取消",
|
success: async ({ confirm, cancel }) => {
|
if (confirm) {
|
try {
|
await oneTouchUnBindHandle({
|
type: type,
|
containerTypeCode: this.form.containerTypeCode,
|
containerNo: this.form.containterCode,
|
placeNo: this.form.placeNo,
|
});
|
$alert("操作成功!");
|
this.onClearContainter();
|
} catch (e) {
|
console.log(e);
|
}
|
}
|
},
|
});
|
},
|
|
// 锁定解锁
|
async placebatchUpdate(islock) {
|
if (!this.form.lockReason) {
|
uni.showToast({
|
title: "请输入原因!",
|
icon: "none",
|
});
|
return;
|
}
|
var titleM = islock == 2 ? "解锁" : "锁定";
|
uni.showModal({
|
title: titleM,
|
content: `库位编码:${this.form.placeNo},是否确认?`,
|
showCancel: true,
|
confirmText: "确定",
|
cancelText: "取消",
|
success: async ({ confirm, cancel }) => {
|
if (confirm) {
|
try {
|
await placebatchUpdate({
|
placeNo: this.form.placeNo,
|
islock: islock,
|
LockReason: this.form.lockReason,
|
});
|
$alert(`${titleM}成功!`);
|
this.onClearContainter();
|
} catch (e) {
|
console.log(e);
|
}
|
}
|
},
|
});
|
},
|
|
/* 页面初始化获取页面body高度的定时器 */
|
startInitInterval(callback) {
|
initInterVal = setInterval(() => {
|
if (this.pageBodyHeight) {
|
this.clearInitInterval();
|
callback && callback();
|
} else {
|
this.pageBodyHeight = this.$refs.page.getBodyHeight();
|
}
|
}, 200);
|
},
|
/* 清除定时器 */
|
clearInitInterval() {
|
try {
|
clearInterval(initInterVal);
|
initInterVal = null;
|
} catch (e) {
|
//TODO handle the exception
|
}
|
},
|
//删除物料
|
delMaterialData(materialId) {
|
this.materialData = this.materialData.filter(
|
(item) => item.materialId != materialId
|
);
|
},
|
},
|
|
onReady() {
|
this.startInitInterval(async () => {
|
/* 页面初始化后需要执行的代码在这边调用 */
|
this.getAreaList();
|
this.ContainerType = getDicList(
|
this.$store,
|
"container_type"
|
).sysDictDatas;
|
});
|
},
|
onUnload() {
|
this.clearInitInterval();
|
},
|
};
|
</script>
|
|
<style scoped lang="scss">
|
|
.bottom-btns-row {
|
display: flex;
|
justify-content: center;
|
padding: 10rpx 10rpx;
|
background-color: #fff;
|
|
.btn-frame {
|
flex: 1;
|
box-sizing: border-box;
|
}
|
|
.btn-frame:nth-child(1) {
|
margin-right: 10rpx;
|
}
|
|
.left-btn-frame {
|
padding-left: 20rpx;
|
padding-right: 8rpx;
|
}
|
|
.right-btn-frame {
|
padding-right: 20rpx;
|
padding-left: 8rpx;
|
}
|
}
|
|
.forma-item {
|
margin-bottom: 24rpx;
|
}
|
|
.material-item-group {
|
background-color: $uni-bg-color;
|
padding-top: 10rpx;
|
|
.material-list-item {
|
border-bottom: 2rpx solid $uni-border-color;
|
padding-bottom: 10rpx;
|
padding-left: 60rpx;
|
margin-bottom: 10rpx;
|
position: relative;
|
|
&:last-child {
|
border-bottom: 0;
|
}
|
|
.item-row {
|
display: flex;
|
|
& > .label {
|
flex-shrink: 0;
|
color: $u-tips-color;
|
width: 144rpx;
|
}
|
|
& > .content {
|
flex-grow: 1;
|
color: $u-content-color;
|
|
uni-input {
|
font: inherit;
|
color: $u-primary;
|
text-decoration: underline;
|
}
|
}
|
}
|
|
.badge-box {
|
position: absolute;
|
top: 8rpx;
|
left: 8rpx;
|
z-index: 1;
|
}
|
|
.close-btn {
|
$closeBtnSize: 70rpx;
|
width: $closeBtnSize;
|
height: $closeBtnSize;
|
z-index: 1;
|
position: absolute;
|
top: 0rpx;
|
right: 8rpx;
|
background-color: $u-error;
|
opacity: 0.6;
|
border-radius: 25rpx;
|
|
.icon-layer {
|
position: absolute;
|
width: 100%;
|
height: 100%;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
z-index: 2;
|
}
|
}
|
}
|
}
|
|
.label {
|
margin-left: 25rpx;
|
font-size: 30rpx;
|
}
|
|
.scan-input-form-item-compontent {
|
width: 100%;
|
.p-form-label {
|
font-size: 32rpx;
|
color: $u-tips-color;
|
padding-bottom: 12rpx;
|
padding-left: 20rpx;
|
.required-tag {
|
color: $u-error;
|
}
|
}
|
.input-row {
|
width: 100%;
|
height: 75rpx;
|
overflow: hidden;
|
background-color: $uni-bg-color;
|
display: flex;
|
align-items: center;
|
position: relative;
|
.scan-view,
|
.btn-view {
|
flex-shrink: 0;
|
}
|
.scan-view {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding-right: 10rpx;
|
}
|
.input-view {
|
flex-grow: 1;
|
padding-left: 20rpx;
|
}
|
.btn-view {
|
width: 70rpx;
|
height: 100%;
|
padding: 20rpx;
|
padding-left: 0rpx;
|
box-sizing: border-box;
|
.search-btn {
|
height: 100%;
|
width: 100%;
|
border-radius: 8rpx;
|
background: linear-gradient(
|
157.342820970935deg,
|
rgba(194, 128, 255, 1) -20%,
|
rgba(194, 128, 255, 1) -19%,
|
rgba(132, 0, 255, 1) 119%
|
);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
color: $uni-bg-color;
|
font-size: 26rpx;
|
}
|
}
|
& > .mask {
|
position: absolute;
|
left: 0;
|
top: 0;
|
width: 100%;
|
height: 100%;
|
z-index: 100;
|
background-color: #fff;
|
opacity: 0.25;
|
}
|
}
|
.msg-row {
|
padding: 6rpx 20rpx 0 20rpx;
|
line-height: 1.3;
|
font-size: 24rpx;
|
color: $u-error;
|
word-break: break-all;
|
word-wrap: break-word;
|
&.info-type {
|
color: $color-blue;
|
}
|
}
|
}
|
</style>
|