Commit 6c9dbfee authored by xiangzj's avatar xiangzj

拣配

parent c1f4076a
......@@ -34,41 +34,7 @@
</StickyNavBar>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList">
<scanningList :item='item' :idx="index" @deleGonds="deleGonds"/>
<!-- <view class="listItemTitle">
<view>
<view class="item">入库条码:{{ item.qrcode }}</view>
<view class="item">产品编号:{{ item.sapItemCode }}</view>
<view class="item">产品描述:{{ item.MAKTX }}</view>
<view class="item">入库数量:{{ item.quantity }}</view>
</view>
<u-button size="mini" type="primary" plain @click="deleGonds(index)">
<u-icon name="trash" size="28"></u-icon>
删除
</u-button>
</view>
<view class="listBottom">
<view class="bottomTitle" @tap="show = !show">
<view class="desc">卷条码明细</view>
<view class="topIcons">
<view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开
</view>
<view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起
</view>
</view>
</view>
<view v-if="!show" class="bottomBox">
<view class="bottomItem">
<view class="items">尺寸:{{ item.standardSize }}</view>
<view class="items">数量:{{ item.quantity }}</view>
<view class="items">生产日期:{{ item.BLDAT }}</view>
</view>
</view>
</view> -->
<scanningList :item='item' :idx="index" @deleGonds="deleGonds" :list='list'/>
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
......@@ -118,6 +84,7 @@ export default {
LGORT: '',
type: 'select',
border: true,
list:[]
};
},
......@@ -249,7 +216,7 @@ export default {
})
.then((res) => {
if (res && res.code == 200) {
if (this.goodsList.some((item) => item.workorderNo !== res.data.workorderNo)) {
if (this.goodsList.some((item) => item.workorderNo !== res.data[0].workorderNo)) {
this.$u.toast('请扫描同一个工单');
this.reset()
return
......@@ -259,7 +226,15 @@ export default {
this.reset()
return
}
this.goodsList.push({...res.data,NLPLA: this.nlpla})
res.data.forEach(ele => {
ele.NLPLA = this.nlpla
});
this.list = this.list.concat(res.data)
const result = res.data.filter((item, index, self) => {
return self.findIndex(t => t.qrcode === item.qrcode) === index;
});
this.goodsList = this.goodsList.concat(result)
this.reset()
} else {
this.reset()
......
......@@ -29,10 +29,9 @@
</view>
</view>
<view v-if="!show" class="bottomBox">
<view class="bottomItem">
<view class="items">尺码:{{ item.standardSize }}</view>
<view class="items">数量:{{ item.quantity }}</view>
<!-- <view class="items">生产日期:{{ item.BLDAT }}</view> -->
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.qrcode+idx" v-if="ele.qrcode === item.qrcode">
<view class="items">尺码:{{ ele.standardSize }}</view>
<view class="items">数量:{{ ele.quantity }}</view>
</view>
</view>
</view>
......
......@@ -145,7 +145,7 @@ export default {
plnr: ele,
...this.form,
zxspe: this.form.long +'*'+ this.form.wide +'*'+ this.form.high,
zxvolum: (this.form.long * this.form.wide*this.form.high)/1000,
zxvolum: (this.form.long * this.form.wide*this.form.high)/1000000,
ntgew: (this.form.brgew-0) - (this.form.zxntgew-0),
zcode: this.form.ZZXFS === 'PL' ? '' : this.blNum,
datum: parseTime(new Date(),'{y}{m}{d}'),
......
......@@ -129,31 +129,14 @@ export default {
})
.then((res) => {
if (res && res.code - 200 === 0) {
// list 第二层显示 也是最后提交的数据(改动最小)
// goodsList 第一层显示
// 第二层显示的数据和第一层必须属于同一个物料 itemCode一样
this.list = res.rows
const data = res.rows
// let num = 0
// data.forEach((ele,index) => {
// ele.sonItemCode = []
// ele.sonItemCode.push(...data)
// ele.applyNum1 = 0
// })
const result = data.filter((item, index, self) => {
return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index;
});
// let i=null,j=null
// for(i = 0; i < result.length; i++){
// for(j = 0; j < result[i].sonItemCode.length; j++){
// if(result[i].itemCode !== result[i].sonItemCode[j].itemCode){
// result[i].sonItemCode.splice(j,1)
// j--
// }else{
// result[i].applyNum1 += result[i].sonItemCode[j].applyNum
// }
// }
// }
// result.forEach((ele,index) => {
// ele.applyNum = []
// })
this.goodsList = [...result]
} else {
this.$u.toast(res.msg);
......@@ -276,9 +259,17 @@ export default {
this.$u.toast('没有匹配到对应物料');
return
}
// PACMG包装数量 applyNum申请数量 vista这一个工单分配了多少数量
// 总的来说逻辑是
// 1)
// 录入一个pl接口返回的数据 里面有包装数量 size 仓位
// 如果第一个applyNum申请数量满足不到 就把当前pl数据和第一个数据整合
// 再扫第二个 检查第一个是否满足,不满足 就先满足第一个,剩余的满足第二个
// 2)
// 如果满足第一个工单applyNum申请数量 就要往下满足 直到分配完。
for (let m = 0; m < this.list.length; m++) {
if(this.list[m].sapItemCode == res.MATNR){
// 递归的方法
// 递归的方法 满足下一个
if(idx){
if(this.list[idx]){
if(num > this.list[idx].applyNum){
......@@ -291,69 +282,73 @@ export default {
}
return
}
// if(this.list[m].grantNum){
// 发过多少货
// }else{
// 没有填入数据的
if(!this.list[m].vista){
// 上一位的数据是否满足
if(this.list[m-1] && this.list[m-1].vista < this.list[m-1].applyNum){
this.handleAddList(m,((this.list[m-1].applyNum-0) - (this.list[m-1].vista-0)),res)
if( res.PACMG > (this.list[m-1].applyNum - this.list[m-1].vista)){
this.factorial(res,plnr, m+1, res.PACMG - (this.list[m-1].applyNum - this.list[m-1].vista))
}
return
// 没有填入数据的
if(!this.list[m].vista){
// 上一位的数据是否满足
if(this.list[m-1] && this.list[m-1].vista < this.list[m-1].applyNum){
this.handleAddList(m,((this.list[m-1].applyNum-0) - (this.list[m-1].vista-0)),res)
if( res.PACMG > (this.list[m-1].applyNum - this.list[m-1].vista)){
this.factorial(res,plnr, m+1, res.PACMG - (this.list[m-1].applyNum - this.list[m-1].vista))
}
// 只有一个
if(count === 1){
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
}else{
if( res.PACMG > this.list[m].applyNum){
if(count === m){
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
return
}
this.list[m].vista = this.list[m].applyNum
this.$set(this.list,m,{...this.list[m],vista : this.list[m].applyNum,... res})
this.factorial(res,plnr,m+1,res.PACMG-this.list[m].applyNum)
return;
}else{
return
}
// 只有一个
// if(count === 1){
// this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
// }else{
// 包装数量大于申请数量
if( res.PACMG > this.list[m].applyNum){
// 最后一个工单处理
if(count === m){
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
return
}
this.list[m].vista = this.list[m].applyNum
this.$set(this.list,m,{...this.list[m],vista : this.list[m].applyNum,... res})
this.factorial(res,plnr,m+1,res.PACMG-this.list[m].applyNum)
return;
}else{
// 包装数量小于等于申请数量
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
return
}
}else{
if(this.list[m].vista < this.list[m].applyNum){
let arr = []
this.list.forEach(ele => {
console.log(`output->`,ele.workorderCode,this.list[m].workorderCode)
if(ele.workorderCode === this.list[m].workorderCode){
arr.push(ele)
}
});
let totalApplyNum = (arr[0].applyNum-0)
let totalVista =0
arr.forEach(ele => {
totalVista = totalVista + (ele.vista?(ele.vista-0):0)
});
// 最终填入的数量
let endVista = 0
endVista = ((this.list[m].applyNum - 0)-(this.list[m].vista-0)).toFixed(3)
if(m===this.list.length-1){
endVista = res.PACMG - 0
// }
}else{
// 当前填入的数量小于申请数量 就把当前所有工单找出来 一个个的去检查是否满足
if(this.list[m].vista < this.list[m].applyNum){
let arr = []
this.list.forEach(ele => {
if(ele.workorderCode === this.list[m].workorderCode){
arr.push(ele)
}
if(totalVista < totalApplyNum){
this.handleAddList(m,endVista,res)
if((res.PACMG-0)-endVista >0){
this.factorial(res,plnr,m+2,(res.PACMG-0)-endVista)
}
return
});
// 工单申请数量
let totalApplyNum = (arr[0].applyNum-0)
// 当前工单已经录入了总数量 vista是每一个录入数量
let totalVista =0
arr.forEach(ele => {
totalVista = totalVista + (ele.vista?(ele.vista-0):0)
});
// 最终填入的数量
let endVista = 0
endVista = ((this.list[m].applyNum - 0)-(this.list[m].vista-0)).toFixed(3)
// 处理最后一行
if(m === this.list.length - 1){
endVista = res.PACMG - 0
}
// 工单录入数量总和小于总的申请数量 那就要新增一行
if(totalVista < totalApplyNum){
this.handleAddList(m,endVista,res)
// 当前包装数量 大于(总的申请数量 减 工单录入数量总)就要往下一个分配
if((res.PACMG-0)-endVista >0){
this.factorial(res,plnr,m+2,(res.PACMG-0)-endVista)
}
}else{
this.$u.toast('暂无剩余物料');
return
}
}else{
this.$u.toast('暂无剩余物料');
}
// }
}
}
}
}
......
......@@ -27,8 +27,14 @@
</view>
<view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode">
<view class="items">生产单号:{{ ele.workorderCode }}</view>
<view class="items">物料批次:{{ ele.CHARG }}</view>
<view class="proItem">
<view class="items">生产单号:{{ ele.workorderCode }}</view>
<view class="progress">
<progress :percent="handleVista(ele)" show-info />
<!-- <u-line-progress active-color="#2979ff" :percent="handleVista(ele)"></u-line-progress> -->
</view>
</view>
<view class="items">PL:{{ ele.PLNR }}</view>
<view class="items">库位:{{ ele.NLPLA }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem">
......@@ -124,7 +130,17 @@ export default {
created() {
},
methods: {
handleVista(items){
let num = 0
this.list.forEach(ele => {
if(ele.workorderCode === items.workorderCode){
console.log(`output->`,ele.vista,items.workorderCode)
num += ((ele.vista?ele.vista: 0)-0)
}
});
console.log(`output->num`,num)
return ((num/items.applyNum).toFixed(2)*100-0)>100? 100 : (num/items.applyNum).toFixed(2)*100|| 0
}
}
};
</script>
......@@ -220,6 +236,7 @@ page {
color: #333;
font-size: 24rpx;
line-height: 40rpx;
word-break: break-all;
/deep/ .uni-easyinput{
width: 200rpx;
}
......@@ -235,4 +252,17 @@ page {
top: 0 !important;
background: #fff;
}
.progress{
width: 45%;
margin-left: 20rpx;
/deep/ .uni-progress-info{
font-size: 24rpx;
}
}
/deep/ .uni-progress{
line-height: 40rpx;
}
.proItem{
display: flex;
}
</style>
<template>
<view>
<StickyNavBar>
<NavBar title="销售退货上架"></NavBar>
<NavBar title="销售货上架"></NavBar>
<view class="btn">
<uni-easyinput
prefixIcon="search"
......@@ -74,7 +74,7 @@ export default {
};
},
created() {
// this.getPlnr('10000001');
// this.getPlnr('80000033');
},
methods: {
getBtnHandle(row) {
......
......@@ -7,7 +7,7 @@
</view> -->
<view class="headerTitle">
<view class="items">交货单号:MO2024032100001</view>
<view class="items">600247|李XXXX宁XXX体</view>
<view class="items">8|李XXXXXXX体</view>
<view class="items">计划日期:2024/03/22</view>
</view>
<view class="">
......@@ -98,6 +98,7 @@ export default {
nlpla: '',
wxparams: '',
goodsList: [],
list: [],
orderItem: {},
};
},
......@@ -106,12 +107,20 @@ export default {
},
onLoad(option) {
if(option && option.order){
this.goodsList = [
const arr = [
...JSON.parse(option.order)
]
this.goodsList.forEach(ele => {
ele.checkedBox = false
arr.forEach(ele => {
// ele.checkedBox = false
ele.ZSIZE.forEach(item => {
if(ele.POSNR === item.POSNR){
item.MATNR = ele.MATNR
item.MAKTX = ele.MAKTX
this.goodsList.push(item)
}
});
});
console.log(`output->this`,this.goodsList.length)
}
},
computed:{
......
......@@ -2,16 +2,19 @@
<view>
<view class="listItemTitle">
<view>
<view class="item">行号:{{ item.POSNR }}</view>
<view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view>
<view class="item">尺码:{{ item.ZSIZE }}</view>
<view class="item">数量:{{ item.ZINSNUM }}</view>
</view>
<view class="right">
<checkbox-group class="checkedBox">
<!-- <checkbox-group class="checkedBox">
<checkbox value="r1" :checked="item.checkedBox" disabled/>
</checkbox-group>
<text class="blue">{{ item.CLABS }}</text>
</checkbox-group> -->
<!-- <text class="blue">{{ item.CLABS }}</text>
<text class="line">/</text>
<text class="">{{item.LFIMG}}pcs</text>
<text class="">{{item.LFIMG}}pcs</text> -->
</view>
</view>
<view class="listBottom">
......
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