Commit eeaf1615 authored by 何远江's avatar 何远江

bug 修改, 优化

parent bc3edf4c
<template>
<view class="factoryBox">
<zxz-uni-data-select
filterable
v-model="warehouseCode"
dataKey="label"
placeholder="请选择库存地点"
dataValue="value"
:localdata="warehouseData"
@change="onWarehouseChange"
/>
</view>
<view class="factoryBox">
<zxz-uni-data-select filterable v-model="warehouseCode" dataKey="label" placeholder="请选择库存地点" dataValue="value"
:localdata="warehouseData" @change="onWarehouseChange" />
</view>
</template>
<script>
export default {
model: {
prop: "value",
event: "update",
},
props: {
value: {
type: String,
defualt: "",
},
},
data() {
return {
warehouseData: [],
};
},
computed: {
warehouseCode: {
get() {
return this.value;
},
set(v) {
this.$emit("update", v);
},
},
},
created() {
this.getDepotLists();
},
methods: {
onWarehouseChange(e) {
this.$emit("change", e);
},
getDepotLists() {
this.$u.api.sapApi
.sapDict({
FIELDNAME: "T001L",
})
.then((res) => {
if (res) {
// 过滤当前工厂下的库存地点
this.warehouseData = res
.filter((ele) => ele.WERKS == this.vuex_user_factory)
.map((item) => {
item.label = item.LGORT + "-" + item.LGOBE;
item.value = item.LGORT;
return item;
});
} else {
this.warehouseData = [];
}
});
},
},
};
export default {
model: {
prop: "value",
event: "update",
},
props: {
value: {
type: String,
default: "",
},
options: {
type: Array,
default: () => ([])
}
},
data() {
return {
warehouseData: [],
};
},
computed: {
warehouseCode: {
get() {
return this.value;
},
set(v) {
this.$emit("update", v);
},
},
},
created() {
this.getDepotLists();
},
methods: {
onWarehouseChange(e) {
this.$emit("change", e);
},
getDepotLists() {
this.$u.api.sapApi
.sapDict({
FIELDNAME: "T001L",
})
.then((res) => {
if (res) {
// 过滤当前工厂下的库存地点
this.warehouseData = res
.filter((ele) => ele.WERKS == this.vuex_user_factory)
.map((item) => {
item.label = item.LGORT + "-" + item.LGOBE;
item.value = item.LGORT;
return item;
})
this.warehouseData.unshift(...this.options)
} else {
this.warehouseData = [];
}
});
},
},
};
</script>
<style lang="scss">
.factoryBox {
padding: 10rpx 20rpx 0;
.factoryBox {
padding: 10rpx 20rpx 0;
.item-select {
margin-bottom: 20rpx;
}
}
</style>
.item-select {
margin-bottom: 20rpx;
}
}
</style>
......@@ -2,7 +2,7 @@
<view class="page">
<StickyNavBar>
<NavBar title="完工入库扫描"></NavBar>
<FactorySelect v-model="LGOBE" @change="actionSheetCallback" />
<FactorySelect v-model="LGOBE" @change="actionSheetCallback" :options="options" />
<!-- <view class="selectSheet">
<u-row >
......@@ -13,7 +13,7 @@
</u-row>
</view> -->
<view class="btn">
<uni-easyinput prefixIcon="search" class="topSearch" 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"
......@@ -65,6 +65,7 @@ export default {
show: true,
nlpla: '',
wxparams: '',
nlplaDisabled: false,
warehouseCode: '',
btnArr: [
{
......@@ -89,12 +90,18 @@ export default {
LGORT: '',
type: 'select',
border: true,
list:[]
list:[],
options: [{
WERKS: "1000",
LGORT: "S000",
LGOBE: "发运仓",
label: "S000-发运仓",
value: "S000",
},]
};
},
created() {
// this.getDepotLists();
// 二维码包含:10位物料号(右对齐不足补充为0)物料号12位生产单号(右对齐不足补充为0),
// 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0)
// this.getPlnr('006000000100100000000300000501001');
......@@ -103,29 +110,12 @@ export default {
totalNum(){
let num = 0;
this.goodsList.forEach((ele) => {
num += ele.quantity;
num += ele.totalQuantity;
});
return num
}
},
methods: {
getDepotLists() {
this.$u.api.sapApi
.sapDict({
FIELDNAME: 'T001L'
})
.then((res) => {
if (res) {
res.forEach((ele) => {
ele.text = ele.LGORT + "-" + ele.LGOBE;
});
this.depotLists = res;
console.log(this.depotLists, 'depotLists', res);
} else {
this.depotLists = [];
}
});
},
// 点击actionSheet回调
actionSheetCallback(item) {
this.LGORT = item?.LGORT || "";
......@@ -200,6 +190,7 @@ export default {
},
handleInputNlpla(e) {
console.log(`output->e`,e)
this.nlplaDisabled = !!e
},
reset(){
setTimeout(() => {
......@@ -211,29 +202,34 @@ export default {
getPlnr(qrcode) {
this.isDisabled = true;
this.isFocus = false
if(!this.nlpla){
if(!this.nlpla && this.vuex_user_factory !== '1010'){
this.$u.toast('请先扫描仓位');
this.reset()
return
}
// if(!this.nlpla){
// this.$u.toast('请先扫描仓位');
// this.reset()
// return
// }
this.$u.api.mesApi
.pdaFindPackageLinkInfo({
qrcode
})
.then((res) => {
if (res && res.code == 200) {
if (this.goodsList.some((item) => item.workorderNo !== res.data[0].workorderNo)) {
this.$u.toast('请扫描同一个工单');
this.reset()
return
}
// if (this.goodsList.some((item) => item.workorderNo !== res.data[0].workorderNo)) {
// this.$u.toast('请扫描同一个工单');
// this.reset()
// return
// }
if (this.goodsList.some((item) => item.qrcode === qrcode)) {
this.$u.toast('已经存在当前条码');
this.reset()
return
}
res.data.forEach(ele => {
ele.NLPLA = this.nlpla?.trim();
this.nlpla && (ele.NLPLA = this.nlpla?.trim())
});
this.list = this.list.concat(res.data)
......
......@@ -8,6 +8,7 @@
<view class="item">产品描述:{{ item.itemName }}</view>
<view class="item">入库仓位:{{ item.NLPLA }}</view>
<view class="item">入库数量:{{ item.quantity }}</view>
<view class="item">loss数量:{{ item.lossNum }}</view>
</view>
<u-button size="mini" type="primary" plain @click="deleGonds(idx)">
<u-icon name="trash" size="28"></u-icon>
......
......@@ -9,11 +9,6 @@
>{{ goodsInfo.KOSTL }} / {{ goodsInfo.KTEXT }}</view
>
</view>
<view class="checkedCase">
<checkbox-group @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否结案
</checkbox-group>
</view>
</view>
<view class="btn">
<uni-easyinput
......@@ -158,10 +153,12 @@ export default {
// 获取items
const items = this.goodsList.reduce((acc, cur) => {
acc.push(...cur.details.map(v => {
v.KOSTL = cur.KOSTL
return v
}));
acc.push(
...cur.details.map((v) => {
v.KOSTL = cur.KOSTL;
return v;
})
);
return acc;
}, []);
......@@ -170,7 +167,7 @@ export default {
BUDAT: parseTime(new Date(), "{y}{m}{d}"),
zencode: "A006",
ZMARK: "A001",
TYPE: 'FL',
TYPE: "FL",
item: items,
};
this.$u.api.sapApi.sapRrm([params]).then((res) => {
......@@ -183,8 +180,17 @@ export default {
return this.$u.toast(errObj.MESSAGE);
}
// 提交成功 返回上一个页面
this.$u.toast("提交成功!");
this.goBack();
this.$u.toast("提交成功!", 3000, {
icon: "success",
mask: true,
complete: () => {
setTimeout(() => {
uni.navigateBack({
delta: 1,
});
}, 3000);
},
});
});
},
......@@ -231,10 +237,9 @@ export default {
let bdmng = 0;
// 查询需求数量与pl数量总和不等的物料
const item = items.find((v) => {
const total = v.details.length ? v.details.reduce(
(acc, cur) => (acc + +cur.ERFMG).toFixed(3),
0
) : 0
const total = v.details.length
? v.details.reduce((acc, cur) => (acc + +cur.ERFMG).toFixed(3), 0)
: 0;
bdmng = (v.BDMNG - total).toFixed(3);
return bdmng > 0;
});
......@@ -246,7 +251,7 @@ export default {
splitBlpl.ERFMG = bdmng;
blpl.ERFMG = (blpl.ERFMG - bdmng).toFixed(3);
}
splitBlpl.PACMG = splitBlpl.ERFMG
splitBlpl.PACMG = splitBlpl.ERFMG;
item.details.push(splitBlpl);
}
} else {
......
<template>
<view class="lists page">
<StickyNavBar class="listTitle">
<NavBar title="销售拣货"></NavBar>
<view class="headerTitle">
<view class="items">交货单号:{{ vbeln }}</view>
<view class="items">{{saleInfo.KUNNR}} | {{ saleInfo.NAME1 }}</view>
<view class="items">计划日期:{{ saleInfo.WADAT }}</view>
<view class="items">装箱数:{{ plslen }} / {{ Number(saleInfo.XSNUM) }}</view>
</view>
<view class="">
<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="blue">{{ totalNum }}</text>
<text class="line">/</text>
<text class="">{{ goodsList.length }}</text>
</view>
</view>
</view>
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.PLNR">
<scanningList :item="item" :list="item.ZPLDT" />
</view>
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
<view class="lists page">
<StickyNavBar class="listTitle">
<NavBar title="销售拣货"></NavBar>
<view class="headerTitle">
<view class="items">交货单号:{{ vbeln }}</view>
<view class="items">{{ saleInfo.KUNNR }} | {{ saleInfo.NAME1 }}</view>
<view class="items">计划日期:{{ saleInfo.WADAT }}</view>
<view class="items"
>装箱数:{{ plslen }} / {{ Number(saleInfo.XSNUM) }}</view
>
</view>
<view class="">
<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="blue">{{ totalNum }}</text>
<text class="line">/</text>
<text class="">{{ goodsList.length }}</text>
</view>
</view>
</view>
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view
class="cardContent"
v-for="(item, index) in goodsList"
:key="item.PLNR"
>
<scanningList
:item="item"
:list="item.ZPLDT"
@deleGonds="(idx) => deleGonds(item, idx)"
/>
</view>
</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 stockList from "./stockList.vue";
import {
parseTime
} from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList,
stockList,
},
data() {
return {
value: "",
type: "select",
border: true,
current: 0,
status: "loadmore",
btnArr: [{
style: "",
type: "primary",
text: "保存",
way: "goSave",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
isFocus: false,
isDisabled: false,
nlpla: "",
wxparams: "",
goodsList: [],
pls: [], // 已经扫码的pl号
resFlag: false,
};
},
created() {},
onLoad(option) {
/**
* 查询缓存中是否有单号,有单号读取扫描PL的数据
*/
this.getInfo(option.order);
this.vbeln = option.order
},
computed: {
totalNum() {
const count = this.goodsList.filter((item) => item.checkedBox).length;
return count || 0;
},
/**
* 缓存的扫描过的pl条目
*/
catchPL() {
return this.vuex_sales_outbound[this.vbeln] || null
},
plslen() {
return this.goodsList.reduce((acc,cur) => {
return acc + (cur.ZPLDT?.length || 0)
},0)
},
saleInfo() {
return this.goodsList[0] || {}
}
},
methods: {
goSubmit() {
if (!this.goodsList.length) return;
if (this.resFlag) {
return this.$u.toast("当前单据已经提交成功!无需继续提交!");
}
const flag = this.goodsList.every((ele) => {
return (
ele.sumNum == ele?.ZPLDT?.reduce((acc, cur) => acc + cur.PACMG, 0)
);
});
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 stockList from "./stockList.vue";
import { parseTime } from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList,
stockList,
},
data() {
return {
value: "",
type: "select",
border: true,
current: 0,
status: "loadmore",
btnArr: [
{
style: "",
type: "primary",
text: "保存",
way: "goSave",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
isFocus: false,
isDisabled: false,
nlpla: "",
wxparams: "",
goodsList: [],
pls: [], // 已经扫码的pl号
resFlag: false,
};
},
created() {},
onLoad(option) {
/**
* 查询缓存中是否有单号,有单号读取扫描PL的数据
*/
this.getInfo(option.order);
this.vbeln = option.order;
},
computed: {
totalNum() {
const count = this.goodsList.filter((item) => item.checkedBox).length;
return count || 0;
},
/**
* 缓存的扫描过的pl条目
*/
catchPL() {
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);
}
}
return a;
}, []).length || 0)
);
}, 0);
},
saleInfo() {
return this.goodsList[0] || {};
},
},
methods: {
goSubmit() {
if (!this.goodsList.length) return;
if (this.resFlag) {
return this.$u.toast("当前单据已经提交成功!无需继续提交!");
}
const flag = this.goodsList.every((ele) => {
return (
ele.sumNum == ele?.ZPLDT?.reduce((acc, cur) => acc + cur.PACMG, 0)
);
});
if (!flag) {
return this.$u.toast("请确认所有包装数量是否正确");
}
if (!flag) {
return this.$u.toast("请确认所有包装数量是否正确");
}
const params = this.goodsList.reduce((acc, cur, index) => {
if (index == 0) {
acc.push(JSON.parse(JSON.stringify(cur)));
} else {
const item = acc.find((v) => v.POSNR === cur.POSNR);
if (item) {
item.ZPLDT.push(...cur.ZPLDT);
} else {
acc.push(JSON.parse(JSON.stringify(cur)));
}
}
return acc;
}, []);
const params = this.goodsList.reduce((acc, cur, index) => {
if (index == 0) {
acc.push(JSON.parse(JSON.stringify(cur)));
} else {
const item = acc.find((v) => v.POSNR === cur.POSNR);
if (item) {
item.ZPLDT.push(...cur.ZPLDT);
} else {
acc.push(JSON.parse(JSON.stringify(cur)));
}
}
return acc;
}, []);
this.$u.api.sapApi.sapPickingDn(params).then((res) => {
this.loading = false;
if (!Array.isArray(res)) {
return;
}
const flag = res.some((item) => {
const f = item.TYPE == "E";
if (f) {
this.$u.toast(item.MESSAGE);
}
return f;
});
if (!flag) {
this.$u.toast("提交成功");
// 如果有缓存PL,提交成功将要清楚当前缓存
if (this.catchPL) {
const sales_outbound = {
...this.vuex_sales_outbound
}
delete sales_outbound[this.vbeln]
this.$u.vuex('vuex_sales_outbound', sales_outbound)
}
setTimeout(() => {
this.goBack();
}, 1000);
}
});
},
goSave() {
console.log(this.vuex_sales_outbound, 'this.vuex_sales_outbound')
// 缓存以单号为key,扫描的pl为value
const pls = this.goodsList.reduce((acc, cur) => {
cur.ZPLDT && acc.push(...cur.ZPLDT)
return acc
}, [])
// 如果已经扫描pl执行缓存
if (pls.length) {
const sales_outbound = {
...(this.vuex_sales_outbound || {}),
[this.vbeln]: pls
}
this.$u.vuex('vuex_sales_outbound', sales_outbound)
this.$u.toast('保存成功!')
}
},
getInfo(VBELN) {
this.$u.api.sapApi
.sapSchDn({
VBELN
}).then(res => {
this.initGoodsList(res.BKDT)
console.log(this.catchPL, 'this.catchPL')
this.catchPL && this.setSalesBoundPL(this.catchPL)
})
},
initGoodsList(arr) {
// 有SIZE行就取ZINSNUM+ZLOSSC,没有SIZE行的就是取交货单行的LFIMG
arr.forEach((ele) => {
if (ele.ZSIZE.length) {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
KDAUF: ele.KDAUF,
KDPOS: ele.KDPOS,
LFIMG: ele.LFIMG,
MEINS: ele.MEINS,
WERKS: ele.WERKS,
...item,
KUNNR: ele.KUNNR,
NAME1: ele.NAME1,
WADAT: ele.WADAT,
XSNUM: ele.XSNUM,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
sumNum: item.ZINSNUM + item.ZLOSSC
};
})
);
} else {
ele.ZSIZE = "";
ele.sumNum = ele.LFIMG;
// ele.ZINSNUM = ele.LFIMG;
this.goodsList.push(ele);
this.$u.toast(`物料编号:${ele.MATNR}--没有尺码信息`);
}
});
},
setSalesBoundPL(pls) {
console.log(pls, 'pls')
// 循环BLPL合并相同的物料号和size
pls.forEach((ele) => {
if (!this.pls.includes(ele.PLNR) || !this.pls.includes(ele.ZCODE)) {
ele.PLNR && this.pls.push(ele.PLNR)
ele.ZCODE && this.pls.push(ele.ZCODE)
}
ele.TOMNG = ele.PACMG;
const item = this.goodsList.find(
(v) => v.ZSIZE == ele.ZSIZE && ele.MATNR == v.MATNR
);
if (item) {
if (Reflect.has(item, "ZPLDT")) {
item.ZPLDT.push(ele);
} else {
this.$set(item, "ZPLDT", [ele]);
}
}
});
},
getPlnr(plnr) {
let params = {
ZCODE: plnr.includes("BL") ? plnr : "",
plnr: plnr.includes("BL") ? "" : plnr,
ztype: '005'
};
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.setSalesBoundPL(res.BLPL)
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
// 加载更多
onReachBottom() {
console.log("加载更多inventoryCounting");
},
getBtnHandle(row) {
console.log("getBtnHandle", row);
this[row.way]();
},
goBack() {
console.log("进来");
uni.navigateBack();
},
changeTab(index) {
this.current = index;
},
handleInputNlpla(e) {},
handleInputPlnr(e) {
if (!e) return
this.isFocus = false;
console.log(this.pls, 'this.pls')
if (this.pls.includes(e)) {
return this.$u.toast('请勿重复扫描!')
}
this.getPlnr(e);
},
},
};
this.$u.api.sapApi.sapPickingDn(params).then((res) => {
this.loading = false;
if (!Array.isArray(res)) {
return;
}
const flag = res.some((item) => {
const f = item.TYPE == "E";
if (f) {
this.$u.toast(item.MESSAGE);
}
return f;
});
if (!flag) {
this.$u.toast("提交成功");
// 如果有缓存PL,提交成功将要清楚当前缓存
if (this.catchPL) {
const sales_outbound = {
...this.vuex_sales_outbound,
};
delete sales_outbound[this.vbeln];
this.$u.vuex("vuex_sales_outbound", sales_outbound);
}
setTimeout(() => {
this.goBack();
}, 1000);
}
});
},
goSave() {
console.log(this.vuex_sales_outbound, "this.vuex_sales_outbound");
// 缓存以单号为key,扫描的pl为value
const pls = this.goodsList.reduce((acc, cur) => {
cur.ZPLDT && acc.push(...cur.ZPLDT);
return acc;
}, []);
const sales_outbound = {
...(this.vuex_sales_outbound || {}),
[this.vbeln]: pls,
};
this.$u.vuex("vuex_sales_outbound", sales_outbound);
this.$u.toast("保存成功!");
},
getInfo(VBELN) {
this.$u.api.sapApi
.sapSchDn({
VBELN,
})
.then((res) => {
this.initGoodsList(res.BKDT);
console.log(this.catchPL, "this.catchPL");
this.catchPL && this.setSalesBoundPL(this.catchPL);
});
},
initGoodsList(arr) {
// 有SIZE行就取ZINSNUM+ZLOSSC,没有SIZE行的就是取交货单行的LFIMG
arr.forEach((ele) => {
if (ele.ZSIZE.length) {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
KDAUF: ele.KDAUF,
KDPOS: ele.KDPOS,
LFIMG: ele.LFIMG,
MEINS: ele.MEINS,
WERKS: ele.WERKS,
...item,
KUNNR: ele.KUNNR,
NAME1: ele.NAME1,
WADAT: ele.WADAT,
XSNUM: ele.XSNUM,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
sumNum: item.ZINSNUM + item.ZLOSSC,
};
})
);
} else {
ele.ZSIZE = "";
ele.sumNum = ele.LFIMG;
// ele.ZINSNUM = ele.LFIMG;
this.goodsList.push(ele);
this.$u.toast(`物料编号:${ele.MATNR}--没有尺码信息`);
}
});
},
setSalesBoundPL(pls) {
console.log(pls, "pls");
// 循环BLPL合并相同的物料号和size
pls.forEach((ele) => {
if (!this.pls.includes(ele.PLNR) || !this.pls.includes(ele.ZCODE)) {
ele.PLNR && this.pls.push(ele.PLNR);
ele.ZCODE && this.pls.push(ele.ZCODE);
}
ele.TOMNG = ele.PACMG;
const item = this.goodsList.find(
(v) => v.ZSIZE == ele.ZSIZE && ele.MATNR == v.MATNR
);
if (item) {
if (Reflect.has(item, "ZPLDT")) {
item.ZPLDT.push(ele);
} else {
this.$set(item, "ZPLDT", [ele]);
}
}
});
},
getPlnr(plnr) {
const isBL = plnr.includes("BL");
let params = {
ZCODE: isBL ? plnr : "",
plnr: isBL ? "" : plnr,
ztype: "005",
};
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.setSalesBoundPL(res.BLPL);
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
deleGonds(item, idx) {
const currentPL = item.ZPLDT[idx];
if (currentPL.ZCODE) {
// 删除当前物料 与当前PL关联的所有BL
item.ZPLDT = item.ZPLDT.filter((ele) => ele.ZCODE != currentPL.ZCODE);
// 查询其他物料中是否有相同的ZCODE
this.goodsList.forEach((ele) => {
if (ele?.ZPLDT?.some((v) => v.ZCODE == currentPL.ZCODE)) {
ele.ZPLDT = ele.ZPLDT.filter((v) => v.ZCODE != currentPL.ZCODE);
}
});
} else {
item.ZPLDT.splice(idx, 1)
}
},
// 加载更多
onReachBottom() {
console.log("加载更多inventoryCounting");
},
getBtnHandle(row) {
console.log("getBtnHandle", row);
this[row.way]();
},
goBack() {
console.log("进来");
uni.navigateBack();
},
changeTab(index) {
this.current = index;
},
handleInputNlpla(e) {},
handleInputPlnr(e) {
if (!e) return;
this.isFocus = false;
console.log(this.pls, "this.pls");
if (this.pls.includes(e)) {
return this.$u.toast("请勿重复扫描!");
}
this.getPlnr(e);
},
},
};
</script>
<style lang="scss">
.selectSheet {
border-bottom: 1px solid #ccc;
}
.selectSheet {
border-bottom: 1px solid #ccc;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.tabTwo {
/deep/ .u-sticky-wrap {
height: 330rpx !important;
}
}
.tabTwo {
/deep/ .u-sticky-wrap {
height: 330rpx !important;
}
}
.listTitle {}
.listTitle {
}
.contentMore {
margin: 20rpx;
}
.contentMore {
margin: 20rpx;
}
page {
background: #f8f8f8;
}
page {
background: #f8f8f8;
}
.headerTitle {
padding: 20rpx;
font-weight: 600;
.headerTitle {
padding: 20rpx;
font-weight: 600;
.items {
line-height: 40rpx;
}
}
.items {
line-height: 40rpx;
}
}
.btn {
padding: 20rpx;
background: #fff;
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.topSearch {
margin-bottom: 20rpx;
}
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.line {
margin: 0px 10rpx;
}
}
.cardbox {
min-height: calc(100vh - 410rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardbox {
min-height: calc(100vh - 410rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
</style>
......@@ -2,6 +2,7 @@
<view>
<view class="listItemTitle">
<view>
<view class="item">交货单:{{ item.VBELN }}</view>
<view class="item">行号:{{ item.POSNR }}</view>
<view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view>
......@@ -33,20 +34,18 @@
</view>
<view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.PLNR+idx" v-if="ele.ZSIZE === item.ZSIZE && ele.MATNR === item.MATNR && ele.PLNR">
<view class="items" v-if="ele.ZCODE">BL号:{{ ele.ZCODE }}</view>
<view class="items">PL号:{{ ele.PLNR }}</view>
<view class="items">物料批号:{{ ele.CHARG }}</view>
<view class="items">库位:{{ ele.LGORT }} - {{ ele.LGOBE }}</view>
<view class="items">仓位:{{ ele.NLPLA }}</view>
<!-- <view class="items">{{ ele.MATNR }}</view> -->
<view class="items inputItem">
<!-- <u-row gutter="8"> -->
数量:
{{ele.PACMG}}
<!-- <uni-easyinput v-model="ele.CLABS"></uni-easyinput> -->
<!-- /
{{ ele.LFIMG }} -->
<!-- </u-row> -->
</view>
<view class="items inputItem">数量:{{ele.PACMG}}</view>
<view class="boxBtn">
<u-button class="botBtn" size="mini" type="primary" plain @click="deleGonds(idx)">
<u-icon name="trash" size="28"></u-icon>
删除
</u-button>
</view>
</view>
</view>
</view>
......@@ -105,6 +104,9 @@ export default {
},
methods: {
deleGonds(idx) {
this.$emit('deleGonds', idx);
},
handleNum(){
let num = 0
this.list.forEach(ele => {
......@@ -205,6 +207,7 @@ page {
background: #f8f8f8;
padding: 20rpx;
margin-bottom: 20rpx;
position: relative;
.items {
color: #333;
font-size: 24rpx;
......@@ -224,6 +227,11 @@ page {
top: 0 !important;
background: #fff;
}
.boxBtn {
position: absolute;
bottom: 10rpx;
right: 10rpx;
}
.checkedBox{
text-align: right;
}
......
<template>
<view class="lists">
<StickyNavBar>
<NavBar title="发货下架"></NavBar>
<view class="btn">
<uni-easyinput class="boxSelect" prefixIcon="search" v-model.trim="lgort" placeholder="请扫描目标仓位"></uni-easyinput>
<uni-easyinput class="boxSelect" prefixIcon="search" v-model.trim="vbeln" placeholder="请扫描交货单" @input="handleInputvbeln"></uni-easyinput>
<uni-easyinput prefixIcon="search" :disabled="isDisabled" v-model.trim="wxparams" :focus="isFocus"
placeholder="请扫描产品包装条码/外箱码" @input="handleInputPlnr"></uni-easyinput>
</view>
<!-- <view class="total" v-show="goodsList && goodsList.length > 0">
<view class="lists">
<StickyNavBar>
<NavBar title="发货下架"></NavBar>
<FactorySelect v-model="lgort" :options="options" />
<view class="btn">
<uni-easyinput
class="boxSelect"
prefixIcon="search"
v-model.trim="vbeln"
placeholder="请扫描交货单"
@input="handleInputvbeln"
></uni-easyinput>
<uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
v-model.trim="wxparams"
:focus="isFocus"
placeholder="请扫描产品包装条码/外箱码"
@input="handleInputPlnr"
></uni-easyinput>
</view>
<!-- <view class="total" v-show="goodsList && goodsList.length > 0">
<view class="left">明细</view>
</view> -->
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view class="cardContent" v-for="item in goodsList" :key="item.PLNR">
<scanningList :item="item" :list="item.ZPLDT" />
</view>
</view>
</ContentLoadingMore>
</StickyNavBar>
<ContentLoadingMore class="contentMore" :list="goodsList">
<view class="cardbox">
<view class="cardContent" v-for="item in goodsList" :key="item.PLNR">
<scanningList :item="item" :list="item.ZPLDT" />
</view>
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
<script>
import BottomBtn from '@/components/BottomBtn/index.vue';
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import scanningList from "../salesOutbound/scanningList.vue";
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import {
parseTime
} from "@/utils/ruoyi";
import BottomBtn from "@/components/BottomBtn/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import scanningList from "../salesOutbound/scanningList.vue";
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import { parseTime } from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
ContentLoadingMore,
scanningList,
BottomBtn
},
data() {
return {
wxparams: "",
lgort: '',
vbeln: '',
isDisabled: false,
isFocus: false,
goodsList: [],
pls: [], // 已经扫码的pl号
btnArr: [{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
},
{
style: '',
type: 'primary',
text: '提交',
way: 'goSubmit'
}
],
}
},
computed: {
/**
* 缓存的扫描过的pl条目
*/
catchPL() {
return this.vuex_sales_outbound[this.vbeln] || null
}
},
methods: {
handleInputPlnr(e) {
if (!e) return
this.isFocus = false;
console.log(this.pls, 'this.pls')
if (this.pls.includes(e)) {
return this.$u.toast('请勿重复扫描!')
}
this.getPlnr(e);
},
getPlnr(plnr) {
let params = {
ZCODE: plnr.includes("BL") ? plnr : "",
plnr: plnr.includes("BL") ? "" : plnr,
ztype: '005'
};
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.setSalesBoundPL(res.BLPL)
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
setSalesBoundPL(pls) {
console.log(pls, 'pls')
// 循环BLPL合并相同的物料号和size
pls.forEach((ele) => {
if (!this.pls.includes(ele.PLNR) || !this.pls.includes(ele.ZCODE)) {
ele.PLNR && this.pls.push(ele.PLNR)
ele.ZCODE && this.pls.push(ele.ZCODE)
}
ele.TOMNG = ele.PACMG;
const item = this.goodsList.find(
(v) => v.ZSIZE == ele.ZSIZE && ele.MATNR == v.MATNR
);
if (item) {
if (Reflect.has(item, "ZPLDT")) {
item.ZPLDT.push(ele);
} else {
this.$set(item, "ZPLDT", [ele]);
}
}
});
},
initGoodsList(arr) {
// 有SIZE行就取ZINSNUM+ZLOSSC,没有SIZE行的就是取交货单行的LFIMG
arr.forEach((ele) => {
if (ele.ZSIZE.length) {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
KDAUF: ele.KDAUF,
KDPOS: ele.KDPOS,
LFIMG: ele.LFIMG,
MEINS: ele.MEINS,
WERKS: ele.WERKS,
...item,
KUNNR: ele.KUNNR,
NAME1: ele.NAME1,
WADAT: ele.WADAT,
XSNUM: ele.XSNUM,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
sumNum: item.ZINSNUM + item.ZLOSSC
};
})
);
} else {
ele.ZSIZE = "";
ele.sumNum = ele.LFIMG;
// ele.ZINSNUM = ele.LFIMG;
this.goodsList.push(ele);
this.$u.toast(`物料编号:${ele.MATNR}--没有尺码信息`);
}
});
},
handleInputvbeln(VBELN) {
this.$u.api.sapApi
.sapSchDn({
VBELN
}).then(res => {
this.initGoodsList(res.BKDT)
console.log(this.catchPL, 'this.catchPL')
this.catchPL && this.setSalesBoundPL(this.catchPL)
setTimeout(() => {
this.vbeln = "";
}, 1000);
})
},
deleGonds(index) {
this.goodsList.splice(index, 1)
},
reset() {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = ''
}, 1000);
},
goBack() {
uni.navigateBack()
},
getBtnHandle(row) {
console.log('getBtnHandle', row);
this[row.way]();
},
// 提交
goSubmit() {
if (!this.goodsList.length) {
return this.$u.toast('请扫描需要下架的箱条码/外箱码')
}
if (!this.vbeln) {
return this.$u.toast('请扫描交货单')
}
if (!this.lgort) {
return this.$u.toast('请选择目标仓位')
}
const arr = this.goodsList.map((item) => {
item.LGORT = this.lgort
item.VBELN = this.vbeln
return item
})
this.$u.api.sapApi
.sapCasePlnr2(arr)
.then((res) => {
const flag = res.some((item) => {
const b = item.TYPE == 'E'
if (b) {
this.$u.toast(item.MESSAGE)
}
return b
})
if (!flag) {
this.$u.toast(res[0].MESSAGE);
this.goodsList = []
}
})
},
}
}
export default {
components: {
StickyNavBar,
ContentLoadingMore,
scanningList,
BottomBtn,
},
data() {
return {
wxparams: "",
lgort: "",
vbeln: "",
isDisabled: false,
isFocus: false,
goodsList: [],
options: [
{
WERKS: "1000",
LGORT: "S000",
LGOBE: "发运仓",
label: "S000-发运仓",
value: "S000",
},
],
pls: [], // 已经扫码的pl号
btnArr: [
{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
};
},
computed: {
/**
* 缓存的扫描过的pl条目
*/
catchPL() {
return this.vuex_sales_outbound[this.vbeln] || null;
},
},
methods: {
handleInputPlnr(e) {
if (!e) return;
this.isFocus = false;
console.log(this.pls, "this.pls");
if (this.pls.includes(e)) {
return this.$u.toast("请勿重复扫描!");
}
this.getPlnr(e);
},
getPlnr(plnr) {
if (!this.goodsList.length) {
return this.$u.toast("请先扫描交货单!");
}
let params = {
ZCODE: plnr.includes("BL") ? plnr : "",
plnr: plnr.includes("BL") ? "" : plnr,
ztype: "005",
};
this.$u.api.sapApi.sapBlpl(params).then((res) => {
if (res && res.MSG[0].TYPE === "S") {
this.setSalesBoundPL(res.BLPL);
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
this.loading = false;
});
},
setSalesBoundPL(pls) {
console.log(pls, "pls");
// 循环BLPL合并相同的物料号和size
pls.forEach((ele) => {
if (!this.pls.includes(ele.PLNR) || !this.pls.includes(ele.ZCODE)) {
ele.PLNR && this.pls.push(ele.PLNR);
ele.ZCODE && this.pls.push(ele.ZCODE);
}
ele.TOMNG = ele.PACMG;
const item = this.goodsList.find(
(v) => v.ZSIZE == ele.ZSIZE && ele.MATNR == v.MATNR
);
if (item) {
if (Reflect.has(item, "ZPLDT")) {
item.ZPLDT.push(ele);
} else {
this.$set(item, "ZPLDT", [ele]);
}
}
});
},
initGoodsList(arr, VBELN) {
// 有SIZE行就取ZINSNUM+ZLOSSC,没有SIZE行的就是取交货单行的LFIMG
arr.forEach((ele) => {
if (ele.ZSIZE.length) {
this.goodsList.push(
...ele.ZSIZE.map((item) => {
return {
KDAUF: ele.KDAUF,
KDPOS: ele.KDPOS,
LFIMG: ele.LFIMG,
MEINS: ele.MEINS,
WERKS: ele.WERKS,
...item,
KUNNR: ele.KUNNR,
NAME1: ele.NAME1,
WADAT: ele.WADAT,
XSNUM: ele.XSNUM,
MATNR: ele.MATNR,
MAKTX: ele.MAKTX,
VBELN: VBELN,
POSNR: ele.POSNR,
ZPLDT: [],
sumNum: item.ZINSNUM + item.ZLOSSC,
};
})
);
} else {
ele.ZSIZE = "";
ele.sumNum = ele.LFIMG;
// ele.ZINSNUM = ele.LFIMG;
this.goodsList.push(ele);
this.$u.toast(`物料编号:${ele.MATNR}--没有尺码信息`);
}
});
},
handleInputvbeln(VBELN) {
this.$u.api.sapApi
.sapSchDn({
VBELN,
})
.then((res) => {
this.initGoodsList(res.BKDT, VBELN);
setTimeout(() => {
this.vbeln = "";
}, 1000);
});
},
deleGonds(index) {
this.goodsList.splice(index, 1);
},
reset() {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = "";
}, 1000);
},
goBack() {
uni.navigateBack();
},
getBtnHandle(row) {
console.log("getBtnHandle", row);
this[row.way]();
},
// 提交
goSubmit() {
// console.log(this.goodsList, '--------');
// return
if (!this.goodsList.length) {
return this.$u.toast("请先扫描交货单!");
}
if (!this.lgort) {
return this.$u.toast("请选择目标仓位");
}
const arr = this.goodsList.reduce((acc, cur) => {
acc.push(
...cur.ZPLDT.map((item) => {
item.LGORT = this.lgort;
item.VBELN = cur.VBELN;
item.POSNR = cur.POSNR;
return item;
})
);
return acc;
}, []);
// const arr = this.goodsList.map((item) => {
// item.LGORT = this.lgort
// item.VBELN = this.vbeln
// return item
// })
this.$u.api.sapApi.sapCasePlnr2(arr).then((res) => {
const flag = res.some((item) => {
const b = item.TYPE == "E";
if (b) {
this.$u.toast(item.MESSAGE);
}
return b;
});
if (!flag) {
this.$u.toast(res[0].MESSAGE);
this.goodsList = [];
}
});
},
},
};
</script>
<style lang="scss" scoped>
.lists {
flex: 1;
flex-direction: column;
}
.lists {
flex: 1;
flex-direction: column;
}
page {
background: #f8f8f8;
}
page {
background: #f8f8f8;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
.btn {
padding: 20rpx;
background: #fff;
.btn {
padding: 20rpx;
background: #fff;
.boxSelect {
margin-bottom: 20rpx;
}
}
.boxSelect {
margin-bottom: 20rpx;
}
}
.contentMore {
margin: 20rpx;
}
.cardbox {
max-height: calc(100vh - 105px - 60rpx - 140rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.contentMore {
margin: 20rpx;
}
.cardbox {
max-height: calc(100vh - 105px - 60rpx - 140rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
</style>
function toast(title, duration = 3000) {
function toast(title, duration = 3000, params) {
uni.showToast({
title: title,
icon: 'none',
duration: duration
duration: duration,
...params
})
}
......
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