From 5e04f49e7d40182f0175033cd5a0a60f31293886 Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Mon, 31 Oct 2022 18:16:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=87=BA=E8=B4=A7=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ProcessMaterialsDeliveryForm.vue | 264 ++++++++++++------ .../ProcessSuppliesStrongerList.vue | 9 +- .../modules/ProcessSuppliesStrongerForm.vue | 36 +-- 3 files changed, 205 insertions(+), 104 deletions(-) diff --git a/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue b/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue index 5ad66c8..b08ba44 100644 --- a/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue +++ b/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue @@ -60,7 +60,14 @@ @valueChange ="onSelect" :rowNumber="true" :rowSelection="true" - :actionButton="true"/> + :actionButton="true" + @added="addid" + > + + + + +
@@ -104,8 +111,8 @@ import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany' }, data() { return { - accountingAttributesVal: '', heid: true, + addId : '', bigIdMerchandiseNewsList:[], labelCol: { xs: { span: 24 }, @@ -194,6 +201,7 @@ import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany' width:"200px", placeholder: '请输入${title}', defaultValue:'', + // slotName: 'qing' }, { title: '实发数', @@ -334,24 +342,29 @@ import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany' console.log(userInfo) // userInfo.company=company; this.popupCallback(company,userInfo); - this.fetchData(); }, methods: { + //请数量输入 + addid(val){ + this.addId = val.row.id; + // console.log(this.addId); + }, + //核算属性切换 isMaterialType(val){ if(val !== undefined){ - this.accountingAttributesVal = val; this.heid = false; + this.fetchData(val); } // console.log("执行l",val); }, //table 值改变触发 - onSelect(record) { - console.log(record) + async onSelect(record) { + // console.log(record) if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment === ''){ // console.log("执行materialGroup") - this.fetchMerchandiseNews(record.row.materialGroup); + this.fetchMerchandiseNews(record.row.materialGroup,1); } - if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== ''){ + if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.actualSendNumber === '' ){ // console.log("执行materialNumber") let materialName = { } this.bigIdMerchandiseNewsList.forEach( item => { @@ -361,7 +374,7 @@ import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany' unit: item.materialsUnit, supplierName: item.supplierName, price: item.price, - residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, + // residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, } } @@ -376,96 +389,183 @@ import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany' 'materialUnit': materialName.unit, 'supplier': materialName.supplierName, 'materialPrice': materialName.price, - 'actualSendNumber': materialName.residueNumber, - 'materialAmount': materialName.price * materialName.residueNumber, + // 'actualSendNumber': materialName.residueNumber, + // 'materialAmount': materialName.price * materialName.residueNumber, }, }, ] this.$refs.processMaterialsDeliveryList.setValues(values); } - // - // if(record.row.pleaseSendNumber !== '' && record.row.materialPrice !== '' && record.row.pleaseSendNumber !== undefined && record.row.materialPrice !== undefined){ - // // record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice; - // let values = [ - // { - // rowKey: record.row.id, - // values: { - // 'equipment': record.row.equipment, - // 'materialGroup': record.row.materialGroup, - // 'materialName': record.row.materialName, - // 'materialUnit': record.row.materialUnit, - // 'supplier': record.row.supplier, - // 'materialPrice': record.row.materialPrice, - // 'materialAmount': record.row.pleaseSendNumber * record.row.materialPrice, - // }, - // }, - // ] - // this.$refs.processMaterialsDeliveryList.setValues(values); - // } + let a = false; + let numberStar = 0; + let numberEnd = 0; + // 根据请发数量计算 + if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined){ + // record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice; + let num = 0; + this.bigIdMerchandiseNewsList.forEach( item =>{ + console.log("item",item); + numberStar = item.batch.substring(0,item.batch.indexOf("/")); + numberEnd = item.batch.slice(numberStar.length+1); + num = record.row.pleaseSendNumber - item.residueNumber; + if(num > 0){ + // 限制最大数量 + record.row.pleaseSendNumber = item.residueNumber; + record.row.actualSendNumber = record.row.pleaseSendNumber; + this.$refs.processMaterialsDeliveryList.handleClickAdd(); + a =true; + }else{ + record.row.actualSendNumber = record.row.pleaseSendNumber; + // console.log("执行了222" ,record.row.actualSendNumber); + } + }); + let drop = record.row.materialGroup; + let values = [ + { + rowKey: record.row.id, + values: { + 'equipment': record.row.equipment, + 'materialGroup': record.row.materialGroup, + 'materialName': record.row.materialName, + 'materialUnit': record.row.materialUnit, + 'supplier': record.row.supplier, + 'materialPrice': record.row.materialPrice, + 'actualSendNumber': record.row.actualSendNumber, + 'materialAmount': record.row.actualSendNumber * record.row.materialPrice, + 'pleaseSendNumber' : record.row.pleaseSendNumber, + }, + }, + ] + this.$refs.processMaterialsDeliveryList.setValues(values); + //重新赋值 + if(a){ + let merchandiseNewser = {}; + let merchandiseNews = {}; + let is = false; + let onIs= false; + do{ + // console.log("numberStar",parseInt(numberStar)+1) + merchandiseNewser =await this.fetchMerchandiseNews(drop,parseInt(numberStar)+1); + // console.log(merchandiseNewser); + merchandiseNewser.forEach( item => { + merchandiseNews = item; + }); + // console.log(merchandiseNews); + let sum = num - merchandiseNews.residueNumber; + if( sum > 0 ){ + // console.log("大于"); + // console.log("numberEnd",numberEnd); + // console.log("merchandiseNews.batch.substring()",merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/"))); + //第三批 + let isLose = parseInt(numberEnd) - parseInt( merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/")) ); + if(isLose === 0 ){ + onIs = true; + }else { + is = true; + numberStar = numberStar+1; + this.$refs.processMaterialsDeliveryList.handleClickAdd(); + } + }else{ + sum = num; + // console.log("小于"); + is = false; + } + let values = [ + { + rowKey: this.addId, + values: { + 'equipment': record.row.equipment, + 'materialGroup': record.row.materialGroup, + 'materialName': record.row.materialName, + 'materialUnit': record.row.materialUnit, + 'supplier': record.row.supplier, + 'materialPrice': record.row.materialPrice, + 'actualSendNumber': sum, + 'materialAmount': sum * record.row.materialPrice, + 'pleaseSendNumber' : sum, + }, + }, + ] + this.$refs.processMaterialsDeliveryList.setValues(values); + if(onIs){ + this.$message.warn('没有更多批次了'); + is = false; + return; + } + }while (is); + } + } }, - fetchMerchandiseNews(value){ //查询物料清单信息 + fetchMerchandiseNews(value,batch){ //查询物料清单信息 //查询大品类数据 - let par = { - delFlag: 0, - descriptionId:value, - } - this.bigIdMerchandiseNews = []; - this.bigIdMerchandiseNewsList = []; - let qc = []; - let numberList = []; - if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ - this.processMaterialsDeliveryListTable.columns[1].options = []; - } - this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ - // console.log(a,b,c) - b.forEach(item =>{ - if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ - numberList.push(item.materialNumber); - } + return new Promise((resolve, reject) => { + //你的逻辑代码 + let par = { + delFlag: 0, + descriptionId:value, + batchNum: batch, + } + this.bigIdMerchandiseNews = []; + this.bigIdMerchandiseNewsList = []; + let qc = []; + let numberList = []; + if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ + this.processMaterialsDeliveryListTable.columns[1].options = []; + } + this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ + // console.log(a,b,c) + b.forEach(item =>{ + if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ + numberList.push(item.materialNumber); + } + }); }); - }); - getAction(this.url.merchandiseNewsList,par).then((res)=>{ - if(res.success){ - console.log(res.result); - let newList = res.result; - // console.log("12312312:"+numberList.length); - if(numberList.length > 0){ - newList.forEach( item => { - qc.push({ - title : item.materialsNumber, - value : item.merchandiseNewsId, - disabled : false + getAction(this.url.merchandiseNewsList,par).then((res)=>{ + if(res.success){ + console.log(res.result); + let newList = res.result; + // console.log("12312312:"+numberList.length); + if(numberList.length > 0){ + newList.forEach( item => { + qc.push({ + title : item.materialsNumber, + value : item.merchandiseNewsId, + disabled : false + }) }) - }) - numberList.forEach( num => { - qc.forEach( i => { - if(num === i.value){ - // console.log(num,i.value); - i.disabled = true; - } - }); - }) - this.processMaterialsDeliveryListTable.columns[1].options = qc; - }else{ - newList.forEach( item => { - this.processMaterialsDeliveryListTable.columns[1].options.push({ - title : item.materialsNumber, - value : item.merchandiseNewsId, - disabled : false + numberList.forEach( num => { + qc.forEach( i => { + if(num === i.value){ + // console.log(num,i.value); + i.disabled = true; + } + }); }) - }) + this.processMaterialsDeliveryListTable.columns[1].options = qc; + }else{ + newList.forEach( item => { + this.processMaterialsDeliveryListTable.columns[1].options.push({ + title : item.materialsNumber, + value : item.merchandiseNewsId, + disabled : false + }) + }) + } + // console.log(this.processUdgetPlanMaterialTable.columns[1].options); + resolve(this.bigIdMerchandiseNewsList = res.result ); + // return } - // console.log(this.processUdgetPlanMaterialTable.columns[1].options); - this.bigIdMerchandiseNewsList = res.result; - } + }); + }); + }, - fetchData(){ //查询物料组 + fetchData(value){ //查询物料组 //查询大品类数据 let par = { delFlag: 0, - accountingAttributes: this.accountingAttributesVal, + accountingAttributes: value, } getAction(this.url.descriptionRake,par).then((res)=>{ if(res.success){ diff --git a/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue b/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue index 549e228..1cc3368 100644 --- a/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue +++ b/src/views/suppliesstronger/ProcessSuppliesStrongerList.vue @@ -35,6 +35,7 @@
+ 新增 导出 导入 @@ -143,22 +144,22 @@ { title:'物料组', align:"center", - dataIndex: 'itemGroup' + dataIndex: 'descriptionName' }, { title:'物料', align:"center", - dataIndex: 'item' + dataIndex: 'materialsNumber' }, { title:'物料描述', align:"center", - dataIndex: 'itemDescription' + dataIndex: 'merchandiseName' }, { title:'计量单位', align:"center", - dataIndex: 'unitMeasurement' + dataIndex: 'materialsUnit' }, { title:'数量', diff --git a/src/views/suppliesstronger/modules/ProcessSuppliesStrongerForm.vue b/src/views/suppliesstronger/modules/ProcessSuppliesStrongerForm.vue index 0eed1d1..d4018ce 100644 --- a/src/views/suppliesstronger/modules/ProcessSuppliesStrongerForm.vue +++ b/src/views/suppliesstronger/modules/ProcessSuppliesStrongerForm.vue @@ -10,35 +10,35 @@ - - - - - - + + + + + + - + - - {{item.itemGroup}} - - - - - - + + + - - + + + + + + + - +