Browse Source

修改扫描组件

hella_online_20240829
niexiting 4 months ago
parent
commit
8985ed091a
  1. 2
      .env.development
  2. 173
      src/mycomponents/scan/winScanPackAndLocationNoBalance.vue
  3. 4
      src/pages/putaway/job/putawayDetail.vue
  4. 46
      src/pages/putaway/job/putawayJob.vue

2
.env.development

@ -1 +1 @@
VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api # 租户配置 VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]' VITE_BASE_URL=http://172.21.32.14:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.14:81/api/admin-api # 租户配置 VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]'

173
src/mycomponents/scan/winScanPackAndLocationNoBalance.vue

@ -45,7 +45,7 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> <!-- <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> -->
</view> </view>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</template> </template>
@ -120,7 +120,7 @@
inventoryStatus: [], inventoryStatus: [],
managementPrecision: '', managementPrecision: '',
fromInventoryStatuses: "", fromInventoryStatuses: "",
isCheck:false isCheck: false
} }
}, },
created() { created() {
@ -171,7 +171,8 @@
}, },
scanLocation(scanResult) { getScanResult(scanResult) {
this.scanResult = scanResult;
var isCheck = false; var isCheck = false;
if (this.fromLocationCode == '') { if (this.fromLocationCode == '') {
this.showErrorMessage('来源库位不能为空', callback => { this.showErrorMessage('来源库位不能为空', callback => {
@ -180,9 +181,9 @@
return; return;
} }
if(this.fromLocationList.length>0){ if (this.fromLocationList.length > 0) {
if(!this.isInLocationList(this.fromLocationCode)){ if (!this.isInLocationList(this.fromLocationCode)) {
this.showErrorMessage("扫描库位【"+this.fromLocationCode+'】不在任务来源库位中', callback => { this.showErrorMessage("扫描库位【" + this.fromLocationCode + '】不在任务来源库位中', callback => {
this.locationGetFocus(); this.locationGetFocus();
}) })
return; return;
@ -193,6 +194,7 @@
title: '扫描中...', title: '扫描中...',
mask: true mask: true
}); });
getBasicLocationByCode(this.fromLocationCode).then(res => { getBasicLocationByCode(this.fromLocationCode).then(res => {
if (res.data.total > 0) { if (res.data.total > 0) {
let result = res.data.list[0]; let result = res.data.list[0];
@ -201,8 +203,7 @@
if (available == "TRUE") { if (available == "TRUE") {
if (checkDirectoryItemExist(this.fromLocationTypeArray, type)) { if (checkDirectoryItemExist(this.fromLocationTypeArray, type)) {
this.location = result; this.location = result;
// this.packGetFocus(); this.packCallBack();
this.checkPackage(scanResult);
} else { } else {
uni.hideLoading(); uni.hideLoading();
var hint = getListLocationTypeDesc(this.fromLocationTypeArray); var hint = getListLocationTypeDesc(this.fromLocationTypeArray);
@ -212,11 +213,11 @@
}) })
} }
} else { } else {
uni.hideLoading();
this.showErrorMessage("扫描库位[" + this.fromLocationCode + "]不可用", res => { this.showErrorMessage("扫描库位[" + this.fromLocationCode + "]不可用", res => {
this.locationGetFocus(); this.locationGetFocus();
}) })
} }
uni.hideLoading();
} else { } else {
uni.hideLoading(); uni.hideLoading();
this.showErrorMessage('未查询到库位[' + this.fromLocationCode + ']', res => { this.showErrorMessage('未查询到库位[' + this.fromLocationCode + ']', res => {
@ -231,131 +232,13 @@
}) })
}, },
getScanResult(result) { packCallBack() {
// console.log("", result)
// if (this.fromLocationCode == '' || this.fromLocationCode == null) {
// this.showMessage('', callback => {
// this.locationGetFocus();
// })
// return;
// } else
this.scanLocation(result);
// debugger
// if(this.isCheck){
// this.checkPackage(result);
// }
},
checkPackage(result){
if (result.label != null) {
this.scanResult = result;
// uni.showLoading({
// title: '...',
// mask: true
// })
getBalanceByManagementPrecision(result.label, this.fromLocationCode, this.fromInventoryStatuses,
res => {
uni.hideLoading();
if (res.success) {
this.managementPrecision = res.managementPrecision
this.afterQueryBalance(res.data.list);
} else {
this.showErrorMessage(res.message, res => {
this.packGetFocus();
})
}
// uni.hideLoading();
});
}
},
afterQueryBalance(datas) {
if (this.allowNullBalance) {
this.allowNoneBalance(datas);
} else if (this.noShowBalanceMessage) {
this.countCallBack(datas);
} else {
this.mustHavaBalance(datas);
}
uni.hideLoading();
},
//
allowNoneBalance(datas) {
this.packCallBack(null);
// if (datas.length == 0) {
// this.packCallBack(null);
// } else {
// this.showErrorMessage('[' + this.fromLocationCode + '],,', res => {
// this.packGetFocus();
// })
// }
},
//
mustHavaBalance(datas) {
if (datas.length == 0) {
this.showErrorMessage(this.getQueryCondition() + '<br>未查找到库存记录', res => {
this.packGetFocus();
})
} else if (datas.length == 1) {
let balance = datas[0];
this.packCallBack(balance);
// 20231228
// if (balance.qty > 0) {
// this.packCallBack(balance);
// } else {
// this.showErrorMessage(this.getQueryCondition() + '<br>[' + balance.qty + "],<br>",
// res => {
// this.packGetFocus();
// })
// }
} else {
this.showBalanceSelect(datas);
}
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
selectBalanceItem(balance) {
this.packCallBack(balance);
// 20231228
// if (balance.qty > 0) {
// this.packCallBack(balance);
// } else {
// this.showErrorMessage(this.getQueryCondition() + '<br>[' + balance.qty + "],",
// res => {
// this.packGetFocus();
// })
// }
},
//
countCallBack(datas) {
this.$refs.comscan.clear(); this.$refs.comscan.clear();
// //
let data = { let data = {
label: this.scanResult.label, label: this.scanResult.label,
package: this.scanResult.package, package: this.scanResult.package,
balance: datas, balance: null,
fromLocationCode: this.fromLocationCode,
}
this.packGetFocus();
this.$emit("getCountScanResult", data);
},
packCallBack(item) {
this.$refs.comscan.clear();
//
let data = {
label: this.scanResult.label,
package: this.scanResult.package,
balance: item,
fromLocationCode: this.fromLocationCode, fromLocationCode: this.fromLocationCode,
} }
this.packGetFocus(); this.packGetFocus();
@ -379,36 +262,6 @@
this.locationOnFocus = true; this.locationOnFocus = true;
}, },
getQueryCondition() {
let condition = '按照以下条件:<br>';
let label = this.scanResult.label;
let status = getInventoryStatusDesc(this.inventoryStatus);
switch (this.managementPrecision) {
case 'BY_PACKAGING':
condition = condition + '物料号=[' + label.itemCode + ']<br>箱码=[' + label.packingNumber +
']<br>批次=[' +
label.batch +
']<br>库位=[' + this.fromLocationCode + ']'
break;
case 'BY_BATCH':
condition = condition + '物料号=[' + label.itemCode + ']<br>批次=[' +
label.batch +
']<br>库位=[' + this.fromLocationCode + ']'
break;
case 'BY_QUANTITY':
condition = condition + '物料号=[' + label.itemCode + ']<br>库位=[' + this.fromLocationCode + ']'
break;
case 'BY_UNIQUEID':
condition = condition + '物料号=[' + label.itemCode + ']'
break;
}
if (this.inventoryStatus.length > 0) {
condition = condition + '<br>库存状态=[' + status + ']'
}
return condition;
},
showMessage(message, callback) { showMessage(message, callback) {
setTimeout(r => { setTimeout(r => {
@ -428,9 +281,7 @@
this.show = e.show this.show = e.show
}, },
isInLocationList(location) { isInLocationList(location) {
var item = this.fromLocationList.find(res => res == location) var item = this.fromLocationList.find(res => res == location)
if (item = undefined) { if (item = undefined) {
return false return false
} }

4
src/pages/putaway/job/putawayDetail.vue

@ -282,7 +282,7 @@
var qty = result.label.qty; var qty = result.label.qty;
var itemCode = result.label.itemCode; var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode; var locationCode = result.fromLocationCode;
var inventoryStatus = "OK"; // var inventoryStatus = "OK";
var detail = this.detailSource.find(r => r.itemCode == itemCode); var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) { if (detail == undefined) {
@ -339,7 +339,7 @@
itemDetail.scaned = true; itemDetail.scaned = true;
this.detailSource[0].subList.sort(compareAsc('scaned')); // this.detailSource[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty; itemDetail.handleQty = result.label.qty;
itemDetail.toInventoryStatus = "OK" // itemDetail.toInventoryStatus = "OK"
itemDetail.packList.forEach(pac => { itemDetail.packList.forEach(pac => {
pac.scaned = true pac.scaned = true
pac.handleQty = Number(pac.qty); pac.handleQty = Number(pac.qty);

46
src/pages/putaway/job/putawayJob.vue

@ -9,8 +9,7 @@
<view v-if="jobList.length>0"> <view v-if="jobList.length>0">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index"> <view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item <uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions"
:right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)"> @click="swipeClick($event,item)">
<com-putaway-job-card :dataContent="item" @click='openJobDetail(item)'></com-putaway-job-card> <com-putaway-job-card :dataContent="item" @click='openJobDetail(item)'></com-putaway-job-card>
</uni-swipe-action-item> </uni-swipe-action-item>
@ -220,12 +219,12 @@
cancleJob(id) { cancleJob(id) {
cancleTakePutawayJob(id).then(res => { cancleTakePutawayJob(id).then(res => {
if(res.data){ if (res.data) {
this.getList("refresh") this.getList("refresh")
uni.showToast({ uni.showToast({
title:"放弃任务成功" title: "放弃任务成功"
}) })
}else { } else {
this.showMessage("放弃任务失败") this.showMessage("放弃任务失败")
} }
}).catch(error => { }).catch(error => {
@ -296,7 +295,7 @@
openScanPopup() { openScanPopup() {
this.$refs.scanPopup.openScanPopup(); this.$refs.scanPopup.openScanPopup();
}, },
selectItem(item){ selectItem(item) {
this.$refs.scanPopup.closeScanPopup(); this.$refs.scanPopup.closeScanPopup();
uni.navigateTo({ uni.navigateTo({
url: './putawayDetail?id=' + item.masterId + '&status=' + item.status url: './putawayDetail?id=' + item.masterId + '&status=' + item.status
@ -314,36 +313,43 @@
action: "==", action: "==",
value: result.label.batch value: result.label.batch
}, },
// {
// column: "qty",
// action: "==",
// value: result.label.qty
// },
{ {
column: "qty",
action: "==",
value: result.label.qty
},{
column: "itemCode", column: "itemCode",
action: "==", action: "==",
value: result.label.itemCode value: result.label.itemCode
},{ },
column: "fromLocationCode", // {
action: "==", // column: "fromLocationCode",
value: result.label.fromLocationCode // action: "==",
}] // value: result.label.fromLocationCode
// },
]
getPutawayJobList({ getPutawayJobList({
filters: filters, filters: filters,
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
}).then(res => { }).then(res => {
console.log('getPutawayJobList',getPutawayJobList) console.log('getPutawayJobList', getPutawayJobList)
var list = res.data.list; var list = res.data.list;
list.forEach(item=>{ if (list.length > 0) {
list.forEach(item => {
item.title = item.number; item.title = item.number;
item.selected = false item.selected = false
}) })
console.log('list',list) console.log('list', list)
if(list.length>1){ if (list.length > 1) {
this.$refs.jobList.openList(list) this.$refs.jobList.openList(list)
}else{ } else {
this.selectItem(list[0]) this.selectItem(list[0])
} }
} else {
this.showMessage('未查找到任务')
}
}).catch(error => { }).catch(error => {
this.showMessage(error) this.showMessage(error)
}) })

Loading…
Cancel
Save