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);
......
...@@ -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