Browse Source

修改盘点单件码扫描和盘点描述支持扫描

pda_nev
李俊城 7 months ago
parent
commit
271bd1efdb
  1. 8
      fe/PDA/mycomponents/common/comEasyInput.vue
  2. 219
      fe/PDA/pages/task/countFgDetail.vue

8
fe/PDA/mycomponents/common/comEasyInput.vue

@ -10,7 +10,8 @@
<view class="tab_info"> <view class="tab_info">
<view class="conbox"> <view class="conbox">
<textarea v-model="content" trim="all" style="margin-left: 5px;" :focus="true"></textarea> <textarea v-model="content" trim="all" style="margin-left: 5px;" :focus="true"
@keydown.enter="confirm"></textarea>
<!-- <uni-easyinput v-model="content" type="textarea" ></uni-easyinput> --> <!-- <uni-easyinput v-model="content" type="textarea" ></uni-easyinput> -->
</view> </view>
<view class="uni-flex"> <view class="uni-flex">
@ -36,6 +37,11 @@
}, },
created() { created() {
},
mounted() {
if (this.$el.querySelector('textarea') != null) {
this.$el.querySelector('textarea').setAttribute('inputmode', 'none')
}
}, },
methods: { methods: {
openPopup(content) { openPopup(content) {

219
fe/PDA/pages/task/countFgDetail.vue

@ -42,8 +42,8 @@
<text class="text_black">{{item.inventoryQty}}</text> <text class="text_black">{{item.inventoryQty}}</text>
</uni-th> </uni-th>
<uni-th width="100" align="center"> <uni-th width="100" align="center">
<com-number-box v-model="item.countQty" :max="99999" <com-number-box v-model="item.countQty" :max="99999" :min="0"
:min="0" @change="qtyChanged($event,item)" @change="qtyChanged($event,item)"
style='margin-right: 10px;padding: 2px;'> style='margin-right: 10px;padding: 2px;'>
</com-number-box> </com-number-box>
@ -102,7 +102,7 @@
</view> </view>
<view class="uni-flex space-between" style="margin:0 20rpx 20rpx;" > <view class="uni-flex space-between" style="margin:0 20rpx 20rpx;">
<view class=""> <view class="">
<text class="font_xs" <text class="font_xs"
style="padding: 5px 2px; text-overflow: ellipsis; overflow: hidden;">{{item.countDescription}}</text> style="padding: 5px 2px; text-overflow: ellipsis; overflow: hidden;">{{item.countDescription}}</text>
@ -133,7 +133,7 @@
</view> </view>
<!-- <com-count-items ref='comcountItems' @selectedItem='selectedCountItem'> </com-count-items> --> <!-- <com-count-items ref='comcountItems' @selectedItem='selectedCountItem'> </com-count-items> -->
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
<winScanByProductCode ref="scanPopup" title="单件码" @getScanResult='getScanResult' ></winScanByProductCode> <winScanByProductCode ref="scanPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode>
<com-easy-input ref="descPopup" @confirm='closeEditCountDesc'></com-easy-input> <com-easy-input ref="descPopup" @confirm='closeEditCountDesc'></com-easy-input>
<com-easy-input-count ref="countPopup" @confirm='closeEditCount'></com-easy-input-count> <com-easy-input-count ref="countPopup" @confirm='closeEditCount'></com-easy-input-count>
<win-inventory-status ref="statusPopup"></win-inventory-status> <win-inventory-status ref="statusPopup"></win-inventory-status>
@ -178,7 +178,8 @@
getCurrDateTime, getCurrDateTime,
navigateBack, navigateBack,
scanSuccessAudio, scanSuccessAudio,
scanFailedAudio scanFailedAudio,
deepCopyData
} from '@/common/basic.js'; } from '@/common/basic.js';
import { import {
@ -249,7 +250,7 @@
names: [], names: [],
values: [], values: [],
origin: [] origin: []
} },
} }
}, },
props: {}, props: {},
@ -345,6 +346,7 @@
}) })
}, },
methods: { methods: {
initList() { initList() {
this.index = 1; this.index = 1;
this.showList = [] this.showList = []
@ -352,7 +354,7 @@
this.showList = this.getDataPage(this.index, this.pageSize) this.showList = this.getDataPage(this.index, this.pageSize)
}, },
queryItemCode(){ queryItemCode() {
this.$refs.wzSelectPopup.open({ this.$refs.wzSelectPopup.open({
mode: 'radio', //radio checkbox mode: 'radio', //radio checkbox
// dataList:[], //dataList使proxyConfig // dataList:[], //dataList使proxyConfig
@ -373,57 +375,25 @@
selectCheckbox(mode, resultData) { selectCheckbox(mode, resultData) {
console.log(mode, resultData) console.log(mode, resultData)
var result = resultData var result = resultData
var itemCode = result.itemCode; 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 => 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) { if (items.length == 0) {
this.addNewDetail(result) this.addNewDetail(result)
} else if (items.length == 1) { } else if (items.length == 1) {
var item = items[0]; var item = items[0];
item.isNew =true; item.isNew = true;
this.setQty(item, item.inventoryQty, true); var addItem = deepCopyData(item)
this.addItemExit(addItem, true);
} else { } else {
this.showMessage('盘点数量异常,ERP物料号【' + itemCode + '】的出现多条数据'); this.showMessage('盘点数量异常,ERP物料号【' + itemCode + '】的出现多条数据');
} }
}, },
reqGetList(data) { reqGetList(data) {
return getBalancesByItemCode(data.searchValue,data.pageIndex,data.pageSize); return getBalancesByItemCode(data.searchValue, data.pageIndex, data.pageSize);
}, },
getDetail() { getDetail() {
uni.showLoading({ uni.showLoading({
@ -443,9 +413,9 @@
that.scanAllDetails = res.depDetails.filter(r => r.inventoryStage == res.inventoryStage); that.scanAllDetails = res.depDetails.filter(r => r.inventoryStage == res.inventoryStage);
that.scanCount = res.depDetails.length that.scanCount = res.depDetails.length
that.scanAllDetails.forEach(res=>{ that.scanAllDetails.forEach(item => {
res.isDelete = false; item.isDelete = false;
res.modified=false; item.modified = false;
}) })
this.initList() this.initList()
@ -468,46 +438,47 @@
// //
const start = (pageNo - 1) * pageSize; const start = (pageNo - 1) * pageSize;
const end = start + 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) return list.slice(start, end)
}, },
getScanResult(result){ getScanResult(result) {
var itemCode =result.itemCode; var itemCode = result.itemCode;
this.getitem(itemCode,res=>{ this.getitem(itemCode, res => {
var result = res; var result = res;
result.itemCode = result.code; result.itemCode = result.code;
result.itemName = result.name; result.itemName = result.name;
result.itemDesc1 = result.desc1; result.itemDesc1 = result.desc1;
result.itemDesc2 = result.desc2; result.itemDesc2 = result.desc2;
result.uom =result.basicUom result.uom = result.basicUom
var itemScan = this.scanAllDetails.filter(r => // var itemScan = this.scanAllDetails.filter(r =>
r.itemCode == itemCode&& // r.itemCode == itemCode&&
r.inventoryStage==this.datacontent.inventoryStage&& // r.inventoryStage==this.datacontent.inventoryStage&&
r.isDelete==false // r.isDelete==false
) // )
if (itemScan.length > 0) { // if (itemScan.length > 0) {
setTimeout(res => { // setTimeout(res => {
scanFailedAudio() // scanFailedAudio()
showConfirmMsg("物料【" + itemCode + "】已经扫描,是否覆盖已经扫描的信息", res => { // showConfirmMsg("" + itemCode + ",", res => {
if (res) { // if (res) {
this.setQty(itemScan[0], itemScan[0].inventoryQty, false); // this.setQty(itemScan[0], itemScan[0].inventoryQty, false);
} // }
}) // })
}, 100) // }, 100)
return; // return;
} // }
let items = this.originalDetails.filter(r => 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) { if (items.length == 0) {
this.addNewDetail(result) this.addNewDetail(result)
} else if (items.length == 1) { } else if (items.length == 1) {
scanSuccessAudio() scanSuccessAudio()
var item = items[0]; var item = items[0];
item.isNew =true; item.isNew = true;
this.setQty(item, item.inventoryQty, true); var addItem = deepCopyData(item)
this.addItemExit(addItem, true);
} else { } else {
scanFailedAudio() scanFailedAudio()
this.showMessage('盘点数量异常,箱码【' + packingCode + '】的出现多条数据'); this.showMessage('盘点数量异常,箱码【' + packingCode + '】的出现多条数据');
@ -540,7 +511,7 @@
if (balanceItem == null || balanceItem == undefined) { if (balanceItem == null || balanceItem == undefined) {
setTimeout(res => { setTimeout(res => {
scanFailedAudio() scanFailedAudio()
showConfirmMsg("扫描的物料["+result.code+"]在任务中不存在,是否要添加为任务明细?", async confirm => { showConfirmMsg("扫描的物料[" + result.code + "]在任务中不存在,是否要添加为任务明细?", async confirm => {
if (confirm) { if (confirm) {
this.setDetailNoBalance(detail, result) this.setDetailNoBalance(detail, result)
this.scanAllDetails.unshift(detail); this.scanAllDetails.unshift(detail);
@ -561,7 +532,8 @@
} else { } else {
setTimeout(res => { setTimeout(res => {
scanFailedAudio() scanFailedAudio()
showConfirmMsg("扫描的物料["+result.itemCode+"]在任务中不存在,是否要添加为任务明细?", async confirm => { showConfirmMsg("扫描的物料[" + result.itemCode + "]在任务中不存在,是否要添加为任务明细?",
async confirm => {
if (confirm) { if (confirm) {
this.setDetailByBalance(detail, balanceItem); this.setDetailByBalance(detail, balanceItem);
this.scanAllDetails.unshift(detail); this.scanAllDetails.unshift(detail);
@ -604,13 +576,13 @@
creatDetail(result) { creatDetail(result) {
let detail = { let detail = {
isNew: true, isNew: true,
isDelete:false, isDelete: false,
modified:true, modified: true,
countTime: new Date(), countTime: new Date(),
masterID: this.id, masterID: this.id,
countLabel: "", countLabel: "",
number: this.datacontent.number, number: this.datacontent.number,
inventoryStage:this.datacontent.inventoryStage, inventoryStage: this.datacontent.inventoryStage,
inventoryQty: 0, inventoryQty: 0,
uom: result.uom, uom: result.uom,
@ -652,23 +624,41 @@
setDetailNoBalance(detail, result) { setDetailNoBalance(detail, result) {
detail.InventoryLocationCode = ""; detail.InventoryLocationCode = "";
detail.inventoryQty = 0; detail.inventoryQty = 0;
detail.countQty = 1; detail.countQty = 0;
detail.status = 2; detail.status = 2;
detail.uom =result.uom detail.uom = result.uom
return detail; return detail;
}, },
setQty(item, qty, isAdd) { setQty(item, qty, isAdd) {
item.countQty = Number(qty); item.countQty = 0;
item.countTime = new Date(); item.countTime = new Date();
item.isDelete =false; item.isDelete = false;
item.modified =true; item.modified = true;
item.countOperator = localStorage.userId; item.countOperator = localStorage.userId;
if (isAdd) { if (isAdd) {
this.scanAllDetails.unshift(item) this.scanAllDetails.unshift(item)
}else { } else {
item.countDescription="" 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.initList();
this.scanPopupGetfocus(); this.scanPopupGetfocus();
@ -681,10 +671,10 @@
content: '是否移除选择的行?', content: '是否移除选择的行?',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
if(item.isNew){ if (item.isNew) {
this.showList.splice(index, 1) this.showList.splice(index, 1)
this.scanAllDetails.splice(index, 1) this.scanAllDetails.splice(index, 1)
}else { } else {
item.isDelete = true; item.isDelete = true;
item.modified = true; item.modified = true;
} }
@ -717,26 +707,25 @@
return; return;
} }
var commitList=this.scanAllDetails.filter(r=>r.modified==true) var commitList = this.scanAllDetails.filter(r => r.modified == true)
if (commitList.length == 0) { if (commitList.length == 0) {
this.showMessage("没有修改的数据,请先扫描") this.showMessage("没有修改的数据,请先扫描")
return; return;
} }
var temp=""; var temp = "";
for (var i = 0; i < this.scanAllDetails.length; i++) { for (var i = 0; i < this.scanAllDetails.length; i++) {
if(this.scanAllDetails[i].countQty==0){ if (this.scanAllDetails[i].countQty == 0) {
temp=this.scanAllDetails[i]; temp = this.scanAllDetails[i];
break; break;
} }
} }
if(temp!=""){ if (temp != "") {
this.showMessage("ERP料号:["+temp.itemCode+"]盘点数量为0,请输入盘点数量") this.showMessage("ERP料号:[" + temp.itemCode + "]盘点数量为0,请输入盘点数量")
return; return;
} }
this.finishJob(); this.finishJob();
}, },
@ -746,13 +735,7 @@
title: "提交中...", title: "提交中...",
mask: true mask: true
}); });
this.datacontent.depDetails =this.scanAllDetails.filter(r=>r.modified==true&&r.isDelete==false); var params =this.setParams();
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)
finishCountJob(this.id, params) finishCountJob(this.id, params)
.then(res => { .then(res => {
uni.hideLoading(); 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) { qtyChanged(value, item) {
if (value > 0) { if (value > 0) {
item.countTime = new Date(); item.countTime = new Date();
item.countOperator = localStorage.userId; item.countOperator = localStorage.userId;
this.calcScanCount(); this.calcScanCount();
if(value==item.countQty){ if (value == item.countQty) {
item.modified=false item.modified = false
}else { } else {
item.modified=true item.modified = true
} }
}else { } else {
item.countTime = new Date();
item.modified = true
this.showMessage("盘点数量必须大于0") this.showMessage("盘点数量必须大于0")
} }
}, },
calcScanCount() { calcScanCount() {
this.scanCount = this.scanAllDetails.filter(r=>r.isDelete==false).length; this.scanCount = this.scanAllDetails.filter(r => r.isDelete == false).length;
}, },
bindPickerChange(e, item) { bindPickerChange(e, item) {

Loading…
Cancel
Save