Commit a820d6e0 authored by 何远江's avatar 何远江

库存盘点接口对接

parent 3f492ed2
......@@ -4,19 +4,11 @@
<NavBar title="库存盘点"></NavBar>
<view class="btn">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="nlpla" focus placeholder="请扫盘点凭证码" @change="handleInputNlpla"></uni-easyinput>
<!-- <uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
v-model="wxparams"
:focus="isFocus"
placeholder="请扫描产品包装条码/外箱码"
@input="handleInputPlnr"
></uni-easyinput> -->
</view>
</StickyNavBar>
<waitInventoried ref="waitInventoriedRef" />
<!-- <inventoryForm v-else /> -->
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle" v-if="current === 0"></BottomBtn>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle" ></BottomBtn>
</view>
</template>
......@@ -37,24 +29,9 @@ export default {
},
data() {
return {
value: '',
type: 'select',
show: false,
border: true,
nlpla: '',
isDisabled: false,
isFocus: false,
wxparams: '',
list: [
{
name: '待盘点'
},
{
name: '盘点调整单'
}
],
current: 0,
status: 'loadmore',
btnArr: [
{
style: '',
......@@ -81,9 +58,6 @@ export default {
console.log('返回了');
uni.navigateBack();
},
changeTab(index) {
this.current = index;
}
}
};
</script>
......
......@@ -3,37 +3,36 @@
<StickyNavBar class="stickyBox">
<NavBar title="库存盘点"></NavBar>
<view class="planBox">
<view class="planTitle">盘点计划:WHPD2023110900002</view>
<view class="planTip">仓库:CBCK|存货单元:XB-001-04</view>
<view class="planTitle">盘点计划:{{ inventoryInfo.IVNUM || inventoryInfo.IBLNR }}</view>
<view class="planTip">仓库:{{ inventoryInfo.LGOBE }} | 存货单元:{{ inventoryInfo.LGPLA }}</view>
</view>
</StickyNavBar>
<view class="workTitle">盘点作业</view>
<view class="scanningBtn">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="value" focus placeholder="请扫描盘点库位条码" @input="handleInput"></uni-easyinput>
<uni-easyinput prefixIcon="search" v-model="value" focus placeholder="请扫描盘点物料条码" @input="handleInput"></uni-easyinput>
<uni-easyinput prefixIcon="search" v-model="value" focus placeholder="请扫描盘点条码" @input="handleInput"></uni-easyinput>
</view>
<view class="inventoryDetail">
<view class="detailTitle">盘点明细</view>
<view class="">
<!-- <view class="">
<u-button size="mini" class="" type="success" @click="addShowModel = true">
<u-icon name="plus"></u-icon>
新增
</u-button>
</view>
</view> -->
</view>
<view class="cardContent">
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.MATNR">
<view class="cardItem">
<view class="bottomItem">
<view class="items">防霉抗菌PE平口袋|PD202309992(2)</view>
<view class="items">物料编码:{{item.MATNR}}({{item.list.length}})</view>
<view class="items">物料名称:{{item.MAKTX}}</view>
</view>
<view class="boxRight">
<view class="items">891/1000pcs</view>
<view class="items">0 / {{item.GESME}}pcs</view>
</view>
</view>
<view class="listBottom">
<view class="bottomTitle" @tap="show = !show">
<view class="bottomTitle" @tap="toggleShow(item,index)">
<view class="topIcons">
<view v-if="show">
<view v-if="item.show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开
</view>
......@@ -43,14 +42,14 @@
</view>
</view>
</view>
<view v-if="!show" class="bottomBox">
<view class="boxAll">
<view v-if="!item.show" class="bottomBox">
<view class="boxAll" v-for="itm in item.list">
<view class="bottomItem">
<view class="items">C00990099900027</view>
<view class="items">C009900|防霉抗菌包装纸</view>
<view class="items">{{ item.MATNR }}</view>
<view class="items">C009900 | 防霉抗菌包装纸</view>
</view>
<view class="boxRight">
<view class="items">891/1000pcs</view>
<view class="items">891 / 1000pcs</view>
<view class="itemsBtn">
<u-button size="mini" class="" type="primary" @click="checkShowModel = true">盘点</u-button>
</view>
......@@ -92,8 +91,8 @@ export default {
},
data() {
return {
urlPs: {},
value: '',
show: true,
btnArr: [
{
style: '',
......@@ -102,6 +101,8 @@ export default {
way: 'goBack'
}
],
inventoryList: [],
inventoryInfo: {},
addShowModel: false,
checkShowModel: false,
addForm: {
......@@ -112,11 +113,59 @@ export default {
}
};
},
computed: {},
computed: {
goodsList() {
return this.inventoryList.reduce((acc, cur) => {
// 没有分类的产品编码
const item = acc.find(v => v.MATNR == cur.MATNR)
if (!item) {
acc.push({
MATNR: cur.MATNR, // 物料编码
MAKTX: cur.MAKTX, // 物料名称
GESME: cur.GESME, // 该物料盘点总数
MEINS: cur.MEINS, // 单位
show: true,
list: [cur]
})
} else {
// 有产品分类
item.list.push(cur)
}
return acc
}, [])
}
},
onLoad(option) {
this.urlPs = option
this.$u.api.sapApi
.sapInventory(this.urlPs).then(res => {
if (res.RDATA_IM.length || res.RDATA_WM.length) {
// 是否是IM
this.isIm = res.RDATA_IM.length > 0;
this.inventoryInfo = this.isIm ? res.RDATA_IM[0] : res.RDATA_WM[0];
this.inventoryList = (
this.isIm ? res.RDATA_IM : res.RDATA_WM
).reduce((acc, cur) => {
if (acc.findIndex((item) => item.MATNR === cur.MATNR) === -1) {
acc.push(cur);
}
return acc;
}, []);
} else {
// 不能盘点
this.$u.toast(res.MSG[0].MESSAGE || "该盘点计划暂无库存数据");
}
})
},
methods: {
handleInput(e) {
console.log(e, 'eee');
},
toggleShow(item, index) {
console.log('触发了当前选项!', item)
item.show = !item.show
this.$set(this.goodsList,index,item)
},
getBtnHandle(row) {
console.log('getBtnHandle', row);
this[row.way]();
......
<template>
<view class="cardbox">
<view class="cardContent">
<view class="listItemTitle">
<view>
<view class="item">盘点计划:WHPD202311080001</view>
<view class="item">线边仓|XB-001-02</view>
<view class="item">计划日期:2023-11-09</view>
<view class="item">盘点人员:张丹</view>
<view class="item">盘点状态:未开始</view>
</view>
</view>
<view class="listBottom">
<view class="bottomTitle" @tap="show = !show">
<view class="desc">展开盘点明细</view>
<view class="topIcons">
<view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开
</view>
<view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起
</view>
</view>
<view class="workBtn">
<u-button size="mini" class="" type="primary" @click="handleClickWork()">盘点作业</u-button>
</view>
</view>
<view v-if="!show" class="bottomBox">
<view class="boxAll">
<view class="bottomItem">
<view class="items">C00990099900027</view>
<view class="items">C009900|防霉抗菌包装纸</view>
<view class="items">生产日期:2023-10-27</view>
</view>
<view class="boxRight">
<view class="items">891/1000pcs</view>
<view class="items">线边仓|XB-X01-001</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="cardbox">
<view class="cardContent" v-if="inventoryInfo">
<view class="listItemTitle">
<view>
<view class="item"
>盘点计划:{{ inventoryInfo.IVNUM || inventoryInfo.IBLNR }}</view
>
<!-- <view class="item">线边仓|XB-001-02</view> -->
<view class="item">计划日期:{{ inventoryInfo.PDATU }}</view>
<view class="item">盘点人员:{{ vuex_user.nickName }}</view>
<view class="item">盘点状态:未开始</view>
</view>
</view>
<view class="listBottom">
<view class="bottomTitle" @tap="show = !show">
<view class="desc">展开盘点明细</view>
<view class="topIcons">
<view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开
</view>
<view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起
</view>
</view>
<view class="workBtn">
<u-button
size="mini"
class=""
type="primary"
@click="handleClickWork()"
>盘点作业</u-button
>
</view>
</view>
<view v-if="!show" class="bottomBox">
<view
class="boxAll"
v-for="(item, index) in inventoryList"
:key="item.PLNR"
>
<view class="bottomItem">
<view class="items">物料编码:{{ item.MATNR }}</view>
<view class="items">物料名称:{{ item.MAKTX }}</view>
<view class="items">生产日期:{{ item.PDATU }}</view>
</view>
<view class="boxRight">
<view class="items nums">{{ item.GESME }} ({{ item.MEINS }})</view>
<view class="items">{{ item.LGOBE }}</view>
<view class="items">{{ item.LGPLA }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
show: true
};
data() {
return {
show: true,
inventoryInfo: null,
isIm: false,
inventoryList: [],
params: {}
};
},
computed: {},
created() {
// this.getList();
},
methods: {
getList(params) {
this.params = params || {
IBLNR: "",
GJAHR: "2024",
IVNUM: "28",
NVERS: "00",
FLAG: 'X'
}
this.$u.api.sapApi
.sapInventory(this.params)
.then((res) => {
console.log(res);
if (res.RDATA_IM.length || res.RDATA_WM.length) {
// 可以盘点
this.isIm = res.RDATA_IM.length > 0;
this.inventoryInfo = this.isIm ? res.RDATA_IM[0] : res.RDATA_WM[0];
this.inventoryList = (
this.isIm ? res.RDATA_IM : res.RDATA_WM
).reduce((acc, cur) => {
if (acc.findIndex((item) => item.MATNR === cur.MATNR) === -1) {
acc.push(cur);
}
return acc;
}, []);
} else {
// 不能盘点
this.$u.toast(res.MSG[0].MESSAGE || "该盘点计划暂无库存数据");
}
});
},
objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
},
computed: {},
created() {
this.getList();
},
methods: {
getList() {
this.$u.api.sapApi.sapInventory({GJAHR: '2024'}).then(res => {
console.log(res);
})
},
handleClickWork() {
uni.navigateTo({
url: `/pages/inventoryCounting/inventoryList`
});
}
}
handleClickWork() {
uni.navigateTo({
url: '/pages/inventoryCounting/inventoryList?' + this.objectToQueryString(this.params),
});
},
},
};
</script>
<style lang="scss" scoped>
.cardbox {
min-height: calc(100vh - 480rpx);
margin-top: 20rpx;
min-height: calc(100vh - 480rpx);
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
border-radius: 8px;
background: #fff;
}
.listItemTitle {
display: flex;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2px solid #f8f8f8;
.u-btn {
width: 150rpx;
margin: 0px;
margin-top: 10rpx;
}
.item {
height: 40rpx;
line-height: 40rpx;
color: #000;
font-size: 28rpx;
font-weight: 500;
}
display: flex;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2px solid #f8f8f8;
.u-btn {
width: 150rpx;
margin: 0px;
margin-top: 10rpx;
}
.item {
height: 40rpx;
line-height: 40rpx;
color: #000;
font-size: 28rpx;
font-weight: 500;
}
}
.listBottom {
.bottomTitle {
height: 60rpx;
position: relative;
display: flex;
justify-content: space-between;
.desc {
color: #bbb;
font-size: 24rpx;
line-height: 60rpx;
padding-left: 20rpx;
}
.topIcons {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #aaa;
}
.workBtn {
margin-right: 20rpx;
}
}
.bottomBox {
padding: 20rpx;
.boxAll {
display: flex;
justify-content: space-between;
background: #f8f8f8;
border-radius: 10rpx;
}
.bottomItem {
padding: 20rpx;
// margin-bottom: 20rpx;
.items {
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
}
.boxRight {
padding: 20rpx;
.items {
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
.bottomTitle {
height: 60rpx;
position: relative;
display: flex;
justify-content: space-between;
.desc {
color: #bbb;
font-size: 24rpx;
line-height: 60rpx;
padding-left: 20rpx;
}
.topIcons {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #aaa;
}
.workBtn {
margin-right: 20rpx;
}
}
.bottomBox {
padding: 20rpx;
.boxAll {
display: flex;
justify-content: space-between;
background: #f8f8f8;
border-radius: 10rpx;
margin-bottom: 20rpx;
}
.bottomItem {
padding: 20rpx;
// margin-bottom: 20rpx;
.items {
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
}
.boxRight {
padding: 20rpx;
.items {
text-align: right;
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
&.nums {
color: #1989fa;
}
}
}
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment