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

工厂调拨优化

parent af4b9314
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
<view class="items">PL:{{ ele.PLNR }}</view> <view class="items">PL:{{ ele.PLNR }}</view>
<view class="items">退货库位:{{ ele.NLPLA }}</view> <view class="items">退货库位:{{ ele.NLPLA }}</view>
<view class="items">数量:{{ ele.PACMG }}</view> <view class="items">数量:{{ ele.PACMG }}</view>
<view class="boxBtn"> <!-- <view class="boxBtn">
<u-button class="botBtn" size="mini" type="primary" plain @click="deleGonds()"> <u-button class="botBtn" size="mini" type="primary" plain @click="deleGonds(idx)">
<u-icon name="trash" size="28"></u-icon> <u-icon name="trash" size="28"></u-icon>
删除 删除
</u-button> </u-button>
</view> </view> -->
</view> </view>
</view> </view>
</view> </view>
...@@ -60,6 +60,7 @@ export default { ...@@ -60,6 +60,7 @@ export default {
return {}; return {};
} }
}, },
itemIndex: Number
}, },
computed: { computed: {
totalVistaNum() { totalVistaNum() {
...@@ -74,8 +75,8 @@ export default { ...@@ -74,8 +75,8 @@ export default {
created() { created() {
}, },
methods: { methods: {
deleGonds() { deleGonds(idx) {
this.$emit('deleGonds',this.item) this.$emit('deleGonds',this.itemIndex, idx)
}, },
} }
}; };
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</StickyNavBar> </StickyNavBar>
<ContentLoadingMore class="cardbox" :list="goodsList"> <ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index"> <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> </view>
</ContentLoadingMore> </ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
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 { parseTime } from "@/utils/ruoyi"; import {
parseTime
} from "@/utils/ruoyi";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
...@@ -103,7 +105,7 @@ ...@@ -103,7 +105,7 @@
}, },
goSubmit() { goSubmit() {
if (this.goodsList.length == 0) return if (this.goodsList.length == 0) return
if (this.goodsList.some(item => item.MENGE != item.details.reduce((acc, cur) => acc + cur.PACMG, 0))){ if (this.goodsList.some(item => item.MENGE != item.details.reduce((acc, cur) => acc + cur.PACMG, 0))) {
return this.$u.toast("请确认物料数量是否正确") return this.$u.toast("请确认物料数量是否正确")
} }
const params = { const params = {
...@@ -132,7 +134,10 @@ ...@@ -132,7 +134,10 @@
}, 3000); }, 3000);
}) })
}, },
/**
* 删除PL,因为有拆分的PL情况, 要删除关联的的PL
*/
deleGonds(index, detailIndex, detail) {},
handleInputPlnr(e) { handleInputPlnr(e) {
if (!e) return if (!e) return
if (this.catchPl.length > 0) { if (this.catchPl.length > 0) {
...@@ -146,6 +151,37 @@ ...@@ -146,6 +151,37 @@
} }
this.getPlnr(e); 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) { getPlnr(plnr) {
this.isDisabled = true; this.isDisabled = true;
this.isFocus = false; this.isFocus = false;
...@@ -168,11 +204,7 @@ ...@@ -168,11 +204,7 @@
if (res.BLPL.length == 0) { if (res.BLPL.length == 0) {
return this.$u.toast("未查询到该条码信息") return this.$u.toast("未查询到该条码信息")
} }
// 匹配相同物料添加进details this.setPL(res.BLPL)
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() this.reset()
}); });
}, },
......
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