Commit 9aec8dbe authored by 何远江's avatar 何远江

委外退料

parent 25945c6a
<template>
<view>
<view class="listItemTitle">
<view>
<view class="item">退料批次:{{ item.CHARG }}</view>
<view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view>
<view class="item">退料数量:{{ item.cardNum }}</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>
<view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in goodsList" v-if="ele.CHARG === item.CHARG">
<view class="items plNum">{{ ele.PLNR }}</view>
<view class="item">退料库位:{{ ele.NLPLA }}</view>
<view class="items">数量:{{ ele.TOMNG }}</view>
<view class="boxBtn">
<view class="items">生产日期:{{ ele.BLDAT }}</view>
<u-button class="botBtn" size="mini" type="primary" plain @click="deleGonds()">
<u-icon name="trash" size="28"></u-icon>
删除
</u-button>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn
},
props: {
item: {
type: Object,
default: function () {
return {};
}
},
goodsList: {
type: Array ,
default: function () {
return [];
}
},
nlpla: {
type: String,
default: ''
}
},
data() {
return {
number: 0,
totalNum: 0,
show: true,
wxparams: '',
isFocus: false,
isDisabled: false,
chargaArr: []
};
},
created() {
},
methods: {
deleGonds() {
this.$emit('deleGonds',this.item)
},
}
};
</script>
<style lang="scss" scoped>
page {
background: #f8f8f8;
}
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.bottomBtn {
position: sticky;
padding: 20rpx;
display: flex;
justify-content: space-between;
background: #fff;
bottom: 0rpx;
margin-top: 20rpx;
.u-btn {
width: 300rpx;
}
}
.blue {
color: #3f9dcc;
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.listItemTitle {
display: flex;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2px solid #f8f8f8;
.u-btn {
width: 150rpx;
margin: 0px;
margin-top: 10rpx;
}
.item {
line-height: 50rpx;
color: #000;
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
}
}
.listBottom {
.bottomTitle {
height: 80rpx;
position: relative;
.desc {
color: #bbb;
font-size: 24rpx;
line-height: 80rpx;
padding-left: 20rpx;
}
.topIcons {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #aaa;
}
}
.bottomBox {
padding: 20rpx;
.bottomItem {
background: #f8f8f8;
padding: 20rpx;
margin-bottom: 20rpx;
.items {
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
.plNum{
height: 80rpx;
word-break: break-all;
}
}
}
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.boxBtn{
display: flex;
justify-content: space-between;
/deep/.u-btn{
margin-right: 0 !important;
}
}
.botBtn{
}
</style>
\ No newline at end of file
<template> <template>
<view> <view class="page">
<StickyNavBar> <StickyNavBar>
<NavBar title="委外退料"></NavBar> <NavBar title="委外退料"></NavBar>
<view class="btn"> <view class="btn">
...@@ -14,54 +14,19 @@ ...@@ -14,54 +14,19 @@
></uni-easyinput> ></uni-easyinput>
</view> </view>
<view class="total"> <view class="total">
<view class="left">入库明细</view> <view class="left">退料明细</view>
<view class="right"> <view class="right">
批次数: 批次数:
<text class="blue">{{ goodsList.length }}</text> <text class="blue">{{ chargaArr.length }}</text>
<text class="line">|</text> <text class="line">|</text>
总数量: 总数量:
<text class="blue">{{ totalNum }}</text> <text class="blue">{{ totalNum }}</text>
</view> </view>
</view> </view>
</StickyNavBar> </StickyNavBar>
<ContentLoadingMore class="cardbox"> <ContentLoadingMore class="cardbox" :list='chargaArr'>
<view class="cardContent" v-for="(item, index) in goodsList"> <view class="cardContent" v-for="(item, index) in chargaArr">
<view class="listItemTitle"> <listItem :item="item" :goodsList="goodsList" :nlpla="nlpla" @deleGonds="deleGonds"/>
<view>
<view class="item">入库批次:{{ item.CHARG }}</view>
<view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view>
<view class="item">入库数量:{{ item.ERFMG }}</view>
<view class="item">入库库位:{{ item.MATNR }}</view>
</view>
<u-button size="mini" type="primary" plain @click="deleGonds(index)">
<u-icon name="trash" size="28"></u-icon>
删除
</u-button>
</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>
<view v-if="!show" class="bottomBox">
<view class="bottomItem">
<view class="items">{{ item.CHARG }}</view>
<view class="items">{{ item.MATNR }}</view>
<view class="items">数量:{{ item.ERFMG }}</view>
<view class="items">生产日期:{{ item.BLDAT }}</view>
</view>
</view>
</view>
</view> </view>
</ContentLoadingMore> </ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
...@@ -69,14 +34,17 @@ ...@@ -69,14 +34,17 @@
</template> </template>
<script> <script>
import listItem from "./listItem.vue"
import StickyNavBar from '@/components/StickyNavBar/index.vue'; import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue'; import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue'; import BottomBtn from '@/components/BottomBtn/index.vue';
import { parseTime} from "@/utils/ruoyi";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn BottomBtn,
listItem
}, },
data() { data() {
return { return {
...@@ -101,19 +69,27 @@ export default { ...@@ -101,19 +69,27 @@ export default {
], ],
goodsList: [], goodsList: [],
isFocus: false, isFocus: false,
isDisabled: false isDisabled: false,
chargaArr: []
}; };
}, },
created() { created() {
// this.getPlnr('10000820240325000001|10000320100'); // this.getPlnr('100001240428000002|00100000000000014.000|10002442800002');
// this.getPlnr('100001240428000002|00100000000000019.500|10002442800001');
}, },
methods: { methods: {
deleGonds(idx) { deleGonds(detail) {
this.goodsList.forEach((ele,idx) => {
if(detail.PLNR === ele.PLNR){
this.goodsList.splice(idx, 1); this.goodsList.splice(idx, 1);
}
});
this.totalNum = 0; this.totalNum = 0;
this.goodsList.forEach((ele) => { this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG; this.totalNum += ele.TOMNG - 0
ele.cardNum = 0
}); });
this.handleData()
}, },
getBtnHandle(row) { getBtnHandle(row) {
this[row.way](); this[row.way]();
...@@ -125,22 +101,18 @@ export default { ...@@ -125,22 +101,18 @@ export default {
if (this.goodsList.length === 0) { if (this.goodsList.length === 0) {
return; return;
} }
console.log([ const data = JSON.parse(JSON.stringify(this.goodsList))
{ data.forEach(ele => {
BLDAT: '20240325', ele.ERFMG = ele.TOMNG
BUDAT: '20240325', });
ZENCODE: 'A014',
ITEM: this.goodsList
}
]);
this.$u.api.sapApi this.$u.api.sapApi
.sapRrm([ .sapRrm([
{ {
BLDAT: '20240325', BLDAT: parseTime(new Date(),'{y}{m}{d}'),
BUDAT: '20240325', BUDAT: parseTime(new Date(),'{y}{m}{d}'),
ZENCODE: 'A014', ZENCODE: 'A014',
TYPE: 'CG', TYPE: 'CG',
ITEM: this.goodsList ITEM: data
} }
]) ])
.then((res) => { .then((res) => {
...@@ -150,6 +122,7 @@ export default { ...@@ -150,6 +122,7 @@ export default {
} }
if (res && res.every((item) => item.TYPE === 'S')) { if (res && res.every((item) => item.TYPE === 'S')) {
this.goodsList = []; this.goodsList = [];
this.chargaArr = []
this.totalNum = 0; this.totalNum = 0;
this.nlpla = ''; this.nlpla = '';
this.wxparams = ''; this.wxparams = '';
...@@ -168,28 +141,53 @@ export default { ...@@ -168,28 +141,53 @@ export default {
}, },
handleInputNlpla(e) { handleInputNlpla(e) {
if (e) { if (e) {
this.nlpla = e; // this.nlpla = e;
this.goodsList.forEach((ele) => { // this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG; // this.totalNum += ele.TOMNG-0;
ele.NLPLA = ele.NLPLA || this.nlpla; // ele.NLPLA = ele.NLPLA || this.nlpla;
}); // });
} }
}, },
getPlnr(plnr) { getPlnr(plnr) {
this.totalNum = 0;
this.isDisabled = true; this.isDisabled = true;
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
return
}
this.$u.api.sapApi this.$u.api.sapApi
.sapPlnr({ .sapPlnr({
plnr plnr,
zType: '001'
}) })
.then((res) => { .then((res) => {
if (res && res.RESULT.TYPE === 'S') { if (res && res.RESULT.TYPE === 'S') {
this.goodsList = this.goodsList.concat(res.DATA); if (this.goodsList.some((item) => item.PLNR === plnr)) {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = '';
}, 1000);
this.$u.toast('已经存在当前条码');
return
}
const arr = [
{
...res.DATA[0],
NLPLA: this.nlpla
}
]
this.goodsList = this.goodsList.concat(arr);
this.totalNum = 0;
this.goodsList.forEach((ele) => { this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG; this.totalNum += ele.TOMNG - 0
ele.NLPLA = ele.NLPLA || this.nlpla; ele.cardNum = 0
ele.PLNR = plnr
}); });
this.handleData()
setTimeout(() => { setTimeout(() => {
this.wxparams = ''; this.wxparams = '';
this.isFocus = true; this.isFocus = true;
...@@ -199,20 +197,32 @@ export default { ...@@ -199,20 +197,32 @@ export default {
setTimeout(() => { setTimeout(() => {
this.isFocus = true; this.isFocus = true;
this.isDisabled = false; this.isDisabled = false;
this.wxparams = '';
}, 1000); }, 1000);
this.$u.toast(res.RESULT.MESSAGE); this.$u.toast(res.RESULT.MESSAGE);
} }
this.loading = false; this.loading = false;
}); });
},
handleData(){
this.chargaArr = this.goodsList.filter((item, index, self) => {
return self.findIndex(t => t.CHARG === item.CHARG) === index;
});
this.chargaArr.forEach((ele,idx) => {
this.goodsList.forEach(item => {
if(ele.CHARG === item.CHARG){
ele.cardNum += (item.TOMNG - 0)
this.$set(this.chargaArr,idx,{...ele})
} }
});
});
},
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
page {
background: #f8f8f8;
}
.btn { .btn {
padding: 20rpx; padding: 20rpx;
background: #fff; background: #fff;
...@@ -254,60 +264,11 @@ page { ...@@ -254,60 +264,11 @@ page {
.cardContent { .cardContent {
border-radius: 8px; border-radius: 8px;
background: #fff; 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 {
line-height: 50rpx;
color: #000;
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
}
}
.listBottom {
.bottomTitle {
height: 80rpx;
position: relative;
.desc {
color: #bbb;
font-size: 24rpx;
line-height: 80rpx;
padding-left: 20rpx;
}
.topIcons {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #aaa;
}
}
.bottomBox {
padding: 20rpx;
.bottomItem {
background: #f8f8f8;
padding: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.items {
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
}
}
} }
/deep/ .u-sticky { /deep/ .u-sticky {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
</style> </style>
\ No newline at end of file
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