Commit 7190ef8b authored by xiangzj's avatar xiangzj

生产发料

parent d65625eb
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<StickyNavBar> <StickyNavBar>
<NavBar title="生产发料单号"></NavBar> <NavBar title="生产发料单号"></NavBar>
</StickyNavBar> </StickyNavBar>
<ContentLoadingMore class="cardbox" :loadmore='true' :status="status"> <ContentLoadingMore class="cardbox" :loadmore='true' :status="status" :list='goodsList'>
<view class="cardContent" v-for="(item, index) in goodsList"> <view class="cardContent" v-for="(item, index) in goodsList">
<view class="listItemTitle" @click="handleClick(item)"> <view class="listItemTitle" @click="handleClick(item)">
<view> <view>
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<view class="item">申请单号:{{ item.applyNo }}</view> <view class="item">申请单号:{{ item.applyNo }}</view>
<view class="item">物料编号:{{ item.itemCode }}</view> <view class="item">物料编号:{{ item.itemCode }}</view>
<view class="item">物料描述:{{ item.itemName }}</view> <view class="item">物料描述:{{ item.itemName }}</view>
<view class="item">工作中心:{{ item.workstationName }}</view> <view class="item">作业单元:{{ item.workunitName }}</view>
<view class="item">作业类型:{{ item.materialType ? '补料': '领料' }}</view>
<view class="item">备料状态:{{ item.grantNum? '配货中' : '未配货' }}</view> <view class="item">备料状态:{{ item.grantNum? '配货中' : '未配货' }}</view>
<view class="item">计划时间:{{ item.startTime }}</view> <view class="item">计划时间:{{ item.startTime }}</view>
</view> </view>
...@@ -103,7 +104,7 @@ export default { ...@@ -103,7 +104,7 @@ export default {
}, },
handleClick(item){ handleClick(item){
uni.navigateTo({ uni.navigateTo({
url: `/pages/productionIssuance/productionIssuanceList?order=${JSON.stringify([item])}` url: `/pages/productionIssuance/productionIssuanceList?order=${item.applyNo}`
}); });
}, },
getBtnHandle(row) { getBtnHandle(row) {
......
...@@ -107,9 +107,18 @@ export default { ...@@ -107,9 +107,18 @@ export default {
.then((res) => { .then((res) => {
console.log(res,'-=') console.log(res,'-=')
if (res.code - 200 === 0) { if (res.code - 200 === 0) {
if(res.rows.length){
uni.navigateTo({ uni.navigateTo({
url: `/pages/productionIssuance/productionIssuanceList?order=${applyNo}` url: `/pages/productionIssuance/productionIssuanceList?order=${applyNo}`
}); });
}else{
setTimeout(() => {
this.isFocus = true;
this.isDisabled = false;
this.wxparams = ''
this.$u.toast('未查询到数据');
}, 1000);
}
// const data = res.rows // const data = res.rows
// data.forEach((ele,index) => { // data.forEach((ele,index) => {
// ele.sonItemCode = [] // ele.sonItemCode = []
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +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 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"
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</view> </view>
</StickyNavBar> </StickyNavBar>
<ContentLoadingMore class="cardbox" :list='goodsList'> <ContentLoadingMore class="cardbox" :list='goodsList'>
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.workorderCode"> <view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList :item='item' :list='list'/> <scanningList :item='item' :list='list'/>
</view> </view>
</ContentLoadingMore> </ContentLoadingMore>
...@@ -241,32 +241,35 @@ export default { ...@@ -241,32 +241,35 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res) { if (res) {
this.goodsList.forEach((ele,index) => { this.list.forEach((ele,index) => {
// ele.NLPLA = this.nlpla this.$set(this.list,index,{...ele,...res.BKDT})
ele.LGBER = res.BKDT.LGBER
ele.LGNUM = res.BKDT.LGNUM
ele.LGPLA = res.BKDT.LGPLA
ele.NLTYP = res.BKDT.NLTYP
}) })
} else { } else {
} }
}); });
}, },
factorial(res,plnr,idx,num=0) { factorial(res,plnr,idx,num=0) {
// 先找出符合条件的数组长度
// const arr = this.list.filter(item => item.itemCode.slice(9, 18) === plnr.slice(20, 29)) // const arr = this.list.filter(item => item.itemCode.slice(9, 18) === plnr.slice(20, 29))
// 找出符合条件的数组长度
const count = this.list.filter(item => item.itemCode.slice(9, 18) === plnr.slice(20, 29)).length const count = this.list.filter(item => item.itemCode.slice(9, 18) === plnr.slice(20, 29)).length
if(!count){
this.$u.toast('没有匹配到对应物料');
return
}
for (let m = 0; m < this.list.length; m++) { for (let m = 0; m < this.list.length; m++) {
if(this.list[m].itemCode.slice(9, 18) === plnr.slice(20, 29)){ if(this.list[m].itemCode.slice(9, 18) === plnr.slice(20, 29)){
// 这是递归的方法
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.list[idx].charg = res.BLPL[0].CHARG
this.list[idx].vista = this.list[idx].applyNum // 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.list[idx].charg = res.BLPL[0].CHARG
this.list[idx].vista = num // 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)
} }
} }
...@@ -275,13 +278,16 @@ export default { ...@@ -275,13 +278,16 @@ export default {
// if(this.list[m].grantNum){ // if(this.list[m].grantNum){
// 发过多少货 // 发过多少货
// }else{ // }else{
// 没有填入数据的
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 = { const newCard = {
...this.list[m-1], ...this.list[m-1],
vista : this.list[m-1].applyNum - this.list[m-1].vista, vista : this.list[m-1].applyNum - this.list[m-1].vista,
add: '1', add: '1',
charg: res.BLPL[0].CHARG charg: res.BLPL[0].CHARG,
... res.BLPL[0]
} }
this.list.splice(m, 0, newCard); this.list.splice(m, 0, newCard);
if( Math.floor(plnr.slice(29, 40)) > (this.list[m-1].applyNum - this.list[m-1].vista)){ if( Math.floor(plnr.slice(29, 40)) > (this.list[m-1].applyNum - this.list[m-1].vista)){
...@@ -289,161 +295,43 @@ export default { ...@@ -289,161 +295,43 @@ export default {
} }
return return
} }
// 只有一个
if(count === 1){ if(count === 1){
this.$set(this.list,m,{...this.list[m],vista : Math.floor(plnr.slice(29, 40)),charg: res.BLPL[0].CHARG}) this.$set(this.list,m,{...this.list[m],vista : Math.floor(plnr.slice(29, 40)),charg: res.BLPL[0].CHARG,... res.BLPL[0]})
}else{ }else{
if( Math.floor(plnr.slice(29, 40)) > this.list[m].applyNum){ if( Math.floor(plnr.slice(29, 40)) > this.list[m].applyNum){
if(count === m){ if(count === m){
this.$set(this.list,m,{...this.list[m],vista : Math.floor(plnr.slice(29, 40)),charg: res.BLPL[0].CHARG}) this.$set(this.list,m,{...this.list[m],vista : Math.floor(plnr.slice(29, 40)),charg: res.BLPL[0].CHARG,... res.BLPL[0]})
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}) 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,Math.floor(plnr.slice(29, 40))-this.list[m].applyNum) this.factorial(res,plnr,m+1,Math.floor(plnr.slice(29, 40))-this.list[m].applyNum)
return; return;
}else{ }else{
this.$set(this.list,m,{...this.list[m],vista : Math.floor(plnr.slice(29, 40)),charg: res.BLPL[0].CHARG}) this.$set(this.list,m,{...this.list[m],vista : Math.floor(plnr.slice(29, 40)),charg: res.BLPL[0].CHARG,... res.BLPL[0]})
} }
} }
}else{ }else{
if(this.list[m].vista < this.list[m].applyNum){ if(this.list[m].vista < this.list[m].applyNum){
if(count === m){ if(count === m || count === 1){
console.log(`output->res.BLPL[0].CHARG`,res.BLPL[0].CHARG)
const newCard = { const newCard = {
...this.list[m], ...this.list[m],
vista : Math.floor(plnr.slice(29, 40)) , vista : Math.floor(plnr.slice(29, 40)) ,
add: '1', add: '1',
charg: res.BLPL[0].CHARG charg: res.BLPL[0].CHARG,
... res.BLPL[0]
} }
this.list.splice(m+1, 0, newCard); this.list.splice(m+1, 0, newCard);
return return
} }
}else{ }else{
this.$u.toast('暂无剩余工单'); this.$u.toast('暂无剩余物料');
} }
} }
// } // }
} }
} }
// if(idx){
// // 大于
// if(arr[idx]){
// if(num > arr[idx].applyNum){
// arr[idx].vista = arr[idx].applyNum
// arr[idx].PACMG = res.BLPL[0].PACMG
// arr[idx].aufnr = arr[idx].workorderCode,
// arr[idx].mtsnr = arr[idx].applyNo,
// arr[idx].zeile = idx,
// arr[idx].werks = plnr.slice(41, 45),
// arr[idx].erfmg = arr[idx].applyNum
// arr[idx].charg = plnr.slice(45, 55)
// arr[idx].plnr = plnr.slice(12, 18)
// // arr[idx].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[idx].NLBER = res.BLPL[0].NLBER || '001'
// arr[idx].MATNR = res.BLPL[0].MATNR
// arr[idx].WERKS = res.BLPL[0].WERKS
// arr[idx].lgort = res.BLPL[0].LGORT
// this.factorial(res,plnr,idx+1,num-arr[idx].applyNum)
// }else{
// arr[idx].vista = num
// arr[idx].PACMG = res.BLPL[0].PACMG
// arr[idx].aufnr = arr[idx].workorderCode,
// arr[idx].mtsnr = arr[idx].applyNo,
// arr[idx].zeile = idx,
// arr[idx].werks = plnr.slice(41, 45),
// arr[idx].erfmg = arr[idx].applyNum
// arr[idx].charg = plnr.slice(45, 55)
// arr[idx].plnr = plnr.slice(12, 18)
// // arr[idx].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[idx].NLBER = res.BLPL[0].NLBER || '001'
// arr[idx].MATNR = res.BLPL[0].MATNR
// arr[idx].WERKS = res.BLPL[0].WERKS
// arr[idx].lgort = res.BLPL[0].LGORT
// this.factorial(res,plnr,idx+1,0)
// }
// }
// return
// }
// // 扫pl获取数量 从第一个开始匹配 超了就往下找
// for (let i = 0; i < arr.length; i++) {
// // 已发
// if(arr[i].grantNum){
// }else{
// if(!arr[i].vista){
// if(arr[i-1] && arr[i-1].vista < arr[i-1].applyNum){
// const newCard = {
// ...arr[i-1],
// LGNUM : res.BLPL[0].LGNUM || 'W00',
// NLBER : res.BLPL[0].NLBER || '001',
// MATNR : res.BLPL[0].MATNR,
// WERKS : res.BLPL[0].WERKS,
// lgort : res.BLPL[0].LGORT,
// PACMG : res.BLPL[0].PACMG,
// vista : arr[i-1].applyNum-arr[i-1].vista,
// erfmg : arr[i].applyNum,
// add: '1'
// }
// this.list.splice(i+1, 0, newCard);
// if( Math.floor(plnr.slice(29, 40)) > (arr[i-1].applyNum - arr[i-1].vista)){
// this.factorial(res,plnr, i+1, Math.floor(plnr.slice(29, 40)) - (arr[i-1].applyNum - arr[i-1].vista))
// }
// return;
// }
// if(arr.length - 1 === i){
// arr[i].vista = Math.floor(plnr.slice(29, 40))
// arr[i].PACMG = res.BLPL[0].PACMG
// arr[i].aufnr = arr[i].workorderCode,
// arr[i].mtsnr = arr[i].applyNo,
// arr[i].zeile = i,
// arr[i].werks = plnr.slice(41, 45),
// arr[i].erfmg = arr[i].applyNum
// arr[i].charg = plnr.slice(45, 55)
// arr[i].plnr = plnr.slice(12, 18)
// // arr[i].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[i].NLBER = res.BLPL[0].NLBER || '001'
// arr[i].MATNR = res.BLPL[0].MATNR
// arr[i].WERKS = res.BLPL[0].WERKS
// arr[i].lgort = res.BLPL[0].LGORT
// }else{
// // pl>发货数量
// if( Math.floor(plnr.slice(29, 40)) > arr[i].applyNum){
// arr[i].vista = arr[i].applyNum
// arr[i].PACMG = res.BLPL[0].PACMG
// arr[i].aufnr = arr[i].workorderCode,
// arr[i].mtsnr = arr[i].applyNo,
// arr[i].zeile = i,
// arr[i].werks = plnr.slice(41, 45),
// arr[i].erfmg = arr[i].applyNum
// arr[i].charg = plnr.slice(45, 55)
// arr[i].plnr = plnr.slice(12, 18)
// // arr[i].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[i].NLBER = res.BLPL[0].NLBER || '001'
// arr[i].MATNR = res.BLPL[0].MATNR
// arr[i].WERKS = res.BLPL[0].WERKS
// arr[i].lgort = res.BLPL[0].LGORT
// this.factorial(res,plnr,i+1,Math.floor(plnr.slice(29, 40))-arr[i].applyNum)
// return;
// }else{
// arr[i].vista = Math.floor(plnr.slice(29, 40))
// arr[i].PACMG = res.BLPL[0].PACMG
// arr[i].aufnr = arr[i].workorderCode,
// arr[i].mtsnr = arr[i].applyNo,
// arr[i].zeile = i,
// arr[i].werks = plnr.slice(41, 45),
// arr[i].erfmg = arr[i].applyNum
// arr[i].charg = plnr.slice(45, 55)
// arr[i].plnr = plnr.slice(12, 18)
// // arr[i].LGNUM = res.BLPL[0].LGNUM || 'W00'
// arr[i].NLBER = res.BLPL[0].NLBER || '001'
// arr[i].MATNR = res.BLPL[0].MATNR
// arr[i].WERKS = res.BLPL[0].WERKS
// arr[i].lgort = res.BLPL[0].LGORT
// }
// }
// }
// }
// }
// this.totalNum = this.goodsList.filter(ele=>ele.vista).length
} }
} }
}; };
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<view v-if="!show" class="bottomBox"> <view v-if="!show" class="bottomBox">
<view class="bottomItem" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode"> <view class="bottomItem" v-for="(ele, idx) in list" :key="ele.workorderCode+idx" v-if="ele.itemCode === item.itemCode">
<view class="items">生产单号:{{ ele.applyNo }}</view> <view class="items">生产单号:{{ ele.applyNo }}</view>
<view class="items">物料批次:{{ ele.charg }}</view> <view class="items">物料批次:{{ ele.CHARG }}</view>
<!-- <view class="items">库位:{{ item.MATNR }}</view> --> <!-- <view class="items">库位:{{ item.MATNR }}</view> -->
<!-- <view class="items">{{ item.MATNR }}</view> --> <!-- <view class="items">{{ item.MATNR }}</view> -->
<view class="items inputItem"> <view class="items inputItem">
......
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