Commit 4ed5674f authored by 何远江's avatar 何远江

成本中心

parent 83164305
<template>
<view>
<StickyNavBar>
<NavBar title="成本中心发料"></NavBar>
<view class="btn">
<uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
v-model="wxparams"
:focus="isFocus"
placeholder="请扫描单号"
@input="handleInputPlnr"
></uni-easyinput>
</view>
</StickyNavBar>
<view class="cardBox">
<text class="cardBoxTip"> 步骤一 扫描单号 </text>
<u-image
class="cardBoxImg"
:src="bgSrc"
width="560rpx"
height="400rpx"
></u-image>
<view class="cardBoxTip2"> 摄像头对准 </view>
<view class="cardBoxTip3"> 生产发料单号二维码 </view>
<view class="cardBoxTip2">
<text class="tipLeft"> 点击扫描或 </text>
<text class="tipRight"> 点选单号 </text>
</view>
</view>
<!-- <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";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
},
data() {
return {
bgSrc: require("@/static/images/qrcode.png"),
number: 0,
totalNum: 0,
show: true,
nlpla: "",
wxparams: "",
btnArr: [
{
style: "",
type: "primary",
text: "扫描单号",
way: "scanning",
},
{
style: "",
type: "warning",
text: "查询单号",
way: "goClick",
},
],
goodsList: [],
isFocus: false,
isDisabled: false,
};
},
created() {},
methods: {
getBtnHandle(row) {
this[row.way]();
},
goClick() {},
handleInputPlnr(e) {
this.isFocus = false;
e && this.getPlnr(e);
},
getPlnr(applyNo) {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.sapApi
.sapSearchArbpl({
RSNUM: applyNo,
})
.then((res) => {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
if (res.length && res.some((v) => v.TYPE == "E")) {
this.$u.toast(res[0].MESSAGE);
} else {
uni.navigateTo({
url: `/pages/costCenter/costCenterList?order=${applyNo}`,
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
page {
background: #f8f8f8;
}
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.cardBox {
min-height: calc(100vh - 400rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.cardBoxTip {
color: #000;
font-size: 28rpx;
}
.cardBoxTip2 {
color: #000;
font-size: 28rpx;
text-align: center;
}
.cardBoxTip3 {
color: #3f9dcc;
font-size: 28rpx;
text-align: center;
}
.tipRight {
color: #ff9900;
}
</style>
<template>
<view class="page">
<StickyNavBar>
<NavBar title="成本中心领料"></NavBar>
<view class="headerTitle">
<view class="">
<view class="items">领料申请:{{ goodsInfo.RSNUM }}</view>
<view class="items"
>{{ goodsInfo.KOSTL }} / {{ goodsInfo.KTEXT }}</view
>
</view>
<view class="checkedCase">
<checkbox-group @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否结案
</checkbox-group>
</view>
</view>
<view class="btn">
<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="">{{ goodsList.length }}</text>
</view>
</view>
</StickyNavBar>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList :item="item" :list="item.details" />
</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 { parseTime } from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList,
},
data() {
return {
checkedBox: false,
r1: "",
// totalNum: 0,
number: 0,
show: true,
nlpla: "YD-02-02-3",
wxparams: "",
btnArr: [
{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
goodsList: [],
isFocus: true,
isDisabled: false,
OrderNum: "",
list: [],
scanPLs: [],
};
},
computed: {
goodsInfo() {
return this.goodsList[0] || {};
},
},
onLoad(option) {
if (option && option.order) {
this.OrderNum = option.order;
this.getOrder(option.order);
}
},
watch: {},
created() {},
methods: {
reset() {
setTimeout(() => {
this.wxparams = "";
this.isFocus = true;
this.isDisabled = false;
}, 1000);
},
getOrder(applyNo) {
this.$u.api.sapApi
.sapSearchArbpl({
RSNUM: applyNo,
})
.then((res) => {
if (res.some((v) => v.TYPE === "E")) {
// 查询出错
} else {
this.goodsList = res.map((v) => {
v.details = [];
return v;
});
}
});
},
checkedChange() {
this.checkedBox = !this.checkedBox;
},
getBtnHandle(row) {
this[row.way]();
},
goBack() {
console.log("进来");
uni.navigateBack({
delta: 1,
});
},
goSubmit() {
// 检查是否扫描PL
if (!this.scanPLs.length) {
return this.$u.toast("请扫描PL!");
}
// 可以少发,不可以超发
if (
this.goodsList.some((item) => {
return (
item.BDMNG <
item.details.reduce((acc, cur) => {
acc += +cur.ERFMG;
}, 0)
);
})
) {
return this.$u.toast("检查数量是否正确!");
}
// 获取items
const items = this.goodsList.reduce((acc, cur) => {
acc.push(...cur.details.map(v => {
v.KOSTL = cur.KOSTL
return v
}));
return acc;
}, []);
const params = {
BLDAT: parseTime(new Date(), "{y}{m}{d}"),
BUDAT: parseTime(new Date(), "{y}{m}{d}"),
zencode: "A006",
ZMARK: "A001",
TYPE: 'FL',
item: items,
};
this.$u.api.sapApi.sapRrm([params]).then((res) => {
this.loading = false;
if (!Array.isArray(res)) {
return;
}
const errObj = res.find((item) => item.TYPE === "E");
if (errObj) {
return this.$u.toast(errObj.MESSAGE);
}
// 提交成功 返回上一个页面
this.$u.toast("提交成功!");
this.goBack();
});
},
handleInputPlnr(e) {
if (this.scanPLs.includes(e)) {
return this.$u.toast("请勿重复扫描!");
}
e && this.getPlnr(e);
},
getPlnr(plnr) {
this.isDisabled = true;
this.isFocus = false;
this.$u.api.sapApi
.sapBlpl({
plnr,
ztype: "002",
})
.then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.handlePL(res.BLPL, plnr);
this.reset();
} else {
this.reset();
this.$u.toast(res.MSG[0].MESSAGE);
}
this.loading = false;
});
},
handlePL(blpls, plnr) {
// 过滤与当前pl相同的物料
const [blpl] = blpls;
// 分配数量
blpl.ERFMG = blpl.PACMG;
const items = this.goodsList.filter((v) => v.MATNR == blpls[0].MATNR);
// 如果没有匹配到PL
if (!items.length) return this.$u.toast("没有匹配到PL对应的物料!");
// 保存已经扫描过的 pl
this.scanPLs.push(plnr);
/**
* 如果超过两个相同的物料,就按照项次依次分配、拆分
*/
if (items.length > 1) {
while (blpl.ERFMG > 0) {
let bdmng = 0;
// 查询需求数量与pl数量总和不等的物料
const item = items.find((v) => {
const total = v.details.length ? v.details.reduce(
(acc, cur) => (acc + +cur.ERFMG).toFixed(3),
0
) : 0
bdmng = (v.BDMNG - total).toFixed(3);
return bdmng > 0;
});
const splitBlpl = this.$u.deepClone(blpl);
// 如果需求数量 大于剩余的数量
if (bdmng > blpl.ERFMG) {
blpl.ERFMG = 0;
} else {
splitBlpl.ERFMG = bdmng;
blpl.ERFMG = (blpl.ERFMG - bdmng).toFixed(3);
}
splitBlpl.PACMG = splitBlpl.ERFMG
item.details.push(splitBlpl);
}
} else {
const [item] = items;
item.details.push(blpl);
}
},
},
};
</script>
<style lang="scss" scoped>
page {
background: #f8f8f8;
}
.headerTitle {
padding: 20rpx;
font-weight: 600;
.items {
line-height: 40rpx;
}
}
.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;
}
}
.cardbox {
min-height: calc(100vh - 480rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.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: #333;
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
font-weight: 600;
}
}
.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;
}
}
}
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.checkedCase {
margin-top: 10rpx;
}
</style>
<template>
<view>
<view class="listItemTitle">
<view>
<view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view>
<view class="item">单位:{{ item.MEINS }}</view>
</view>
<view class="right">
<text class="blue">{{ totalVistaNum }}</text>
<text class="line">/</text>
<text class="">{{ item.BDMNG }}</text>
</view>
</view>
<view class="listBottom">
<view class="bottomTitle" @click="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 list" :key="ele.PLNR">
<view class="items">PL:{{ ele.PLNR }}</view>
<view class="items">库位:{{ ele.LGORT }} - {{ ele.LGOBE }}</view>
<view class="items">仓位:{{ ele.NLPLA }}</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 {};
},
},
list: {
type: Array,
default: function() {
return [];
},
},
},
computed: {
totalVistaNum() {
return this.list
.reduce((acc, cur) => {
return acc + (+cur.ERFMG || 0);
}, 0)
.toFixed(3);
},
},
data() {
return {
number: 0,
nlpla: "",
wxparams: "",
btnArr: [{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
isFocus: false,
show: true,
num1: 0,
};
},
created() {},
methods: {
},
};
</script>
<style lang="scss" scoped>
page {
background: #f8f8f8;
}
.headerTitle {
padding: 20rpx;
font-weight: 600;
.items {
line-height: 40rpx;
}
}
.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: #333;
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
font-weight: 600;
}
}
.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;
line-height: 40rpx;
word-break: break-all;
/deep/ .uni-easyinput {
width: 200rpx;
}
}
.inputItem {
display: inline-flex;
// line-height: 76rpx;
}
}
}
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.progress {
width: 45%;
margin-left: 20rpx;
/deep/ .uni-progress-info {
font-size: 24rpx;
}
}
/deep/ .uni-progress {
line-height: 40rpx;
}
.proItem {
display: flex;
}
</style>
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