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

盘点对接

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