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

盘点对接

parent 3cec088b
......@@ -54,6 +54,9 @@ export default {
handleInputNlpla(e) {
const params = JSON.parse(e)
this.$refs.waitInventoriedRef.getList(params);
setTimeout(() => {
this.nlpla = ''
}, 1000)
},
goBack() {
console.log('返回了');
......
......@@ -8,7 +8,7 @@
</view>
</StickyNavBar>
<view class="scanningBtn">
<uni-easyinput prefixIcon="search" v-model="value" focus placeholder="请扫描盘点条码" @input="handleInput">
<uni-easyinput prefixIcon="search" :focus="isFocus" :disabled="isDisabled" v-model="wxparams" focus placeholder="请扫描盘点条码" @input="handleInput">
</uni-easyinput>
</view>
<view class="inventoryDetail">
......@@ -50,11 +50,12 @@
<view class="boxAll" v-for="(itm, inde) in item.list" :key="inde">
<view class="bottomItem">
<view class="items">仓位:{{ itm.LGPLA }}</view>
<view class="items">存储地点:{{ itm.LGOBE }}</view>
<view class="items">存储地点:{{ itm.LGORT }} - {{ itm.LGOBE }}</view>
</view>
<view class="boxRight">
<view class="items">
<uni-easyinput v-model.number="itm.MENGA" style="width: 200rpx;margin-right:10rpx"/>
<uni-easyinput v-if="isIM" v-model.number="itm.ERFMG" style="width: 200rpx;margin-right:10rpx"/>
<uni-easyinput v-else="isIM" v-model.number="itm.MENGA" style="width: 200rpx;margin-right:10rpx"/>
<view v-show="urlPs.FLAG && urlPs.FLAG === 'X'">/ {{itm.PACMG}} {{itm.MEINS}}</view>
</view>
<!-- <view class="itemsBtn">
......@@ -96,12 +97,19 @@
data() {
return {
urlPs: {},
value: '',
wxparams: '',
isFocus: true,
isDisabled: false,
btnArr: [{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
},{
style: '',
type: 'primary',
text: '盘点确认',
way: 'goBack'
way: 'submitForm'
}],
inventoryList: [],
inventoryInfo: {},
......@@ -122,9 +130,9 @@
.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
this.isIM = Reflect.has(this.urlPs, 'IBLNR');
this.inventoryInfo = this.isIM ? res.RDATA_IM[0] : res.RDATA_WM[0];
this.inventoryList = this.isIM ? res.RDATA_IM : res.RDATA_WM
this.setGoodsList()
} else {
......@@ -137,7 +145,7 @@
sumMENGA(){
return function(item){
return item.list.reduce((pre, item) => {
return pre + Number(item['MENGA'])
return pre + Number(this.isIM ? item['ERFMG'] : item['MENGA'])
}, 0)
}
}
......@@ -151,7 +159,7 @@
acc.push({
MATNR: cur.MATNR, // 物料编码
MAKTX: cur.MAKTX, // 物料名称
GESME: cur.GESME, // 该物料盘点总数
GESME: cur.GESME || cur.PACMG, // 该物料盘点总数
MEINS: cur.MEINS, // 单位
show: true,
list: [cur]
......@@ -159,18 +167,34 @@
} else {
// 有产品分类
item.list.push(cur)
if (this.isIM) {
item.GESME += cur.PACMG
}
}
return acc
}, [])
},
resetInput() {
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
},
handleInput(e) {
this.isDisabled = true
this.goodsList.forEach(element => {
element.list.forEach(item => {
if (item['PLNR'] === e) {
if (this.isIM) {
item.ERFMG = item.PACMG
} else {
item.MENGA = item.PACMG
}
}
})
})
this.resetInput()
},
toggleShow(item, index) {
console.log('触发了当前选项!', item)
......@@ -178,8 +202,14 @@
this.$set(this.goodsList, index, item)
},
getBtnHandle(row) {
this[row.way]();
},
submitForm() {
let params
if (this.isIm) {
this.inventoryList.forEach((item) => {
item.ERFME = item.MEINS
})
if (this.isIM) {
params = {
RDATA_IM: this.inventoryList,
RDATA_WM: []
......@@ -194,17 +224,19 @@
.postInventory(params)
.then((res) => {
if(res && res[0]) {
if (res[0]['TYPE'] === 'S') {
this[row.way]();
} else {
this.$u.toast(res[0].MESSAGE)
const errorMsg = res.find(item => item.TYPE != 'S')
if (errorMsg) {
return this.$u.toast(errorMsg.MESSAGE)
}
this.$u.toast(res[0].MESSAGE)
this.goBack()
}
})
},
goBack() {
console.log('返回了');
setTimeout(() => {
uni.navigateBack()
}, 2000);
},
ontabtap(e, type) {
console.log('切换tab', e, type);
......@@ -292,6 +324,7 @@
justify-content: space-between;
background: #fff;
border-radius: 10rpx;
margin-top: 10rpx;
}
.bottomItem {
......@@ -345,3 +378,16 @@
}
}
</style>
<style lang="scss" scoped>
/deep/ .boxRight {
.uni-easyinput__content {
.uni-easyinput__content-input {
height: 52rpx;
font-size: 24rpx;
}
.uni-icons.content-clear-icon.uniui-clear {
font-size: 24rpx;
}
}
}
</style>
\ No newline at end of file
......@@ -7,7 +7,7 @@
>盘点计划:{{ inventoryInfo.IVNUM || inventoryInfo.IBLNR }}</view
>
<!-- <view class="item">线边仓|XB-001-02</view> -->
<view class="item">计划日期:{{ inventoryInfo.PDATU }}</view>
<view class="item">计划日期:{{ inventoryInfo.PDATU || inventoryInfo.ZLDAT }}</view>
<view class="item">盘点人员:{{ vuex_user.nickName }}</view>
<view class="item">盘点状态:未开始</view>
</view>
......@@ -44,7 +44,7 @@
<view class="bottomItem">
<view class="items">物料编码:{{ item.MATNR }}</view>
<view class="items">物料名称:{{ item.MAKTX }}</view>
<view class="items">生产日期:{{ item.PDATU }}</view>
<view class="items" v-if="item.PDATU">生产日期:{{ item.PDATU }}</view>
</view>
<view class="boxRight">
<view class="items nums">{{ item.GESME }} ({{ item.MEINS }})</view>
......@@ -84,19 +84,33 @@ export default {
// 可以盘点
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) => {
this.inventoryList = this.isIm ? this.filterIMData(res.RDATA_IM) : this.filterWMData(res.RDATA_WM)
} else {
// 不能盘点
this.$u.toast(res.MSG[0].MESSAGE || "该盘点计划暂无库存数据");
}
});
},
filterWMData(data) {
return data.reduce((acc,cur) => {
if (acc.findIndex((item) => item.MATNR === cur.MATNR) === -1) {
acc.push(cur);
}
return acc;
}, []);
}, [])
},
filterIMData(data) {
// GESME IM数据结构没有总数
return data.reduce((acc, cur) => {
const item = acc.find(v => v.MATNR == cur.MATNR)
if (item) {
item.GESME += cur.PACMG
} else {
// 不能盘点
this.$u.toast(res.MSG[0].MESSAGE || "该盘点计划暂无库存数据");
cur.GESME = cur.PACMG
acc.push(cur)
}
});
return acc
},[])
},
objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
......
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