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

bug 修改, 优化

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