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

销售检配

parent 3c0a4a87
......@@ -74,7 +74,7 @@ export default {
};
},
created() {
this.getPlnr('80000033');
// this.getPlnr('80000033');
},
methods: {
getBtnHandle(row) {
......
<template>
<view class="lists page">
<StickyNavBar class="listTitle">
<NavBar title="销售拣货"></NavBar>
<!-- <view class="selectSheet">
<u-tabs :list="list" :is-scroll="false" :current="current" @change="changeTab"></u-tabs>
</view> -->
<view class="headerTitle">
<view class="items">交货单号:{{ goodsList[0].VBELN }}</view>
<view class="items">8|李XXXXXXX体</view>
<view class="items">计划日期:9999/99/99</view>
</view>
<view class="">
<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>
<view class="total">
<view class="left">明细</view>
<view class="right">
<!-- 物料数量: -->
<text class="blue">{{ totalNum }}</text>
<text class="line">/</text>
<text class="">{{ goodsList.length }}</text>
</view>
</view>
</view>
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list='goodsList'>
<view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.PLNR">
<scanningList :item='item' :list='list'/>
</view>
</view>
<!-- <view class="cardbox" v-else>
<view class="cardContent" v-for="(item, index) in goodsList">
<stockList :item='item' />
</view>
</view> -->
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
import scanningList from "./scanningList.vue"
import stockList from "./stockList.vue"
import { parseTime} from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList,
stockList
},
data() {
return {
value: '',
type: 'select',
border: true,
current: 0,
status: 'loadmore',
btnArr: [
{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
},
{
style: '',
type: 'primary',
text: '提交',
way: 'goSubmit'
}
],
isFocus: false,
isDisabled: false,
nlpla: '',
wxparams: '',
goodsList: [],
list: [],
orderItem: {},
};
},
created() {
// this.getPlnr('10000820240325000001|10000320100');
},
onLoad(option) {
if(option && option.order){
const arr = [
...JSON.parse(option.order)
]
arr.forEach(ele => {
// ele.checkedBox = false
ele.ZSIZE.forEach(item => {
if(ele.POSNR === item.POSNR){
item.MATNR = ele.MATNR
item.MAKTX = ele.MAKTX
this.goodsList.push(item)
}
});
});
this.list = JSON.parse(JSON.stringify(this.goodsList))
}
},
computed:{
totalNum(){
const count = this.goodsList.filter(item => item.checkedBox).length
return count || 0
},
},
methods: {
goSubmit() {
// const checkboxArr = this.goodsList.filter(item => item.checkedBox)
// if (checkboxArr.length === 0) {
// this.$u.toast('暂无提交数据');
// return;
// }
// const chargLength = checkboxArr.filter(item => item.CHARG).length
// const chargListLength = this.goodsList.filter(item => item.CHARG).length
// if (chargLength > 1 || chargListLength != chargLength) {
// this.$u.toast('超过拣配数量');
// return;
// }
const arr = this.list.filter(item => item.PLNR)
this.$u.api.sapApi
.sapPickingDn(arr)
.then((res) => {
this.loading = false;
if(!Array.isArray(res)){
return
}
if (res.every((item) => item.TYPE === 'S')) {
this.$u.toast('提交成功');
}
const foundObject = res.find(item => item.TYPE === 'E');
if(foundObject && foundObject.MESSAGE){
this.$u.toast(foundObject.MESSAGE);
}
});
},
getPlnr(plnr) {
let params = {
ZCODE: plnr.includes('BL') ? plnr : '',
plnr: plnr.includes('BL') ? '': plnr
}
this.$u.api.sapApi
.sapBlpl(params)
.then((res) => {
if (res && res.MSG[0].TYPE === 'S') {
this.list.forEach(ele => {
res.BLPL.forEach(item => {
if(ele.ZSIZE === item.ZSIZE && ele.MATNR === item.MATNR ){
if((item.PACMG-0) > ele.ZINSNUM){
this.$u.toast('太多了');
}else{
this.list.push({
...ele,
...item
})
}
}
});
});
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = ''
}, 1000);
this.loading = false;
});
},
// 加载更多
onReachBottom() {
console.log('加载更多inventoryCounting');
},
getBtnHandle(row) {
console.log('getBtnHandle', row);
this[row.way]();
},
goBack() {
console.log('进来');
uni.navigateBack({
delta: 0
});
},
changeTab(index) {
this.current = index;
},
handleInputNlpla(e) {
},
handleInputPlnr(e) {
this.isFocus = false;
e && this.getPlnr(e);
},
}
};
</script>
<style lang="scss">
.selectSheet {
border-bottom: 1px solid #ccc;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.tabTwo{
/deep/ .u-sticky-wrap{
height: 330rpx !important;
}
}
.listTitle{
}
.contentMore {
margin: 20rpx;
}
page {
background: #f8f8f8;
}
.headerTitle{
padding: 20rpx;
font-weight: 600;
.items{
line-height: 40rpx;
}
}
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.cardbox {
min-height: calc(100vh - 410rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
</style>
<template>
<view class="lists page">
<StickyNavBar class="listTitle">
<NavBar title="销售拣货"></NavBar>
<!-- <view class="selectSheet">
<u-tabs :list="list" :is-scroll="false" :current="current" @change="changeTab"></u-tabs>
</view> -->
<view class="headerTitle">
<view class="items">交货单号:{{ goodsList[0].VBELN }}</view>
<view class="items">8|李XXXXXXX体</view>
<view class="items">计划日期:9999/99/99</view>
</view>
<view class="">
<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>
<view class="total">
<view class="left">明细</view>
<view class="right">
<!-- 物料数量: -->
<text class="blue">{{ totalNum }}</text>
<text class="line">/</text>
<text class="">{{ goodsList.length }}</text>
</view>
</view>
</view>
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view
class="cardContent"
v-for="(item, index) in goodsList"
:key="item.PLNR"
>
<scanningList :item="item" :list="item.ZPLDT" />
</view>
</view>
<!-- <view class="cardbox" v-else>
<view class="cardContent" v-for="(item, index) in goodsList">
<stockList :item='item' />
</view>
</view> -->
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
<script>
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import BottomBtn from "@/components/BottomBtn/index.vue";
import scanningList from "./scanningList.vue";
import stockList from "./stockList.vue";
import { parseTime } from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList,
stockList,
},
data() {
return {
value: "",
type: "select",
border: true,
current: 0,
status: "loadmore",
btnArr: [
{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
isFocus: false,
isDisabled: false,
nlpla: "",
wxparams: "",
goodsList: [],
list: [],
orderItem: {},
};
},
created() {
// this.getPlnr('10000820240325000001|10000320100');
},
onLoad(option) {
if (option && option.order) {
const arr = [...JSON.parse(option.order)];
arr.forEach((ele) => {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
...item,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
};
})
);
});
this.list = JSON.parse(JSON.stringify(this.goodsList));
}
},
computed: {
totalNum() {
const count = this.goodsList.filter((item) => item.checkedBox).length;
return count || 0;
},
},
methods: {
goSubmit() {
const flag = this.goodsList.every((ele) => {
return (
ele.ZINSNUM == ele?.ZPLDT?.reduce((acc, cur) => acc + cur.PACMG, 0)
);
});
if (!flag) {
return this.$u.toast("请确认所有包装数量是否正确");
}
const params = this.goodsList.reduce((acc, cur, index) => {
if (index == 0) {
acc.push({ ...cur });
} else {
const item = acc.find(v => v.POSNR === cur.POSNR)
if (item) {
item.ZPLDT.push(...cur.ZPLDT)
}else {
acc.push({ ...cur })
}
}
return acc
}, []);
this.$u.api.sapApi.sapPickingDn(params).then((res) => {
this.loading = false;
if (!Array.isArray(res)) {
return;
}
const flag = res.some((item) => {
const f = item.TYPE == "E";
if (f) {
this.$u.toast(item.MESSAGE);
}
return f;
});
if (!flag) {
this.$u.toast("提交成功");
}
});
},
getPlnr(plnr) {
let params = {
ZCODE: plnr.includes("BL") ? plnr : "",
plnr: plnr.includes("BL") ? "" : plnr,
};
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
// 循环BLPL合并相同的物料号和size
res.BLPL.forEach((ele) => {
const item = this.goodsList.find(
(v) => v.ZSIZE == ele.ZSIZE && ele.MATNR == v.MATNR
);
if (item) {
if (Reflect.has(item, "ZPLDT")) {
item.ZPLDT.push(ele);
} else {
this.$set(item, "ZPLDT", [ele]);
}
}
});
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
// 加载更多
onReachBottom() {
console.log("加载更多inventoryCounting");
},
getBtnHandle(row) {
console.log("getBtnHandle", row);
this[row.way]();
},
goBack() {
console.log("进来");
uni.navigateBack({
delta: 0,
});
},
changeTab(index) {
this.current = index;
},
handleInputNlpla(e) {},
handleInputPlnr(e) {
this.isFocus = false;
e && this.getPlnr(e);
},
},
};
</script>
<style lang="scss">
.selectSheet {
border-bottom: 1px solid #ccc;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.tabTwo {
/deep/ .u-sticky-wrap {
height: 330rpx !important;
}
}
.listTitle {
}
.contentMore {
margin: 20rpx;
}
page {
background: #f8f8f8;
}
.headerTitle {
padding: 20rpx;
font-weight: 600;
.items {
line-height: 40rpx;
}
}
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.cardbox {
min-height: calc(100vh - 410rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
</style>
......@@ -35,7 +35,8 @@
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.PLNR+idx" v-if="ele.ZSIZE === item.ZSIZE && ele.MATNR === item.MATNR && ele.PLNR">
<view class="items">PL号:{{ ele.PLNR }}</view>
<view class="items">物料批号:{{ ele.CHARG }}</view>
<view class="items">库位:{{ ele.NLPLA }}</view>
<view class="items">库位:{{ ele.LGORT }} - {{ ele.LGOBE }}</view>
<view class="items">仓位:{{ ele.NLPLA }}</view>
<!-- <view class="items">{{ ele.MATNR }}</view> -->
<view class="items inputItem">
<!-- <u-row gutter="8"> -->
......
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