Commit c1f4076a authored by xiangzj's avatar xiangzj

调整生产领料规则

parent 0a7603ac
......@@ -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),
},
mesApi:{
//生产领料
//生产领料查询单号
pdaMaterialcreate: (params = {}) => vm.$u.get(config.adminPath + 'apiPda/material/pdaMaterialcreate', params),
// 生产退料
// 生产退料查询单号
pdaMaterialReturn: (params = {}) => vm.$u.get(config.adminPath + '/apiPad/materialReturn/pdaMaterialReturn', 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),
......
......@@ -92,7 +92,30 @@ const install = (Vue, vm) => {
}
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 (data.token) {
vm.$u.vuex('vuex_token', data.token);
......
......@@ -125,7 +125,7 @@ export default {
this.getDepotLists();
// 二维码包含:10位物料号(右对齐不足补充为0)物料号12位生产单号(右对齐不足补充为0),
// 10位批次号(右对齐不足补充为0),8位数量(100000.0)(右对齐不足补充为0)
this.getPlnr('006000000100100000000300000501001');
// this.getPlnr('006000000100100000000300000501001');
},
computed:{
totalNum(){
......@@ -191,7 +191,6 @@ export default {
INSNAM: ele.checkBy,
ZMNGO: ele.totalQuantity,
ZMNGL: ele.lossNum,
NLPLA: this.nlpla,
})
});
params.push({
......@@ -239,13 +238,18 @@ export default {
getPlnr(qrcode) {
this.isDisabled = true;
this.isFocus = false
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
this.reset()
return
}
this.$u.api.mesApi
.pdaFindPackageLinkInfo({
qrcode
})
.then((res) => {
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.reset()
return
......@@ -255,7 +259,7 @@ export default {
this.reset()
return
}
this.goodsList.push(res.data)
this.goodsList.push({...res.data,NLPLA: this.nlpla})
this.reset()
} else {
this.reset()
......
......@@ -6,6 +6,7 @@
<view class="item">工单编号:{{ item.workorderNo }}</view>
<view class="item">产品编号:{{ item.sapItemCode }}</view>
<view class="item">产品描述:{{ item.itemName }}</view>
<view class="item">入库仓位:{{ item.NLPLA }}</view>
<view class="item">入库数量:{{ item.quantity }}</view>
</view>
<u-button size="mini" type="primary" plain @click="deleGonds(idx)">
......@@ -29,9 +30,9 @@
</view>
<view v-if="!show" class="bottomBox">
<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.BLDAT }}</view>
<!-- <view class="items">生产日期:{{ item.BLDAT }}</view> -->
</view>
</view>
</view>
......
......@@ -100,7 +100,7 @@ export default {
},
],
form: {
ZZXFS: '',
ZZXFS: 'BL+PL',
zxspe: '', //箱规格(cm)
zxvolum: '', //体积(m132)
zxntgew: '', //箱重(kg)
......@@ -130,6 +130,14 @@ export default {
this.$u.toast('暂无提交数据');
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 = []
this.goodsList.forEach(ele => {
arr.push(
......@@ -170,16 +178,24 @@ export default {
handleInputNlpla(e){
console.log(`output->e`,e)
},
handleInputPlnr(e) {
this.isFocus = false;
this.isDisabled = true;
e && this.goodsList.push(e)
reset(){
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = ''
}, 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回调
actionSheetCallback(index) {
this.form.ZZXFS = this.actionSheetList[index].text;
......
......@@ -5,7 +5,7 @@
<view class="headerTitle">
<view class="">
<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>
<view class="checkedCase">
......@@ -15,6 +15,7 @@
</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"
......@@ -62,7 +63,7 @@ export default {
// totalNum: 0,
number: 0,
show: true,
nlpla: 'YD-02-02-3',
nlpla: '',
wxparams: '',
btnArr: [
{
......@@ -131,29 +132,9 @@ export default {
if (res && 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.sapItemCode === item.sapItemCode) === index;
});
// let i=null,j=null
// for(i = 0; i < result.length; i++){
// for(j = 0; j < result[i].sonItemCode.length; j++){
// if(result[i].itemCode !== result[i].sonItemCode[j].itemCode){
// result[i].sonItemCode.splice(j,1)
// j--
// }else{
// result[i].applyNum1 += result[i].sonItemCode[j].applyNum
// }
// }
// }
// result.forEach((ele,index) => {
// ele.applyNum = []
// })
this.goodsList = [...result]
} else {
this.$u.toast(res.msg);
......@@ -177,25 +158,7 @@ export default {
if (this.list.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位
// // 'quantityIssued': '1', // 来自PDA。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
let arr = this.list.filter(ele=>ele.quantityIssued)
// "windCase": null,是否结案 Y是 N否
arr.forEach((ele,index) => {
ele.windCase = this.checkedBox ? 'Y': 'N'
......@@ -203,11 +166,11 @@ export default {
ele.ERFMG = ele.quantityIssued
ele.MTSNR = ele.applyNo
ele.ZEILE = index+1
ele.RSNUM = ele.requirementNumber
ele.RSPOS = ele.requirementProjectNumber
ele.RSNUM = ele.requirementNumber || '10'
ele.RSPOS = ele.requirementProjectNumber || '2'
})
const params = {
'zencode': 'A008',
'zencode': 'A009',
'item': arr
}
this.$u.api.sapApi
......@@ -230,12 +193,12 @@ export default {
handleMes(arr,num){
arr.forEach(ele => {
ele.batchCode = ele.CHARG
ele.quantityIssued = ele.quantityIssued
ele.backNum = ele.quantityIssued
ele.issueCode = num
ele.issueType = ele.materialType
});
this.$u.api.mesApi
.pdaSapissuecreate(arr)
.pdaMaterialReturnNum(arr)
.then((res) => {
this.loading = false;
console.log(res);
......@@ -255,10 +218,15 @@ export default {
getPlnr(plnr) {
this.isDisabled = true;
this.isFocus = false
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
this.reset()
return
}
this.$u.api.sapApi
.sapBlpl({
plnr,
ztype: '002'
ztype: '003'
})
.then((res) => {
if (res && res.MSG[0].TYPE === 'S') {
......@@ -289,18 +257,14 @@ export default {
}
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.list[idx].charg = res.BLPL[0].CHARG
// 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.$set(this.list,idx,{...this.list[idx],quantityIssued : this.list[idx].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
this.factorial(res,plnr,idx+1,num-this.list[idx].applyNum)
}else{
// this.list[idx].charg = res.BLPL[0].CHARG
// this.list[idx].quantityIssued = num
this.$set(this.list,idx,{...this.list[idx],quantityIssued : num,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.$set(this.list,idx,{...this.list[idx],quantityIssued : num,charg: res.BLPL[0].CHARG,... res.BLPL[0],NLPLA: this.nlpla})
this.factorial(res,plnr,idx+1,0)
}
}
......@@ -318,7 +282,8 @@ export default {
quantityIssued : this.list[m-1].applyNum - this.list[m-1].quantityIssued,
add: '1',
charg: res.BLPL[0].CHARG,
... res.BLPL[0]
... res.BLPL[0],
NLPLA: this.nlpla
}
this.list.splice(m, 0, newCard);
if( res.BLPL[0].PACMG > (this.list[m-1].applyNum - this.list[m-1].quantityIssued)){
......@@ -328,19 +293,19 @@ export default {
}
// 只有一个
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{
if( res.BLPL[0].PACMG > this.list[m].applyNum){
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
}
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)
return;
}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{
......@@ -351,7 +316,8 @@ export default {
quantityIssued : res.BLPL[0].PACMG ,
add: '1',
charg: res.BLPL[0].CHARG,
... res.BLPL[0]
... res.BLPL[0],
NLPLA: this.nlpla
}
this.list.splice(m+1, 0, newCard);
return
......
......@@ -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="items">生产单号:{{ ele.workorderCode }}</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 inputItem">
数量:
......
......@@ -8,8 +8,8 @@
<view class="listItemTitle" @click="handleClick(item)">
<view>
<view class="item">申请单号:{{ item.applyNo }}</view>
<view class="item">物料编号:{{ item.sapItemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view>
<!-- <view class="item">物料编号:{{ item.sapItemCode }}</view> -->
<!-- <view class="item">物料描述:{{ item.itemName }}</view> -->
<view class="item">作业单元:{{ item.workunitName }}</view>
<view class="item">作业类型:{{ item.materialType ? '补料': '领料' }}</view>
<view class="item">备料状态:{{ item.grantNum? '配货中' : '未配货' }}</view>
......@@ -144,6 +144,9 @@ export default {
.then((res) => {
if (res && res.code - 200 === 0) {
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
} else {
this.$u.toast(res.msg);
......
<template>
<view>
<view class="page">
<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].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view>
<view class="">
<view class="checkedCase">
<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"
......@@ -29,55 +28,17 @@
<view class="left">物料明细</view>
<view class="right">
物料数量:
<text class="blue">{{ totalNum }}</text>
<text class="line">/</text>
<!-- <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'/>
<ContentLoadingMore class="cardbox" :list='goodsList'>
<view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList :item='item' :list='list'/>
</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> -->
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
......@@ -98,7 +59,7 @@ export default {
return {
checkedBox: false,
r1:'',
totalNum: 0,
// totalNum: 0,
number: 0,
show: true,
nlpla: 'YD-02-02-3',
......@@ -118,27 +79,48 @@ export default {
}
],
goodsList: [],
isFocus: false,
isFocus: true,
isDisabled: false,
OrderNum: '',
list: []
};
},
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) {
if(option && option.order){
this.OrderNum = option.order
this.getOrder(option.order)
}
},
watch: {
},
created() {
this.handleInputNlpla()
this.getPlnr('100021240419000001|00010001020000050.000|10002441900001');
},
methods: {
reset(){
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
},
getOrder(applyNo) {
this.totalNum = 0;
this.isDisabled = true;
this.$u.api.mesApi
.pdaMaterialcreate({
pageNum:1,
......@@ -147,32 +129,32 @@ export default {
})
.then((res) => {
if (res && 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
})
// 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;
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
}
}
}
// 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);
}
......@@ -192,30 +174,21 @@ export default {
});
},
goSubmit() {
if (this.goodsList.length === 0) {
if (this.list.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。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
let arr = this.list.filter(ele=>ele.vista)
// "windCase": null,是否结案 Y是 N否
this.goodsList.forEach((ele) => {
arr.forEach((ele,index) => {
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 = {
'zencode': 'A008',
'item': arr
......@@ -228,10 +201,8 @@ export default {
return
}
if (res.every((item) => item.TYPE === 'S')) {
this.goodsList = [];
this.nlpla = '';
this.wxparams = '';
this.$u.toast('提交成功');
// this.$u.toast('提交成功');
this.handleMes(arr,res[0].MESSAGE_V1)
}
const foundObject = res.find(item => item.TYPE === 'E');
if(foundObject && foundObject.MESSAGE){
......@@ -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) {
e && this.getPlnr(e);
},
getPlnr(plnr) {
this.totalNum = 0;
this.isDisabled = true;
this.isFocus = false
this.$u.api.sapApi
.sapBlpl({
plnr
plnr,
ztype: '002'
})
.then((res) => {
if (res && 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
}
if (this.list.some((item) => item.PLNR === plnr)) {
this.reset()
this.$u.toast('已经存在当前条码');
return
}
res.BLPL.forEach(ele => {
ele.vista = 0
});
this.totalNum = this.goodsList.filter(ele=>ele.vista).length
// this.handleAverage(res,plnr)
this.factorial(res,plnr,0)
this.reset()
} else {
this.reset()
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 {
}
});
// 按照比例来分的方法
handleAverage(res,plnr){
console.log(`output->`,this.list)
let arr = []
for (let m = 0; m < this.list.length; m++) {
if(this.list[m].sapItemCode == res.BLPL[0].MATNR){
arr.push(this.list[m])
}
}
let total = 0
arr.forEach(ele => {
total += ele.applyNum
});
this.list.forEach((ele,idx) => {
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>
......@@ -416,4 +515,7 @@ page {
top: 0 !important;
background: #fff;
}
.checkedCase{
margin-top: 10rpx;
}
</style>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<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].workstationCode}}/{{goodsList[0]&&goodsList[0].workstationName}}</view>
<view class="items">计划日期:{{goodsList[0]&&goodsList[0].startTime}}</view>
</view>
<view class="checkedCase">
......@@ -177,23 +177,6 @@ export default {
if (this.list.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。本方案中,目标下架数量=实际下架数量,无差异
// })
// })
let arr = this.list.filter(ele=>ele.vista)
// "windCase": null,是否结案 Y是 N否
......@@ -267,7 +250,7 @@ export default {
this.$u.toast('已经存在当前条码');
return
}
this.factorial(res,plnr,0)
this.factorial({...res.BLPL[0]},plnr,0)
this.reset()
} else {
this.reset()
......@@ -276,31 +259,33 @@ export default {
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) {
// 找出符合条件的数组长度
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
const count = this.list.filter(item => item.sapItemCode == res.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(this.list[m].sapItemCode == res.MATNR){
// 递归的方法
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.$set(this.list,idx,{...this.list[idx],vista : this.list[idx].applyNum,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
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.list[idx].charg = res.BLPL[0].CHARG
// this.list[idx].vista = num
this.$set(this.list,idx,{...this.list[idx],vista : num,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.$set(this.list,idx,{...this.list[idx],vista : num,... res})
this.factorial(res,plnr,idx+1,0)
}
}
......@@ -313,49 +298,57 @@ export default {
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))
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.BLPL[0].PACMG,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.$set(this.list,m,{...this.list[m],vista : res.PACMG,... res})
}else{
if( res.BLPL[0].PACMG > this.list[m].applyNum){
if( res.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]})
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,charg: res.BLPL[0].CHARG,... res.BLPL[0]})
this.factorial(res,plnr,m+1,res.BLPL[0].PACMG-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.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{
if(this.list[m].vista < this.list[m].applyNum){
// if(count === m || count === 1){
const newCard = {
...this.list[m],
vista : res.BLPL[0].PACMG ,
add: '1',
charg: res.BLPL[0].CHARG,
... res.BLPL[0]
let arr = []
this.list.forEach(ele => {
console.log(`output->`,ele.workorderCode,this.list[m].workorderCode)
if(ele.workorderCode === this.list[m].workorderCode){
arr.push(ele)
}
});
let totalApplyNum = (arr[0].applyNum-0)
let totalVista =0
arr.forEach(ele => {
totalVista = totalVista + (ele.vista?(ele.vista-0):0)
});
// 最终填入的数量
let endVista = 0
endVista = ((this.list[m].applyNum - 0)-(this.list[m].vista-0)).toFixed(3)
if(m===this.list.length-1){
endVista = res.PACMG - 0
}
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
// }
}
}else{
this.$u.toast('暂无剩余物料');
}
......
......@@ -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="items">生产单号:{{ ele.workorderCode }}</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 inputItem">
数量:
......@@ -83,7 +83,7 @@ export default {
let num = 0
this.list.forEach(ele => {
if(ele.itemCode === this.item.itemCode){
num += ele.vista
num += (ele.vista-0)
}
});
return num || ''
......
......@@ -6,7 +6,6 @@
<view class="item">物料编号:{{ item.MATNR }}</view>
<view class="item">物料描述:{{ item.MAKTX }}</view>
<view class="item">入库数量:{{ item.cardNum }}</view>
<view class="item">入库库位:{{ nlpla }}</view>
</view>
</view>
<view class="listBottom">
......@@ -26,6 +25,7 @@
<view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in goodsList" v-if="ele.CHARG === item.CHARG">
<view class="items plNum">{{ ele.PLNR }}</view>
<view class="item">入库库位:{{ ele.NLPLA }}</view>
<view class="items">数量:{{ ele.TOMNG }}</view>
<view class="boxBtn">
<view class="items">生产日期:{{ ele.BLDAT }}</view>
......
......@@ -141,15 +141,24 @@ export default {
},
handleInputNlpla(e) {
if (e) {
this.nlpla = e;
this.goodsList.forEach((ele) => {
this.totalNum += ele.TOMNG-0;
ele.NLPLA = ele.NLPLA || this.nlpla;
});
// this.nlpla = e;
// this.goodsList.forEach((ele) => {
// this.totalNum += ele.TOMNG-0;
// ele.NLPLA = ele.NLPLA || this.nlpla;
// });
}
},
getPlnr(plnr) {
this.isDisabled = true;
if(!this.nlpla){
this.$u.toast('请先扫描仓位');
setTimeout(() => {
this.wxparams = '';
this.isFocus = true;
this.isDisabled = false;
}, 1000);
return
}
this.$u.api.sapApi
.sapPlnr({
plnr,
......@@ -166,11 +175,16 @@ export default {
this.$u.toast('已经存在当前条码');
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.goodsList.forEach((ele) => {
this.totalNum += ele.TOMNG - 0
ele.NLPLA = this.nlpla;
ele.cardNum = 0
});
this.handleData()
......
......@@ -89,10 +89,10 @@ class Request {
...options.header,
'content-type': 'application/json;charset=UTF-8',
}
// url = 'http://192.168.66.119:8080'
url = 'http://192.168.3.91: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