Commit 1d7afeb1 authored by 何远江's avatar 何远江

bug 修改

parent 41c71ed6
<template> <template>
<view class="page"> <view class="page">
<StickyNavBar> <StickyNavBar>
<NavBar title="完工入库扫描"></NavBar> <NavBar title="完工入库扫描"></NavBar>
<FactorySelect v-model="LGOBE" @change="actionSheetCallback" :options="options" /> <FactorySelect
v-model="LGOBE"
@change="actionSheetCallback"
:options="options"
/>
<!-- <view class="selectSheet"> <!-- <view class="selectSheet">
<u-row > <u-row >
<u-col span="12"> <u-col span="12">
<u-picker v-model="depotShow" mode="selector" :default-selector="[0]" range-key="text" :range="depotLists" @confirm="actionSheetCallback"></u-picker> <u-picker v-model="depotShow" mode="selector" :default-selector="[0]" range-key="text" :range="depotLists" @confirm="actionSheetCallback"></u-picker>
...@@ -12,346 +16,399 @@ ...@@ -12,346 +16,399 @@
</u-col> </u-col>
</u-row> </u-row>
</view> --> </view> -->
<view class="btn"> <view class="btn">
<uni-easyinput v-if="vuex_user_factory !== '1010'" prefixIcon="search" class="topSearch" :disabled="nlplaDisabled" v-model="nlpla" focus placeholder="请扫描库位" @change="handleInputNlpla"></uni-easyinput> <uni-easyinput
<uni-easyinput v-if="vuex_user_factory !== '1010'"
prefixIcon="search" prefixIcon="search"
:disabled="isDisabled" class="topSearch"
v-model="wxparams" :disabled="nlplaDisabled"
:focus="isFocus" v-model="nlpla"
placeholder="请扫描产品包装条码/外箱码" focus
@input="handleInputPlnr" placeholder="请扫描库位"
></uni-easyinput> @change="handleInputNlpla"
</view> ></uni-easyinput>
<view class="total"> <uni-easyinput
<view class="left">入库明细</view> prefixIcon="search"
<view class="right"> :disabled="isDisabled"
条码数: v-model="wxparams"
<text class="blue">{{ goodsList.length }}</text> :focus="isFocus"
<text class="line">|</text> placeholder="请扫描产品包装条码/外箱码"
总数量: @input="handleInputPlnr"
<text class="blue">{{ totalNum }}</text> ></uni-easyinput>
</view> </view>
</view> <view class="total">
</StickyNavBar> <view class="left">入库明细</view>
<ContentLoadingMore class="cardbox" :list="goodsList"> <view class="right">
<view class="cardContent" v-for="(item, index) in goodsList"> 条码数:
<scanningList :item='item' :idx="index" @deleGonds="deleGonds" :list='list'/> <text class="blue">{{ goodsList.length }}</text>
</view> <text class="line">|</text>
</ContentLoadingMore> 总数量:
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <text class="blue">{{ totalNum }}</text>
</view> </view>
</view>
</StickyNavBar>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList">
<scanningList
:item="item"
:idx="index"
@deleGonds="deleGonds"
:list="list"
/>
</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 { parseTime} from "@/utils/ruoyi"; import { parseTime } from "@/utils/ruoyi";
import scanningList from "./scanningList.vue" import scanningList from "./scanningList.vue";
import FactorySelect from '@/components/FactorySelect/FactorySelect.vue' import FactorySelect from "@/components/FactorySelect/FactorySelect.vue";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn, BottomBtn,
scanningList scanningList,
}, },
data() { data() {
return { return {
number: 0, number: 0,
show: true, show: true,
nlpla: '', nlpla: "",
wxparams: '', wxparams: "",
nlplaDisabled: false, nlplaDisabled: false,
warehouseCode: '', warehouseCode: "",
btnArr: [ btnArr: [
{ {
style: '', style: "",
type: 'warning', type: "warning",
text: '返回', text: "返回",
way: 'goBack' way: "goBack",
}, },
{ {
style: '', style: "",
type: 'primary', type: "primary",
text: '提交', text: "提交",
way: 'goSubmit' way: "goSubmit",
} },
], ],
goodsList: [], goodsList: [],
isFocus: false, isFocus: false,
isDisabled: false, isDisabled: false,
depotShow: false, depotShow: false,
depotLists: [], depotLists: [],
LGOBE: '', LGOBE: "",
LGORT: '', LGORT: "",
type: 'select', type: "select",
border: true, border: true,
list:[], list: [],
options: [{ options: [
{
WERKS: "1000", WERKS: "1000",
LGORT: "S000", LGORT: "S000",
LGOBE: "发运仓", LGOBE: "发运仓",
label: "S000-发运仓", label: "S000-发运仓",
value: "S000", value: "S000",
},] },
],
};
},
created() {
// 二维码包含:10位物料号(右对齐不足补充为0)物料号12位生产单号(右对齐不足补充为0),
// 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0)
// this.getPlnr('006000000100100000000300000501001');
},
computed: {
totalNum() {
let num = 0;
this.list.forEach((ele) => {
num += ele.totalQuantity;
});
return num;
},
},
methods: {
// 点击actionSheet回调
actionSheetCallback(item) {
this.LGORT = item?.LGORT || "";
},
deleGonds(idx) {
this.goodsList.splice(idx, 1);
},
getBtnHandle(row) {
this[row.way]();
},
goBack() {
uni.navigateBack();
},
goSubmit() {
if (!this.goodsList.length) return;
}; let params = [];
}, // this.list.forEach((ele) => {
created() { // item.push({
// 二维码包含:10位物料号(右对齐不足补充为0)物料号12位生产单号(右对齐不足补充为0), // AUFNR: ele.workorderNo,
// 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0) // PLNR: ele.qrcode,
// this.getPlnr('006000000100100000000300000501001'); // MATNR: ele.sapItemCode,
}, // WERKS: this.vuex_user_factory,
computed:{ // LGORT: this.LGORT,
totalNum(){ // PACKNR: ele.qrcode,
let num = 0; // ZSIZE: ele.standardSize,
this.list.forEach((ele) => { // ZINSTNUM: ele.clientCmd,
num += ele.totalQuantity; // BRGEW: ele.grossWeight,
}); // NTGEW: ele.netWeight,
return num // GEWEI: ele.unitOfMeasure,
} // INSNAM: ele.checkBy,
}, // TOMNG: ele.totalQuantity,
methods: { // ZMNGO: ele.quantity,
// 点击actionSheet回调 // ZMNGL: ele.lossNum,
actionSheetCallback(item) { // NLPLA: ele.NLPLA,
this.LGORT = item?.LGORT || ""; // });
}, // });
deleGonds(idx) { const items = this.list.reduce(
this.goodsList.splice(idx, 1); (pre, cur) => {
pre.item.push({
}, AUFNR: cur.workorderNo,
getBtnHandle(row) { PLNR: cur.qrcode,
this[row.way](); MATNR: cur.sapItemCode,
}, WERKS: this.vuex_user_factory,
goBack() { LGORT: this.LGORT,
uni.navigateBack(); PACKNR: cur.qrcode,
}, ZSIZE: cur.standardSize,
goSubmit() { ZINSTNUM: cur.clientCmd,
if (this.goodsList.length === 0) { BRGEW: cur.grossWeight,
return; NTGEW: cur.netWeight,
} GEWEI: cur.unitOfMeasure,
let params = [] INSNAM: cur.checkBy,
let item = [] TOMNG: cur.totalQuantity,
this.list.forEach(ele => { ZMNGO: cur.quantity,
item.push({ ZMNGL: cur.lossNum,
AUFNR:ele.workorderNo, NLPLA: cur.NLPLA,
PLNR: ele.qrcode, ZCODE: cur.blQrcode
MATNR: ele.sapItemCode, });
WERKS: this.vuex_user_factory, if (pre.zcode.findIndex((v) => v.ZCODE == cur.blQrcode) == -1) {
LGORT: this.LGORT, pre.zcode.push({
PACKNR: ele.qrcode, ZCODE: cur.blQrcode,
ZSIZE: ele.standardSize, ZXSPE: cur.packageStandard,
ZINSTNUM: ele.clientCmd, ZXVOLUM: cur.packVolume,
BRGEW: ele.grossWeight, ZXNTGEW: cur.boxWeight,
NTGEW: ele.netWeight, NTGEW: cur.netWeight,
GEWEI: ele.unitOfMeasure, BRGEW: cur.grossWeight,
INSNAM: ele.checkBy, ZXTEXT: cur.remark,
TOMNG: ele.totalQuantity, KUNNR: cur.clientCode,
ZMNGO: ele.quantity, ZPRINT: cur.templateStandard,
ZMNGL: ele.lossNum, ZPRNTDA: cur.printDate,
NLPLA: ele.NLPLA, ZPRNTTI: cur.printTime,
}) ZPRNTER: cur.printBy,
}); UNAME: cur.createBy,
params.push({ DATUM: cur.createDate,
lfsnr: this.goodsList[0].workorderNo, UZEIT: cur.createTime,
// BLDAT: 20240420, });
// BUDAT: 20240420, }
BLDAT: parseTime(new Date(),'{y}{m}{d}'), return pre;
BUDAT: parseTime(new Date(),'{y}{m}{d}'), },
item, { item: [], zcode: [] }
}) );
this.$u.api.sapApi params.push({
.sapOrder(params) lfsnr: this.goodsList[0].workorderNo,
.then((res) => { // BLDAT: 20240420,
this.loading = false; // BUDAT: 20240420,
if(!Array.isArray(res)){ BLDAT: parseTime(new Date(), "{y}{m}{d}"),
return BUDAT: parseTime(new Date(), "{y}{m}{d}"),
} ...items,
if (res.every((item) => item.TYPE === 'S')) { });
this.goodsList = []; this.$u.api.sapApi.sapOrder(params).then((res) => {
this.LGOBE = ''; this.loading = false;
this.LGORT = ''; if (!Array.isArray(res)) {
this.nlpla = ''; return;
this.wxparams = ''; }
this.$u.toast('提交成功'); if (res.every((item) => item.TYPE === "S")) {
} this.goodsList = [];
const foundObject = res.find(item => item.TYPE === 'E'); this.LGOBE = "";
if(foundObject && foundObject.MESSAGE){ this.LGORT = "";
this.$u.toast(foundObject.MESSAGE); this.nlpla = "";
} this.wxparams = "";
}); this.$u.toast("提交成功");
}, }
handleInputPlnr(e) { const foundObject = res.find((item) => item.TYPE === "E");
e && this.getPlnr(e); if (foundObject && foundObject.MESSAGE) {
}, this.$u.toast(foundObject.MESSAGE);
handleInputNlpla(e) { }
console.log(`output->e`,e) });
this.nlplaDisabled = !!e },
}, handleInputPlnr(e) {
reset(){ e && this.getPlnr(e);
setTimeout(() => { },
this.wxparams = ''; handleInputNlpla(e) {
this.isFocus = true; console.log(`output->e`, e);
this.isDisabled = false; this.nlplaDisabled = !!e;
}, 1000); },
}, reset() {
getPlnr(qrcode) { setTimeout(() => {
this.isDisabled = true; this.wxparams = "";
this.isFocus = false this.isFocus = true;
if(!this.nlpla && this.vuex_user_factory !== '1010'){ this.isDisabled = false;
this.$u.toast('请先扫描仓位'); }, 1000);
this.reset() },
return getPlnr(qrcode) {
} this.isDisabled = true;
// if(!this.nlpla){ this.isFocus = false;
// this.$u.toast('请先扫描仓位'); if (!this.nlpla && this.vuex_user_factory !== "1010") {
// this.reset() this.$u.toast("请先扫描仓位");
// return this.reset();
// } return;
this.$u.api.mesApi }
.pdaFindPackageLinkInfo({ // if(!this.nlpla){
qrcode // this.$u.toast('请先扫描仓位');
}) // this.reset()
.then((res) => { // return
if (res && res.code == 200) { // }
// if (this.goodsList.some((item) => item.workorderNo !== res.data[0].workorderNo)) { this.$u.api.mesApi
// this.$u.toast('请扫描同一个工单'); .pdaFindPackageLinkInfo({
// this.reset() qrcode,
// return })
// } .then((res) => {
if (this.goodsList.some((item) => item.qrcode === qrcode)) { if (res && res.code == 200) {
this.$u.toast('已经存在当前条码'); // if (this.goodsList.some((item) => item.workorderNo !== res.data[0].workorderNo)) {
this.reset() // this.$u.toast('请扫描同一个工单');
return // this.reset()
} // return
res.data.forEach(ele => { // }
this.nlpla && (ele.NLPLA = this.nlpla?.trim()) if (this.goodsList.some((item) => item.qrcode === qrcode)) {
}); this.$u.toast("已经存在当前条码");
this.list = this.list.concat(res.data) this.reset();
return;
}
res.data.forEach((ele) => {
this.nlpla && (ele.NLPLA = this.nlpla?.trim());
});
this.list = this.list.concat(res.data);
const result = res.data.filter((item, index, self) => { const result = res.data.filter((item, index, self) => {
return self.findIndex(t => t.qrcode === item.qrcode) === index; return self.findIndex((t) => t.qrcode === item.qrcode) === index;
}); });
this.goodsList = this.goodsList.concat(result) this.goodsList = this.goodsList.concat(result);
console.log(this.goodsList, '-goodsList') console.log(this.goodsList, "-goodsList");
this.reset() this.reset();
} else { } else {
this.reset() this.reset();
this.$u.toast(res.msg); this.$u.toast(res.msg);
} }
this.loading = false; this.loading = false;
}); });
} },
} },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.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: #000; color: #000;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
word-break: break-all; word-break: break-all;
} }
} }
.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;
} }
.selectSheet { .selectSheet {
padding: 20rpx 10rpx; padding: 20rpx 10rpx;
padding-bottom: 0; padding-bottom: 0;
background: #fff; background: #fff;
} }
</style> </style>
\ No newline at end of file
...@@ -116,21 +116,16 @@ export default { ...@@ -116,21 +116,16 @@ export default {
return this.vuex_sales_outbound[this.vbeln] || null; return this.vuex_sales_outbound[this.vbeln] || null;
}, },
plslen() { plslen() {
return this.goodsList.reduce((acc, cur) => { const codes = [];
return ( this.goodsList.forEach((cur) => {
acc + cur?.ZPLDT?.forEach((c) => {
(cur?.ZPLDT?.reduce((a, c) => { const code = c.ZCODE || c.PLNR;
if (c.ZCODE == "" && c.PLNR) { if (!codes.includes(code)) {
a.push(c.PLNR); codes.push(code);
} else if (c.PLNR && c.ZCODE) { }
if (!a.includes(c.ZCODE)) { });
a.push(c.ZCODE); });
} return codes.length;
}
return a;
}, []).length || 0)
);
}, 0);
}, },
saleInfo() { saleInfo() {
return this.goodsList[0] || {}; return this.goodsList[0] || {};
...@@ -305,8 +300,8 @@ export default { ...@@ -305,8 +300,8 @@ export default {
} }
}); });
} else { } else {
item.ZPLDT.splice(idx, 1) item.ZPLDT.splice(idx, 1);
} }
}, },
// 加载更多 // 加载更多
onReachBottom() { onReachBottom() {
......
...@@ -282,7 +282,6 @@ page { ...@@ -282,7 +282,6 @@ page {
margin: 20rpx; margin: 20rpx;
} }
.cardbox { .cardbox {
max-height: calc(100vh - 105px - 60rpx - 140rpx);
padding: 0rpx 20rpx; padding: 0rpx 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
......
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