Browse Source

修改扫描组件

hella_online_20240829
niexiting 4 months ago
parent
commit
8985ed091a
  1. 2
      .env.development
  2. 179
      src/mycomponents/scan/winScanPackAndLocationNoBalance.vue
  3. 4
      src/pages/putaway/job/putawayDetail.vue
  4. 110
      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}]'

179
src/mycomponents/scan/winScanPackAndLocationNoBalance.vue

@ -28,7 +28,7 @@
<view v-if='allowModifyLocation'> <view v-if='allowModifyLocation'>
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位" <uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位"
style='height: 30rpx;border:1px solid #fff ;'></uni-combox> style='height: 30rpx;border:1px solid #fff ;'></uni-combox>
</view> </view>
<view v-else> <view v-else>
<text style="padding: 5px"> <text style="padding: 5px">
@ -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 => {
@ -179,10 +180,10 @@
}) })
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
} }
@ -451,4 +302,4 @@
height: auto; height: auto;
max-height: 300rpx; max-height: 300rpx;
} }
</style> </style>

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);

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

@ -5,12 +5,11 @@
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask"> :checkedWaitTask="checkedWaitTask">
</job-filter> </job-filter>
<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>
@ -20,21 +19,21 @@
<putaway-info-popup ref='jobInfoPopup'></putaway-info-popup> <putaway-info-popup ref='jobInfoPopup'></putaway-info-popup>
<putaway-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></putaway-job-list-popup> <putaway-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></putaway-job-list-popup>
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> <uni-load-more :status="loadingType" v-if="jobList.length>0" />
</view> </view>
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button> <win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
<winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true"> <winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true">
</winScanPackJob> </winScanPackJob>
<jobList ref="jobList" @selectItem="selectItem"></jobList> <jobList ref="jobList" @selectItem="selectItem"></jobList>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
<script> <script>
import jobList from '@/mycomponents/jobList/jobList.vue' import jobList from '@/mycomponents/jobList/jobList.vue'
import { import {
getPutawayJobList, getPutawayJobList,
cancleTakePutawayJob cancleTakePutawayJob
@ -131,7 +130,7 @@
title: "加载中­....", title: "加载中­....",
mask: true mask: true
}); });
this.loadingType = "loading"; this.loadingType = "loading";
if (type === "refresh") { if (type === "refresh") {
this.pageNo = 1; this.pageNo = 1;
@ -146,13 +145,13 @@
value: this.todayTime value: this.todayTime
}) })
} }
filters.push({ filters.push({
column: "status", column: "status",
action: "in", action: "in",
value: this.status value: this.status
}) })
var params = { var params = {
filters: filters, filters: filters,
pageNo: this.pageNo, pageNo: this.pageNo,
@ -164,7 +163,7 @@
if (type === "refresh") { if (type === "refresh") {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
} }
var list = res.data.list; var list = res.data.list;
this.totalCount = res.data.total this.totalCount = res.data.total
updateTitle("采购上架(" + this.totalCount + ")"); updateTitle("采购上架(" + this.totalCount + ")");
@ -175,7 +174,7 @@
} }
this.jobList = type === "refresh" ? list : this.jobList.concat(list); this.jobList = type === "refresh" ? list : this.jobList.concat(list);
this.pageNo++; this.pageNo++;
}).catch(error => { }).catch(error => {
if (type === "refresh") { if (type === "refresh") {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
@ -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 => {
@ -248,7 +247,7 @@
getScanNumber(code) { getScanNumber(code) {
this.getDataListByType(code) this.getDataListByType(code)
}, },
getDataListByType(code) { getDataListByType(code) {
let that = this; let that = this;
uni.showLoading({ uni.showLoading({
@ -266,7 +265,7 @@
action: "==", action: "==",
value: code value: code
}) })
var params = { var params = {
filters: filters, filters: filters,
pageNo: 1, pageNo: 1,
@ -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
@ -305,49 +304,56 @@
getScanResult(result) { getScanResult(result) {
try { try {
var filters = [{ var filters = [{
column: "packingNumber", column: "packingNumber",
action: "==", action: "==",
value: result.label.packingNumber value: result.label.packingNumber
}, },
{ {
column: "batch", column: "batch",
action: "==", action: "==",
value: result.label.batch value: result.label.batch
}, },
{ // {
column: "qty", // column: "qty",
action: "==", // action: "==",
value: result.label.qty // value: result.label.qty
},{ // },
column: "itemCode", {
action: "==", column: "itemCode",
value: result.label.itemCode action: "==",
},{ value: result.label.itemCode
column: "fromLocationCode", },
action: "==", // {
value: result.label.fromLocationCode // column: "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) {
item.title = item.number; list.forEach(item => {
item.selected = false item.title = item.number;
}) item.selected = false
console.log('list',list) })
if(list.length>1){ console.log('list', list)
this.$refs.jobList.openList(list) if (list.length > 1) {
}else{ this.$refs.jobList.openList(list)
this.selectItem(list[0]) } else {
this.selectItem(list[0])
}
} else {
this.showMessage('未查找到任务')
} }
}).catch(error => { }).catch(error => {
this.showMessage(error) this.showMessage(error)
}) })
} catch (e) { } catch (e) {
this.showMessage(e.message) this.showMessage(e.message)
} }
@ -358,4 +364,4 @@
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>
Loading…
Cancel
Save