diff --git a/fe/PDA/mycomponents/common/comEasyInput.vue b/fe/PDA/mycomponents/common/comEasyInput.vue index 07514cbed..643c78131 100644 --- a/fe/PDA/mycomponents/common/comEasyInput.vue +++ b/fe/PDA/mycomponents/common/comEasyInput.vue @@ -10,7 +10,8 @@ - + @@ -36,6 +37,11 @@ }, created() { + }, + mounted() { + if (this.$el.querySelector('textarea') != null) { + this.$el.querySelector('textarea').setAttribute('inputmode', 'none') + } }, methods: { openPopup(content) { diff --git a/fe/PDA/pages/task/countFgDetail.vue b/fe/PDA/pages/task/countFgDetail.vue index f95064235..351a5d64e 100644 --- a/fe/PDA/pages/task/countFgDetail.vue +++ b/fe/PDA/pages/task/countFgDetail.vue @@ -8,9 +8,9 @@ - + - + @@ -42,8 +42,8 @@ {{item.inventoryQty}} - @@ -93,7 +93,7 @@ --> - + {{ item.status | statusColor}} @@ -102,7 +102,7 @@ - + {{item.countDescription}} @@ -133,7 +133,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -178,7 +178,8 @@ getCurrDateTime, navigateBack, scanSuccessAudio, - scanFailedAudio + scanFailedAudio, + deepCopyData } from '@/common/basic.js'; import { @@ -249,7 +250,7 @@ names: [], values: [], origin: [] - } + }, } }, props: {}, @@ -345,14 +346,15 @@ }) }, methods: { + initList() { this.index = 1; this.showList = [] this.loadingType = ""; this.showList = this.getDataPage(this.index, this.pageSize) }, - - queryItemCode(){ + + queryItemCode() { this.$refs.wzSelectPopup.open({ mode: 'radio', //radio checkbox 单选、多选 // dataList:[], //如果dataList传入了数组则直接使用传入的数组渲染,无需再配置proxyConfig @@ -373,57 +375,25 @@ selectCheckbox(mode, resultData) { console.log(mode, resultData) var result = resultData - var itemCode = result.itemCode; - var itemScan = this.scanAllDetails.filter(r => - r.itemCode == itemCode&& - r.inventoryStage==this.datacontent.inventoryStage&& - r.isDelete==false) - // if(itemScan.length == 0){ - // let detail = this.creatDetail(result); - // this.setDetailNoBalance(detail, result) - // detail.inventoryQty=result.qty - // detail.countQty =result.qty - // this.scanAllDetails.unshift(detail); - // this.initList(); - // this.calcScanCount(); - // this.$forceUpdate(); - // }else if (itemScan.length == 1){ - // setTimeout(res => { - // showConfirmMsg("物料【" + itemCode + "】已经扫描,是否覆盖已经扫描的信息", res => { - // if (res) { - // this.setQty(itemScan[0], itemScan[0].inventoryQty, false); - // } - // }) - // }, 100) - // } - if (itemScan.length > 0) { - setTimeout(res => { - showConfirmMsg("物料【" + itemCode + "】已经扫描,是否覆盖已经扫描的信息", res => { - if (res) { - this.setQty(itemScan[0], itemScan[0].inventoryQty, false); - } - }) - }, 100) - return; - } - + let items = this.originalDetails.filter(r => - r.itemCode === itemCode&&r.inventoryStage==this.datacontent.inventoryStage) + r.itemCode === itemCode && r.inventoryStage == this.datacontent.inventoryStage) //不在任务列表中,查询库存赋值 if (items.length == 0) { this.addNewDetail(result) } else if (items.length == 1) { var item = items[0]; - item.isNew =true; - this.setQty(item, item.inventoryQty, true); + item.isNew = true; + var addItem = deepCopyData(item) + this.addItemExit(addItem, true); } else { this.showMessage('盘点数量异常,ERP物料号【' + itemCode + '】的出现多条数据'); } - + }, reqGetList(data) { - return getBalancesByItemCode(data.searchValue,data.pageIndex,data.pageSize); + return getBalancesByItemCode(data.searchValue, data.pageIndex, data.pageSize); }, getDetail() { uni.showLoading({ @@ -443,11 +413,11 @@ that.scanAllDetails = res.depDetails.filter(r => r.inventoryStage == res.inventoryStage); that.scanCount = res.depDetails.length - that.scanAllDetails.forEach(res=>{ - res.isDelete = false; - res.modified=false; + that.scanAllDetails.forEach(item => { + item.isDelete = false; + item.modified = false; }) - + this.initList() //查询库位信息 @@ -468,54 +438,55 @@ //当前页起始索引 const start = (pageNo - 1) * pageSize; const end = start + pageSize; //当前页结束索引 - var list =this.scanAllDetails.filter((r=>r.isDelete==false)) + var list = this.scanAllDetails.filter((r => r.isDelete == false)) return list.slice(start, end) }, - getScanResult(result){ - var itemCode =result.itemCode; - this.getitem(itemCode,res=>{ + getScanResult(result) { + var itemCode = result.itemCode; + this.getitem(itemCode, res => { var result = res; result.itemCode = result.code; result.itemName = result.name; result.itemDesc1 = result.desc1; result.itemDesc2 = result.desc2; - result.uom =result.basicUom - var itemScan = this.scanAllDetails.filter(r => - r.itemCode == itemCode&& - r.inventoryStage==this.datacontent.inventoryStage&& - r.isDelete==false - ) - if (itemScan.length > 0) { - setTimeout(res => { - scanFailedAudio() - showConfirmMsg("物料【" + itemCode + "】已经扫描,是否覆盖已经扫描的信息", res => { - if (res) { - this.setQty(itemScan[0], itemScan[0].inventoryQty, false); - } - }) - }, 100) - return; - } - + result.uom = result.basicUom + // var itemScan = this.scanAllDetails.filter(r => + // r.itemCode == itemCode&& + // r.inventoryStage==this.datacontent.inventoryStage&& + // r.isDelete==false + // ) + // if (itemScan.length > 0) { + // setTimeout(res => { + // scanFailedAudio() + // showConfirmMsg("物料【" + itemCode + "】已经扫描,是否覆盖已经扫描的信息", res => { + // if (res) { + // this.setQty(itemScan[0], itemScan[0].inventoryQty, false); + // } + // }) + // }, 100) + // return; + // } + let items = this.originalDetails.filter(r => - r.itemCode === itemCode&&r.inventoryStage==this.datacontent.inventoryStage) + r.itemCode === itemCode && r.inventoryStage == this.datacontent.inventoryStage) //不在任务列表中,查询库存赋值 if (items.length == 0) { this.addNewDetail(result) } else if (items.length == 1) { scanSuccessAudio() var item = items[0]; - item.isNew =true; - this.setQty(item, item.inventoryQty, true); + item.isNew = true; + var addItem = deepCopyData(item) + this.addItemExit(addItem, true); } else { scanFailedAudio() this.showMessage('盘点数量异常,箱码【' + packingCode + '】的出现多条数据'); } - + }) }, - + getitem(itemCode, callback) { getitems(itemCode).then((res) => { if (res === null) { @@ -527,7 +498,7 @@ this.showMessage(err.message); }) }, - + async addNewDetail(result) { if (this.location == null) { @@ -540,7 +511,7 @@ if (balanceItem == null || balanceItem == undefined) { setTimeout(res => { scanFailedAudio() - showConfirmMsg("扫描的物料["+result.code+"]在任务中不存在,是否要添加为任务明细?", async confirm => { + showConfirmMsg("扫描的物料[" + result.code + "]在任务中不存在,是否要添加为任务明细?", async confirm => { if (confirm) { this.setDetailNoBalance(detail, result) this.scanAllDetails.unshift(detail); @@ -561,17 +532,18 @@ } else { setTimeout(res => { scanFailedAudio() - showConfirmMsg("扫描的物料["+result.itemCode+"]在任务中不存在,是否要添加为任务明细?", async confirm => { - if (confirm) { - this.setDetailByBalance(detail, balanceItem); - this.scanAllDetails.unshift(detail); - this.initList(); - this.calcScanCount(); - this.$forceUpdate(); - } else { - this.scanPopupGetfocus(); - } - }); + showConfirmMsg("扫描的物料[" + result.itemCode + "]在任务中不存在,是否要添加为任务明细?", + async confirm => { + if (confirm) { + this.setDetailByBalance(detail, balanceItem); + this.scanAllDetails.unshift(detail); + this.initList(); + this.calcScanCount(); + this.$forceUpdate(); + } else { + this.scanPopupGetfocus(); + } + }); }, 100) } } @@ -604,14 +576,14 @@ creatDetail(result) { let detail = { isNew: true, - isDelete:false, - modified:true, + isDelete: false, + modified: true, countTime: new Date(), masterID: this.id, countLabel: "", number: this.datacontent.number, - inventoryStage:this.datacontent.inventoryStage, - + inventoryStage: this.datacontent.inventoryStage, + inventoryQty: 0, uom: result.uom, @@ -652,23 +624,41 @@ setDetailNoBalance(detail, result) { detail.InventoryLocationCode = ""; detail.inventoryQty = 0; - detail.countQty = 1; + detail.countQty = 0; detail.status = 2; - detail.uom =result.uom + detail.uom = result.uom return detail; }, setQty(item, qty, isAdd) { - - item.countQty = Number(qty); + + item.countQty = 0; item.countTime = new Date(); - item.isDelete =false; - item.modified =true; + item.isDelete = false; + item.modified = true; item.countOperator = localStorage.userId; if (isAdd) { this.scanAllDetails.unshift(item) - }else { - item.countDescription="" + } else { + item.countDescription = "" + } + this.initList(); + this.scanPopupGetfocus(); + this.calcScanCount(); + this.$forceUpdate(); + }, + + addItemExit(item, isAdd) { + + item.countQty = 0; + item.countTime = new Date(); + item.isDelete = false; + item.modified = true; + item.countOperator = localStorage.userId; + if (isAdd) { + this.scanAllDetails.unshift(item) + } else { + item.countDescription = "" } this.initList(); this.scanPopupGetfocus(); @@ -681,10 +671,10 @@ content: '是否移除选择的行?', success: res => { if (res.confirm) { - if(item.isNew){ + if (item.isNew) { this.showList.splice(index, 1) this.scanAllDetails.splice(index, 1) - }else { + } else { item.isDelete = true; item.modified = true; } @@ -716,27 +706,26 @@ this.showMessage("盘点数量为0,请先扫描") return; } - - var commitList=this.scanAllDetails.filter(r=>r.modified==true) + + var commitList = this.scanAllDetails.filter(r => r.modified == true) if (commitList.length == 0) { this.showMessage("没有修改的数据,请先扫描") return; } - - - var temp=""; + + + var temp = ""; for (var i = 0; i < this.scanAllDetails.length; i++) { - if(this.scanAllDetails[i].countQty==0){ - temp=this.scanAllDetails[i]; - break; - } + if (this.scanAllDetails[i].countQty == 0) { + temp = this.scanAllDetails[i]; + break; + } } - - if(temp!=""){ - this.showMessage("ERP料号:["+temp.itemCode+"]盘点数量为0,请输入盘点数量") + + if (temp != "") { + this.showMessage("ERP料号:[" + temp.itemCode + "]盘点数量为0,请输入盘点数量") return; } - this.finishJob(); }, @@ -746,13 +735,7 @@ title: "提交中...", mask: true }); - this.datacontent.depDetails =this.scanAllDetails.filter(r=>r.modified==true&&r.isDelete==false); - this.datacontent.details =[]; - that.datacontent.completeUserId = localStorage.getItem('userId') - that.datacontent.completeUserName = localStorage.getItem('userName_CN') - that.datacontent.completeTime = getCurrDateTime() - let params = JSON.stringify(this.datacontent); - console.log("提交参数",params) + var params =this.setParams(); finishCountJob(this.id, params) .then(res => { uni.hideLoading(); @@ -766,24 +749,50 @@ }); }, + setParams() { + var filterList = this.scanAllDetails.filter(r => r.modified == true && r.isDelete == false) + + let submitList = []; //定义空数组,用于装载去重之后的数组, + filterList.forEach(item => { + //可以用indexOf()数组去重 如果检索的结果匹配到,则返回 1. 如果检索的结果没有匹配值,则返回 -1. + var findItem = submitList.find(r => r.itemCode == item.itemCode) + if (findItem) { + findItem.countQty += item.countQty + } else { + submitList.push(item); + } + }) + + + this.datacontent.depDetails = submitList; + this.datacontent.details = []; + this.datacontent.completeUserId = localStorage.getItem('userId') + this.datacontent.completeUserName = localStorage.getItem('userName_CN') + this.datacontent.completeTime = getCurrDateTime() + var params = JSON.stringify(this.datacontent); + return params; + }, + qtyChanged(value, item) { if (value > 0) { item.countTime = new Date(); item.countOperator = localStorage.userId; this.calcScanCount(); - if(value==item.countQty){ - item.modified=false - }else { - item.modified=true + if (value == item.countQty) { + item.modified = false + } else { + item.modified = true } - }else { + } else { + item.countTime = new Date(); + item.modified = true this.showMessage("盘点数量必须大于0") } }, calcScanCount() { - this.scanCount = this.scanAllDetails.filter(r=>r.isDelete==false).length; + this.scanCount = this.scanAllDetails.filter(r => r.isDelete == false).length; }, bindPickerChange(e, item) {