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

工作中心

parent 4ed5674f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<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">
...@@ -26,28 +26,10 @@ ...@@ -26,28 +26,10 @@
</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 class="proItem">
<view class="items">生产单号:{{ ele.workorderCode }}</view>
<view class="progress">
<progress :percent="handleVista(ele)" show-info />
</view>
</view>
<view class="items inputItem">
数量:
{{ handleUseVista(ele) }}
/
{{ ele.applyNum }}
</view>
<template v-for="item in ele.details">
<view class="items">PL:{{ item.PLNR }}</view>
<view class="items">库位:{{ item.LGORT }} - {{ item.LGOBE }}</view>
<view class="items">仓位:{{ item.NLPLA }}</view>
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -55,10 +37,10 @@ ...@@ -55,10 +37,10 @@
</template> </template>
<script> <script>
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";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
...@@ -67,49 +49,29 @@ export default { ...@@ -67,49 +49,29 @@ export default {
props: { props: {
item: { item: {
type: Object, type: Object,
default: function () { default: function() {
return {}; return {};
}, },
}, },
list: { list: {
type: Array, type: Array,
default: function () { default: function() {
return []; return [];
}, },
}, },
}, },
computed: { computed: {
details() {
return this.list.reduce((acc, cur) => {
const item = acc.find((v) => v.workorderCode === cur.workorderCode);
if (item) {
item.details.push({ ...cur });
} else {
acc.push({ ...cur, details: [{...cur}] });
}
return acc;
}, []);
},
totalNum() {
const workCodes = [];
return this.list.reduce((acc, cur) => {
if (workCodes.includes(cur.workorderCode)) {
return acc;
} else {
workCodes.push(cur.workorderCode);
return acc + cur.applyNum;
}
}, 0).toFixed(3);
},
totalVistaNum() { totalVistaNum() {
return this.list.reduce((acc, cur) => { return this.list
return acc + cur.vista; .reduce((acc, cur) => {
}, 0).toFixed(3); return acc + (cur.PACMG || 0);
}, 0)
.toFixed(3);
}, },
}, },
watch: { watch: {
details: { details: {
handler: function (val, oldVal) { handler: function(val, oldVal) {
console.log(val, "00-------", this.list); console.log(val, "00-------", this.list);
}, },
immediate: true, immediate: true,
...@@ -121,8 +83,7 @@ export default { ...@@ -121,8 +83,7 @@ export default {
number: 0, number: 0,
nlpla: "", nlpla: "",
wxparams: "", wxparams: "",
btnArr: [ btnArr: [{
{
style: "", style: "",
type: "warning", type: "warning",
text: "返回", text: "返回",
...@@ -142,45 +103,35 @@ export default { ...@@ -142,45 +103,35 @@ export default {
}, },
created() {}, created() {},
methods: { methods: {
handleUseVista(items) {
return items.details.reduce((acc, cur) => cur.vista + acc, 0)
},
handleVista(items) {
let num = 0;
this.list.forEach((ele) => {
if (ele.workorderCode === items.workorderCode) {
console.log(`output->`, ele.vista, items.workorderCode);
num += (ele.vista ? ele.vista : 0) - 0;
}
});
console.log(`output->num`, num);
return (num / items.applyNum).toFixed(2) * 100 - 0 > 100
? 100
: (num / items.applyNum).toFixed(2) * 100 || 0;
},
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
page { page {
background: #f8f8f8; background: #f8f8f8;
} }
.headerTitle {
.headerTitle {
padding: 20rpx; padding: 20rpx;
font-weight: 600; font-weight: 600;
.items { .items {
line-height: 40rpx; line-height: 40rpx;
} }
} }
.btn {
.btn {
padding: 20rpx; padding: 20rpx;
background: #fff; background: #fff;
.topSearch { .topSearch {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
} }
.bottomBtn {
.bottomBtn {
position: sticky; position: sticky;
padding: 20rpx; padding: 20rpx;
display: flex; display: flex;
...@@ -188,34 +139,41 @@ page { ...@@ -188,34 +139,41 @@ page {
background: #fff; background: #fff;
bottom: 0rpx; bottom: 0rpx;
margin-top: 20rpx; margin-top: 20rpx;
.u-btn { .u-btn {
width: 300rpx; width: 300rpx;
} }
} }
.blue {
.blue {
color: #3f9dcc; color: #3f9dcc;
} }
.total {
.total {
background: #fff; background: #fff;
color: #000; color: #000;
padding: 0rpx 40rpx; padding: 0rpx 40rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 32rpx; font-size: 32rpx;
.line { .line {
margin: 0px 10rpx; margin: 0px 10rpx;
} }
} }
.listItemTitle {
.listItemTitle {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx; padding: 20rpx;
border-bottom: 2px solid #f8f8f8; border-bottom: 2px solid #f8f8f8;
.u-btn { .u-btn {
width: 150rpx; width: 150rpx;
margin: 0px; margin: 0px;
margin-top: 10rpx; margin-top: 10rpx;
} }
.item { .item {
line-height: 50rpx; line-height: 50rpx;
color: #333; color: #333;
...@@ -224,17 +182,20 @@ page { ...@@ -224,17 +182,20 @@ page {
word-break: break-all; word-break: break-all;
font-weight: 600; font-weight: 600;
} }
} }
.listBottom {
.listBottom {
.bottomTitle { .bottomTitle {
height: 80rpx; height: 80rpx;
position: relative; position: relative;
.desc { .desc {
color: #bbb; color: #bbb;
font-size: 24rpx; font-size: 24rpx;
line-height: 80rpx; line-height: 80rpx;
padding-left: 20rpx; padding-left: 20rpx;
} }
.topIcons { .topIcons {
position: absolute; position: absolute;
left: 50%; left: 50%;
...@@ -243,43 +204,53 @@ page { ...@@ -243,43 +204,53 @@ page {
color: #aaa; color: #aaa;
} }
} }
.bottomBox { .bottomBox {
padding: 20rpx; padding: 20rpx;
.bottomItem { .bottomItem {
background: #f8f8f8; background: #f8f8f8;
padding: 20rpx; padding: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.items { .items {
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
line-height: 40rpx; line-height: 40rpx;
word-break: break-all; word-break: break-all;
/deep/ .uni-easyinput { /deep/ .uni-easyinput {
width: 200rpx; width: 200rpx;
} }
} }
.inputItem { .inputItem {
display: inline-flex; display: inline-flex;
// line-height: 76rpx; // line-height: 76rpx;
} }
} }
} }
} }
/deep/ .u-sticky {
/deep/ .u-sticky {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.progress {
.progress {
width: 45%; width: 45%;
margin-left: 20rpx; margin-left: 20rpx;
/deep/ .uni-progress-info { /deep/ .uni-progress-info {
font-size: 24rpx; font-size: 24rpx;
} }
} }
/deep/ .uni-progress {
/deep/ .uni-progress {
line-height: 40rpx; line-height: 40rpx;
} }
.proItem {
.proItem {
display: flex; 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