Commit 186cabc4 authored by 何远江's avatar 何远江

1

parent f1be7edb
<template> <template>
<view class="page"> <view class="page">
<StickyNavBar> <StickyNavBar>
<NavBar title="工作中心领料"></NavBar> <NavBar title="工作中心领料"></NavBar>
<view class="headerTitle"> <view class="headerTitle">
<view class=""> <view class="">
<view class="items">领料申请:{{ goodsInfo.applyNo }}</view> <view class="items">领料申请:{{ goodsInfo.applyNo }}</view>
<view class="items">{{ goodsInfo.workstationCode }}/{{ <view class="items"
goodsInfo.workstationName >{{ goodsInfo.workstationCode }}/{{
}}</view> goodsInfo.workstationName
<view class="items">计划日期:{{ goodsInfo.startTime }}</view> }}</view
</view> >
<view class="checkedCase"> <view class="items">计划日期:{{ goodsInfo.startTime }}</view>
<checkbox-group @change="checkedChange"> </view>
<checkbox value="r1" :checked="checkedBox" />是否结案 <view class="checkedCase">
</checkbox-group> <checkbox-group @change="checkedChange">
</view> <checkbox value="r1" :checked="checkedBox" />是否结案
</view> </checkbox-group>
<view class="btn"> </view>
<uni-easyinput prefixIcon="search" :disabled="isDisabled" v-model="wxparams" :focus="isFocus" </view>
placeholder="请扫描产品包装条码/外箱码" @input="handleInputPlnr"></uni-easyinput> <view class="btn">
</view> <uni-easyinput
<view class="total"> prefixIcon="search"
<view class="left">物料明细</view> :disabled="isDisabled"
<view class="right"> v-model="wxparams"
物料数量: :focus="isFocus"
<text class="">{{ goodsList.length }}</text> placeholder="请扫描产品包装条码/外箱码"
</view> @input="handleInputPlnr"
</view> ></uni-easyinput>
</StickyNavBar> </view>
<ContentLoadingMore class="cardbox" :list="goodsList"> <view class="total">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index"> <view class="left">物料明细</view>
<scanningList :item="item" :list="item.details" /> <view class="right">
</view> 物料数量:
</ContentLoadingMore> <text class="">{{ goodsList.length }}</text>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> </view>
</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> </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";
import scanningList from "./scanningList.vue"; import scanningList from "./scanningList.vue";
import { import { parseTime } from "@/utils/ruoyi";
parseTime
} from "@/utils/ruoyi";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn, BottomBtn,
scanningList, scanningList,
}, },
data() { data() {
return { return {
checkedBox: false, checkedBox: false,
r1: "", r1: "",
// totalNum: 0, // totalNum: 0,
number: 0, number: 0,
show: true, show: true,
nlpla: "YD-02-02-3", nlpla: "YD-02-02-3",
wxparams: "", wxparams: "",
btnArr: [{ btnArr: [
style: "", {
type: "warning", style: "",
text: "返回", type: "warning",
way: "goBack", text: "返回",
}, way: "goBack",
{ },
style: "", {
type: "primary", style: "",
text: "提交", type: "primary",
way: "goSubmit", text: "提交",
}, way: "goSubmit",
], },
goodsList: [], ],
isFocus: true, goodsList: [],
isDisabled: false, isFocus: true,
OrderNum: "", isDisabled: false,
list: [], OrderNum: "",
scanPLs: [] list: [],
}; scanPLs: [],
}, };
computed: { },
goodsInfo() { computed: {
return this.goodsList[0] || {} goodsInfo() {
}, return this.goodsList[0] || {};
}, },
onLoad(option) { },
if (option && option.order) { onLoad(option) {
this.OrderNum = option.order; if (option && option.order) {
this.getOrder(option.order); this.OrderNum = option.order;
} this.getOrder(option.order);
}, }
watch: {}, },
created() {}, watch: {},
methods: { created() {},
reset() { methods: {
setTimeout(() => { reset() {
this.wxparams = ""; setTimeout(() => {
this.isFocus = true; this.wxparams = "";
this.isDisabled = false; this.isFocus = true;
}, 1000); this.isDisabled = false;
}, }, 1000);
getOrder(applyNo) { },
this.$u.api.mesApi getOrder(applyNo) {
.pdaWortstation({ this.$u.api.mesApi
pageNum: 1, .pdaWortstation({
pageSize: 10, pageNum: 1,
applyNo, pageSize: 10,
}) applyNo,
.then((res) => { })
if (res && res.code - 200 === 0) { .then((res) => {
this.goodsList = res.rows.map(item => { if (res && res.code - 200 === 0) {
item.details = [] this.goodsList = res.rows.map((item) => {
return item item.details = [];
}); return item;
} else { });
this.$u.toast(res.msg); } else {
} this.$u.toast(res.msg);
this.loading = false; }
}); this.loading = false;
}, });
checkedChange() { },
this.checkedBox = !this.checkedBox; checkedChange() {
}, this.checkedBox = !this.checkedBox;
getBtnHandle(row) { },
this[row.way](); getBtnHandle(row) {
}, this[row.way]();
goBack() { },
console.log("进来"); goBack() {
// uni.navigateBack({ console.log("进来");
// delta: 1, // uni.navigateBack({
// }); // delta: 1,
}, // });
goSubmit() { },
// 检查是否扫描PL goSubmit() {
if (!this.scanPLs.length) { // 检查是否扫描PL
return this.$u.toast('请扫描PL!'); if (!this.scanPLs.length) {
} return this.$u.toast("请扫描PL!");
}
// 可以少发,不可以超发 // 可以少发,不可以超发
if (this.goodsList.some((item) => { if (
return item.applyNum < item.details.reduce((acc, cur) => { this.goodsList.some((item) => {
acc += cur.PACMG return (
}, 0) item.applyNum <
})) { item.details.reduce((acc, cur) => {
return this.$u.toast('检查数量是否正确!') acc += cur.PACMG;
} }, 0)
);
})
) {
return this.$u.toast("检查数量是否正确!");
}
// 获取items // 获取items
const items = this.goodsList.reduce((acc, cur) => { const items = this.goodsList.reduce((acc, cur) => {
// 添加工作中心 // 添加工作中心
acc.push(...cur.details) acc.push(...cur.details);
return acc return acc;
}, []) }, []);
const params = { const params = {
BLDAT: parseTime(new Date(), '{y}{m}{d}'), BLDAT: parseTime(new Date(), "{y}{m}{d}"),
BUDAT: parseTime(new Date(), '{y}{m}{d}'), BUDAT: parseTime(new Date(), "{y}{m}{d}"),
zencode: "A006", zencode: "A006",
TYPE: 'FL', TYPE: "FL",
ZMARK: 'A002', ZMARK: "A002",
item: items, item: items,
}; };
this.$u.api.sapApi.sapRrm([params]).then((res) => { this.$u.api.sapApi.sapRrm([params]).then((res) => {
this.loading = false; this.loading = false;
if (!Array.isArray(res)) { if (!Array.isArray(res)) {
return; return;
} }
if (res.every((item) => item.TYPE === "S")) { const errObj = res.find((item) => item.TYPE === "E");
this.handleMes(); if (errObj) {
} return this.$u.toast(errObj.MESSAGE);
const foundObject = res.find((item) => item.TYPE === "E"); }
if (foundObject && foundObject.MESSAGE) { this.handleMes();
this.$u.toast(foundObject.MESSAGE); });
} },
}); handleMes() {
}, const params = this.goodsList.map((item) => {
handleMes() { item.windCase = this.checkedBox ? "Y" : "N";
const params = this.goodsList.map(item => { item.grantNum = item.details.reduce((acc, cur) => acc + cur.PACMG, 0);
item.windCase = this.checkedBox ? 'Y' : 'N' return item;
item.grantNum = item.details.reduce((acc, cur) => acc + cur.PACMG, 0) });
return item this.$u.api.mesApi.pdaworkstationUpadteNum(params).then((res) => {
}) this.loading = false;
this.$u.api.mesApi.pdaworkstationUpadteNum(params).then((res) => { console.log(res);
this.loading = false; if (res && res.code == 200) {
console.log(res); this.$u.toast("提交成功");
if (res && res.code == 200) { setTimeout(() => {
this.$u.toast("提交成功"); this.goBack();
setTimeout(() => { }, 1000);
this.goBack(); } else {
}, 1000); this.$u.toast(res.msg);
} else { }
this.$u.toast(res.msg); });
} },
}); handleInputPlnr(e) {
}, if (this.scanPLs.includes(e)) {
handleInputPlnr(e) { return this.$u.toast("请勿重复扫描!");
if (this.scanPLs.includes(e)) { }
return this.$u.toast('请勿重复扫描!') e && this.getPlnr(e);
} },
e && this.getPlnr(e); getPlnr(plnr) {
}, this.isDisabled = true;
getPlnr(plnr) { this.isFocus = false;
this.isDisabled = true; this.$u.api.sapApi
this.isFocus = false; .sapBlpl({
this.$u.api.sapApi plnr,
.sapBlpl({ ztype: "002",
plnr, })
ztype: "002", .then((res) => {
}) if (res && res.MSG[0].TYPE === "S") {
.then((res) => { // 相同物料
if (res && res.MSG[0].TYPE === "S") { const item = this.goodsList.find(
// 相同物料 (v) => v.sapItemCode == res.BLPL[0].MATNR
const item = this.goodsList.find(v => v.sapItemCode == res.BLPL[0].MATNR) );
item && item.details.push(...res.BLPL.map(v => { item &&
v.ARBPL = item.workstationCode item.details.push(
v.ERFMG = v.PACMG ...res.BLPL.map((v) => {
return v v.ARBPL = item.workstationCode;
})) v.ERFMG = v.PACMG;
item && this.scanPLs.push(plnr) return v;
})
);
item && this.scanPLs.push(plnr);
this.reset(); this.reset();
} else { } else {
this.reset(); this.reset();
this.$u.toast(res.MSG[0].MESSAGE); this.$u.toast(res.MSG[0].MESSAGE);
} }
this.loading = false; this.loading = false;
}); });
}, },
}, },
}; };
</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;
justify-content: space-between; justify-content: space-between;
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;
} }
} }
.cardbox { .cardbox {
min-height: calc(100vh - 480rpx); min-height: calc(100vh - 480rpx);
padding: 0rpx 20rpx; padding: 0rpx 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
.cardContent { .cardContent {
border-radius: 8px; border-radius: 8px;
background: #fff; background: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.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;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
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%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
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;
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
} }
} }
} }
} }
/deep/ .u-sticky { /deep/ .u-sticky {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.checkedCase { .checkedCase {
margin-top: 10rpx; margin-top: 10rpx;
} }
</style> </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