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

bug 修改

parent 41c71ed6
......@@ -2,7 +2,11 @@
<view class="page">
<StickyNavBar>
<NavBar title="完工入库扫描"></NavBar>
<FactorySelect v-model="LGOBE" @change="actionSheetCallback" :options="options" />
<FactorySelect
v-model="LGOBE"
@change="actionSheetCallback"
:options="options"
/>
<!-- <view class="selectSheet">
<u-row >
......@@ -13,7 +17,16 @@
</u-row>
</view> -->
<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
v-if="vuex_user_factory !== '1010'"
prefixIcon="search"
class="topSearch"
:disabled="nlplaDisabled"
v-model="nlpla"
focus
placeholder="请扫描库位"
@change="handleInputNlpla"
></uni-easyinput>
<uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
......@@ -36,7 +49,12 @@
</StickyNavBar>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList">
<scanningList :item='item' :idx="index" @deleGonds="deleGonds" :list='list'/>
<scanningList
:item="item"
:idx="index"
@deleGonds="deleGonds"
:list="list"
/>
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
......@@ -44,61 +62,61 @@
</template>
<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
import { parseTime} from "@/utils/ruoyi";
import scanningList from "./scanningList.vue"
import FactorySelect from '@/components/FactorySelect/FactorySelect.vue'
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import BottomBtn from "@/components/BottomBtn/index.vue";
import { parseTime } from "@/utils/ruoyi";
import scanningList from "./scanningList.vue";
import FactorySelect from "@/components/FactorySelect/FactorySelect.vue";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList
scanningList,
},
data() {
return {
number: 0,
show: true,
nlpla: '',
wxparams: '',
nlpla: "",
wxparams: "",
nlplaDisabled: false,
warehouseCode: '',
warehouseCode: "",
btnArr: [
{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: '',
type: 'primary',
text: '提交',
way: 'goSubmit'
}
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
goodsList: [],
isFocus: false,
isDisabled: false,
depotShow: false,
depotLists: [],
LGOBE: '',
LGORT: '',
type: 'select',
LGOBE: "",
LGORT: "",
type: "select",
border: true,
list:[],
options: [{
list: [],
options: [
{
WERKS: "1000",
LGORT: "S000",
LGOBE: "发运仓",
label: "S000-发运仓",
value: "S000",
},]
},
],
};
},
created() {
......@@ -106,14 +124,14 @@ export default {
// 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0)
// this.getPlnr('006000000100100000000300000501001');
},
computed:{
totalNum(){
computed: {
totalNum() {
let num = 0;
this.list.forEach((ele) => {
num += ele.totalQuantity;
});
return num
}
return num;
},
},
methods: {
// 点击actionSheet回调
......@@ -122,7 +140,6 @@ export default {
},
deleGonds(idx) {
this.goodsList.splice(idx, 1);
},
getBtnHandle(row) {
this[row.way]();
......@@ -131,56 +148,96 @@ export default {
uni.navigateBack();
},
goSubmit() {
if (this.goodsList.length === 0) {
return;
}
let params = []
let item = []
this.list.forEach(ele => {
item.push({
AUFNR:ele.workorderNo,
PLNR: ele.qrcode,
MATNR: ele.sapItemCode,
if (!this.goodsList.length) return;
let params = [];
// this.list.forEach((ele) => {
// item.push({
// AUFNR: ele.workorderNo,
// PLNR: ele.qrcode,
// MATNR: ele.sapItemCode,
// WERKS: this.vuex_user_factory,
// LGORT: this.LGORT,
// PACKNR: ele.qrcode,
// ZSIZE: ele.standardSize,
// ZINSTNUM: ele.clientCmd,
// BRGEW: ele.grossWeight,
// NTGEW: ele.netWeight,
// GEWEI: ele.unitOfMeasure,
// INSNAM: ele.checkBy,
// TOMNG: ele.totalQuantity,
// ZMNGO: ele.quantity,
// ZMNGL: ele.lossNum,
// NLPLA: ele.NLPLA,
// });
// });
const items = this.list.reduce(
(pre, cur) => {
pre.item.push({
AUFNR: cur.workorderNo,
PLNR: cur.qrcode,
MATNR: cur.sapItemCode,
WERKS: this.vuex_user_factory,
LGORT: this.LGORT,
PACKNR: ele.qrcode,
ZSIZE: ele.standardSize,
ZINSTNUM: ele.clientCmd,
BRGEW: ele.grossWeight,
NTGEW: ele.netWeight,
GEWEI: ele.unitOfMeasure,
INSNAM: ele.checkBy,
TOMNG: ele.totalQuantity,
ZMNGO: ele.quantity,
ZMNGL: ele.lossNum,
NLPLA: ele.NLPLA,
})
PACKNR: cur.qrcode,
ZSIZE: cur.standardSize,
ZINSTNUM: cur.clientCmd,
BRGEW: cur.grossWeight,
NTGEW: cur.netWeight,
GEWEI: cur.unitOfMeasure,
INSNAM: cur.checkBy,
TOMNG: cur.totalQuantity,
ZMNGO: cur.quantity,
ZMNGL: cur.lossNum,
NLPLA: cur.NLPLA,
ZCODE: cur.blQrcode
});
if (pre.zcode.findIndex((v) => v.ZCODE == cur.blQrcode) == -1) {
pre.zcode.push({
ZCODE: cur.blQrcode,
ZXSPE: cur.packageStandard,
ZXVOLUM: cur.packVolume,
ZXNTGEW: cur.boxWeight,
NTGEW: cur.netWeight,
BRGEW: cur.grossWeight,
ZXTEXT: cur.remark,
KUNNR: cur.clientCode,
ZPRINT: cur.templateStandard,
ZPRNTDA: cur.printDate,
ZPRNTTI: cur.printTime,
ZPRNTER: cur.printBy,
UNAME: cur.createBy,
DATUM: cur.createDate,
UZEIT: cur.createTime,
});
}
return pre;
},
{ item: [], zcode: [] }
);
params.push({
lfsnr: this.goodsList[0].workorderNo,
// BLDAT: 20240420,
// BUDAT: 20240420,
BLDAT: parseTime(new Date(),'{y}{m}{d}'),
BUDAT: parseTime(new Date(),'{y}{m}{d}'),
item,
})
this.$u.api.sapApi
.sapOrder(params)
.then((res) => {
BLDAT: parseTime(new Date(), "{y}{m}{d}"),
BUDAT: parseTime(new Date(), "{y}{m}{d}"),
...items,
});
this.$u.api.sapApi.sapOrder(params).then((res) => {
this.loading = false;
if(!Array.isArray(res)){
return
if (!Array.isArray(res)) {
return;
}
if (res.every((item) => item.TYPE === 'S')) {
if (res.every((item) => item.TYPE === "S")) {
this.goodsList = [];
this.LGOBE = '';
this.LGORT = '';
this.nlpla = '';
this.wxparams = '';
this.$u.toast('提交成功');
this.LGOBE = "";
this.LGORT = "";
this.nlpla = "";
this.wxparams = "";
this.$u.toast("提交成功");
}
const foundObject = res.find(item => item.TYPE === 'E');
if(foundObject && foundObject.MESSAGE){
const foundObject = res.find((item) => item.TYPE === "E");
if (foundObject && foundObject.MESSAGE) {
this.$u.toast(foundObject.MESSAGE);
}
});
......@@ -189,23 +246,23 @@ export default {
e && this.getPlnr(e);
},
handleInputNlpla(e) {
console.log(`output->e`,e)
this.nlplaDisabled = !!e
console.log(`output->e`, e);
this.nlplaDisabled = !!e;
},
reset(){
reset() {
setTimeout(() => {
this.wxparams = '';
this.wxparams = "";
this.isFocus = true;
this.isDisabled = false;
}, 1000);
},
getPlnr(qrcode) {
this.isDisabled = true;
this.isFocus = false
if(!this.nlpla && this.vuex_user_factory !== '1010'){
this.$u.toast('请先扫描仓位');
this.reset()
return
this.isFocus = false;
if (!this.nlpla && this.vuex_user_factory !== "1010") {
this.$u.toast("请先扫描仓位");
this.reset();
return;
}
// if(!this.nlpla){
// this.$u.toast('请先扫描仓位');
......@@ -214,7 +271,7 @@ export default {
// }
this.$u.api.mesApi
.pdaFindPackageLinkInfo({
qrcode
qrcode,
})
.then((res) => {
if (res && res.code == 200) {
......@@ -224,29 +281,29 @@ export default {
// return
// }
if (this.goodsList.some((item) => item.qrcode === qrcode)) {
this.$u.toast('已经存在当前条码');
this.reset()
return
this.$u.toast("已经存在当前条码");
this.reset();
return;
}
res.data.forEach(ele => {
this.nlpla && (ele.NLPLA = this.nlpla?.trim())
res.data.forEach((ele) => {
this.nlpla && (ele.NLPLA = this.nlpla?.trim());
});
this.list = this.list.concat(res.data)
this.list = this.list.concat(res.data);
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)
console.log(this.goodsList, '-goodsList')
this.reset()
this.goodsList = this.goodsList.concat(result);
console.log(this.goodsList, "-goodsList");
this.reset();
} else {
this.reset()
this.reset();
this.$u.toast(res.msg);
}
this.loading = false;
});
}
}
},
},
};
</script>
......
......@@ -116,21 +116,16 @@ export default {
return this.vuex_sales_outbound[this.vbeln] || null;
},
plslen() {
return this.goodsList.reduce((acc, cur) => {
return (
acc +
(cur?.ZPLDT?.reduce((a, c) => {
if (c.ZCODE == "" && c.PLNR) {
a.push(c.PLNR);
} else if (c.PLNR && c.ZCODE) {
if (!a.includes(c.ZCODE)) {
a.push(c.ZCODE);
}
const codes = [];
this.goodsList.forEach((cur) => {
cur?.ZPLDT?.forEach((c) => {
const code = c.ZCODE || c.PLNR;
if (!codes.includes(code)) {
codes.push(code);
}
return a;
}, []).length || 0)
);
}, 0);
});
});
return codes.length;
},
saleInfo() {
return this.goodsList[0] || {};
......@@ -305,7 +300,7 @@ export default {
}
});
} else {
item.ZPLDT.splice(idx, 1)
item.ZPLDT.splice(idx, 1);
}
},
// 加载更多
......
......@@ -282,7 +282,6 @@ page {
margin: 20rpx;
}
.cardbox {
max-height: calc(100vh - 105px - 60rpx - 140rpx);
padding: 0rpx 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