Commit 572b25a1 authored by xiangzj's avatar xiangzj

生产发料

parent e529eab7
......@@ -36,6 +36,22 @@ const install = (Vue, vm) => {
sapPlnr: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/get_mm_plnr/plnr?sap-client=300', params,),
// 仓位转移
sapDict: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/ep_dict?sap-client=300', params),
// 生产领料
sapProiss: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/pda_plto_proiss?sap-client=300', params),
// 完工入库
sapOrder: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/PDA_MES_Order/PDA_ORDER?sap-client=300', params),
// 线边库转移下架
sapXbkzy: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/pda_plto_xbkzy?sap-client=300', params),
// 销售拣货单号查询
sapSchDn: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/search/sch_dn?sap-client=300', params),
// 销售拣货单
sapPickingDn: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/picking_dn?sap-client=300', params),
// 销售拣货过账
sapDelv: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/post_delv?sap-client=300', params),
// 销售拣货查询bl pl
sapBlpl: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/search/sch_BLPL?sap-client=300', params),
// 查询仓位
sapLgpla: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/search/sch_LGPLA?sap-client=300', params),
},
mesApi:{
//生产领料
......
<template>
<view>
<StickyNavBar>
<NavBar title="销售拣货单号"></NavBar>
<NavBar title="生产发料单号"></NavBar>
</StickyNavBar>
<ContentLoadingMore class="cardbox" :loadmore='true'>
<ContentLoadingMore class="cardbox" :loadmore='true' :status="status">
<view class="cardContent" v-for="(item, index) in goodsList">
<view class="listItemTitle" @click="handleClick(item)">
<view>
<view class="item">申请单号:{{ item.applyNo }}</view>
<view class="item">物料编号:{{ item.itemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view>
<view class="item">工作中心:{{ item.workstationName }}</view>
<view class="item">备料状态:{{ item.grantNum? '配货中' : '未配货' }}</view>
<view class="item">计划时间:{{ item.startTime }}</view>
</view>
</view>
<view class="listBottom">
<!-- <view class="listBottom">
<view class="bottomTitle" @tap="show = !show">
<view class="desc">卷条码明细</view>
<view class="topIcons">
......@@ -33,7 +38,7 @@
<view class="items">生产日期:{{ item.BLDAT }}</view>
</view>
</view>
</view>
</view> -->
</view>
</ContentLoadingMore>
<!-- <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> -->
......@@ -72,6 +77,12 @@ export default {
}
],
goodsList: [],
pagination: {
pageNum:1,
pageSize:10,
},
total: 0,
status: 'loadmore'
};
},
created() {
......@@ -81,10 +92,18 @@ export default {
// 加载更多
onReachBottom() {
console.log('加载更多');
if(this.pagination.pageNum * this.pagination.pageSize >= this.total){
this.status = "noMore"
return;
}else{
this.status = "loading"
this.pagination.pageNum++
this.getPlnr();
}
},
handleClick(item){
uni.navigateTo({
url: `/pages/productionIssuance/productionIssuanceList?order=${JSON.stringify(item)}`
url: `/pages/productionIssuance/productionIssuanceList?order=${JSON.stringify([item])}`
});
},
getBtnHandle(row) {
......@@ -136,18 +155,18 @@ export default {
// e&& e.length > 79 && this.getPlnr(e);
e && this.getPlnr(e);
},
getPlnr(applyNo) {
getPlnr(applyNo = '') {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.mesApi
.pdaMaterialcreate({
pageNum:1,
pageSize:10,
...this.pagination,
applyNo
})
.then((res) => {
if (res.code - 200 === 0) {
this.goodsList = this.goodsList.concat(res.data);
this.goodsList = this.goodsList.concat(res.rows);
this.total = res.total
} else {
this.$u.toast(res.msg);
}
......
......@@ -69,13 +69,13 @@ export default {
way: 'goClick'
}
],
goodsList: [{}],
goodsList: [],
isFocus: false,
isDisabled: false
};
},
created() {
this.getPlnr('SN202400058');
this.getPlnr('SN202400172');
},
methods: {
getBtnHandle(row) {
......@@ -107,15 +107,47 @@ export default {
.then((res) => {
console.log(res,'-=')
if (res.code - 200 === 0) {
this.goodsList = this.goodsList.concat(res.data);
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
uni.navigateTo({
url: `/pages/productionIssuance/productionIssuanceList?order=${JSON.stringify(this.goodsList)}`
});
uni.navigateTo({
url: `/pages/productionIssuance/productionIssuanceList?order=${applyNo}`
});
// const data = res.rows
// data.forEach((ele,index) => {
// ele.sonItemCode = []
// ele.sonItemCode.push(...data)
// })
// const result = data.filter((item, index, self) => {
// return self.findIndex(t => t.itemCode === item.itemCode) === 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--
// }
// }
// }
// console.log(result)
// setTimeout(() => {
// this.wxparams = '';
// this.isFocus = true;
// this.isDisabled = false;
// }, 1000);
// uni.navigateTo({
// url: `/pages/productionIssuance/productionIssuanceList?order=${JSON.stringify(result)}`
// });
// console.log(result)
// this.goodsList = this.goodsList.concat(res.rows);
// setTimeout(() => {
// this.wxparams = '';
// this.isFocus = true;
// this.isDisabled = false;
// }, 1000);
// console.log(this.goodsList)
// uni.navigateTo({
// url: `/pages/productionIssuance/productionIssuanceList?order=${JSON.stringify(this.goodsList)}`
// });
} else {
setTimeout(() => {
this.isFocus = true;
......
<template>
<view>
<StickyNavBar>
<NavBar title="生产发料"></NavBar>
<view class="headerTitle">
<view class="">
<view class="items">领料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view>
<view class="items">WC01:{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view>
<view class="">
<checkbox-group @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否结案
</checkbox-group>
</view>
</view>
<view class="btn">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="nlpla" focus placeholder="请扫描库位" @change="handleInputNlpla"></uni-easyinput>
<uni-easyinput
prefixIcon="search"
:disabled="isDisabled"
v-model="wxparams"
:focus="isFocus"
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="">{{ goodsList.length }}</text>
</view>
</view>
</StickyNavBar>
<view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.erfmg">
<scanningList :item='item'/>
</view>
</view>
<!-- <view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList">
<view class="listItemTitle">
<view>
<view class="item">物料编号:{{ item.itemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view>
</view>
<view class="right">
<text class="blue">XX</text>
<text class="line">/</text>
<text class="">{{item.applyNum}}</text>
</view>
</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.applyNo }}</view>
<view class="items">物料批次:{{ item.MATNR }}</view>
<view class="items">{{ item.MATNR }}</view>
<view class="items">数量:{{ item.ERFMG }}</view>
</view>
</view>
</view>
</view>
</view> -->
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
import scanningList from "./scanningList.vue"
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn,
scanningList
},
data() {
return {
checkedBox: false,
r1:'',
totalNum: 0,
number: 0,
show: true,
nlpla: 'YD-02-02-3',
wxparams: '',
btnArr: [
{
style: '',
type: 'warning',
text: '返回',
way: 'goBack'
},
{
style: '',
type: 'primary',
text: '提交',
way: 'goSubmit'
}
],
goodsList: [],
isFocus: false,
isDisabled: false,
OrderNum: '',
};
},
computed:{
},
onLoad(option) {
if(option && option.order){
this.OrderNum = option.order
this.getOrder(option.order)
}
},
created() {
this.handleInputNlpla()
this.getPlnr('100021240419000001|00010001020000050.000|10002441900001');
},
methods: {
getOrder(applyNo) {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.mesApi
.pdaMaterialcreate({
pageNum:1,
pageSize:10,
applyNo
})
.then((res) => {
if (res.code - 200 === 0) {
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.itemCode === item.itemCode) === 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]
console.log(this.goodsList,result)
} else {
this.$u.toast(res.msg);
}
this.loading = false;
});
},
checkedChange(){
this.checkedBox = !this.checkedBox
},
getBtnHandle(row) {
this[row.way]();
},
goBack() {
console.log('进来')
uni.navigateBack({
delta: 0
});
},
goSubmit() {
if (this.goodsList.length === 0) {
return;
}
// this.goodsList.forEach((item,idnex)=>{
// arr.push({
// ...item,
// "aufnr": item.workorderCode,
//         "mtsnr": item.applyNo,
// 'zeile': index,
// 'werks': '1000', // 第42~45位:4位数,工厂代码
// 'lgort': this.nlpla,
// 'matnr': item.itemCode,
// // 'erfmg': '1', //当然是PDA扫描实体PL标签所获取的数量 第30~40位:总共11位数,每个版号的数量
// // 'erfme': '1', //为防止采用“可辨单位”管理的情况,选择这个字段来记录单位是万无一失的。
// // 'charg': '1', //批次号 PDA扫码获取 第46位~55位:10位数。 批次号
// // 'plnr': '1', //券号 版号 PDA扫码获取 第13~18位
// // 'vista': '1', // 来自PDA。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
// "windCase": null,是否结案 Y是 N否
this.goodsList.forEach((ele) => {
ele.windCase = this.checkedBox ? 'Y': 'N'
})
const arr = this.goodsList.filter(ele=>ele.vista)
const params = {
'zencode': 'A008',
'item': arr
}
this.$u.api.sapApi
.sapProiss(params)
.then((res) => {
this.loading = false;
console.log(res);
if (res.every((item) => item.TYPE === 'S')) {
this.goodsList = [];
this.nlpla = '';
this.wxparams = '';
this.$u.toast('提交成功');
}
res.forEach((ele) => {
if (ele.TYPE === 'E') {
this.$u.toast(ele.MESSAGE);
}
});
});
},
handleInputPlnr(e) {
e && this.getPlnr(e);
},
getPlnr(plnr) {
this.totalNum = 0;
this.$u.api.sapApi
.sapBlpl({
plnr
})
.then((res) => {
if (res.MSG[0].TYPE === 'S') {
this.goodsList.forEach((ele,index) => {
if (ele.itemCode.slice(9, 18) === plnr.slice(20, 29)) {
// 已发
if(ele.grantNum){
}else{
if(!ele.PACMG){
}
}
ele.aufnr = ele.workorderCode,
ele.mtsnr = ele.applyNo,
ele.zeile = index,
ele.werks = plnr.slice(41, 45),
ele.erfmg = plnr.slice(29, 40)
ele.charg = plnr.slice(45, 55)
ele.plnr = plnr.slice(12, 18)
ele.vista = Math.floor(plnr.slice(29, 40))
// ele.LGNUM = res.BLPL[0].LGNUM || 'W00'
ele.NLBER = res.BLPL[0].NLBER || '001'
ele.MATNR = res.BLPL[0].MATNR
ele.WERKS = res.BLPL[0].WERKS
ele.lgort = res.BLPL[0].LGORT
ele.PACMG = res.BLPL[0].PACMG
}
});
this.totalNum = this.goodsList.filter(ele=>ele.vista).length
} else {
this.$u.toast(res.MSG[0].MESSAGE);
}
this.loading = false;
});
},
handleInputNlpla(e) {
this.$u.api.sapApi
.sapLgpla({
LGPLA:"YD-02-02-3"
})
.then((res) => {
if (res) {
this.goodsList.forEach((ele,index) => {
// ele.NLPLA = this.nlpla
ele.LGBER = res.BKDT.LGBER
ele.LGNUM = res.BKDT.LGNUM
ele.LGPLA = res.BKDT.LGPLA
ele.NLTYP = res.BKDT.NLTYP
})
} else {
}
});
},
}
};
</script>
<style lang="scss" scoped>
page {
background: #f8f8f8;
}
.headerTitle{
padding: 20rpx;
font-weight: 600;
.items{
line-height: 40rpx;
}
}
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.bottomBtn {
position: sticky;
padding: 20rpx;
display: flex;
justify-content: space-between;
background: #fff;
bottom: 0rpx;
margin-top: 20rpx;
.u-btn {
width: 300rpx;
}
}
.blue {
color: #3f9dcc;
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.cardbox {
min-height: calc(100vh - 480rpx);
padding: 0rpx 20rpx;
margin-top: 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.listItemTitle {
display: flex;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2px solid #f8f8f8;
.u-btn {
width: 150rpx;
margin: 0px;
margin-top: 10rpx;
}
.item {
line-height: 50rpx;
color: #333;
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
font-weight: 600;
}
}
.listBottom {
.bottomTitle {
height: 80rpx;
position: relative;
.desc {
color: #bbb;
font-size: 24rpx;
line-height: 80rpx;
padding-left: 20rpx;
}
.topIcons {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #aaa;
}
}
.bottomBox {
padding: 20rpx;
.bottomItem {
background: #f8f8f8;
padding: 20rpx;
margin-bottom: 20rpx;
.items {
color: #333;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
}
}
}
/deep/ .u-sticky {
top: 0 !important;
}
</style>
\ No newline at end of file
......@@ -3,9 +3,16 @@
<StickyNavBar>
<NavBar title="生产发料"></NavBar>
<view class="headerTitle">
<view class="items">领料申请:{{goodsList[0].workorderCode}}</view>
<view class="items">WC01:数码印刷车间</view>
<view class="items">计划日期:{{goodsList[0].startTime}}</view>
<view class="">
<view class="items">领料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view>
<view class="items">WC01:{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view>
<view class="">
<checkbox-group @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否结案
</checkbox-group>
</view>
</view>
<view class="btn">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="nlpla" focus placeholder="请扫描库位" @change="handleInputNlpla"></uni-easyinput>
......@@ -22,48 +29,15 @@
<view class="left">物料明细</view>
<view class="right">
物料数量:
<text class="blue">{{ goodsList.length }}</text>
<text class="blue">{{ totalNum }}</text>
<text class="line">/</text>
<text class="">{{ totalNum }}</text>
<text class="">{{ goodsList.length }}</text>
</view>
</view>
</StickyNavBar>
<view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList">
<view class="listItemTitle">
<view>
<view class="item">物料编号:{{ item.itemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view>
</view>
<view class="right">
<text class="blue">XX</text>
<text class="line">/</text>
<text class="">{{item.applyNum}}</text>
</view>
</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.CHARG }}</view>
<view class="items">物料批次:{{ item.MATNR }}</view>
<view class="items">{{ item.MATNR }}</view>
<view class="items">数量:{{ item.ERFMG }}</view>
</view>
</view>
</view>
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.workorderCode">
<scanningList :item='item' :list='list'/>
</view>
</view>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
......@@ -74,18 +48,22 @@
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
import scanningList from "./scanningList.vue"
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn
BottomBtn,
scanningList
},
data() {
return {
checkedBox: false,
r1:'',
// totalNum: 0,
number: 0,
totalNum: 0,
show: true,
nlpla: '',
nlpla: 'YD-02-02-3',
wxparams: '',
btnArr: [
{
......@@ -104,19 +82,82 @@ export default {
goodsList: [],
isFocus: false,
isDisabled: false,
OrderNum: '',
list: []
};
},
computed:{
totalNum(){
let num = 0
// let i=null,j=null
// for(i = 0; i < this.goodsList.length; i++){
// for(j = 0; j < this.list.length; j++){
// if(this.goodsList[i].itemCode === this.list[j].itemCode){
// console.log(`output->`,this.list[j].vista)
// num = (num - 0) + (this.list[j].vista - 0)
// }
// }
// }
// console.log(`output->num`,num)
return num || ''
},
},
onLoad(option) {
if(option && option.order){
this.goodsList = [
...JSON.parse(option.order)
]
this.OrderNum = option.order
this.getOrder(option.order)
}
},
created() {
// this.getPlnr('10000820240325000001|10000320100');
// this.handleInputNlpla()
// this.getPlnr('100021240419000001|00010001020000050.000|10002441900001');
// this.getPlnr('100021240419000001|00010001020000060.000|10002441900002');
},
methods: {
getOrder(applyNo) {
this.$u.api.mesApi
.pdaMaterialcreate({
pageNum:1,
pageSize:10,
applyNo
})
.then((res) => {
if (res.code - 200 === 0) {
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.itemCode === item.itemCode) === 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);
}
this.loading = false;
});
},
checkedChange(){
this.checkedBox = !this.checkedBox
},
getBtnHandle(row) {
this[row.way]();
},
......@@ -127,33 +168,41 @@ export default {
});
},
goSubmit() {
if (this.goodsList.length === 0) {
if (this.list.length === 0) {
return;
}
console.log([
{
BLDAT: '20240325',
BUDAT: '20240325',
ZENCODE: 'A014',
ITEM: this.goodsList
}
]);
// this.goodsList.forEach((item,idnex)=>{
// arr.push({
// ...item,
// "aufnr": item.workorderCode,
//         "mtsnr": item.applyNo,
// 'zeile': index,
// 'werks': '1000', // 第42~45位:4位数,工厂代码
// 'lgort': this.nlpla,
// 'matnr': item.itemCode,
// // 'erfmg': '1', //当然是PDA扫描实体PL标签所获取的数量 第30~40位:总共11位数,每个版号的数量
// // 'erfme': '1', //为防止采用“可辨单位”管理的情况,选择这个字段来记录单位是万无一失的。
// // 'charg': '1', //批次号 PDA扫码获取 第46位~55位:10位数。 批次号
// // 'plnr': '1', //券号 版号 PDA扫码获取 第13~18位
// // 'vista': '1', // 来自PDA。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
// "windCase": null,是否结案 Y是 N否
this.list.forEach((ele) => {
ele.windCase = this.checkedBox ? 'Y': 'N'
})
const arr = this.list.filter(ele=>ele.vista)
const params = {
'zencode': 'A008',
'item': arr
}
this.$u.api.sapApi
.sapRrm([
{
BLDAT: '20240325',
BUDAT: '20240325',
ZENCODE: 'A014',
// TYPE: 'CG',
ITEM: this.goodsList
}
])
.sapProiss(params)
.then((res) => {
this.loading = false;
console.log(res);
if (res.every((item) => item.TYPE === 'S')) {
this.goodsList = [];
this.totalNum = 0;
this.nlpla = '';
this.wxparams = '';
this.$u.toast('提交成功');
......@@ -166,46 +215,230 @@ export default {
});
},
handleInputPlnr(e) {
this.isFocus = false;
e && this.getPlnr(e);
},
handleInputNlpla(e) {
if (e) {
this.nlpla = e;
this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG;
ele.NLPLA = ele.NLPLA || this.nlpla;
});
}
},
getPlnr(plnr) {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.sapApi
.sapPlnr({
.sapBlpl({
plnr
})
.then((res) => {
if (res.RESULT.TYPE === 'S') {
this.goodsList = this.goodsList.concat(res.DATA);
this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG;
ele.NLPLA = ele.NLPLA || this.nlpla;
});
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
if (res.MSG[0].TYPE === 'S') {
this.factorial(res,plnr,0)
} else {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
}, 1000);
this.$u.toast(res.RESULT.MESSAGE);
this.$u.toast(res.MSG[0].MESSAGE);
}
this.loading = false;
});
},
handleInputNlpla(e) {
this.$u.api.sapApi
.sapLgpla({
LGPLA:"YD-02-02-3"
})
.then((res) => {
if (res) {
this.goodsList.forEach((ele,index) => {
// ele.NLPLA = this.nlpla
ele.LGBER = res.BKDT.LGBER
ele.LGNUM = res.BKDT.LGNUM
ele.LGPLA = res.BKDT.LGPLA
ele.NLTYP = res.BKDT.NLTYP
})
} else {
}
});
},
factorial(res,plnr,idx,num=0) {
// 先找出符合条件的数组长度
// const arr = this.list.filter(item => item.itemCode.slice(9, 18) === plnr.slice(20, 29))
const count = this.list.filter(item => item.itemCode.slice(9, 18) === plnr.slice(20, 29)).length
for (let m = 0; m < this.list.length; m++) {
if(this.list[m].itemCode.slice(9, 18) === plnr.slice(20, 29)){
if(idx){
if(this.list[idx]){
if(num > this.list[idx].applyNum){
this.list[idx].charg = res.BLPL[0].CHARG
this.list[idx].vista = this.list[idx].applyNum
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum)
}else{
this.list[idx].charg = res.BLPL[0].CHARG
this.list[idx].vista = num
this.factorial(res,plnr,idx+1,0)
}
}
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){
const newCard = {
...this.list[m-1],
vista : this.list[m-1].applyNum - this.list[m-1].vista,
add: '1',
charg: res.BLPL[0].CHARG
}
this.list.splice(m, 0, newCard);
console.log(`output->Math.f`,Math.floor(plnr.slice(29, 40)) , this.list[m-1].applyNum , this.list[m-1].vista)
if( Math.floor(plnr.slice(29, 40)) > (this.list[m-1].applyNum - this.list[m-1].vista)){
this.factorial(res,plnr, m+1, Math.floor(plnr.slice(29, 40)) - (this.list[m-1].applyNum - this.list[m-1].vista))
}
return
}
if(count - 1 === m){
this.list[m].charg = res.BLPL[0].CHARG
this.list[m].vista = Math.floor(plnr.slice(29, 40))
}else{
if( Math.floor(plnr.slice(29, 40)) > this.list[m].applyNum){
this.list[m].vista = this.list[m].applyNum
this.$set(this.list,m,{...this.list[m],vista : this.list[m].applyNum,charg: res.BLPL[0].CHARG})
this.factorial(res,plnr,m+1,Math.floor(plnr.slice(29, 40))-this.list[m].applyNum)
return;
}else{
this.list[m].charg = res.BLPL[0].CHARG
this.list[m].vista = Math.floor(plnr.slice(29, 40))
}
}
}else{
if(this.list[m].vista < this.list[m].applyNum){
if(count === m){
console.log(`output->res.BLPL[0].CHARG`,res.BLPL[0].CHARG)
const newCard = {
...this.list[m],
vista : Math.floor(plnr.slice(29, 40)) ,
add: '1',
charg: res.BLPL[0].CHARG
}
this.list.splice(m+1, 0, newCard);
return
}
}
}
}
}
}
// if(idx){
// // 大于
// if(arr[idx]){
// if(num > arr[idx].applyNum){
// arr[idx].vista = arr[idx].applyNum
// arr[idx].PACMG = res.BLPL[0].PACMG
// arr[idx].aufnr = arr[idx].workorderCode,
// arr[idx].mtsnr = arr[idx].applyNo,
// arr[idx].zeile = idx,
// arr[idx].werks = plnr.slice(41, 45),
// arr[idx].erfmg = arr[idx].applyNum
// arr[idx].charg = plnr.slice(45, 55)
// arr[idx].plnr = plnr.slice(12, 18)
// // arr[idx].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[idx].NLBER = res.BLPL[0].NLBER || '001'
// arr[idx].MATNR = res.BLPL[0].MATNR
// arr[idx].WERKS = res.BLPL[0].WERKS
// arr[idx].lgort = res.BLPL[0].LGORT
// this.factorial(res,plnr,idx+1,num-arr[idx].applyNum)
// }else{
// arr[idx].vista = num
// arr[idx].PACMG = res.BLPL[0].PACMG
// arr[idx].aufnr = arr[idx].workorderCode,
// arr[idx].mtsnr = arr[idx].applyNo,
// arr[idx].zeile = idx,
// arr[idx].werks = plnr.slice(41, 45),
// arr[idx].erfmg = arr[idx].applyNum
// arr[idx].charg = plnr.slice(45, 55)
// arr[idx].plnr = plnr.slice(12, 18)
// // arr[idx].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[idx].NLBER = res.BLPL[0].NLBER || '001'
// arr[idx].MATNR = res.BLPL[0].MATNR
// arr[idx].WERKS = res.BLPL[0].WERKS
// arr[idx].lgort = res.BLPL[0].LGORT
// this.factorial(res,plnr,idx+1,0)
// }
// }
// return
// }
// // 扫pl获取数量 从第一个开始匹配 超了就往下找
// for (let i = 0; i < arr.length; i++) {
// // 已发
// if(arr[i].grantNum){
// }else{
// if(!arr[i].vista){
// if(arr[i-1] && arr[i-1].vista < arr[i-1].applyNum){
// const newCard = {
// ...arr[i-1],
// LGNUM : res.BLPL[0].LGNUM || 'W00',
// NLBER : res.BLPL[0].NLBER || '001',
// MATNR : res.BLPL[0].MATNR,
// WERKS : res.BLPL[0].WERKS,
// lgort : res.BLPL[0].LGORT,
// PACMG : res.BLPL[0].PACMG,
// vista : arr[i-1].applyNum-arr[i-1].vista,
// erfmg : arr[i].applyNum,
// add: '1'
// }
// this.list.splice(i+1, 0, newCard);
// if( Math.floor(plnr.slice(29, 40)) > (arr[i-1].applyNum - arr[i-1].vista)){
// this.factorial(res,plnr, i+1, Math.floor(plnr.slice(29, 40)) - (arr[i-1].applyNum - arr[i-1].vista))
// }
// return;
// }
// if(arr.length - 1 === i){
// arr[i].vista = Math.floor(plnr.slice(29, 40))
// arr[i].PACMG = res.BLPL[0].PACMG
// arr[i].aufnr = arr[i].workorderCode,
// arr[i].mtsnr = arr[i].applyNo,
// arr[i].zeile = i,
// arr[i].werks = plnr.slice(41, 45),
// arr[i].erfmg = arr[i].applyNum
// arr[i].charg = plnr.slice(45, 55)
// arr[i].plnr = plnr.slice(12, 18)
// // arr[i].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[i].NLBER = res.BLPL[0].NLBER || '001'
// arr[i].MATNR = res.BLPL[0].MATNR
// arr[i].WERKS = res.BLPL[0].WERKS
// arr[i].lgort = res.BLPL[0].LGORT
// }else{
// // pl>发货数量
// if( Math.floor(plnr.slice(29, 40)) > arr[i].applyNum){
// arr[i].vista = arr[i].applyNum
// arr[i].PACMG = res.BLPL[0].PACMG
// arr[i].aufnr = arr[i].workorderCode,
// arr[i].mtsnr = arr[i].applyNo,
// arr[i].zeile = i,
// arr[i].werks = plnr.slice(41, 45),
// arr[i].erfmg = arr[i].applyNum
// arr[i].charg = plnr.slice(45, 55)
// arr[i].plnr = plnr.slice(12, 18)
// // arr[i].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[i].NLBER = res.BLPL[0].NLBER || '001'
// arr[i].MATNR = res.BLPL[0].MATNR
// arr[i].WERKS = res.BLPL[0].WERKS
// arr[i].lgort = res.BLPL[0].LGORT
// this.factorial(res,plnr,i+1,Math.floor(plnr.slice(29, 40))-arr[i].applyNum)
// return;
// }else{
// arr[i].vista = Math.floor(plnr.slice(29, 40))
// arr[i].PACMG = res.BLPL[0].PACMG
// arr[i].aufnr = arr[i].workorderCode,
// arr[i].mtsnr = arr[i].applyNo,
// arr[i].zeile = i,
// arr[i].werks = plnr.slice(41, 45),
// arr[i].erfmg = arr[i].applyNum
// arr[i].charg = plnr.slice(45, 55)
// arr[i].plnr = plnr.slice(12, 18)
// // arr[i].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[i].NLBER = res.BLPL[0].NLBER || '001'
// arr[i].MATNR = res.BLPL[0].MATNR
// arr[i].WERKS = res.BLPL[0].WERKS
// arr[i].lgort = res.BLPL[0].LGORT
// }
// }
// }
// }
// }
// this.totalNum = this.goodsList.filter(ele=>ele.vista).length
}
}
};
......@@ -263,6 +496,7 @@ page {
.cardContent {
border-radius: 8px;
background: #fff;
margin-bottom: 20rpx;
}
.listItemTitle {
display: flex;
......
<template>
<view>
<view class="listItemTitle">
<view>
<view class="item">物料编号:{{ item.itemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view>
</view>
<view class="right">
<text class="blue">{{totalVistaNum}}</text>
<text class="line">/</text>
<text class="">{{totalNum}}</text>
</view>
</view>
<view class="listBottom">
<view class="bottomTitle" @click="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" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode">
<view class="items">生产单号:{{ ele.applyNo }}</view>
<view class="items">物料批次:{{ ele.charg }}</view>
<!-- <view class="items">库位:{{ item.MATNR }}</view> -->
<!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem">
数量:
<!-- <uni-easyinput v-model="item.vista"></uni-easyinput> -->
{{ele.vista}}
/
{{ ele.applyNum }}
</view>
</view>
</view>
</view>
<!-- <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> -->
</view>
</template>
<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
export default {
components: {
StickyNavBar,
ContentLoadingMore,
BottomBtn
},
props: {
item: {
type: Object,
default: function () {
return {};
}
},
list: {
type: Array,
default: function () {
return [];
}
}
},
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
}
});
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: {
}
};
</script>
<style lang="scss" scoped>
page {
background: #f8f8f8;
}
.headerTitle {
padding: 20rpx;
font-weight: 600;
.items {
line-height: 40rpx;
}
}
.btn {
padding: 20rpx;
background: #fff;
.topSearch {
margin-bottom: 20rpx;
}
}
.bottomBtn {
position: sticky;
padding: 20rpx;
display: flex;
justify-content: space-between;
background: #fff;
bottom: 0rpx;
margin-top: 20rpx;
.u-btn {
width: 300rpx;
}
}
.blue {
color: #3f9dcc;
}
.total {
background: #fff;
color: #000;
padding: 0rpx 40rpx;
display: flex;
justify-content: space-between;
font-size: 32rpx;
.line {
margin: 0px 10rpx;
}
}
.listItemTitle {
display: flex;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2px solid #f8f8f8;
.u-btn {
width: 150rpx;
margin: 0px;
margin-top: 10rpx;
}
.item {
line-height: 50rpx;
color: #333;
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
font-weight: 600;
}
}
.listBottom {
.bottomTitle {
height: 80rpx;
position: relative;
.desc {
color: #bbb;
font-size: 24rpx;
line-height: 80rpx;
padding-left: 20rpx;
}
.topIcons {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: #aaa;
}
}
.bottomBox {
padding: 20rpx;
.bottomItem {
background: #f8f8f8;
padding: 20rpx;
margin-bottom: 20rpx;
.items {
color: #333;
font-size: 24rpx;
line-height: 40rpx;
/deep/ .uni-easyinput{
width: 200rpx;
}
}
.inputItem{
display: inline-flex;
// line-height: 76rpx;
}
}
}
}
/deep/ .u-sticky {
top: 0 !important;
}
</style>
......@@ -51,7 +51,6 @@ export default {
return {
bgSrc: require('@/static/images/qrcode.png'),
number: 0,
totalNum: 0,
show: true,
nlpla: '',
wxparams: '',
......@@ -75,16 +74,9 @@ export default {
};
},
created() {
// this.getPlnr('10000820240325000001|10000320100');
// this.getPlnr('10000001');
},
methods: {
deleGonds(idx) {
this.goodsList.splice(idx, 1);
this.totalNum = 0;
this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG;
});
},
getBtnHandle(row) {
this[row.way]();
},
......@@ -103,43 +95,21 @@ export default {
this.isFocus = false;
e && this.getPlnr(e);
},
handleInputNlpla(e) {
if (e) {
this.nlpla = e;
this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG;
ele.NLPLA = ele.NLPLA || this.nlpla;
});
}
},
getPlnr(plnr) {
this.totalNum = 0;
this.isDisabled = true;
getPlnr(VBELN) {
this.$u.api.sapApi
.sapPlnr({
plnr
.sapSchDn({
VBELN
})
.then((res) => {
if (res.RESULT.TYPE === 'S') {
this.goodsList = this.goodsList.concat(res.DATA);
this.goodsList.forEach((ele) => {
this.totalNum += ele.ERFMG;
ele.NLPLA = ele.NLPLA || this.nlpla;
});
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
if (res.BKDT.length) {
this.goodsList = res.BKDT
uni.navigateTo({
url: `/pages/salesOutbound/salesOutboundList`
url: `/pages/salesOutbound/salesOutboundList?order=${JSON.stringify(this.goodsList)}`
});
} else {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
}, 1000);
this.$u.toast(res.RESULT.MESSAGE);
// res.forEach(element => {
// });
this.$u.toast(res.MSG[0].MESSAGE);
}
this.loading = false;
});
......
......@@ -26,16 +26,16 @@
<view class="left">物料明细</view>
<view class="right">
物料数量:
<text class="blue">{{ goodsList.length }}</text>
<text class="blue">{{ totalNum }}</text>
<text class="line">/</text>
<text class="">{{ totalNum }}</text>
<text class="">{{ goodsList.length }}</text>
</view>
</view>
</view>
</StickyNavBar>
<ContentLoadingMore class="contentMore">
<view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.MATNR">
<scanningList :item='item'/>
</view>
</view>
......@@ -106,11 +106,10 @@ export default {
},
onLoad(option) {
if(option && option.order){
this.orderItem = {
this.goodsList = [
...JSON.parse(option.order)
}
]
}
},
methods: {
goSubmit() {
......@@ -118,15 +117,7 @@ export default {
return;
}
this.$u.api.sapApi
.sapRrm([
{
BLDAT: '20240325',
BUDAT: '20240325',
ZENCODE: 'A014',
// TYPE: 'CG',
ITEM: this.goodsList
}
])
.sapPickingDn(this.goodsList)
.then((res) => {
this.loading = false;
console.log(res);
......@@ -146,30 +137,24 @@ export default {
},
getPlnr(plnr) {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.sapApi
.sapPlnr({
.sapBlpl({
ZCODE: '',
plnr
})
.then((res) => {
if (res.RESULT.TYPE === 'S') {
this.goodsList = this.goodsList.concat(res.DATA);
this.goodsList.forEach((ele) => {
ele.show = false
this.totalNum += ele.ERFMG;
ele.NLPLA = ele.NLPLA || this.nlpla;
if (res.MSG[0].TYPE === 'S') {
const data = res.BLPL[0]
this.goodsList.forEach(ele => {
if(ele.MATNR === res.BLPL[0].MATNR){
ele.NLBER = data.NLBER
ele.NLPLA = data.NLPLA
ele.NLTYP = data.NLTYP
ele.CLABS = data.PACMG
}
});
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
} else {
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
}, 1000);
this.$u.toast(res.RESULT.MESSAGE);
this.$u.toast(res.MSG[0].MESSAGE);
}
this.loading = false;
});
......
......@@ -6,9 +6,9 @@
<view class="item">物料描述:{{ item.MAKTX }}</view>
</view>
<view class="right">
<text class="blue">{{ item.ERFMG }}</text>
<text class="blue">{{ item.CLABS }}</text>
<text class="line">/</text>
<text class="">2000pcs</text>
<text class="">{{item.LFIMG}}pcs</text>
</view>
</view>
<view class="listBottom">
......@@ -27,16 +27,16 @@
</view>
<view v-if="!show" class="bottomBox">
<view class="bottomItem">
<view class="items">装箱号:{{ item.CHARG }}</view>
<view class="items">装箱号:{{ item.ZCODE }}</view>
<view class="items">物料批号:{{ item.CHARG }}</view>
<view class="items">库位:{{ item.MATNR }}</view>
<view class="items">库位:{{ item.LGORT }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem">
<!-- <u-row gutter="8"> -->
数量:
<uni-easyinput v-model="wxparams"></uni-easyinput>
<uni-easyinput v-model="item.CLABS"></uni-easyinput>
/
{{ item.CHARG }}
{{ item.LFIMG }}
<!-- </u-row> -->
</view>
</view>
......@@ -93,7 +93,7 @@ export default {
}
],
isFocus: false,
show: false,
show: true,
};
},
......@@ -193,12 +193,12 @@ page {
color: #333;
font-size: 24rpx;
line-height: 40rpx;
display: inline-flex;
/deep/ .uni-easyinput{
width: 200rpx;
}
}
.inputItem{
display: inline-flex;
line-height: 76rpx;
}
}
......
......@@ -78,7 +78,7 @@ class Request {
let url= this.config.baseUrl
if(options.url.indexOf('sap') > -1){
// console.log('sap')
url = 'http://192.168.3.109:8000'
// url = 'http://192.168.3.109:8000'
options.header = {
...options.header,
'content-type': 'application/json;charset=UTF-8',
......@@ -89,10 +89,10 @@ class Request {
...options.header,
'content-type': 'application/json;charset=UTF-8',
}
url = 'http://192.168.3.91:8080'
// url = 'http://192.168.66.119:8080'
}else{
// console.log('mobile')
url = 'http://192.168.3.91:8080'
// url = 'http://192.168.3.91:8080'
}
// 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
options.url = validate.url(options.url) ? options.url : (url + (options.url.indexOf('/') == 0 ?
......
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