Commit 09695334 authored by tanjunxin's avatar tanjunxin

fix: 余料退料添加副产品标识

parent 6508ee13
......@@ -2,8 +2,8 @@
"name" : "mes-pda",
"appid" : "__UNI__FB0FD5F",
"description" : "MES-PDA",
"versionName" : "1.2.3",
"versionCode" : 123,
"versionName" : "1.2.4",
"versionCode" : 124,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......
......@@ -7,10 +7,11 @@
均摊明细
</u-button>
</view>
<view class="item input">退料数量:<uni-easyinput v-model="num" trim="all" type="text"
<view class="item input">退料数量:<uni-easyinput v-model="num" trim="all" type="number"
@input="handleChange"></uni-easyinput>/PCS
</view>
<view class="item">申请数量:{{ batchNum }}/PCS</view>
<view class="item">是否副产品:{{ item.coproduct == "Y" ? '是' : '否' }}</view>
</view>
<view class="listBottom">
<view class="bottomTitle" @tap="show = !show">
......@@ -27,13 +28,15 @@
</view>
</view>
<view v-if="show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in sapList">
<view class="bottomItem" v-for="(ele, idx) in sapList" :key="idx">
<view class="items">{{ ele.batchNo }}</view>
<view class="items">{{ ele.sapItemCode }}<br>{{ele.itemName}}</view>
<view class="items">PL号:<br>
<view class="items" v-for="p in ele.plNum.split('|')">
{{ p }}
</view>
<template v-if="ele.plNum">
<view class="items" v-for="(p, i) in ele.plNum.split('|')" key="i">
{{ p }}
</view>
</template>
</view>
<view class="items">批次数量:{{ ele.backNum }}/PCS</view>
<view class="items">生产日期:{{ ele.produceTime }}</view>
......@@ -42,7 +45,7 @@
</view>
<u-popup class="oddments-popup" v-model="visible" mode="center" :mask-close-able="false">
<scroll-view scroll-y="true" style="height: 600rpx;">
<view class="content" v-for="(ele, idx) in pordList">
<view class="content" v-for="(ele, idx) in pordList" :index="idx">
<view class="item">生产单号:{{ ele.workorderCode }}</view>
<view class="item">{{ ele.sapItemCode }}<br>{{ele.itemName}}</view>
<view class="item">工单计划数:{{ ele.quantity }}/PCS</view>
......@@ -141,7 +144,12 @@
this.$u.toast("退料数量不可以超过申请数量!");
} else {
this.sapList.forEach(ele => {
ele.ERFMG = (val * (ele.quantity / this.totalNum)).toFixed(2);
if (ele.coproduct == "Y") {
ele.ERFMG = val;
} else {
ele.ERFMG = (val * (ele.quantity / this.totalNum)).toFixed(2);
}
ele.COPRODUCT = ele.coproduct;
})
}
// }
......
......@@ -24,7 +24,7 @@
</view>
<ContentLoadingMore class="cardbox" :list='chargaArr'>
<scroll-view scroll-y="true" style="height: 680rpx;">
<view class="cardContent" v-for="(item, index) in chargaArr">
<view class="cardContent" v-for="(item, index) in chargaArr" :key="index">
<PutwayItem :item='item' :list='chargaArr' @delGonds="delGonds" />
</view>
</scroll-view>
......
<template>
<view class="lists">
<StickyNavBar>
<NavBar title="发货下架"></NavBar>
<FactorySelect v-model="lgort" :options="options" />
<view class="btn">
<uni-easyinput
class="boxSelect"
prefixIcon="search"
v-model.trim="vbeln"
placeholder="请扫描交货单"
@confirm="handleConfirm"
></uni-easyinput>
<uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
v-model.trim="wxparams"
:focus="isFocus"
placeholder="请扫描产品包装条码/外箱码"
@confirm="handleConfirmPlnr"
></uni-easyinput>
</view>
<!-- <view class="total" v-show="goodsList && goodsList.length > 0">
<view class="lists">
<StickyNavBar>
<NavBar title="发货下架"></NavBar>
<FactorySelect v-model="lgort" :options="options" />
<view class="btn">
<uni-easyinput class="boxSelect" prefixIcon="search" v-model.trim="vbeln" placeholder="请扫描交货单"
@confirm="handleConfirm"></uni-easyinput>
<uni-easyinput prefixIcon="search" :disabled="isDisabled" v-model.trim="wxparams" :focus="isFocus"
placeholder="请扫描产品包装条码/外箱码" @confirm="handleConfirmPlnr"></uni-easyinput>
</view>
<!-- <view class="total" v-show="goodsList && goodsList.length > 0">
<view class="left">明细</view>
</view> -->
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view class="cardContent" v-for="item in goodsList" :key="item.PLNR">
<scanningList :item="item" :list="item.ZPLDT" />
</view>
</view>
</ContentLoadingMore>
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view class="cardContent" v-for="item in goodsList" :key="item.PLNR">
<scanningList :item="item" :list="item.ZPLDT" />
</view>
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
<script>
import BottomBtn from "@/components/BottomBtn/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import scanningList from "../salesOutbound/scanningList.vue";
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import { parseTime } from "@/utils/ruoyi";
import BottomBtn from "@/components/BottomBtn/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import scanningList from "../salesOutbound/scanningList.vue";
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import {
parseTime
} from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
scanningList,
BottomBtn,
},
data() {
return {
wxparams: "",
lgort: "",
vbeln: "",
isDisabled: false,
isFocus: false,
goodsList: [],
options: [
{
WERKS: "1000",
LGORT: "S000",
LGOBE: "发运仓",
label: "S000-发运仓",
value: "S000",
},
],
pls: [], // 已经扫码的pl号
btnArr: [
{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
};
},
computed: {
/**
* 缓存的扫描过的pl条目
*/
catchPL() {
return this.vuex_sales_outbound[this.vbeln] || null;
},
},
methods: {
handleConfirmPlnr(e) {
if (!e) return;
this.isFocus = false;
console.log(this.pls, "this.pls");
if (this.pls.includes(e)) {
return this.$u.toast("请勿重复扫描!");
}
this.getPlnr(e);
},
getPlnr(plnr) {
if (!this.goodsList.length) {
return this.$u.toast("请先扫描交货单!");
}
let params = {
ztype: "005",
};
plnr.startsWith('B') ? (params.ZCODE = plnr) :(params.PLNR = plnr)
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.setSalesBoundPL(res.BLPL);
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
setSalesBoundPL(pls) {
console.log(pls, "pls");
// 循环BLPL合并相同的物料号和size
pls.forEach((ele) => {
if (!this.pls.includes(ele.PLNR) || !this.pls.includes(ele.ZCODE)) {
ele.PLNR && this.pls.push(ele.PLNR);
ele.ZCODE && this.pls.push(ele.ZCODE);
}
ele.TOMNG = ele.PACMG;
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]);
}
}
});
},
initGoodsList(arr, VBELN) {
// 有SIZE行就取ZINSNUM+ZLOSSC,没有SIZE行的就是取交货单行的LFIMG
arr.forEach((ele) => {
if (ele.ZSIZE.length) {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
KDAUF: ele.KDAUF,
KDPOS: ele.KDPOS,
LFIMG: ele.LFIMG,
MEINS: ele.MEINS,
WERKS: ele.WERKS,
...item,
KUNNR: ele.KUNNR,
NAME1: ele.NAME1,
WADAT: ele.WADAT,
XSNUM: ele.XSNUM,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
VBELN: VBELN,
POSNR: ele.POSNR,
ZPLDT: [],
sumNum: item.ZINSNUM + item.ZLOSSC,
};
})
);
} else {
ele.ZSIZE = "";
ele.sumNum = ele.LFIMG;
ele.ZPLDT = []
// ele.ZINSNUM = ele.LFIMG;
this.goodsList.push(ele);
this.$u.toast(`物料编号:${ele.MATNR}--没有尺码信息`);
}
});
},
handleConfirm(VBELN) {
this.$u.api.sapApi
.sapSchDn({
VBELN,
})
.then((res) => {
this.initGoodsList(res.BKDT, VBELN);
setTimeout(() => {
this.vbeln = "";
}, 1000);
});
},
deleGonds(index) {
this.goodsList.splice(index, 1);
},
reset() {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
},
goBack() {
uni.navigateBack();
},
getBtnHandle(row) {
console.log("getBtnHandle", row);
this[row.way]();
},
// 提交
goSubmit() {
// console.log(this.goodsList, '--------');
// return
if (!this.goodsList.length) {
return this.$u.toast("请先扫描交货单!");
}
if (!this.lgort) {
return this.$u.toast("请选择目标仓位");
}
const arr = this.goodsList.reduce((acc, cur) => {
acc.push(
...cur.ZPLDT.map((item) => {
item.LGORT = this.lgort;
item.VBELN = cur.VBELN;
item.POSNR = cur.POSNR;
return item;
})
);
return acc;
}, []);
// const arr = this.goodsList.map((item) => {
// item.LGORT = this.lgort
// item.VBELN = this.vbeln
// return item
// })
this.$u.api.sapApi.sapCasePlnr2(arr).then((res) => {
const flag = res.some((item) => {
const b = item.TYPE == "E";
if (b) {
this.$u.toast(item.MESSAGE);
}
return b;
});
if (!flag) {
this.$u.toast(res[0].MESSAGE);
this.goodsList = [];
}
});
},
},
};
export default {
components: {
StickyNavBar,
ContentLoadingMore,
scanningList,
BottomBtn,
},
data() {
return {
wxparams: "",
lgort: "",
vbeln: "",
isDisabled: false,
isFocus: false,
goodsList: [],
options: [{
WERKS: "1000",
LGORT: "S000",
LGOBE: "发运仓",
label: "S000-发运仓",
value: "S000",
}, ],
pls: [], // 已经扫码的pl号
btnArr: [{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
};
},
computed: {
/**
* 缓存的扫描过的pl条目
*/
catchPL() {
return this.vuex_sales_outbound[this.vbeln] || null;
},
},
methods: {
handleConfirmPlnr(e) {
if (!e) return;
this.isFocus = false;
console.log(this.pls, "this.pls");
if (this.pls.includes(e)) {
return this.$u.toast("请勿重复扫描!");
}
this.getPlnr(e);
},
getPlnr(plnr) {
if (!this.goodsList.length) {
return this.$u.toast("请先扫描交货单!");
}
let params = {
ztype: "005",
};
plnr.startsWith('B') ? (params.ZCODE = plnr) : (params.PLNR = plnr)
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.setSalesBoundPL(res.BLPL);
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
setSalesBoundPL(pls) {
console.log(pls, "pls");
// 循环BLPL合并相同的物料号和size
pls.forEach((ele) => {
if (!this.pls.includes(ele.PLNR) || !this.pls.includes(ele.ZCODE)) {
ele.PLNR && this.pls.push(ele.PLNR);
ele.ZCODE && this.pls.push(ele.ZCODE);
}
ele.TOMNG = ele.PACMG;
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]);
}
}
});
},
initGoodsList(arr, VBELN) {
// 有SIZE行就取ZINSNUM+ZLOSSC,没有SIZE行的就是取交货单行的LFIMG
arr.forEach((ele) => {
if (ele.ZSIZE.length) {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
KDAUF: ele.KDAUF,
KDPOS: ele.KDPOS,
LFIMG: ele.LFIMG,
MEINS: ele.MEINS,
WERKS: ele.WERKS,
...item,
KUNNR: ele.KUNNR,
NAME1: ele.NAME1,
WADAT: ele.WADAT,
XSNUM: ele.XSNUM,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
VBELN: VBELN,
POSNR: ele.POSNR,
ZPLDT: [],
sumNum: item.ZINSNUM + item.ZLOSSC,
};
})
);
} else {
ele.ZSIZE = "";
ele.sumNum = ele.LFIMG;
ele.ZPLDT = []
// ele.ZINSNUM = ele.LFIMG;
this.goodsList.push(ele);
this.$u.toast(`物料编号:${ele.MATNR}--没有尺码信息`);
}
});
},
handleConfirm(VBELN) {
this.$u.api.sapApi
.sapSchDn({
VBELN,
})
.then((res) => {
this.initGoodsList(res.BKDT, VBELN);
setTimeout(() => {
this.vbeln = "";
}, 1000);
});
},
deleGonds(index) {
this.goodsList.splice(index, 1);
},
reset() {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
},
goBack() {
uni.navigateBack();
},
getBtnHandle(row) {
console.log("getBtnHandle", row);
this[row.way]();
},
// 提交
goSubmit() {
// console.log(this.goodsList, '--------');
// return
if (!this.goodsList.length) {
return this.$u.toast("请先扫描交货单!");
}
if (!this.lgort) {
return this.$u.toast("请选择目标仓位");
}
const arr = this.goodsList.reduce((acc, cur) => {
acc.push(
...cur.ZPLDT.map((item) => {
item.LGORT = this.lgort;
item.VBELN = cur.VBELN;
item.POSNR = cur.POSNR;
return item;
})
);
return acc;
}, []);
// const arr = this.goodsList.map((item) => {
// item.LGORT = this.lgort
// item.VBELN = this.vbeln
// return item
// })
this.$u.api.sapApi.sapCasePlnr2(arr).then((res) => {
const flag = res.some((item) => {
const b = item.TYPE == "E";
if (b) {
this.$u.toast(item.MESSAGE);
}
return b;
});
if (!flag) {
this.$u.toast(res[0].MESSAGE);
this.goodsList = [];
}
});
},
},
};
</script>
<style lang="scss" scoped>
.lists {
flex: 1;
flex-direction: column;
}
.lists {
flex: 1;
flex-direction: column;
}
page {
background: #f8f8f8;
}
page {
background: #f8f8f8;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.btn {
padding: 20rpx;
background: #fff;
.btn {
padding: 20rpx;
background: #fff;
.boxSelect {
margin-bottom: 20rpx;
}
}
.boxSelect {
margin-bottom: 20rpx;
}
}
.contentMore {
margin: 20rpx;
}
.cardbox {
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.contentMore {
margin: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.cardbox {
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.line {
margin: 0px 10rpx;
}
}
</style>
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
</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