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

工厂调拨优化

parent af4b9314
......@@ -30,12 +30,12 @@
<view class="items">PL:{{ ele.PLNR }}</view>
<view class="items">退货库位:{{ ele.NLPLA }}</view>
<view class="items">数量:{{ ele.PACMG }}</view>
<view class="boxBtn">
<u-button class="botBtn" size="mini" type="primary" plain @click="deleGonds()">
<!-- <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>
</view>
......@@ -59,7 +59,8 @@ export default {
default: function () {
return {};
}
},
},
itemIndex: Number
},
computed: {
totalVistaNum() {
......@@ -74,8 +75,8 @@ export default {
created() {
},
methods: {
deleGonds() {
this.$emit('deleGonds',this.item)
deleGonds(idx) {
this.$emit('deleGonds',this.itemIndex, idx)
},
}
};
......
......@@ -21,7 +21,7 @@
</StickyNavBar>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList :item="item" :list="item.details" />
<scanningList :item="item" :list="item.details" :itemIndex="index" @deleGonds="deleGonds" />
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
......@@ -33,7 +33,9 @@
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
import BottomBtn from "@/components/BottomBtn/index.vue";
import scanningList from "./scanningList.vue";
import { parseTime } from "@/utils/ruoyi";
import {
parseTime
} from "@/utils/ruoyi";
export default {
components: {
StickyNavBar,
......@@ -45,7 +47,7 @@
return {
wxparams: "",
ebeln: '',
catchPl: [],
catchPl: [],
btnArr: [{
style: "",
type: "warning",
......@@ -102,49 +104,83 @@
});
},
goSubmit() {
if (this.goodsList.length == 0) return
if (this.goodsList.some(item => item.MENGE != item.details.reduce((acc, cur) => acc + cur.PACMG, 0))){
return this.$u.toast("请确认物料数量是否正确")
}
const params = {
BLDAT: parseTime(new Date(), "{y}{m}{d}"),
lfsnr: this.ebeln,
item: this.goodsList.reduce((acc, cur) => {
acc.push(...cur.details.map(item => {
return {
...cur,
...item,
if (this.goodsList.length == 0) return
if (this.goodsList.some(item => item.MENGE != item.details.reduce((acc, cur) => acc + cur.PACMG, 0))) {
return this.$u.toast("请确认物料数量是否正确")
}
const params = {
BLDAT: parseTime(new Date(), "{y}{m}{d}"),
lfsnr: this.ebeln,
item: this.goodsList.reduce((acc, cur) => {
acc.push(...cur.details.map(item => {
return {
...cur,
...item,
EBELN: this.ebeln,
EBELP: cur.EBELP
}
}))
return acc
}, [])
}
this.$u.api.sapApi.sapAllot(params).then(res => {
}
}))
return acc
}, [])
}
this.$u.api.sapApi.sapAllot(params).then(res => {
const errobj = res.find(item => item.TYPE == 'E')
if (errobj) {
if (errobj) {
return this.$u.toast(errobj.MESSAGE)
}
this.$u.toast(res[0].MESSAGE)
setTimeout(() => {
this.goBack()
}, 3000);
})
})
},
/**
* 删除PL,因为有拆分的PL情况, 要删除关联的的PL
*/
deleGonds(index, detailIndex, detail) {},
handleInputPlnr(e) {
if (!e) return
if (this.catchPl.length > 0) {
if (!this.catchPl.inculdes(e)) {
this.getPlnr(e);
} else {
this.reset()
this.$u.toast("请不要重复扫码")
}
return
}
this.getPlnr(e);
if (!e) return
if (this.catchPl.length > 0) {
if (!this.catchPl.inculdes(e)) {
this.getPlnr(e);
} else {
this.reset()
this.$u.toast("请不要重复扫码")
}
return
}
this.getPlnr(e);
},
setPL(blpls) {
blpls.forEach(item => {
// 记录如有拆分,剩余数量
const remainder = item.PACMG
// 查询相同工厂,相同物料编码的条目,且还未分配满数量的
let goods = this.goodsList.find(v => item.MATNR == v.MATNR && item.WERKS == v.RESWK && v
.total != v.MENGE)
// 如果有满足条件的物料
while (goods != undefined) {
// 需求量
const reqNum = goods.MENGE - (goods.total || 0)
// 如果需求量大于等于剩余量,直接分配
if (reqNum >= remainder) {
goods.details.push({...item, PACMG: remainder})
// 累加已经分配的数量
goods.total += remainder
// 终止循环条件
goods = undefined
} else {
// 如果需求量小于剩余量,需要使用拆分
goods.details.push({...item, PACMG: reqNum})
goods.total += reqNum
remainder -= reqNum
// 还有剩余数量,需要继续遍历添加
goods = this.goodsList.find(v => item.MATNR == v.MATNR && item.WERKS == v.RESWK && v
.total != v.MENGE)
}
}
})
},
getPlnr(plnr) {
this.isDisabled = true;
......@@ -155,25 +191,21 @@
ztype: "002",
})
.then((res) => {
// 验证查询PL是否成功
if (res.MSG.some(item => {
if (item.TYPE == 'E') {
this.$u.toast(item.MESSAGE)
return true
}
return false
})) {
return this.reset()
}
if (res.BLPL.length == 0) {
return this.$u.toast("未查询到该条码信息")
}
// 匹配相同物料添加进details
res.BLPL.forEach(item => {
const goods = this.goodsList.find(v => item.MATNR == v.MATNR && item.WERKS ==v.RESWK)
goods && goods.details.push(item)
})
this.reset()
// 验证查询PL是否成功
if (res.MSG.some(item => {
if (item.TYPE == 'E') {
this.$u.toast(item.MESSAGE)
return true
}
return false
})) {
return this.reset()
}
if (res.BLPL.length == 0) {
return this.$u.toast("未查询到该条码信息")
}
this.setPL(res.BLPL)
this.reset()
});
},
},
......@@ -315,4 +347,4 @@
.checkedCase {
margin-top: 10rpx;
}
</style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment