Commit 33494f5c authored by 何远江's avatar 何远江

工作中心

parent 4ed5674f
<template> <template>
<view> <view>
<view class="listItemTitle"> <view class="listItemTitle">
<view> <view>
<view class="item">物料编号:{{ item.sapItemCode }}</view> <view class="item">物料编号:{{ item.sapItemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view> <view class="item">物料描述:{{ item.itemName }}</view>
</view> </view>
<view class="right"> <view class="right">
<text class="blue">{{ totalVistaNum }}</text> <text class="blue">{{ totalVistaNum }}</text>
<text class="line">/</text> <text class="line">/</text>
<text class="">{{ totalNum }}</text> <text class="">{{ item.applyNum }}</text>
</view> </view>
</view> </view>
<view class="listBottom"> <view class="listBottom">
<view class="bottomTitle" @click="show = !show"> <view class="bottomTitle" @click="show = !show">
<view class="desc">卷条码明细</view> <view class="desc">卷条码明细</view>
<view class="topIcons"> <view class="topIcons">
<view v-if="show"> <view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon> <u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开 展开
</view> </view>
<view v-else> <view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon> <u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起 收起
</view> </view>
</view> </view>
</view> </view>
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
<view <view class="bottomItem" v-for="(ele, idx) in list" :key="ele.PLNR">
class="bottomItem" <view class="items">PL:{{ ele.PLNR }}</view>
v-for="(ele, idx) in details" <view class="items">库位:{{ ele.LGORT }} - {{ ele.LGOBE }}</view>
:key="ele.workorderCode" <view class="items">仓位:{{ ele.NLPLA }}</view>
> </view>
<view class="proItem"> </view>
<view class="items">生产单号:{{ ele.workorderCode }}</view> </view>
<view class="progress"> </view>
<progress :percent="handleVista(ele)" show-info /> </template>
</view>
</view> <script>
<view class="items inputItem"> import StickyNavBar from "@/components/StickyNavBar/index.vue";
数量: import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
{{ handleUseVista(ele) }} import BottomBtn from "@/components/BottomBtn/index.vue";
/ export default {
{{ ele.applyNum }} components: {
</view> StickyNavBar,
<template v-for="item in ele.details"> ContentLoadingMore,
<view class="items">PL:{{ item.PLNR }}</view> BottomBtn,
<view class="items">库位:{{ item.LGORT }} - {{ item.LGOBE }}</view> },
<view class="items">仓位:{{ item.NLPLA }}</view> props: {
</template> item: {
</view> type: Object,
</view> default: function() {
</view> return {};
</view> },
</template> },
list: {
<script> type: Array,
import StickyNavBar from "@/components/StickyNavBar/index.vue"; default: function() {
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue"; return [];
import BottomBtn from "@/components/BottomBtn/index.vue"; },
export default { },
components: { },
StickyNavBar, computed: {
ContentLoadingMore, totalVistaNum() {
BottomBtn, return this.list
}, .reduce((acc, cur) => {
props: { return acc + (cur.PACMG || 0);
item: { }, 0)
type: Object, .toFixed(3);
default: function () { },
return {}; },
}, watch: {
}, details: {
list: { handler: function(val, oldVal) {
type: Array, console.log(val, "00-------", this.list);
default: function () { },
return []; immediate: true,
}, deep: true,
}, },
}, },
computed: { data() {
details() { return {
return this.list.reduce((acc, cur) => { number: 0,
const item = acc.find((v) => v.workorderCode === cur.workorderCode); nlpla: "",
if (item) { wxparams: "",
item.details.push({ ...cur }); btnArr: [{
} else { style: "",
acc.push({ ...cur, details: [{...cur}] }); type: "warning",
} text: "返回",
return acc; way: "goBack",
}, []); },
}, {
totalNum() { style: "",
const workCodes = []; type: "primary",
return this.list.reduce((acc, cur) => { text: "提交",
if (workCodes.includes(cur.workorderCode)) { way: "goSubmit",
return acc; },
} else { ],
workCodes.push(cur.workorderCode); isFocus: false,
return acc + cur.applyNum; show: true,
} num1: 0,
}, 0).toFixed(3); };
}, },
totalVistaNum() { created() {},
return this.list.reduce((acc, cur) => { methods: {
return acc + cur.vista;
}, 0).toFixed(3); },
}, };
}, </script>
watch: {
details: { <style lang="scss" scoped>
handler: function (val, oldVal) { page {
console.log(val, "00-------", this.list); background: #f8f8f8;
}, }
immediate: true,
deep: true, .headerTitle {
}, padding: 20rpx;
}, font-weight: 600;
data() {
return { .items {
number: 0, line-height: 40rpx;
nlpla: "", }
wxparams: "", }
btnArr: [
{ .btn {
style: "", padding: 20rpx;
type: "warning", background: #fff;
text: "返回",
way: "goBack", .topSearch {
}, margin-bottom: 20rpx;
{ }
style: "", }
type: "primary",
text: "提交", .bottomBtn {
way: "goSubmit", position: sticky;
}, padding: 20rpx;
], display: flex;
isFocus: false, justify-content: space-between;
show: true, background: #fff;
num1: 0, bottom: 0rpx;
}; margin-top: 20rpx;
},
created() {}, .u-btn {
methods: { width: 300rpx;
handleUseVista(items) { }
return items.details.reduce((acc, cur) => cur.vista + acc, 0) }
},
handleVista(items) { .blue {
let num = 0; color: #3f9dcc;
this.list.forEach((ele) => { }
if (ele.workorderCode === items.workorderCode) {
console.log(`output->`, ele.vista, items.workorderCode); .total {
num += (ele.vista ? ele.vista : 0) - 0; background: #fff;
} color: #000;
}); padding: 0rpx 40rpx;
console.log(`output->num`, num); display: flex;
return (num / items.applyNum).toFixed(2) * 100 - 0 > 100 justify-content: space-between;
? 100 font-size: 32rpx;
: (num / items.applyNum).toFixed(2) * 100 || 0;
}, .line {
}, margin: 0px 10rpx;
}; }
</script> }
<style lang="scss" scoped> .listItemTitle {
page { display: flex;
background: #f8f8f8; justify-content: space-between;
} padding: 20rpx;
.headerTitle { border-bottom: 2px solid #f8f8f8;
padding: 20rpx;
font-weight: 600; .u-btn {
.items { width: 150rpx;
line-height: 40rpx; margin: 0px;
} margin-top: 10rpx;
} }
.btn {
padding: 20rpx; .item {
background: #fff; line-height: 50rpx;
.topSearch { color: #333;
margin-bottom: 20rpx; font-size: 28rpx;
} font-weight: 500;
} word-break: break-all;
.bottomBtn { font-weight: 600;
position: sticky; }
padding: 20rpx; }
display: flex;
justify-content: space-between; .listBottom {
background: #fff; .bottomTitle {
bottom: 0rpx; height: 80rpx;
margin-top: 20rpx; position: relative;
.u-btn {
width: 300rpx; .desc {
} color: #bbb;
} font-size: 24rpx;
.blue { line-height: 80rpx;
color: #3f9dcc; padding-left: 20rpx;
} }
.total {
background: #fff; .topIcons {
color: #000; position: absolute;
padding: 0rpx 40rpx; left: 50%;
display: flex; top: 50%;
justify-content: space-between; transform: translate(-50%, -50%);
font-size: 32rpx; color: #aaa;
.line { }
margin: 0px 10rpx; }
}
} .bottomBox {
.listItemTitle { padding: 20rpx;
display: flex;
justify-content: space-between; .bottomItem {
padding: 20rpx; background: #f8f8f8;
border-bottom: 2px solid #f8f8f8; padding: 20rpx;
.u-btn { margin-bottom: 20rpx;
width: 150rpx;
margin: 0px; .items {
margin-top: 10rpx; color: #333;
} font-size: 24rpx;
.item { line-height: 40rpx;
line-height: 50rpx; word-break: break-all;
color: #333;
font-size: 28rpx; /deep/ .uni-easyinput {
font-weight: 500; width: 200rpx;
word-break: break-all; }
font-weight: 600; }
}
} .inputItem {
.listBottom { display: inline-flex;
.bottomTitle { // line-height: 76rpx;
height: 80rpx; }
position: relative; }
.desc { }
color: #bbb; }
font-size: 24rpx;
line-height: 80rpx; /deep/ .u-sticky {
padding-left: 20rpx; top: 0 !important;
} background: #fff;
.topIcons { }
position: absolute;
left: 50%; .progress {
top: 50%; width: 45%;
transform: translate(-50%, -50%); margin-left: 20rpx;
color: #aaa;
} /deep/ .uni-progress-info {
} font-size: 24rpx;
.bottomBox { }
padding: 20rpx; }
.bottomItem {
background: #f8f8f8; /deep/ .uni-progress {
padding: 20rpx; line-height: 40rpx;
margin-bottom: 20rpx; }
.items {
color: #333; .proItem {
font-size: 24rpx; display: flex;
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> </style>
...@@ -79,11 +79,7 @@ export default { ...@@ -79,11 +79,7 @@ export default {
getBtnHandle(row) { getBtnHandle(row) {
this[row.way](); this[row.way]();
}, },
goClick() { goClick() {},
uni.navigateTo({
url: `/pages/productionIssuance/oddNumList`
});
},
handleInputPlnr(e) { handleInputPlnr(e) {
this.isFocus = false; this.isFocus = false;
e && this.getPlnr(e); e && this.getPlnr(e);
...@@ -92,16 +88,14 @@ export default { ...@@ -92,16 +88,14 @@ export default {
this.totalNum = 0; this.totalNum = 0;
this.isDisabled = true; this.isDisabled = true;
this.$u.api.mesApi this.$u.api.mesApi
.pdaMaterialcreate({ .pdaWortstation({
pageNum:1,
pageSize:10,
applyNo applyNo
}) })
.then((res) => { .then((res) => {
if (res && res.code - 200 === 0) { if (res && res.code - 200 === 0) {
if(res.rows.length){ if(res.rows.length){
uni.navigateTo({ uni.navigateTo({
url: `/pages/productionIssuance/productionIssuanceList?order=${applyNo}` url: `/pages/workCenter/workCenterList?order=${applyNo}`
}); });
}else{ }else{
setTimeout(() => { setTimeout(() => {
......
<template>
<view class="page">
<StickyNavBar>
<NavBar title="工作中心领料"></NavBar>
<view class="headerTitle">
<view class="">
<view class="items">领料申请:{{ goodsInfo.applyNo }}</view>
<view class="items">{{ goodsInfo.workstationCode }}/{{
goodsInfo.workstationName
}}</view>
<view class="items">计划日期:{{ goodsInfo.startTime }}</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.mesApi
.pdaWortstation({
pageNum: 1,
pageSize: 10,
applyNo,
})
.then((res) => {
if (res && res.code - 200 === 0) {
this.goodsList = res.rows.map(item => {
item.details = []
return item
});
} else {
this.$u.toast(res.msg);
}
this.loading = false;
});
},
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.applyNum < item.details.reduce((acc, cur) => {
acc += cur.PACMG
}, 0)
})) {
return this.$u.toast('检查数量是否正确!')
}
// 获取items
const items = this.goodsList.reduce((acc, cur) => {
// 添加工作中心
acc.push(...cur.details)
return acc
}, [])
const params = {
BLDAT: parseTime(new Date(), '{y}{m}{d}'),
BUDAT: parseTime(new Date(), '{y}{m}{d}'),
zencode: "A006",
TYPE: 'FL',
ZMARK: 'A002',
item: items,
};
this.$u.api.sapApi.sapRrm([params]).then((res) => {
this.loading = false;
if (!Array.isArray(res)) {
return;
}
if (res.every((item) => item.TYPE === "S")) {
this.handleMes();
}
const foundObject = res.find((item) => item.TYPE === "E");
if (foundObject && foundObject.MESSAGE) {
this.$u.toast(foundObject.MESSAGE);
}
});
},
handleMes() {
const params = this.goodsList.map(item => {
item.windCase = this.checkedBox ? 'Y' : 'N'
item.grantNum = item.details.reduce((acc, cur) => acc + cur.PACMG, 0)
return item
})
this.$u.api.mesApi.pdaworkstationUpadteNum(params).then((res) => {
this.loading = false;
console.log(res);
if (res && res.code == 200) {
this.$u.toast("提交成功");
setTimeout(() => {
this.goBack();
}, 1000);
} else {
this.$u.toast(res.msg);
}
});
},
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") {
// 相同物料
const item = this.goodsList.find(v => v.sapItemCode == res.BLPL[0].MATNR)
item && item.details.push(...res.BLPL.map(v => {
v.ARBPL = item.workstationCode
v.ERFMG = v.PACMG
return v
}))
item && this.scanPLs.push(plnr)
this.reset();
} else {
this.reset();
this.$u.toast(res.MSG[0].MESSAGE);
}
this.loading = false;
});
},
},
};
</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>
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