Commit 3c0a4a87 authored by 何远江's avatar 何远江

生产发料修改

parent bf258b9d
<template> <template>
<view class="page"> <view class="page">
<StickyNavBar> <StickyNavBar>
<NavBar title="生产发料"></NavBar> <NavBar title="生产发料"></NavBar>
<view class="headerTitle"> <view class="headerTitle">
<view class=""> <view class="">
<view class="items">领料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view> <view class="items"
<view class="items">{{goodsList[0]&&goodsList[0].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view> >领料申请:{{ goodsList[0] && goodsList[0].applyNo }}</view
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view> >
</view> <view class="items"
<view class="checkedCase"> >{{ goodsList[0] && goodsList[0].workstationCode }}/{{
<checkbox-group @change="checkedChange"> goodsList[0] && goodsList[0].workstationName
<checkbox value="r1" :checked="checkedBox" />是否结案 }}</view
</checkbox-group> >
</view> <view class="items"
</view> >计划日期:{{ goodsList[0] && goodsList[0].startTime }}</view
<view class="btn"> >
<uni-easyinput </view>
prefixIcon="search" <view class="checkedCase">
:disabled="isDisabled" <checkbox-group @change="checkedChange">
v-model="wxparams" <checkbox value="r1" :checked="checkedBox" />是否结案
:focus="isFocus" </checkbox-group>
placeholder="请扫描产品包装条码/外箱码" </view>
@input="handleInputPlnr" </view>
></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="请扫描产品包装条码/外箱码"
@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="line">/</text> -->
<text class="">{{ goodsList.length }}</text> <text class="">{{ goodsList.length }}</text>
</view> </view>
</view> </view>
</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='list'/> <scanningList :item="item" :list="item.details" />
</view> </view>
</ContentLoadingMore> </ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view> </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";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn, BottomBtn,
scanningList scanningList,
}, },
data() { data() {
return { return {
checkedBox: false, checkedBox: false,
r1:'', r1: "",
// totalNum: 0, // totalNum: 0,
number: 0, number: 0,
show: true, show: true,
nlpla: 'YD-02-02-3', nlpla: "YD-02-02-3",
wxparams: '', wxparams: "",
btnArr: [ btnArr: [
{ {
style: '', style: "",
type: 'warning', type: "warning",
text: '返回', text: "返回",
way: 'goBack' way: "goBack",
}, },
{ {
style: '', style: "",
type: 'primary', type: "primary",
text: '提交', text: "提交",
way: 'goSubmit' way: "goSubmit",
} },
], ],
goodsList: [], goodsList: [],
isFocus: true, isFocus: true,
isDisabled: false, isDisabled: false,
OrderNum: '', OrderNum: "",
list: [] list: [],
}; };
}, },
computed:{ computed: {
totalNum(){ totalNum() {
let num = 0 let num = 0;
let i=null,j=null let i = null,
const data = JSON.parse(JSON.stringify(this.list)) j = null;
const result = data.filter((item, index, self) => { const data = JSON.parse(JSON.stringify(this.list));
return self.findIndex(t => t.itemCode === item.itemCode) === index; const result = data.filter((item, index, self) => {
}); return self.findIndex((t) => t.itemCode === item.itemCode) === index;
for(i = 0; i < this.goodsList.length; i++){ });
if(this.goodsList[i].itemCode === result[i].itemCode && result[i].vista){ for (i = 0; i < this.goodsList.length; i++) {
num++ if (
} this.goodsList[i].itemCode === result[i].itemCode &&
} result[i].vista
return num || 0 ) {
}, num++;
}, }
onLoad(option) { }
if(option && option.order){ return num || 0;
this.OrderNum = option.order },
this.getOrder(option.order) },
} onLoad(option) {
}, if (option && option.order) {
watch: { this.OrderNum = option.order;
this.getOrder(option.order);
}, }
created() { },
}, watch: {},
methods: { created() {},
reset(){ methods: {
setTimeout(() => { reset() {
this.wxparams = ''; setTimeout(() => {
this.isFocus = true; this.wxparams = "";
this.isDisabled = false; this.isFocus = true;
}, 1000); this.isDisabled = false;
}, }, 1000);
getOrder(applyNo) { },
this.$u.api.mesApi getOrder(applyNo) {
.pdaMaterialcreate({ this.$u.api.mesApi
pageNum:1, .pdaMaterialcreate({
pageSize:10, pageNum: 1,
applyNo pageSize: 10,
}) applyNo,
.then((res) => { })
if (res && res.code - 200 === 0) { .then((res) => {
// list 第二层显示 也是最后提交的数据(改动最小) if (res && res.code - 200 === 0) {
// goodsList 第一层显示 // list 第二层显示 也是最后提交的数据(改动最小)
// 第二层显示的数据和第一层必须属于同一个物料 itemCode一样 // goodsList 第一层显示
this.list = res.rows // 第二层显示的数据和第一层必须属于同一个物料 itemCode一样
const data = res.rows // this.list = res.rows
const result = data.filter((item, index, self) => { this.goodsList = res.rows.reduce((pre, cur) => {
return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index; if (pre.length === 0) {
}); pre.push({
this.goodsList = [...result] ...cur,
} else { details: [{ ...cur, vista: 0 }],
this.$u.toast(res.msg); });
} } else {
this.loading = false; const item = pre.find((v) => v.sapItemCode == cur.sapItemCode);
}); if (item) {
}, item.details.push({ ...cur, vista: 0 });
checkedChange(){ } else {
this.checkedBox = !this.checkedBox pre.push({
}, ...cur,
getBtnHandle(row) { details: [{ ...cur, vista: 0 }],
this[row.way](); });
}, }
goBack() { }
console.log('进来') return pre;
uni.navigateBack({ }, []);
delta: 0
});
},
goSubmit() {
if (this.list.length === 0) {
return;
}
let arr = this.list.filter(ele=>ele.vista)
// "windCase": null,是否结案 Y是 N否 console.log("----goodsList----", this.goodsList);
arr.forEach((ele,index) => { // const data = res.rows
ele.windCase = this.checkedBox ? 'Y': 'N' // const result = data.filter((item, index, self) => {
ele.AUFNR = ele.workorderCode // return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index;
ele.ERFMG = ele.vista // });
ele.MTSNR = ele.applyNo // this.goodsList = [...result]
ele.ZEILE = index+1 } else {
ele.RSNUM = ele.requirementNumber this.$u.toast(res.msg);
ele.RSPOS = ele.requirementProjectNumber }
}) this.loading = false;
const params = { });
'zencode': 'A008', },
'item': arr checkedChange() {
} this.checkedBox = !this.checkedBox;
this.$u.api.sapApi },
.sapProiss(params) getBtnHandle(row) {
.then((res) => { this[row.way]();
this.loading = false; },
if(!Array.isArray(res)){ goBack() {
return console.log("进来");
} uni.navigateBack({
if (res.every((item) => item.TYPE === 'S')) { delta: 0,
// this.$u.toast('提交成功'); });
this.handleMes(arr,res[0].MESSAGE_V1) },
} goSubmit() {
const foundObject = res.find(item => item.TYPE === 'E'); if (this.list.length === 0) {
if(foundObject && foundObject.MESSAGE){ return;
this.$u.toast(foundObject.MESSAGE); }
} let arr = this.list.filter((ele) => ele.vista);
});
}, // "windCase": null,是否结案 Y是 N否
handleMes(arr,num){ arr.forEach((ele, index) => {
arr.forEach(ele => { ele.windCase = this.checkedBox ? "Y" : "N";
ele.batchCode = ele.CHARG ele.AUFNR = ele.workorderCode;
ele.quantityIssued = ele.vista ele.ERFMG = ele.vista;
ele.issueCode = num ele.MTSNR = ele.applyNo;
ele.issueType = ele.materialType ele.ZEILE = index + 1;
}); ele.RSNUM = ele.requirementNumber;
this.$u.api.mesApi ele.RSPOS = ele.requirementProjectNumber;
.pdaSapissuecreate(arr) });
.then((res) => { const params = {
this.loading = false; zencode: "A008",
console.log(res); item: arr,
if(res && res.code == 200){ };
this.$u.toast('提交成功'); this.$u.api.sapApi.sapProiss(params).then((res) => {
setTimeout(() => { this.loading = false;
this.goBack() if (!Array.isArray(res)) {
}, 1000); return;
}else{ }
this.$u.toast(res.msg); if (res.every((item) => item.TYPE === "S")) {
} // this.$u.toast('提交成功');
}); this.handleMes(arr, res[0].MESSAGE_V1);
}, }
handleInputPlnr(e) { const foundObject = res.find((item) => item.TYPE === "E");
e && this.getPlnr(e); if (foundObject && foundObject.MESSAGE) {
}, this.$u.toast(foundObject.MESSAGE);
getPlnr(plnr) { }
this.isDisabled = true; });
this.isFocus = false },
this.$u.api.sapApi handleMes(arr, num) {
.sapBlpl({ arr.forEach((ele) => {
plnr, ele.batchCode = ele.CHARG;
ztype: '002' ele.quantityIssued = ele.vista;
}) ele.issueCode = num;
.then((res) => { ele.issueType = ele.materialType;
if (res && res.MSG[0].TYPE === 'S') { });
if (this.list.some((item) => item.PLNR === plnr)) { this.$u.api.mesApi.pdaSapissuecreate(arr).then((res) => {
this.reset() this.loading = false;
this.$u.toast('已经存在当前条码'); console.log(res);
return if (res && res.code == 200) {
} this.$u.toast("提交成功");
this.factorial({...res.BLPL[0]},plnr,0) setTimeout(() => {
this.reset() this.goBack();
} else { }, 1000);
this.reset() } else {
this.$u.toast(res.MSG[0].MESSAGE); this.$u.toast(res.msg);
} }
this.loading = false; });
}); },
}, handleInputPlnr(e) {
handleAddList(idx,vista,res){ e && this.getPlnr(e);
const newCard = { },
...this.list[idx], getPlnr(plnr) {
vista, this.isDisabled = true;
// vista : ((this.list[idx].applyNum - 0)-(this.list[idx].vista-0)).toFixed(3), this.isFocus = false;
add: '1', this.$u.api.sapApi
... res .sapBlpl({
} plnr,
this.list.splice(idx+1, 0, newCard); ztype: "002",
}, })
factorial(res,plnr,idx,num=0) { .then((res) => {
// 找出符合条件的数组长度 if (res && res.MSG[0].TYPE === "S") {
const count = this.list.filter(item => item.sapItemCode == res.MATNR).length if (
if(!count){ this.goodsList.some((item) =>
this.$u.toast('没有匹配到对应物料'); item.details.some((v) => v.PLNR == plnr)
return )
} ) {
// PACMG包装数量 applyNum申请数量 vista这一个工单分配了多少数量 this.reset();
// 总的来说逻辑是 this.$u.toast("已经存在当前条码");
// 1) return;
// 录入一个pl接口返回的数据 里面有包装数量 size 仓位 }
// 如果第一个applyNum申请数量满足不到 就把当前pl数据和第一个数据整合 // this.factorial({...res.BLPL[0]},plnr,0)
// 再扫第二个 检查第一个是否满足,不满足 就先满足第一个,剩余的满足第二个
// 2) this.handleDetails(res.BLPL, plnr);
// 如果满足第一个工单applyNum申请数量 就要往下满足 直到分配完。
for (let m = 0; m < this.list.length; m++) { this.reset();
if(this.list[m].sapItemCode == res.MATNR){ } else {
// 递归的方法 满足下一个 this.reset();
if(idx){ this.$u.toast(res.MSG[0].MESSAGE);
if(this.list[idx]){ }
if(num > this.list[idx].applyNum){ this.loading = false;
this.$set(this.list,idx,{...this.list[idx],vista : this.list[idx].applyNum,... res}) });
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum) },
}else{ handleDetails(data, plnr) {
this.$set(this.list,idx,{...this.list[idx],vista : num,... res}) data.forEach((ele) => {
this.factorial(res,plnr,idx+1,0) let num = ele.PACMG;
} // 相同的物料
} const item = this.goodsList.find((v) => v.sapItemCode == ele.MATNR);
return
} if (item) {
// 没有填入数据的 // 用于缓存新添加的 details
if(!this.list[m].vista){ const map = new Map();
// 上一位的数据是否满足
if(this.list[m-1] && this.list[m-1].vista < this.list[m-1].applyNum){ item.details.some((v, i) => {
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)){ if (num <= 0) return true;
this.factorial(res,plnr, m+1, res.PACMG - (this.list[m-1].applyNum - this.list[m-1].vista))
} // 没有分配数量时
return if (v.vista == 0) {
} // 如果是最最后一项 直接分配所有的数量
// 只有一个 if (i == item.details.length - 1) {
// if(count === 1){ v.vista = num;
// this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res}) } else {
// }else{ v.vista = num > v.applyNum ? v.applyNum : num;
// 包装数量大于申请数量 }
if( res.PACMG > this.list[m].applyNum){ num = +(num - v.vista).toFixed(3);
// 最后一个工单处理 v.PLNR = plnr;
if(count === m){ v.LGORT = ele.LGORT;
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res}) v.LGOBE = ele.LGOBE;
return v.NLPLA = ele.NLPLA;
} // 添加两个字段,使用数量和剩余数量
this.list[m].vista = this.list[m].applyNum v.usedNum = v.vista;
this.$set(this.list,m,{...this.list[m],vista : this.list[m].applyNum,... res}) v.remainNum = +(v.applyNum - v.usedNum).toFixed(3);
this.factorial(res,plnr,m+1,res.PACMG-this.list[m].applyNum) } else if (v.remainNum > 0) {
return; // 已经分配,但是未分配满的情况 需要创建一条新的申请
}else{ let vista = 0;
// 包装数量小于等于申请数量
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res}) // 如果是最后一项,直接分配所有的数量
return if (i == item.details.length - 1) {
} vista = num;
// } } else {
}else{ // 如果下项的工单号于目前工单号一样跳过
// 当前填入的数量小于申请数量 就把当前所有工单找出来 一个个的去检查是否满足 if (v.workorderCode == item.details[i + 1].workorderCode) {
if(this.list[m].vista < this.list[m].applyNum){ return false;
let arr = [] }
this.list.forEach(ele => { vista = num > v.remainNum ? v.remainNum : +num;
if(ele.workorderCode === this.list[m].workorderCode){ }
arr.push(ele) const reAddItem = {
} ...v,
}); PLNR: plnr,
// 工单申请数量 LGORT: ele.LGORT,
let totalApplyNum = (arr[0].applyNum-0) LGOBE: ele.LGOBE,
// 当前工单已经录入了总数量 vista是每一个录入数量 NLPLA: ele.NLPLA,
let totalVista =0 usedNum: +(v.usedNum + vista).toFixed(3),
arr.forEach(ele => { remainNum: +(v.remainNum - vista).toFixed(3),
totalVista = totalVista + (ele.vista?(ele.vista-0):0) vista,
}); };
// 最终填入的数量 map.set(i + 1, reAddItem);
let endVista = 0 num = +(num - vista).toFixed(3);
endVista = ((this.list[m].applyNum - 0)-(this.list[m].vista-0)).toFixed(3) }
// 处理最后一行 });
if(m === this.list.length - 1){ // 新增的申请插入到明细中
endVista = res.PACMG - 0 for (const [key, value] of map.entries()) {
} item.details.splice(key, 0, value);
// 工单录入数量总和小于总的申请数量 那就要新增一行 }
if(totalVista < totalApplyNum){ } else {
this.handleAddList(m,endVista,res) this.$u.toast("没有物料");
// 当前包装数量 大于(总的申请数量 减 工单录入数量总)就要往下一个分配 }
if((res.PACMG-0)-endVista >0){ });
this.factorial(res,plnr,m+2,(res.PACMG-0)-endVista) console.log("----goodsList--------", this.goodsList);
} },
return handleAddList(idx, vista, res) {
} const newCard = {
}else{ ...this.list[idx],
this.$u.toast('暂无剩余物料'); vista,
} // vista : ((this.list[idx].applyNum - 0)-(this.list[idx].vista-0)).toFixed(3),
} add: "1",
} ...res,
} };
} this.list.splice(idx + 1, 0, newCard);
} },
factorial(res, plnr, idx, num = 0) {
// 找出符合条件的数组长度
const count = this.list.filter(
(item) => item.sapItemCode == res.MATNR
).length;
if (!count) {
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) {
this.$set(this.list, idx, {
...this.list[idx],
vista: this.list[idx].applyNum,
...res,
});
this.factorial(
res,
plnr,
idx + 1,
num - this.list[idx].applyNum
);
} else {
this.$set(this.list, idx, {
...this.list[idx],
vista: num,
...res,
});
this.factorial(res, plnr, idx + 1, 0);
}
}
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)
);
}
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) => {
if (ele.workorderCode === this.list[m].workorderCode) {
arr.push(ele);
}
});
// 工单申请数量
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);
}
return;
}
} else {
this.$u.toast("暂无剩余物料");
}
}
}
}
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
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;
} }
} }
.bottomBtn { .bottomBtn {
position: sticky; position: sticky;
padding: 20rpx; padding: 20rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background: #fff; background: #fff;
bottom: 0rpx; bottom: 0rpx;
margin-top: 20rpx; margin-top: 20rpx;
.u-btn { .u-btn {
width: 300rpx; width: 300rpx;
} }
} }
.blue { .blue {
color: #3f9dcc; color: #3f9dcc;
} }
.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 - 480rpx); min-height: calc(100vh - 480rpx);
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;
} }
.listItemTitle { .listItemTitle {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx; padding: 20rpx;
border-bottom: 2px solid #f8f8f8; border-bottom: 2px solid #f8f8f8;
.u-btn { .u-btn {
width: 150rpx; width: 150rpx;
margin: 0px; margin: 0px;
margin-top: 10rpx; margin-top: 10rpx;
} }
.item { .item {
line-height: 50rpx; line-height: 50rpx;
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
word-break: break-all; word-break: break-all;
font-weight: 600; font-weight: 600;
} }
} }
.listBottom { .listBottom {
.bottomTitle { .bottomTitle {
height: 80rpx; height: 80rpx;
position: relative; position: relative;
.desc { .desc {
color: #bbb; color: #bbb;
font-size: 24rpx; font-size: 24rpx;
line-height: 80rpx; line-height: 80rpx;
padding-left: 20rpx; padding-left: 20rpx;
} }
.topIcons { .topIcons {
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
color: #aaa; color: #aaa;
} }
} }
.bottomBox { .bottomBox {
padding: 20rpx; padding: 20rpx;
.bottomItem { .bottomItem {
background: #f8f8f8; background: #f8f8f8;
padding: 20rpx; padding: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.items { .items {
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
} }
} }
} }
} }
/deep/ .u-sticky { /deep/ .u-sticky {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.checkedCase{ .checkedCase {
margin-top: 10rpx; margin-top: 10rpx;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<view> <view>
<view class="listItemTitle"> <view class="listItemTitle">
<view> <view>
<view class="item">物料编号:{{ item.sapItemCode }}</view> <view class="item">物料编号:{{ item.sapItemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view> <view class="item">物料描述:{{ item.itemName }}</view>
</view> </view>
<view class="right"> <view class="right">
<text class="blue">{{totalVistaNum}}</text> <text class="blue">{{ totalVistaNum }}</text>
<text class="line">/</text> <text class="line">/</text>
<text class="">{{totalNum}}</text> <text class="">{{ totalNum }}</text>
</view> </view>
</view> </view>
<view class="listBottom"> <view class="listBottom">
<view class="bottomTitle" @click="show = !show"> <view class="bottomTitle" @click="show = !show">
<view class="desc">卷条码明细</view> <view class="desc">卷条码明细</view>
<view class="topIcons"> <view class="topIcons">
<view v-if="show"> <view v-if="show">
<u-icon name="arrow-down" color="#aaa" size="32"></u-icon> <u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
展开 展开
</view> </view>
<view v-else> <view v-else>
<u-icon name="arrow-up" color="#aaa" size="32"></u-icon> <u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
收起 收起
</view> </view>
</view> </view>
</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.workorderCode+idx" v-if="ele.itemCode === item.itemCode"> <view
<view class="proItem"> class="bottomItem"
<view class="items">生产单号:{{ ele.workorderCode }}</view> v-for="(ele, idx) in details"
<view class="progress"> :key="ele.workorderCode"
<progress :percent="handleVista(ele)" show-info /> >
<!-- <u-line-progress active-color="#2979ff" :percent="handleVista(ele)"></u-line-progress> --> <view class="proItem">
</view> <view class="items">生产单号:{{ ele.workorderCode }}</view>
</view> <view class="progress">
<view class="items">PL:{{ ele.PLNR }}</view> <progress :percent="handleVista(ele)" show-info />
<view class="items">库位:{{ ele.NLPLA }}</view> <!-- <u-line-progress active-color="#2979ff" :percent="handleVista(ele)"></u-line-progress> -->
<!-- <view class="items">{{ item.MATNR }}</view> --> </view>
<view class="items inputItem"> </view>
数量: <view class="items inputItem">
<!-- <uni-easyinput v-model="item.vista"></uni-easyinput> --> 数量:
{{ele.vista}} <!-- <uni-easyinput v-model="item.vista"></uni-easyinput> -->
/ {{ handleUseVista(ele) }}
{{ ele.applyNum }} /
</view> {{ ele.applyNum }}
</view> </view>
</view> <template v-for="item in ele.details">
</view> <view class="items">PL:{{ item.PLNR }}</view>
<!-- <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> --> <view class="items">库位:{{ item.LGORT }} - {{ item.LGOBE }}</view>
</view> <view class="items">仓位:{{ item.NLPLA }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> -->
</template>
</view>
</view>
</view>
<!-- <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";
export default { export default {
components: { components: {
StickyNavBar, StickyNavBar,
ContentLoadingMore, ContentLoadingMore,
BottomBtn BottomBtn,
},
props: {
item: {
type: Object,
default: function () {
return {};
},
},
list: {
type: Array,
default: function () {
return [];
},
},
},
computed: {
details() {
return this.list.reduce((acc, cur) => {
const item = acc.find((v) => v.workorderCode === cur.workorderCode);
if (item) {
item.details.push({ ...cur });
} else {
acc.push({ ...cur, details: [{ ...cur }] });
}
return acc;
}, []);
},
totalNum() {
const workCodes = [];
return this.list.reduce((acc, cur) => {
if (workCodes.includes(cur.workorderCode)) {
return acc;
} else {
workCodes.push(cur.workorderCode);
return acc + cur.applyNum;
}
}, 0);
},
totalVistaNum() {
// let num = 0
// this.list.forEach(ele => {
// if(ele.itemCode === this.item.itemCode){
// num += (ele.vista-0)
// }
// });
// return num || ''
return this.list.reduce((acc, cur) => {
return acc + cur.vista;
}, 0);
},
},
watch: {
details: {
handler: function (val, oldVal) {
console.log(val, "00-------");
},
immediate: true,
deep: true,
},
},
data() {
return {
number: 0,
nlpla: "",
wxparams: "",
btnArr: [
{
style: "",
type: "warning",
text: "返回",
way: "goBack",
},
{
style: "",
type: "primary",
text: "提交",
way: "goSubmit",
},
],
isFocus: false,
show: true,
num1: 0,
};
},
created() {},
methods: {
handleUseVista(items) {
return items.details.reduce((acc, cur) => cur.vista + acc, 0)
}, },
props: { handleVista(items) {
item: { let num = 0;
type: Object, this.list.forEach((ele) => {
default: function () { if (ele.workorderCode === items.workorderCode) {
return {}; console.log(`output->`, ele.vista, items.workorderCode);
} num += (ele.vista ? ele.vista : 0) - 0;
}, }
list: { });
type: Array, console.log(`output->num`, num);
default: function () { return (num / items.applyNum).toFixed(2) * 100 - 0 > 100
return []; ? 100
} : (num / items.applyNum).toFixed(2) * 100 || 0;
} },
}, },
computed:{
totalNum(){
let num = 0
this.list.forEach(ele => {
if(ele.itemCode === this.item.itemCode && !ele.add){
num += ele.applyNum
}
});
return num
},
totalVistaNum(){
let num = 0
this.list.forEach(ele => {
if(ele.itemCode === this.item.itemCode){
num += (ele.vista-0)
}
});
return num || ''
},
},
// watch: {
// goodsList: {
// handler: function(val, oldVal) {
// this.goodsList = val
// },
// immediate: true
// }
// },
data() {
return {
number: 0,
nlpla: '',
wxparams: '',
btnArr: [
{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
},
{
style: '',
type: 'primary',
text: '提交',
way: 'goSubmit'
}
],
isFocus: false,
show: true,
num1: 0
};
},
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
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;
} }
} }
.bottomBtn { .bottomBtn {
position: sticky; position: sticky;
padding: 20rpx; padding: 20rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background: #fff; background: #fff;
bottom: 0rpx; bottom: 0rpx;
margin-top: 20rpx; margin-top: 20rpx;
.u-btn { .u-btn {
width: 300rpx; width: 300rpx;
} }
} }
.blue { .blue {
color: #3f9dcc; color: #3f9dcc;
} }
.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;
} }
} }
.listItemTitle { .listItemTitle {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx; padding: 20rpx;
border-bottom: 2px solid #f8f8f8; border-bottom: 2px solid #f8f8f8;
.u-btn { .u-btn {
width: 150rpx; width: 150rpx;
margin: 0px; margin: 0px;
margin-top: 10rpx; margin-top: 10rpx;
} }
.item { .item {
line-height: 50rpx; line-height: 50rpx;
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
word-break: break-all; word-break: break-all;
font-weight: 600; font-weight: 600;
} }
} }
.listBottom { .listBottom {
.bottomTitle { .bottomTitle {
height: 80rpx; height: 80rpx;
position: relative; position: relative;
.desc { .desc {
color: #bbb; color: #bbb;
font-size: 24rpx; font-size: 24rpx;
line-height: 80rpx; line-height: 80rpx;
padding-left: 20rpx; padding-left: 20rpx;
} }
.topIcons { .topIcons {
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
color: #aaa; color: #aaa;
} }
} }
.bottomBox { .bottomBox {
padding: 20rpx; padding: 20rpx;
.bottomItem { .bottomItem {
background: #f8f8f8; background: #f8f8f8;
padding: 20rpx; padding: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.items { .items {
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
line-height: 40rpx; line-height: 40rpx;
word-break: break-all; word-break: break-all;
/deep/ .uni-easyinput{ /deep/ .uni-easyinput {
width: 200rpx; width: 200rpx;
} }
} }
.inputItem{ .inputItem {
display: inline-flex; display: inline-flex;
// line-height: 76rpx; // line-height: 76rpx;
} }
} }
} }
} }
/deep/ .u-sticky { /deep/ .u-sticky {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.progress{ .progress {
width: 45%; width: 45%;
margin-left: 20rpx; margin-left: 20rpx;
/deep/ .uni-progress-info{ /deep/ .uni-progress-info {
font-size: 24rpx; font-size: 24rpx;
} }
} }
/deep/ .uni-progress{ /deep/ .uni-progress {
line-height: 40rpx; line-height: 40rpx;
} }
.proItem{ .proItem {
display: flex; display: flex;
} }
</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