Commit c1f4076a authored by xiangzj's avatar xiangzj

调整生产领料规则

parent 0a7603ac
...@@ -56,11 +56,14 @@ const install = (Vue, vm) => { ...@@ -56,11 +56,14 @@ const install = (Vue, vm) => {
sapCasePlnr: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/pda_case/pda_case_plnr?sap-client=310', params), sapCasePlnr: (params = {}) => vm.$u.post(config.adminPath + '/sap/bc/erp_ep/pda_case/pda_case_plnr?sap-client=310', params),
}, },
mesApi:{ mesApi:{
//生产领料 //生产领料查询单号
pdaMaterialcreate: (params = {}) => vm.$u.get(config.adminPath + 'apiPda/material/pdaMaterialcreate', params), pdaMaterialcreate: (params = {}) => vm.$u.get(config.adminPath + 'apiPda/material/pdaMaterialcreate', params),
// 生产退料 // 生产退料查询单号
pdaMaterialReturn: (params = {}) => vm.$u.get(config.adminPath + '/apiPad/materialReturn/pdaMaterialReturn', params), pdaMaterialReturn: (params = {}) => vm.$u.get(config.adminPath + '/apiPad/materialReturn/pdaMaterialReturn', params),
//生产领料
pdaSapissuecreate: (params = {}) => vm.$u.post(config.adminPath + '/apiPda/issue/pdaissuecreate', params), pdaSapissuecreate: (params = {}) => vm.$u.post(config.adminPath + '/apiPda/issue/pdaissuecreate', params),
// 生产退料
pdaMaterialReturnNum: (params = {}) => vm.$u.post(config.adminPath + '/apiPad/materialReturn/pdaMaterialReturnNum', params),
// 完工入库 // 完工入库
pdaFindPackageLinkInfo: (params = {}) => vm.$u.post(config.adminPath + 'apiPda/search/findPackageLinkInfo', params), pdaFindPackageLinkInfo: (params = {}) => vm.$u.post(config.adminPath + 'apiPda/search/findPackageLinkInfo', params),
......
...@@ -92,7 +92,30 @@ const install = (Vue, vm) => { ...@@ -92,7 +92,30 @@ const install = (Vue, vm) => {
} }
break; break;
} }
if(res.data && res.data.code){
switch (res.data.code) {
case 401:
uni.reLaunch({
url: '/pages/sys/login/login'
});
break;
case 403:
// 没有权限
if (data.msg !== null) {
uni.showToast({
title: data.msg,
duration: 3000
})
} else {
uni.showToast({
title: '失败',
duration: 3000
})
}
break;
}
}
if (typeof data === 'object' && !(data instanceof Array)) { if (typeof data === 'object' && !(data instanceof Array)) {
if (data.token) { if (data.token) {
vm.$u.vuex('vuex_token', data.token); vm.$u.vuex('vuex_token', data.token);
......
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
this.getDepotLists(); this.getDepotLists();
// 二维码包含:10位物料号(右对齐不足补充为0)物料号12位生产单号(右对齐不足补充为0), // 二维码包含:10位物料号(右对齐不足补充为0)物料号12位生产单号(右对齐不足补充为0),
// 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0) // 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0)
this.getPlnr('006000000100100000000300000501001'); // this.getPlnr('006000000100100000000300000501001');
}, },
computed:{ computed:{
totalNum(){ totalNum(){
...@@ -191,7 +191,6 @@ export default { ...@@ -191,7 +191,6 @@ export default {
INSNAM: ele.checkBy, INSNAM: ele.checkBy,
ZMNGO: ele.totalQuantity, ZMNGO: ele.totalQuantity,
ZMNGL: ele.lossNum, ZMNGL: ele.lossNum,
NLPLA: this.nlpla,
}) })
}); });
params.push({ params.push({
...@@ -239,13 +238,18 @@ export default { ...@@ -239,13 +238,18 @@ export default {
getPlnr(qrcode) { getPlnr(qrcode) {
this.isDisabled = true; this.isDisabled = true;
this.isFocus = false this.isFocus = false
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
this.reset()
return
}
this.$u.api.mesApi this.$u.api.mesApi
.pdaFindPackageLinkInfo({ .pdaFindPackageLinkInfo({
qrcode qrcode
}) })
.then((res) => { .then((res) => {
if (res && res.code == 200) { if (res && res.code == 200) {
if (this.goodsList.some((item) => item.workorderNo !== res.workorderNo)) { if (this.goodsList.some((item) => item.workorderNo !== res.data.workorderNo)) {
this.$u.toast('请扫描同一个工单'); this.$u.toast('请扫描同一个工单');
this.reset() this.reset()
return return
...@@ -255,7 +259,7 @@ export default { ...@@ -255,7 +259,7 @@ export default {
this.reset() this.reset()
return return
} }
this.goodsList.push(res.data) this.goodsList.push({...res.data,NLPLA: this.nlpla})
this.reset() this.reset()
} else { } else {
this.reset() this.reset()
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<view class="item">工单编号:{{ item.workorderNo }}</view> <view class="item">工单编号:{{ item.workorderNo }}</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 class="item">入库仓位:{{ item.NLPLA }}</view>
<view class="item">入库数量:{{ item.quantity }}</view> <view class="item">入库数量:{{ item.quantity }}</view>
</view> </view>
<u-button size="mini" type="primary" plain @click="deleGonds(idx)"> <u-button size="mini" type="primary" plain @click="deleGonds(idx)">
...@@ -29,9 +30,9 @@ ...@@ -29,9 +30,9 @@
</view> </view>
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
<view class="bottomItem"> <view class="bottomItem">
<view class="items">{{ item.standardSize }}</view> <view class="items">{{ item.standardSize }}</view>
<view class="items">数量:{{ item.quantity }}</view> <view class="items">数量:{{ item.quantity }}</view>
<view class="items">生产日期:{{ item.BLDAT }}</view> <!-- <view class="items">生产日期:{{ item.BLDAT }}</view> -->
</view> </view>
</view> </view>
</view> </view>
......
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
}, },
], ],
form: { form: {
ZZXFS: '', ZZXFS: 'BL+PL',
zxspe: '', //箱规格(cm) zxspe: '', //箱规格(cm)
zxvolum: '', //体积(m132) zxvolum: '', //体积(m132)
zxntgew: '', //箱重(kg) zxntgew: '', //箱重(kg)
...@@ -130,6 +130,14 @@ export default { ...@@ -130,6 +130,14 @@ export default {
this.$u.toast('暂无提交数据'); this.$u.toast('暂无提交数据');
return return
} }
if(!this.blNum){
this.$u.toast('请扫描箱码');
return
}
if(!this.form.long || !this.form.wide || !this.form.high || !this.form.brgew ||!this.form.zxntgew ){
this.$u.toast('请填写体积和重量');
return
}
const arr = [] const arr = []
this.goodsList.forEach(ele => { this.goodsList.forEach(ele => {
arr.push( arr.push(
...@@ -170,16 +178,24 @@ export default { ...@@ -170,16 +178,24 @@ export default {
handleInputNlpla(e){ handleInputNlpla(e){
console.log(`output->e`,e) console.log(`output->e`,e)
}, },
handleInputPlnr(e) { reset(){
this.isFocus = false;
this.isDisabled = true;
e && this.goodsList.push(e)
setTimeout(() => { setTimeout(() => {
this.isFocus = true; this.isFocus = true;
this.isDisabled = false; this.isDisabled = false;
this.wxparams = '' this.wxparams = ''
}, 1000); }, 1000);
}, },
handleInputPlnr(e) {
this.isFocus = false;
this.isDisabled = true;
if (this.goodsList.some((item) => item === e)) {
this.$u.toast('已经存在当前条码');
this.reset()
return
}
e && this.goodsList.push(e)
this.reset()
},
// 点击actionSheet回调 // 点击actionSheet回调
actionSheetCallback(index) { actionSheetCallback(index) {
this.form.ZZXFS = this.actionSheetList[index].text; this.form.ZZXFS = this.actionSheetList[index].text;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view class="headerTitle"> <view class="headerTitle">
<view class=""> <view class="">
<view class="items">退料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view> <view class="items">退料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view>
<view class="items">{{goodsList[0]&&goodsList[0].workstationName}}</view> <view class="items">{{goodsList[0]&&goodsList[0].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view> <view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view> </view>
<view class="checkedCase"> <view class="checkedCase">
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
</view> </view>
</view> </view>
<view class="btn"> <view class="btn">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="nlpla" focus placeholder="请扫描库位" @change="handleInputNlpla"></uni-easyinput>
<uni-easyinput <uni-easyinput
prefixIcon="search" prefixIcon="search"
:disabled="isDisabled" :disabled="isDisabled"
...@@ -62,7 +63,7 @@ export default { ...@@ -62,7 +63,7 @@ export default {
// totalNum: 0, // totalNum: 0,
number: 0, number: 0,
show: true, show: true,
nlpla: 'YD-02-02-3', nlpla: '',
wxparams: '', wxparams: '',
btnArr: [ btnArr: [
{ {
...@@ -131,29 +132,9 @@ export default { ...@@ -131,29 +132,9 @@ export default {
if (res && res.code - 200 === 0) { if (res && res.code - 200 === 0) {
this.list = res.rows this.list = res.rows
const data = 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) => { const result = data.filter((item, index, self) => {
return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index; 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] this.goodsList = [...result]
} else { } else {
this.$u.toast(res.msg); this.$u.toast(res.msg);
...@@ -177,25 +158,7 @@ export default { ...@@ -177,25 +158,7 @@ export default {
if (this.list.length === 0) { if (this.list.length === 0) {
return; 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位
// // 'quantityIssued': '1', // 来自PDA。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
let arr = this.list.filter(ele=>ele.quantityIssued) let arr = this.list.filter(ele=>ele.quantityIssued)
// "windCase": null,是否结案 Y是 N否 // "windCase": null,是否结案 Y是 N否
arr.forEach((ele,index) => { arr.forEach((ele,index) => {
ele.windCase = this.checkedBox ? 'Y': 'N' ele.windCase = this.checkedBox ? 'Y': 'N'
...@@ -203,11 +166,11 @@ export default { ...@@ -203,11 +166,11 @@ export default {
ele.ERFMG = ele.quantityIssued ele.ERFMG = ele.quantityIssued
ele.MTSNR = ele.applyNo ele.MTSNR = ele.applyNo
ele.ZEILE = index+1 ele.ZEILE = index+1
ele.RSNUM = ele.requirementNumber ele.RSNUM = ele.requirementNumber || '10'
ele.RSPOS = ele.requirementProjectNumber ele.RSPOS = ele.requirementProjectNumber || '2'
}) })
const params = { const params = {
'zencode': 'A008', 'zencode': 'A009',
'item': arr 'item': arr
} }
this.$u.api.sapApi this.$u.api.sapApi
...@@ -230,12 +193,12 @@ export default { ...@@ -230,12 +193,12 @@ export default {
handleMes(arr,num){ handleMes(arr,num){
arr.forEach(ele => { arr.forEach(ele => {
ele.batchCode = ele.CHARG ele.batchCode = ele.CHARG
ele.quantityIssued = ele.quantityIssued ele.backNum = ele.quantityIssued
ele.issueCode = num ele.issueCode = num
ele.issueType = ele.materialType ele.issueType = ele.materialType
}); });
this.$u.api.mesApi this.$u.api.mesApi
.pdaSapissuecreate(arr) .pdaMaterialReturnNum(arr)
.then((res) => { .then((res) => {
this.loading = false; this.loading = false;
console.log(res); console.log(res);
...@@ -255,10 +218,15 @@ export default { ...@@ -255,10 +218,15 @@ export default {
getPlnr(plnr) { getPlnr(plnr) {
this.isDisabled = true; this.isDisabled = true;
this.isFocus = false this.isFocus = false
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
this.reset()
return
}
this.$u.api.sapApi this.$u.api.sapApi
.sapBlpl({ .sapBlpl({
plnr, plnr,
ztype: '002' ztype: '003'
}) })
.then((res) => { .then((res) => {
if (res && res.MSG[0].TYPE === 'S') { if (res && res.MSG[0].TYPE === 'S') {
...@@ -289,18 +257,14 @@ export default { ...@@ -289,18 +257,14 @@ export default {
} }
for (let m = 0; m < this.list.length; m++) { for (let m = 0; m < this.list.length; m++) {
if(this.list[m].sapItemCode == res.BLPL[0].MATNR){ if(this.list[m].sapItemCode == res.BLPL[0].MATNR){
// 这是递归的方法 // 递归的方法
if(idx){ if(idx){
if(this.list[idx]){ if(this.list[idx]){
if(num > this.list[idx].applyNum){ if(num > this.list[idx].applyNum){
// this.list[idx].charg = res.BLPL[0].CHARG this.$set(this.list,idx,{...this.list[idx],quantityIssued : this.list[idx].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
// this.list[idx].quantityIssued = this.list[idx].applyNum
this.$set(this.list,idx,{...this.list[idx],quantityIssued : this.list[idx].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum) this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum)
}else{ }else{
// this.list[idx].charg = res.BLPL[0].CHARG this.$set(this.list,idx,{...this.list[idx],quantityIssued : num,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
// this.list[idx].quantityIssued = num
this.$set(this.list,idx,{...this.list[idx],quantityIssued : num,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,idx+1,0) this.factorial(res,plnr,idx+1,0)
} }
} }
...@@ -318,7 +282,8 @@ export default { ...@@ -318,7 +282,8 @@ export default {
quantityIssued : this.list[m-1].applyNum - this.list[m-1].quantityIssued, quantityIssued : this.list[m-1].applyNum - this.list[m-1].quantityIssued,
add: '1', add: '1',
charg: res.BLPL[0].CHARG, charg: res.BLPL[0].CHARG,
... res.BLPL[0] ... res.BLPL[0],
NLPLA: this.nlpla
} }
this.list.splice(m, 0, newCard); this.list.splice(m, 0, newCard);
if( res.BLPL[0].PACMG > (this.list[m-1].applyNum - this.list[m-1].quantityIssued)){ if( res.BLPL[0].PACMG > (this.list[m-1].applyNum - this.list[m-1].quantityIssued)){
...@@ -328,19 +293,19 @@ export default { ...@@ -328,19 +293,19 @@ export default {
} }
// 只有一个 // 只有一个
if(count === 1){ if(count === 1){
this.$set(this.list,m,{...this.list[m],quantityIssued : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],quantityIssued : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
}else{ }else{
if( res.BLPL[0].PACMG > this.list[m].applyNum){ if( res.BLPL[0].PACMG > this.list[m].applyNum){
if(count === m){ if(count === m){
this.$set(this.list,m,{...this.list[m],quantityIssued : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],quantityIssued : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
return return
} }
this.list[m].quantityIssued = this.list[m].applyNum this.list[m].quantityIssued = this.list[m].applyNum
this.$set(this.list,m,{...this.list[m],quantityIssued : this.list[m].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],quantityIssued : this.list[m].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
this.factorial(res,plnr,m+1,res.BLPL[0].PACMG-this.list[m].applyNum) this.factorial(res,plnr,m+1,res.BLPL[0].PACMG-this.list[m].applyNum)
return; return;
}else{ }else{
this.$set(this.list,m,{...this.list[m],quantityIssued : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],quantityIssued : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
} }
} }
}else{ }else{
...@@ -351,7 +316,8 @@ export default { ...@@ -351,7 +316,8 @@ export default {
quantityIssued : res.BLPL[0].PACMG , quantityIssued : res.BLPL[0].PACMG ,
add: '1', add: '1',
charg: res.BLPL[0].CHARG, charg: res.BLPL[0].CHARG,
... res.BLPL[0] ... res.BLPL[0],
NLPLA: this.nlpla
} }
this.list.splice(m+1, 0, newCard); this.list.splice(m+1, 0, newCard);
return return
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode"> <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.workorderCode }}</view>
<view class="items">物料批次:{{ ele.CHARG }}</view> <view class="items">物料批次:{{ ele.CHARG }}</view>
<!-- <view class="items">库位:{{ item.MATNR }}</view> --> <view class="items">库位:{{ ele.NLPLA }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> --> <!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem"> <view class="items inputItem">
数量: 数量:
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<view class="listItemTitle" @click="handleClick(item)"> <view class="listItemTitle" @click="handleClick(item)">
<view> <view>
<view class="item">申请单号:{{ item.applyNo }}</view> <view class="item">申请单号:{{ item.applyNo }}</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 class="item">作业单元:{{ item.workunitName }}</view> <view class="item">作业单元:{{ item.workunitName }}</view>
<view class="item">作业类型:{{ item.materialType ? '补料': '领料' }}</view> <view class="item">作业类型:{{ item.materialType ? '补料': '领料' }}</view>
<view class="item">备料状态:{{ item.grantNum? '配货中' : '未配货' }}</view> <view class="item">备料状态:{{ item.grantNum? '配货中' : '未配货' }}</view>
...@@ -144,6 +144,9 @@ export default { ...@@ -144,6 +144,9 @@ export default {
.then((res) => { .then((res) => {
if (res && res.code - 200 === 0) { if (res && res.code - 200 === 0) {
this.goodsList = this.goodsList.concat(res.rows); this.goodsList = this.goodsList.concat(res.rows);
this.goodsList = this.goodsList.filter((item, index, self) => {
return self.findIndex(t => t.applyNo === item.applyNo) === index;
});
this.total = res.total this.total = res.total
} else { } else {
this.$u.toast(res.msg); this.$u.toast(res.msg);
......
<template> <template>
<view> <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">领料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view>
<view class="items">WC01:{{goodsList[0]&&goodsList[0].workstationName}}</view> <view class="items">{{goodsList[0]&&goodsList[0].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view> <view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view> </view>
<view class=""> <view class="checkedCase">
<checkbox-group @change="checkedChange"> <checkbox-group @change="checkedChange">
<checkbox value="r1" :checked="checkedBox" />是否结案 <checkbox value="r1" :checked="checkedBox" />是否结案
</checkbox-group> </checkbox-group>
</view> </view>
</view> </view>
<view class="btn"> <view class="btn">
<uni-easyinput prefixIcon="search" class="topSearch" v-model="nlpla" focus placeholder="请扫描库位" @change="handleInputNlpla"></uni-easyinput>
<uni-easyinput <uni-easyinput
prefixIcon="search" prefixIcon="search"
:disabled="isDisabled" :disabled="isDisabled"
...@@ -29,55 +28,17 @@ ...@@ -29,55 +28,17 @@
<view class="left">物料明细</view> <view class="left">物料明细</view>
<view class="right"> <view class="right">
物料数量: 物料数量:
<text class="blue">{{ totalNum }}</text> <!-- <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>
<view class="cardbox"> <ContentLoadingMore class="cardbox" :list='goodsList'>
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.erfmg"> <view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList :item='item'/> <scanningList :item='item' :list='list'/>
</view> </view>
</view> </ContentLoadingMore>
<!-- <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> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view> </view>
</template> </template>
...@@ -98,7 +59,7 @@ export default { ...@@ -98,7 +59,7 @@ export default {
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',
...@@ -118,27 +79,48 @@ export default { ...@@ -118,27 +79,48 @@ export default {
} }
], ],
goodsList: [], goodsList: [],
isFocus: false, isFocus: true,
isDisabled: false, isDisabled: false,
OrderNum: '', OrderNum: '',
list: []
}; };
}, },
computed:{ computed:{
totalNum(){
let num = 0
let i=null,j=null
const data = JSON.parse(JSON.stringify(this.list))
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){
num++
}
}
return num || 0
},
}, },
onLoad(option) { onLoad(option) {
if(option && option.order){ if(option && option.order){
this.OrderNum = option.order this.OrderNum = option.order
this.getOrder(option.order) this.getOrder(option.order)
} }
},
watch: {
}, },
created() { created() {
this.handleInputNlpla()
this.getPlnr('100021240419000001|00010001020000050.000|10002441900001');
}, },
methods: { methods: {
reset(){
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
},
getOrder(applyNo) { getOrder(applyNo) {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.mesApi this.$u.api.mesApi
.pdaMaterialcreate({ .pdaMaterialcreate({
pageNum:1, pageNum:1,
...@@ -147,32 +129,32 @@ export default { ...@@ -147,32 +129,32 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res && res.code - 200 === 0) { if (res && res.code - 200 === 0) {
this.list = res.rows
const data = res.rows const data = res.rows
let num = 0 // let num = 0
data.forEach((ele,index) => { // data.forEach((ele,index) => {
ele.sonItemCode = [] // ele.sonItemCode = []
ele.sonItemCode.push(...data) // ele.sonItemCode.push(...data)
ele.applyNum1 = 0 // ele.applyNum1 = 0
}) // })
const result = data.filter((item, index, self) => { const result = data.filter((item, index, self) => {
return self.findIndex(t => t.itemCode === item.itemCode) === index; return self.findIndex(t => t.sapItemCode === item.sapItemCode) === index;
}); });
let i=null,j=null // let i=null,j=null
for(i = 0; i < result.length; i++){ // for(i = 0; i < result.length; i++){
for(j = 0; j < result[i].sonItemCode.length; j++){ // for(j = 0; j < result[i].sonItemCode.length; j++){
if(result[i].itemCode !== result[i].sonItemCode[j].itemCode){ // if(result[i].itemCode !== result[i].sonItemCode[j].itemCode){
result[i].sonItemCode.splice(j,1) // result[i].sonItemCode.splice(j,1)
j-- // j--
}else{ // }else{
result[i].applyNum1 += result[i].sonItemCode[j].applyNum // result[i].applyNum1 += result[i].sonItemCode[j].applyNum
} // }
} // }
} // }
// result.forEach((ele,index) => { // result.forEach((ele,index) => {
// ele.applyNum = [] // ele.applyNum = []
// }) // })
this.goodsList = [...result] this.goodsList = [...result]
console.log(this.goodsList,result)
} else { } else {
this.$u.toast(res.msg); this.$u.toast(res.msg);
} }
...@@ -192,30 +174,21 @@ export default { ...@@ -192,30 +174,21 @@ export default {
}); });
}, },
goSubmit() { goSubmit() {
if (this.goodsList.length === 0) { if (this.list.length === 0) {
return; return;
} }
// this.goodsList.forEach((item,idnex)=>{ let arr = this.list.filter(ele=>ele.vista)
// 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否 // "windCase": null,是否结案 Y是 N否
this.goodsList.forEach((ele) => { arr.forEach((ele,index) => {
ele.windCase = this.checkedBox ? 'Y': 'N' ele.windCase = this.checkedBox ? 'Y': 'N'
ele.AUFNR = ele.workorderCode
ele.ERFMG = ele.vista
ele.MTSNR = ele.applyNo
ele.ZEILE = index+1
ele.RSNUM = ele.requirementNumber
ele.RSPOS = ele.requirementProjectNumber
}) })
const arr = this.goodsList.filter(ele=>ele.vista)
const params = { const params = {
'zencode': 'A008', 'zencode': 'A008',
'item': arr 'item': arr
...@@ -228,10 +201,8 @@ export default { ...@@ -228,10 +201,8 @@ export default {
return return
} }
if (res.every((item) => item.TYPE === 'S')) { if (res.every((item) => item.TYPE === 'S')) {
this.goodsList = []; // this.$u.toast('提交成功');
this.nlpla = ''; this.handleMes(arr,res[0].MESSAGE_V1)
this.wxparams = '';
this.$u.toast('提交成功');
} }
const foundObject = res.find(item => item.TYPE === 'E'); const foundObject = res.find(item => item.TYPE === 'E');
if(foundObject && foundObject.MESSAGE){ if(foundObject && foundObject.MESSAGE){
...@@ -239,69 +210,197 @@ export default { ...@@ -239,69 +210,197 @@ export default {
} }
}); });
}, },
handleMes(arr,num){
arr.forEach(ele => {
ele.batchCode = ele.CHARG
ele.quantityIssued = ele.vista
ele.issueCode = num
ele.issueType = ele.materialType
});
this.$u.api.mesApi
.pdaSapissuecreate(arr)
.then((res) => {
this.loading = false;
console.log(res);
if(res && res.code == 200){
this.$u.toast('提交成功');
setTimeout(() => {
this.goBack()
}, 1000);
}else{
this.$u.toast(res.msg);
}
});
},
handleInputPlnr(e) { handleInputPlnr(e) {
e && this.getPlnr(e); e && this.getPlnr(e);
}, },
getPlnr(plnr) { getPlnr(plnr) {
this.totalNum = 0; this.isDisabled = true;
this.isFocus = false
this.$u.api.sapApi this.$u.api.sapApi
.sapBlpl({ .sapBlpl({
plnr plnr,
ztype: '002'
}) })
.then((res) => { .then((res) => {
if (res && res.MSG[0].TYPE === 'S') { if (res && res.MSG[0].TYPE === 'S') {
this.goodsList.forEach((ele,index) => { if (this.list.some((item) => item.PLNR === plnr)) {
if (ele.itemCode.slice(9, 18) === plnr.slice(20, 29)) { this.reset()
// 已发 this.$u.toast('已经存在当前条码');
if(ele.grantNum){ return
}
}else{ res.BLPL.forEach(ele => {
if(!ele.PACMG){ ele.vista = 0
}
}
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 // this.handleAverage(res,plnr)
this.factorial(res,plnr,0)
this.reset()
} else { } else {
this.reset()
this.$u.toast(res.MSG[0].MESSAGE); this.$u.toast(res.MSG[0].MESSAGE);
} }
this.loading = false; this.loading = false;
}); });
}, },
handleInputNlpla(e) { // 按照比例来分的方法
this.$u.api.sapApi handleAverage(res,plnr){
.sapLgpla({ console.log(`output->`,this.list)
LGPLA:"YD-02-02-3" let arr = []
}) for (let m = 0; m < this.list.length; m++) {
.then((res) => { if(this.list[m].sapItemCode == res.BLPL[0].MATNR){
if (res) { arr.push(this.list[m])
this.goodsList.forEach((ele,index) => { }
// ele.NLPLA = this.nlpla }
ele.LGBER = res.BKDT.LGBER let total = 0
ele.LGNUM = res.BKDT.LGNUM arr.forEach(ele => {
ele.LGPLA = res.BKDT.LGPLA total += ele.applyNum
ele.NLTYP = res.BKDT.NLTYP });
}) this.list.forEach((ele,idx) => {
} else { if(ele.vista){
} this.list.push({
}); ...this.list[idx],
vista : ele.applyNum/total*res.BLPL[0].PACMG ,
charg: res.BLPL[0].CHARG,
... res.BLPL[0]
})
return
}
if(ele.sapItemCode == res.BLPL[0].MATNR){
this.$set(this.list,idx,{...this.list[idx],vista : ele.applyNum/total*res.BLPL[0].PACMG ,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
}
});
}, },
handleAddList(idx,vista,res){
const newCard = {
...this.list[idx],
vista,
// vista : ((this.list[idx].applyNum - 0)-(this.list[idx].vista-0)).toFixed(3),
add: '1',
// charg: res.BLPL[0].CHARG,
... res.BLPL[0]
}
this.list.splice(idx+1, 0, newCard);
},
factorial(res,plnr,idx,num=0) {
// 找出符合条件的数组长度
this.list.forEach(ele => {
console.log(`output->`,ele.sapItemCode,res.BLPL[0].MATNR)
console.log(`output->thi`,this.list.filter(item => item.sapItemCode == res.BLPL[0].MATNR))
});
const count = this.list.filter(item => item.sapItemCode == res.BLPL[0].MATNR).length
if(!count){
this.$u.toast('没有匹配到对应物料');
return
}
for (let m = 0; m < this.list.length; m++) {
if(this.list[m].sapItemCode == res.BLPL[0].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,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum)
}else{
this.$set(this.list,idx,{...this.list[idx],vista : num,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,idx+1,0)
}
}
return
}
// if(this.list[m].grantNum){
// 发过多少货
// }else{
// 没有填入数据的
debugger
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,
... res.BLPL[0]
}
this.list.splice(m, 0, newCard);
if( res.BLPL[0].PACMG > (this.list[m-1].applyNum - this.list[m-1].vista)){
this.factorial(res,plnr, m+1, res.BLPL[0].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.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
// }else{
if( res.BLPL[0].PACMG > this.list[m].applyNum){
if(count === m){
this.$set(this.list,m,{...this.list[m],vista : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
return
}
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,... res.BLPL[0]})
this.factorial(res,plnr,m+1,res.BLPL[0].PACMG-this.list[m].applyNum)
return;
}else{
this.$set(this.list,m,{...this.list[m],vista : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
console.log(`output->res`,this.list[m])
return
}
// }
}else{
console.log(`output->`,this.list[m].vista, this.list[m].applyNum)
if(this.list[m].vista < this.list[m].applyNum){
let arr = []
this.list.forEach(ele => {
if(ele.sapItemCode == this.list[m].sapItemCode){
arr.push(ele)
}
});
let totalApplyNum = 0
let totalVista =0
arr.forEach(ele => {
totalApplyNum += ele.applyNum
console.log(`output->ele`,ele.vista)
// totalVista += (ele.vista-0)
});
// 最终填入的数量
const endVista = ((this.list[idx].applyNum - 0)-(this.list[idx].vista-0)).toFixed(3)
if(totalVista < totalApplyNum){
this.handleAddList(m,endVista,res)
}
if((res.BLPL[0].PACMG-0)-endVista >0){
this.factorial(res,plnr,m+2,(res.BLPL[0].PACMG-0)-endVista)
}
return
}else{
this.$u.toast('暂无剩余物料');
}
}
// }
}
}
}
} }
}; };
</script> </script>
...@@ -416,4 +515,7 @@ page { ...@@ -416,4 +515,7 @@ page {
top: 0 !important; top: 0 !important;
background: #fff; background: #fff;
} }
.checkedCase{
margin-top: 10rpx;
}
</style> </style>
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view class="headerTitle"> <view class="headerTitle">
<view class=""> <view class="">
<view class="items">领料申请:{{goodsList[0]&&goodsList[0].applyNo}}</view> <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].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view> <view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view> </view>
<view class="checkedCase"> <view class="checkedCase">
...@@ -177,23 +177,6 @@ export default { ...@@ -177,23 +177,6 @@ export default {
if (this.list.length === 0) { if (this.list.length === 0) {
return; 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。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
let arr = this.list.filter(ele=>ele.vista) let arr = this.list.filter(ele=>ele.vista)
// "windCase": null,是否结案 Y是 N否 // "windCase": null,是否结案 Y是 N否
...@@ -267,7 +250,7 @@ export default { ...@@ -267,7 +250,7 @@ export default {
this.$u.toast('已经存在当前条码'); this.$u.toast('已经存在当前条码');
return return
} }
this.factorial(res,plnr,0) this.factorial({...res.BLPL[0]},plnr,0)
this.reset() this.reset()
} else { } else {
this.reset() this.reset()
...@@ -276,31 +259,33 @@ export default { ...@@ -276,31 +259,33 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
handleAddList(idx,vista,res){
const newCard = {
...this.list[idx],
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) { factorial(res,plnr,idx,num=0) {
// 找出符合条件的数组长度 // 找出符合条件的数组长度
this.list.forEach(ele => { const count = this.list.filter(item => item.sapItemCode == res.MATNR).length
console.log(`output->`,ele.sapItemCode,res.BLPL[0].MATNR)
console.log(`output->thi`,this.list.filter(item => item.sapItemCode == res.BLPL[0].MATNR))
});
const count = this.list.filter(item => item.sapItemCode == res.BLPL[0].MATNR).length
if(!count){ if(!count){
this.$u.toast('没有匹配到对应物料'); this.$u.toast('没有匹配到对应物料');
return return
} }
for (let m = 0; m < this.list.length; m++) { for (let m = 0; m < this.list.length; m++) {
if(this.list[m].sapItemCode == res.BLPL[0].MATNR){ if(this.list[m].sapItemCode == res.MATNR){
// 这是递归的方法 // 递归的方法
if(idx){ if(idx){
if(this.list[idx]){ if(this.list[idx]){
if(num > this.list[idx].applyNum){ if(num > this.list[idx].applyNum){
// this.list[idx].charg = res.BLPL[0].CHARG this.$set(this.list,idx,{...this.list[idx],vista : this.list[idx].applyNum,... res})
// this.list[idx].vista = this.list[idx].applyNum
this.$set(this.list,idx,{...this.list[idx],vista : this.list[idx].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum) this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum)
}else{ }else{
// this.list[idx].charg = res.BLPL[0].CHARG this.$set(this.list,idx,{...this.list[idx],vista : num,... res})
// this.list[idx].vista = num
this.$set(this.list,idx,{...this.list[idx],vista : num,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,idx+1,0) this.factorial(res,plnr,idx+1,0)
} }
} }
...@@ -313,49 +298,57 @@ export default { ...@@ -313,49 +298,57 @@ export default {
if(!this.list[m].vista){ if(!this.list[m].vista){
// 上一位的数据是否满足 // 上一位的数据是否满足
if(this.list[m-1] && this.list[m-1].vista < this.list[m-1].applyNum){ if(this.list[m-1] && this.list[m-1].vista < this.list[m-1].applyNum){
const newCard = { this.handleAddList(m,((this.list[m-1].applyNum-0) - (this.list[m-1].vista-0)),res)
...this.list[m-1], if( res.PACMG > (this.list[m-1].applyNum - this.list[m-1].vista)){
vista : 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))
add: '1',
charg: res.BLPL[0].CHARG,
... res.BLPL[0]
}
this.list.splice(m, 0, newCard);
if( res.BLPL[0].PACMG > (this.list[m-1].applyNum - this.list[m-1].vista)){
this.factorial(res,plnr, m+1, res.BLPL[0].PACMG - (this.list[m-1].applyNum - this.list[m-1].vista))
} }
return return
} }
// 只有一个 // 只有一个
if(count === 1){ if(count === 1){
this.$set(this.list,m,{...this.list[m],vista : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
}else{ }else{
if( res.BLPL[0].PACMG > this.list[m].applyNum){ if( res.PACMG > this.list[m].applyNum){
if(count === m){ if(count === m){
this.$set(this.list,m,{...this.list[m],vista : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
return return
} }
this.list[m].vista = 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,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],vista : this.list[m].applyNum,... res})
this.factorial(res,plnr,m+1,res.BLPL[0].PACMG-this.list[m].applyNum) this.factorial(res,plnr,m+1,res.PACMG-this.list[m].applyNum)
return; return;
}else{ }else{
this.$set(this.list,m,{...this.list[m],vista : res.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]}) this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
return
} }
} }
}else{ }else{
if(this.list[m].vista < this.list[m].applyNum){ if(this.list[m].vista < this.list[m].applyNum){
// if(count === m || count === 1){ let arr = []
const newCard = { this.list.forEach(ele => {
...this.list[m], console.log(`output->`,ele.workorderCode,this.list[m].workorderCode)
vista : res.BLPL[0].PACMG , if(ele.workorderCode === this.list[m].workorderCode){
add: '1', arr.push(ele)
charg: res.BLPL[0].CHARG, }
... res.BLPL[0] });
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
}
if(totalVista < totalApplyNum){
this.handleAddList(m,endVista,res)
if((res.PACMG-0)-endVista >0){
this.factorial(res,plnr,m+2,(res.PACMG-0)-endVista)
} }
this.list.splice(m+1, 0, newCard);
return return
// } }
}else{ }else{
this.$u.toast('暂无剩余物料'); this.$u.toast('暂无剩余物料');
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode"> <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.workorderCode }}</view>
<view class="items">物料批次:{{ ele.CHARG }}</view> <view class="items">物料批次:{{ ele.CHARG }}</view>
<!-- <view class="items">库位:{{ item.MATNR }}</view> --> <view class="items">库位:{{ ele.NLPLA }}</view>
<!-- <view class="items">{{ item.MATNR }}</view> --> <!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem"> <view class="items inputItem">
数量: 数量:
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
let num = 0 let num = 0
this.list.forEach(ele => { this.list.forEach(ele => {
if(ele.itemCode === this.item.itemCode){ if(ele.itemCode === this.item.itemCode){
num += ele.vista num += (ele.vista-0)
} }
}); });
return num || '' return num || ''
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<view class="item">物料编号:{{ item.MATNR }}</view> <view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view> <view class="item">物料描述:{{ item.MAKTX }}</view>
<view class="item">入库数量:{{ item.cardNum }}</view> <view class="item">入库数量:{{ item.cardNum }}</view>
<view class="item">入库库位:{{ nlpla }}</view>
</view> </view>
</view> </view>
<view class="listBottom"> <view class="listBottom">
...@@ -26,6 +25,7 @@ ...@@ -26,6 +25,7 @@
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in goodsList" v-if="ele.CHARG === item.CHARG"> <view class="bottomItem" v-for="(ele, idx) in goodsList" v-if="ele.CHARG === item.CHARG">
<view class="items plNum">{{ ele.PLNR }}</view> <view class="items plNum">{{ ele.PLNR }}</view>
<view class="item">入库库位:{{ ele.NLPLA }}</view>
<view class="items">数量:{{ ele.TOMNG }}</view> <view class="items">数量:{{ ele.TOMNG }}</view>
<view class="boxBtn"> <view class="boxBtn">
<view class="items">生产日期:{{ ele.BLDAT }}</view> <view class="items">生产日期:{{ ele.BLDAT }}</view>
......
...@@ -141,15 +141,24 @@ export default { ...@@ -141,15 +141,24 @@ export default {
}, },
handleInputNlpla(e) { handleInputNlpla(e) {
if (e) { if (e) {
this.nlpla = e; // this.nlpla = e;
this.goodsList.forEach((ele) => { // this.goodsList.forEach((ele) => {
this.totalNum += ele.TOMNG-0; // this.totalNum += ele.TOMNG-0;
ele.NLPLA = ele.NLPLA || this.nlpla; // ele.NLPLA = ele.NLPLA || this.nlpla;
}); // });
} }
}, },
getPlnr(plnr) { getPlnr(plnr) {
this.isDisabled = true; this.isDisabled = true;
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
return
}
this.$u.api.sapApi this.$u.api.sapApi
.sapPlnr({ .sapPlnr({
plnr, plnr,
...@@ -166,11 +175,16 @@ export default { ...@@ -166,11 +175,16 @@ export default {
this.$u.toast('已经存在当前条码'); this.$u.toast('已经存在当前条码');
return return
} }
this.goodsList = this.goodsList.concat(res.DATA); const arr = [
{
...res.DATA[0],
NLPLA: this.nlpla
}
]
this.goodsList = this.goodsList.concat(arr);
this.totalNum = 0; this.totalNum = 0;
this.goodsList.forEach((ele) => { this.goodsList.forEach((ele) => {
this.totalNum += ele.TOMNG - 0 this.totalNum += ele.TOMNG - 0
ele.NLPLA = this.nlpla;
ele.cardNum = 0 ele.cardNum = 0
}); });
this.handleData() this.handleData()
......
...@@ -89,10 +89,10 @@ class Request { ...@@ -89,10 +89,10 @@ class Request {
...options.header, ...options.header,
'content-type': 'application/json;charset=UTF-8', 'content-type': 'application/json;charset=UTF-8',
} }
// url = 'http://192.168.66.119:8080' url = 'http://192.168.3.91:8080'
}else{ }else{
// console.log('mobile') // console.log('mobile')
// url = 'http://192.168.3.91:8080' url = 'http://192.168.3.91:8080'
} }
// 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法 // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
options.url = validate.url(options.url) ? options.url : (url + (options.url.indexOf('/') == 0 ? 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