yufei0306
7 months ago
11 changed files with 3566 additions and 3062 deletions
@ -0,0 +1,68 @@ |
|||
<template> |
|||
<view class="wyf"> |
|||
<uni-popup ref="listPopup" type="dialog"> |
|||
<view class="container"> |
|||
<uni-list class="list"> |
|||
<uni-list-item v-for="(item,index) in list" :title="item.title" |
|||
thumb-size="lg" > |
|||
<template v-slot:footer> |
|||
<!-- <image class="slot-image" src="@/static/logo.png" mode="widthFix" @click="selectItem(item,index)"></image --> |
|||
<text class="go" @click="selectItem(item,index)">Go</text> |
|||
</template> |
|||
|
|||
</uni-list-item> |
|||
|
|||
</uni-list> |
|||
</view> |
|||
</uni-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { onShow } from '@dcloudio/uni-app'; |
|||
export default { |
|||
emits: ["selectItem"], |
|||
components: { |
|||
}, |
|||
data() { |
|||
return { |
|||
list: [] |
|||
// [{ |
|||
// title:'哈哈哈哈', |
|||
// selected:false |
|||
// }], |
|||
} |
|||
}, |
|||
props: { |
|||
}, |
|||
methods:{ |
|||
openList(list){ |
|||
this.list = list |
|||
this.$refs.listPopup.open('center') |
|||
}, |
|||
selectItem(item,index){ |
|||
this.$emit("selectItem", item); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.container{ |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
.list{ |
|||
width: 80%; |
|||
border-radius: 10px !important; |
|||
overflow: hidden; |
|||
.slot-image{ |
|||
width: 40rpx; |
|||
} |
|||
.go{ |
|||
color: rgb(60, 156, 255); |
|||
} |
|||
} |
|||
|
|||
} |
|||
</style> |
@ -0,0 +1,128 @@ |
|||
<template> |
|||
<uni-popup ref="popup" @change="change" @maskClick="closeScanPopup()"> |
|||
<view class="popup_box"> |
|||
<view class="pop_title uni-flex space-between"> |
|||
<view class="" style="font-size: 35rpx;"> |
|||
扫描{{title}} |
|||
</view> |
|||
|
|||
<view class=""> |
|||
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" |
|||
@click="closeScanPopup()"></image> |
|||
</view> |
|||
</view> |
|||
<view class=""> |
|||
<view class=""> |
|||
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" |
|||
:isShowHistory="isShowHistory" :clearResult="true" :headerType="headerType"></win-com-scan> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</template> |
|||
|
|||
<script> |
|||
import winComScan from '@/mycomponents/scan/winComScan.vue' |
|||
import { |
|||
getBalanceByManagementPrecision, |
|||
} from '@/common/balance.js'; |
|||
|
|||
import { |
|||
getBasicLocationByCode, |
|||
getPutawayJobList |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
getListLocationTypeDesc, |
|||
checkDirectoryItemExist, |
|||
getDirectoryItemArray, |
|||
getLocationTypeName, |
|||
getInventoryStatusDesc |
|||
} from '@/common/directory.js'; |
|||
export default { |
|||
name: 'winScanPack', |
|||
emits: ["getResult", "close", "getCountScanResult"], |
|||
components: { |
|||
winComScan |
|||
}, |
|||
props: { |
|||
title: { |
|||
type: String, |
|||
default: '箱标签' |
|||
}, |
|||
isShowHistory: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
headerType: { |
|||
type: String, |
|||
default: "HPQ,HMQ" |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
show: false, |
|||
} |
|||
}, |
|||
created() { |
|||
|
|||
}, |
|||
methods: { |
|||
// 弹出 |
|||
openScanPopup(){ |
|||
|
|||
this.$refs.popup.open('bottom') |
|||
}, |
|||
// 关闭 |
|||
closeScanPopup(content) { |
|||
this.$refs.popup.close(); |
|||
this.$emit("close", ''); |
|||
}, |
|||
//扫描结果 |
|||
getScanResult(result) { |
|||
this.$emit("getResult", result); |
|||
}, |
|||
packGetFocus() { |
|||
if (this.$refs.comscan != undefined) { |
|||
this.$refs.comscan.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
packLoseFocus() { |
|||
if (this.$refs.comscan != undefined) { |
|||
this.$refs.comscan.losefocus(); |
|||
} |
|||
}, |
|||
showMessage(message, callback) { |
|||
setTimeout(r => { |
|||
this.packLoseFocus(); |
|||
this.$refs.comMessage.showMessage(message, callback); |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message, callback) { |
|||
setTimeout(r => { |
|||
this.packLoseFocus(); |
|||
this.$refs.comMessage.showErrorMessage(message, callback) |
|||
}) |
|||
}, |
|||
|
|||
change(e) { |
|||
this.show = e.show |
|||
}, |
|||
selectItem(item,index){ |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.scroll-view { |
|||
overflow-y: scroll; |
|||
height: auto; |
|||
max-height: 300rpx; |
|||
} |
|||
</style> |
File diff suppressed because it is too large
@ -1,313 +1,380 @@ |
|||
<template> |
|||
<view class=""> |
|||
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
|||
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
|||
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
|||
:checkedWaitTask="checkedWaitTask"> |
|||
</job-filter> |
|||
<view v-if="jobList.length>0"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<view v-for="(item, index) in jobList" :key="index"> |
|||
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
|||
@click="swipeClick($event,item)"> |
|||
<com-product-job-card :dataContent="item" @click='openJobDetail(item)'> |
|||
</com-product-job-card> |
|||
</uni-swipe-action-item> |
|||
</view> |
|||
</uni-swipe-action> |
|||
|
|||
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
|||
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
|||
|
|||
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
|||
</view> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
cancleTakeProductPutawayJob, |
|||
getProductPutawayJobList |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
updateTitle, |
|||
getSwitchInfoByCode |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailGiveupOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
import comProductJobCard from '@/pages/productPutaway/coms/comProductJobCard.vue' |
|||
import jobListPopup from '@/pages/productPutaway/coms/jobListPopup.vue' |
|||
import jobInfoPopup from '@/pages/productPutaway/coms/jobInfoPopup.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
comEmptyView, |
|||
jobFilter, |
|||
comProductJobCard, |
|||
jobListPopup, |
|||
jobInfoPopup |
|||
}, |
|||
data() { |
|||
return { |
|||
jobList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
totalCount: 0, |
|||
loadingType: "nomore", |
|||
checkedToday: false, |
|||
checkedWaitTask: false, |
|||
todayTime: "", |
|||
status: '1,2', //待处理 、进行中 |
|||
detailOptions: [], |
|||
detailGiveupOptions: [], |
|||
}; |
|||
}, |
|||
props: { |
|||
type: 'assemble', |
|||
}, |
|||
|
|||
mounted() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
onReady() { |
|||
this.detailOptions = getDetailOption(); |
|||
this.detailGiveupOptions = getDetailGiveupOption(); |
|||
}, |
|||
|
|||
onReachBottom() { |
|||
//避免多次触发 |
|||
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
return; |
|||
} |
|||
this.getList("more"); |
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
//后退按钮 |
|||
onBackPress(options) { |
|||
if (options.from === 'navigateBack') { |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}) |
|||
return false; |
|||
} |
|||
}, |
|||
|
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index == 1) { |
|||
this.$refs.filter.openFilter(); |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
toHome() { |
|||
goHome() |
|||
}, |
|||
openFilter() { |
|||
this.$refs.filter.openFilter(); |
|||
}, |
|||
refresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
getList(type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
|
|||
this.loadingType = "loading"; |
|||
if (type === "refresh") { |
|||
this.pageNo = 1; |
|||
this.jobList = []; |
|||
} |
|||
var filters = [] |
|||
if (this.checkedToday) { |
|||
filters.push({ |
|||
column: "request_time", |
|||
action: "betweeen", |
|||
value: this.todayTime |
|||
}) |
|||
} |
|||
|
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: this.status |
|||
}) |
|||
|
|||
filters.push({ |
|||
column: "type", |
|||
action: "==", |
|||
value: this.type |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: this.pageNo, |
|||
pageSize: this.pageSize, |
|||
} |
|||
getProductPutawayJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
var list = res.data.list; |
|||
this.totalCount = res.data.total |
|||
this.loadingType = "loadmore"; |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产上架任务(" + this.totalCount + ")"); |
|||
} else if (this.type == 'assemble') { |
|||
updateTitle("装配上架任务(" + this.totalCount + ")"); |
|||
} |
|||
if (list == null || list.length == 0) { |
|||
this.loadingType = "nomore"; |
|||
return; |
|||
} |
|||
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
|||
this.pageNo++; |
|||
|
|||
|
|||
}).catch(error => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产上架任务(" + this.totalCount + ")"); |
|||
} else if (this.type == 'assemble') { |
|||
updateTitle("装配上架任务(" + this.totalCount + ")"); |
|||
} |
|||
this.loadingType = ""; |
|||
uni.hideLoading(); |
|||
that.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
openJobDetail(item) { |
|||
uni.navigateTo({ |
|||
url: './productPutawayDetail?id=' + item.masterId + '&status=' + item.status + '&type=' + item |
|||
.type |
|||
}); |
|||
}, |
|||
|
|||
showItemList(itemList) { |
|||
this.$refs.scanList.openPopup(itemList); |
|||
}, |
|||
|
|||
selectedItem(item) { |
|||
this.openJobDetail(item); |
|||
}, |
|||
|
|||
swipeClick(e, dataContent) { |
|||
if (e.content.text == "详情") { |
|||
this.openjobInfoPopup(dataContent); |
|||
} else if (e.content.text == "放弃") { |
|||
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
|||
res => { |
|||
if (res) { |
|||
this.cancleJob(dataContent.id); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
openjobInfoPopup(item) { |
|||
this.$refs.jobInfoPopup.openPopup(item) |
|||
}, |
|||
|
|||
cancleJob(id) { |
|||
cancleTakeProductPutawayJob(id).then(res => { |
|||
if (res.data) { |
|||
this.getList("refresh") |
|||
uni.showToast({ |
|||
title: "放弃任务成功" |
|||
}) |
|||
} else { |
|||
this.showMessage("放弃任务失败") |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
switchChangeToday(state, creationTime) { |
|||
this.checkedToday = state; |
|||
this.todayTime = creationTime; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
switchChangeWait(state, jobStatus) { |
|||
this.checkedWaitTask = state; |
|||
this.status = jobStatus; |
|||
this.getList("refresh"); |
|||
}, |
|||
getScanNumber(code) { |
|||
this.getDataListByType(code) |
|||
}, |
|||
getDataListByType(code) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
var filters = [] |
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: '1,2' |
|||
}) |
|||
filters.push({ |
|||
column: "number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
} |
|||
getProductPutawayJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data.list.length == 0) { |
|||
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
|||
} else if (res.data.list.length == 1) { |
|||
that.openJobDetail(res.data.list[0]); |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading(); |
|||
that.showMessage(error); |
|||
}) |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
<template> |
|||
<view class=""> |
|||
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
|||
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
|||
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
|||
:checkedWaitTask="checkedWaitTask"> |
|||
</job-filter> |
|||
<view v-if="jobList.length>0"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<view v-for="(item, index) in jobList" :key="index"> |
|||
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
|||
@click="swipeClick($event,item)"> |
|||
<com-product-job-card :dataContent="item" @click='openJobDetail(item)'> |
|||
</com-product-job-card> |
|||
</uni-swipe-action-item> |
|||
</view> |
|||
</uni-swipe-action> |
|||
|
|||
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
|||
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
|||
|
|||
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
|||
</view> |
|||
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button> |
|||
<winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true"> |
|||
</winScanPackJob> |
|||
<jobList ref="jobList" @selectItem="selectItem"></jobList> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
cancleTakeProductPutawayJob, |
|||
getProductPutawayJobList |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
updateTitle, |
|||
getSwitchInfoByCode |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailGiveupOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
import comProductJobCard from '@/pages/productPutaway/coms/comProductJobCard.vue' |
|||
import jobListPopup from '@/pages/productPutaway/coms/jobListPopup.vue' |
|||
import jobInfoPopup from '@/pages/productPutaway/coms/jobInfoPopup.vue' |
|||
import jobList from '@/mycomponents/jobList/jobList.vue' |
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue" |
|||
export default { |
|||
components: { |
|||
comEmptyView, |
|||
jobFilter, |
|||
comProductJobCard, |
|||
jobListPopup, |
|||
jobInfoPopup, |
|||
winScanButton, |
|||
winScanPackJob, |
|||
jobList |
|||
|
|||
}, |
|||
data() { |
|||
return { |
|||
jobList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
totalCount: 0, |
|||
loadingType: "nomore", |
|||
checkedToday: false, |
|||
checkedWaitTask: false, |
|||
todayTime: "", |
|||
status: '1,2', //待处理 、进行中 |
|||
detailOptions: [], |
|||
detailGiveupOptions: [], |
|||
}; |
|||
}, |
|||
props: { |
|||
type: 'assemble', |
|||
}, |
|||
|
|||
mounted() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
onReady() { |
|||
this.detailOptions = getDetailOption(); |
|||
this.detailGiveupOptions = getDetailGiveupOption(); |
|||
}, |
|||
|
|||
onReachBottom() { |
|||
//避免多次触发 |
|||
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
return; |
|||
} |
|||
this.getList("more"); |
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
//后退按钮 |
|||
onBackPress(options) { |
|||
if (options.from === 'navigateBack') { |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}) |
|||
return false; |
|||
} |
|||
}, |
|||
|
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index == 1) { |
|||
this.$refs.filter.openFilter(); |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
toHome() { |
|||
goHome() |
|||
}, |
|||
openFilter() { |
|||
this.$refs.filter.openFilter(); |
|||
}, |
|||
refresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
getList(type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
|
|||
this.loadingType = "loading"; |
|||
if (type === "refresh") { |
|||
this.pageNo = 1; |
|||
this.jobList = []; |
|||
} |
|||
var filters = [] |
|||
if (this.checkedToday) { |
|||
filters.push({ |
|||
column: "request_time", |
|||
action: "betweeen", |
|||
value: this.todayTime |
|||
}) |
|||
} |
|||
|
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: this.status |
|||
}) |
|||
|
|||
filters.push({ |
|||
column: "type", |
|||
action: "==", |
|||
value: this.type |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: this.pageNo, |
|||
pageSize: this.pageSize, |
|||
} |
|||
getProductPutawayJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
var list = res.data.list; |
|||
this.totalCount = res.data.total |
|||
this.loadingType = "loadmore"; |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产上架任务(" + this.totalCount + ")"); |
|||
} else if (this.type == 'assemble') { |
|||
updateTitle("装配上架任务(" + this.totalCount + ")"); |
|||
} |
|||
if (list == null || list.length == 0) { |
|||
this.loadingType = "nomore"; |
|||
return; |
|||
} |
|||
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
|||
this.pageNo++; |
|||
|
|||
|
|||
}).catch(error => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产上架任务(" + this.totalCount + ")"); |
|||
} else if (this.type == 'assemble') { |
|||
updateTitle("装配上架任务(" + this.totalCount + ")"); |
|||
} |
|||
this.loadingType = ""; |
|||
uni.hideLoading(); |
|||
that.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
openJobDetail(item,packingNumber='') { |
|||
uni.navigateTo({ |
|||
url: './productPutawayDetail?id=' + item.masterId + '&status=' + item.status + '&type=' + item |
|||
.type + '&scaned=' + packingNumber |
|||
}); |
|||
}, |
|||
|
|||
showItemList(itemList) { |
|||
this.$refs.scanList.openPopup(itemList); |
|||
}, |
|||
|
|||
selectedItem(item) { |
|||
this.openJobDetail(item); |
|||
}, |
|||
|
|||
swipeClick(e, dataContent) { |
|||
if (e.content.text == "详情") { |
|||
this.openjobInfoPopup(dataContent); |
|||
} else if (e.content.text == "放弃") { |
|||
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
|||
res => { |
|||
if (res) { |
|||
this.cancleJob(dataContent.id); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
openjobInfoPopup(item) { |
|||
this.$refs.jobInfoPopup.openPopup(item) |
|||
}, |
|||
|
|||
cancleJob(id) { |
|||
cancleTakeProductPutawayJob(id).then(res => { |
|||
if (res.data) { |
|||
this.getList("refresh") |
|||
uni.showToast({ |
|||
title: "放弃任务成功" |
|||
}) |
|||
} else { |
|||
this.showMessage("放弃任务失败") |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
switchChangeToday(state, creationTime) { |
|||
this.checkedToday = state; |
|||
this.todayTime = creationTime; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
switchChangeWait(state, jobStatus) { |
|||
this.checkedWaitTask = state; |
|||
this.status = jobStatus; |
|||
this.getList("refresh"); |
|||
}, |
|||
getScanNumber(code) { |
|||
this.getDataListByType(code) |
|||
}, |
|||
getDataListByType(code) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
var filters = [] |
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: '1,2' |
|||
}) |
|||
filters.push({ |
|||
column: "number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
} |
|||
getProductPutawayJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data.list.length == 0) { |
|||
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
|||
} else if (res.data.list.length == 1) { |
|||
that.openJobDetail(res.data.list[0]); |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading(); |
|||
that.showMessage(error); |
|||
}) |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
openScanPopup() { |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
selectItem(item) { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
this.openJobDetail(item, item.packingNumber); |
|||
}, |
|||
getScanResult(result) { |
|||
try { |
|||
var filters = [{ |
|||
column: "packingNumber", |
|||
action: "==", |
|||
value: result.label.packingNumber |
|||
}, |
|||
{ |
|||
column: "batch", |
|||
action: "==", |
|||
value: result.label.batch |
|||
}, |
|||
{ |
|||
column: "qty", |
|||
action: "==", |
|||
value: result.label.qty |
|||
}, { |
|||
column: "itemCode", |
|||
action: "==", |
|||
value: result.label.itemCode |
|||
}, { |
|||
column: "fromLocationCode", |
|||
action: "==", |
|||
value: result.label.fromLocationCode |
|||
} |
|||
] |
|||
getProductPutawayJobList({ |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
}).then(res => { |
|||
var list = res.data.list; |
|||
list.forEach(item => { |
|||
item.title = item.number; |
|||
item.selected = false |
|||
}) |
|||
console.log('list', list) |
|||
if (list.length > 1) { |
|||
this.$refs.jobList.openList(list) |
|||
} else { |
|||
this.selectItem(list[0]) |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
|
|||
} catch (e) { |
|||
this.showMessage(e.message) |
|||
} |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
@ -1,472 +1,481 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="page-header"> |
|||
<view class="header_job_top"> |
|||
<job-top :dataContent="jobContent"></job-top> |
|||
</view> |
|||
</view> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class="cen_card" style="padding: 5rpx;"> |
|||
<view class="cell_box uni-flex uni-row"> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">车间</view> |
|||
<view> |
|||
{{jobContent.workShopCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">生产线</view> |
|||
<view> |
|||
{{item.subList[0].productionLineCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班组</view> |
|||
<view> |
|||
{{jobContent.team}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班次</view> |
|||
<view> |
|||
{{jobContent.shift}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="split_line"></view> |
|||
</view> |
|||
<view class=""> |
|||
<com-product-detail-card :dataContent="item" :settingParam="jobContent" :isShowLocation="false" |
|||
@remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList'> |
|||
</com-product-detail-card> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode" |
|||
:locationCode="toLocationCode" @getLocation='scanLocationCode' |
|||
:locationTypeList="toLocationTypeList"></locationCompare> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
<win-scan-fg-label ref="scanPopup" @getResult='getScanResult' title='制品标签'></win-scan-fg-label> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getManagementPrecisions |
|||
} from '@/common/balance.js'; |
|||
|
|||
import { |
|||
getProductReceiptJobDetail, |
|||
takeProductReceiptJob, |
|||
cancleTakeProductReceiptJob, |
|||
productReceiptJobsubmit |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome, |
|||
navigateBack, |
|||
getPackingNumberAndBatch, |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDirectoryItemArray, |
|||
getInventoryStatusName |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
getDataSource, |
|||
createRecordInfo, |
|||
calcHandleQty, |
|||
getScanCount |
|||
} from '@/common/detail.js'; |
|||
|
|||
import { |
|||
Decimal |
|||
} from 'decimal.js'; //引入 |
|||
|
|||
import { |
|||
calc |
|||
} from '@/common/calc' |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import locationCompare from '@/mycomponents/location/locationCompare.vue' |
|||
import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue" |
|||
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" |
|||
import jobTop from '@/mycomponents/job/jobTop.vue' |
|||
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" |
|||
|
|||
export default { |
|||
name: 'receipt_detail', |
|||
components: { |
|||
winScanButton, |
|||
comDetailCard, |
|||
locationCompare, |
|||
winScanFgLabel, |
|||
jobTop, |
|||
comProductDetailCard, |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
receiptJob: {}, |
|||
toLocationCode: '', |
|||
isShowPackingCode: true, |
|||
scanCount: 0, |
|||
jobContent: {}, //任务内容 |
|||
subList: [], //接口返回的任务subList |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
toLocationTypeList: [], |
|||
managementList: [], |
|||
jobStatus: "", |
|||
jobToLocationCode: "", |
|||
fgList: [], |
|||
itemCode: "" |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
this.id = option.id; |
|||
if (this.id != undefined) { |
|||
//新建的任务自动接收 |
|||
if (option.status == "1") { |
|||
this.receive((callback => { |
|||
this.getDetail(); |
|||
})); |
|||
} else { |
|||
this.getDetail(); |
|||
} |
|||
|
|||
} |
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) { |
|||
//已经接收但是没提交任务 |
|||
if (e.from == 'backbutton') { |
|||
if (this.jobStatus == "2") { |
|||
//取消承接任务 |
|||
cancleTakeProductReceiptJob(this.id).then(res => { |
|||
uni.navigateBack(); |
|||
}).catch(error => { |
|||
uni.navigateBack(); |
|||
}) |
|||
} else { |
|||
uni.navigateBack(); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getDetail(); |
|||
uni.stopPullDownRefresh(); |
|||
}, |
|||
|
|||
mounted() { |
|||
|
|||
}, |
|||
methods: { |
|||
//接收 |
|||
receive(callback) { |
|||
if (this.id != null) { |
|||
takeProductReceiptJob(this.id).then(res => { |
|||
callback(); |
|||
}).catch(error => { |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
getDetail() { |
|||
var that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getProductReceiptJobDetail(that.id).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data == null) { |
|||
that.showMessage('未获取到详情'); |
|||
} else { |
|||
if (res.data.subList.length > 0) { |
|||
that.jobContent = res.data; |
|||
that.subList = res.data.subList; |
|||
that.jobStatus = res.data.status |
|||
that.jobToLocationCode = that.subList[0].toLocationCode |
|||
that.toLocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes) |
|||
that.detailSource = getDataSource(that.subList) |
|||
|
|||
} else { |
|||
that.showMessage('列表数据为0'); |
|||
} |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
//TODO缺少零件号的对应关系 |
|||
let that = this; |
|||
if (that.detailSource.length > 0) { |
|||
let item = that.detailSource[0]; //应该按零件号查找 |
|||
result.uom = item.uom; |
|||
if (item.subList.length > 0) { |
|||
let subItem = item.subList[0]; |
|||
subItem.scaned = true; |
|||
if (subItem.fgList == undefined) { |
|||
subItem.fgList = []; |
|||
} |
|||
|
|||
if (subItem.fgList.length == 0) { |
|||
subItem.fgList.push(result); |
|||
that.calcFgQty(this.detailSource); |
|||
} else { |
|||
var itemIndex = subItem.fgList.findIndex(r => |
|||
r.itemCode == result.itemCode && |
|||
r.productDate == result.productDate && |
|||
r.order == result.order); |
|||
if (itemIndex == -1) { |
|||
subItem.fgList.push(result); |
|||
that.calcFgQty(this.detailSource); |
|||
} else { |
|||
this.showQuestionMessage("标签【" + result.content + '】已经扫描,是否移除', confirm => { |
|||
subItem.fgList.splice(itemIndex, 1) |
|||
that.calcFgQty(this.detailSource); |
|||
}) |
|||
} |
|||
} |
|||
|
|||
setTimeout(r => { |
|||
this.scanPopupGetFocus(); |
|||
}, 500) |
|||
} |
|||
} |
|||
}, |
|||
|
|||
calcFgQty() { |
|||
let that = this; |
|||
that.detailSource.forEach(item => { |
|||
item.subList.forEach(pack => { |
|||
pack.handleQty = new Decimal(0).toNumber(); |
|||
pack.fgList.forEach(fg => { |
|||
if (fg != null) { |
|||
fg.qty = new Decimal(fg.qty).toNumber(); |
|||
pack.handleQty = calc.add(pack.handleQty, fg.qty); |
|||
// item.qty = calc.add(item.qty, detail.qty); |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
calcHandleQty(this.detailSource); |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
var itemCode = this.detailSource[0].subList[0].itemCode |
|||
|
|||
// itemCode = "015553147" |
|||
console.log("物料", itemCode) |
|||
this.$refs.scanPopup.openScanPopup(itemCode); |
|||
}, |
|||
|
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
}, |
|||
|
|||
scanLocationCode(location, code) { |
|||
this.toLocationCode = code |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
detail.toLocationCode = code |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
checkLocation() { |
|||
var isPass = true; |
|||
if (this.toLocationCode == "" || this.toLocationCode == null) { |
|||
this.showMessageHint('请扫描收货库位', callback => { |
|||
this.$refs.comScanLocation.showLocation(); |
|||
}) |
|||
return isPass = false; |
|||
} |
|||
return isPass; |
|||
}, |
|||
|
|||
showMessageHint(hint, callback) { |
|||
this.$refs.comMessage.showErrorMessage(hint, res => { |
|||
if (res) { |
|||
callback() |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
commit() { |
|||
// this.scanCount = getScanCount(this.subList); |
|||
// if (this.scanCount == 0) { |
|||
// this.showErrorMessage("扫描数为0,请先扫描") |
|||
// return; |
|||
// } |
|||
//校验库位、 |
|||
if (!this.checkLocation()) { |
|||
return |
|||
} |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(subitem => { |
|||
if (subitem.handleQty == undefined) { |
|||
this.showMessage("还没扫码成品不能提交") |
|||
} else { |
|||
if (subitem.handleQty != subitem.packQty) { |
|||
this.showQuestionMessage('制品数量不等于包装数量,是否继续提交?', res => { |
|||
if (res) { |
|||
this.submitJob(); |
|||
} |
|||
}); |
|||
} else { |
|||
this.submitJob(); |
|||
} |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
submitJob() { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
var itemCodes = [] |
|||
this.detailSource.forEach(item => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
|||
if (res.success) { |
|||
this.managementList = res.list; |
|||
var params = this.setParams(); |
|||
console.log("提交参数", JSON.stringify(params)); |
|||
productReceiptJobsubmit(params).then(res => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + res.data, ) |
|||
} else { |
|||
this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
uni.hideLoading(); |
|||
this.showErrorMessage(res.message); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
setParams() { |
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
if (detail.scaned) { |
|||
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|||
detail.packingNumber, detail.batch); |
|||
detail.toPackingNumber = info.packingNumber; |
|||
detail.toBatch = info.batch; |
|||
detail.toContainerNumber = ''; |
|||
detail.toInventoryStatus = detail.inventoryStatus |
|||
detail.toLocationCode = this.toLocationCode |
|||
if (detail.fgList) { |
|||
detail.fgList.forEach(res => { |
|||
res.outsideItemCode = res.itemCode |
|||
res.outsideProduceDate = res.productDate |
|||
res.outsideSerialNumber = res.order |
|||
}) |
|||
} |
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
this.jobContent.subList = subList |
|||
this.jobContent.creator = creator; |
|||
return this.jobContent; |
|||
}, |
|||
|
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupLoseFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.losefocus(); |
|||
} |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
navigateBack(1) |
|||
}) |
|||
}, |
|||
|
|||
showQuestionMessage(hint, callback) { |
|||
this.$refs.comMessage.showQuestionMessage(hint, res => { |
|||
if (res) { |
|||
callback(true) |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="page-header"> |
|||
<view class="header_job_top"> |
|||
<job-top :dataContent="jobContent"></job-top> |
|||
</view> |
|||
</view> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class="cen_card" style="padding: 5rpx;"> |
|||
<view class="cell_box uni-flex uni-row"> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">车间</view> |
|||
<view> |
|||
{{jobContent.workShopCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">生产线</view> |
|||
<view> |
|||
{{item.subList[0].productionLineCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班组</view> |
|||
<view> |
|||
{{jobContent.team}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班次</view> |
|||
<view> |
|||
{{jobContent.shift}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="split_line"></view> |
|||
</view> |
|||
<view class=""> |
|||
<com-product-detail-card :dataContent="item" :settingParam="jobContent" :isShowLocation="false" |
|||
@remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList'> |
|||
</com-product-detail-card> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode" |
|||
:locationCode="toLocationCode" @getLocation='scanLocationCode' |
|||
:locationTypeList="toLocationTypeList"></locationCompare> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
<win-scan-fg-label ref="scanPopup" @getResult='getScanResult' title='制品标签'></win-scan-fg-label> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getManagementPrecisions |
|||
} from '@/common/balance.js'; |
|||
|
|||
import { |
|||
getProductReceiptJobDetail, |
|||
takeProductReceiptJob, |
|||
cancleTakeProductReceiptJob, |
|||
productReceiptJobsubmit |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome, |
|||
navigateBack, |
|||
getPackingNumberAndBatch, |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDirectoryItemArray, |
|||
getInventoryStatusName |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
getDataSource, |
|||
createRecordInfo, |
|||
calcHandleQty, |
|||
getScanCount |
|||
} from '@/common/detail.js'; |
|||
|
|||
import { |
|||
Decimal |
|||
} from 'decimal.js'; //引入 |
|||
|
|||
import { |
|||
calc |
|||
} from '@/common/calc' |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import locationCompare from '@/mycomponents/location/locationCompare.vue' |
|||
import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue" |
|||
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" |
|||
import jobTop from '@/mycomponents/job/jobTop.vue' |
|||
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" |
|||
|
|||
export default { |
|||
name: 'receipt_detail', |
|||
components: { |
|||
winScanButton, |
|||
comDetailCard, |
|||
locationCompare, |
|||
winScanFgLabel, |
|||
jobTop, |
|||
comProductDetailCard, |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
receiptJob: {}, |
|||
toLocationCode: '', |
|||
isShowPackingCode: true, |
|||
scanCount: 0, |
|||
jobContent: {}, //任务内容 |
|||
subList: [], //接口返回的任务subList |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
toLocationTypeList: [], |
|||
managementList: [], |
|||
jobStatus: "", |
|||
jobToLocationCode: "", |
|||
fgList: [], |
|||
itemCode: "", |
|||
scanedPackingNumber: '' |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
this.id = option.id; |
|||
this.scanedPackingNumber = option.scaned || ''; |
|||
if (this.id != undefined) { |
|||
//新建的任务自动接收 |
|||
if (option.status == "1") { |
|||
this.receive((callback => { |
|||
this.getDetail(); |
|||
})); |
|||
} else { |
|||
this.getDetail(); |
|||
} |
|||
|
|||
} |
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) { |
|||
//已经接收但是没提交任务 |
|||
if (e.from == 'backbutton') { |
|||
if (this.jobStatus == "2") { |
|||
//取消承接任务 |
|||
cancleTakeProductReceiptJob(this.id).then(res => { |
|||
uni.navigateBack(); |
|||
}).catch(error => { |
|||
uni.navigateBack(); |
|||
}) |
|||
} else { |
|||
uni.navigateBack(); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getDetail(); |
|||
uni.stopPullDownRefresh(); |
|||
}, |
|||
|
|||
mounted() { |
|||
|
|||
}, |
|||
methods: { |
|||
//接收 |
|||
receive(callback) { |
|||
if (this.id != null) { |
|||
takeProductReceiptJob(this.id).then(res => { |
|||
callback(); |
|||
}).catch(error => { |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
getDetail() { |
|||
var that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getProductReceiptJobDetail(that.id).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data == null) { |
|||
that.showMessage('未获取到详情'); |
|||
} else { |
|||
if (res.data.subList.length > 0) { |
|||
that.jobContent = res.data; |
|||
that.subList = res.data.subList; |
|||
that.jobStatus = res.data.status |
|||
that.jobToLocationCode = that.subList[0].toLocationCode |
|||
that.toLocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes) |
|||
that.detailSource = getDataSource(that.subList) |
|||
that.detailSource.forEach(r => { |
|||
r.subList.forEach(s => { |
|||
if (this.scanedPackingNumber && this.scanedPackingNumber == s |
|||
.packingNumber) s.scaned = true |
|||
}) |
|||
}) |
|||
|
|||
|
|||
} else { |
|||
that.showMessage('列表数据为0'); |
|||
} |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
//TODO缺少零件号的对应关系 |
|||
let that = this; |
|||
if (that.detailSource.length > 0) { |
|||
let item = that.detailSource[0]; //应该按零件号查找 |
|||
result.uom = item.uom; |
|||
if (item.subList.length > 0) { |
|||
let subItem = item.subList[0]; |
|||
subItem.scaned = true; |
|||
if (subItem.fgList == undefined) { |
|||
subItem.fgList = []; |
|||
} |
|||
|
|||
if (subItem.fgList.length == 0) { |
|||
subItem.fgList.push(result); |
|||
that.calcFgQty(this.detailSource); |
|||
} else { |
|||
var itemIndex = subItem.fgList.findIndex(r => |
|||
r.itemCode == result.itemCode && |
|||
r.productDate == result.productDate && |
|||
r.order == result.order); |
|||
if (itemIndex == -1) { |
|||
subItem.fgList.push(result); |
|||
that.calcFgQty(this.detailSource); |
|||
} else { |
|||
this.showQuestionMessage("标签【" + result.content + '】已经扫描,是否移除', confirm => { |
|||
subItem.fgList.splice(itemIndex, 1) |
|||
that.calcFgQty(this.detailSource); |
|||
}) |
|||
} |
|||
} |
|||
|
|||
setTimeout(r => { |
|||
this.scanPopupGetFocus(); |
|||
}, 500) |
|||
} |
|||
} |
|||
}, |
|||
|
|||
calcFgQty() { |
|||
let that = this; |
|||
that.detailSource.forEach(item => { |
|||
item.subList.forEach(pack => { |
|||
pack.handleQty = new Decimal(0).toNumber(); |
|||
pack.fgList.forEach(fg => { |
|||
if (fg != null) { |
|||
fg.qty = new Decimal(fg.qty).toNumber(); |
|||
pack.handleQty = calc.add(pack.handleQty, fg.qty); |
|||
// item.qty = calc.add(item.qty, detail.qty); |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
calcHandleQty(this.detailSource); |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
var itemCode = this.detailSource[0].subList[0].itemCode |
|||
|
|||
// itemCode = "015553147" |
|||
console.log("物料", itemCode) |
|||
this.$refs.scanPopup.openScanPopup(itemCode); |
|||
}, |
|||
|
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
}, |
|||
|
|||
scanLocationCode(location, code) { |
|||
this.toLocationCode = code |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
detail.toLocationCode = code |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
checkLocation() { |
|||
var isPass = true; |
|||
if (this.toLocationCode == "" || this.toLocationCode == null) { |
|||
this.showMessageHint('请扫描收货库位', callback => { |
|||
this.$refs.comScanLocation.showLocation(); |
|||
}) |
|||
return isPass = false; |
|||
} |
|||
return isPass; |
|||
}, |
|||
|
|||
showMessageHint(hint, callback) { |
|||
this.$refs.comMessage.showErrorMessage(hint, res => { |
|||
if (res) { |
|||
callback() |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
commit() { |
|||
// this.scanCount = getScanCount(this.subList); |
|||
// if (this.scanCount == 0) { |
|||
// this.showErrorMessage("扫描数为0,请先扫描") |
|||
// return; |
|||
// } |
|||
//校验库位、 |
|||
if (!this.checkLocation()) { |
|||
return |
|||
} |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(subitem => { |
|||
if (subitem.handleQty == undefined) { |
|||
this.showMessage("还没扫码成品不能提交") |
|||
} else { |
|||
if (subitem.handleQty != subitem.packQty) { |
|||
this.showQuestionMessage('制品数量不等于包装数量,是否继续提交?', res => { |
|||
if (res) { |
|||
this.submitJob(); |
|||
} |
|||
}); |
|||
} else { |
|||
this.submitJob(); |
|||
} |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
submitJob() { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
var itemCodes = [] |
|||
this.detailSource.forEach(item => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
|||
if (res.success) { |
|||
this.managementList = res.list; |
|||
var params = this.setParams(); |
|||
console.log("提交参数", JSON.stringify(params)); |
|||
productReceiptJobsubmit(params).then(res => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + res.data, ) |
|||
} else { |
|||
this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
uni.hideLoading(); |
|||
this.showErrorMessage(res.message); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
setParams() { |
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
if (detail.scaned) { |
|||
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|||
detail.packingNumber, detail.batch); |
|||
detail.toPackingNumber = info.packingNumber; |
|||
detail.toBatch = info.batch; |
|||
detail.toContainerNumber = ''; |
|||
detail.toInventoryStatus = detail.inventoryStatus |
|||
detail.toLocationCode = this.toLocationCode |
|||
if (detail.fgList) { |
|||
detail.fgList.forEach(res => { |
|||
res.outsideItemCode = res.itemCode |
|||
res.outsideProduceDate = res.productDate |
|||
res.outsideSerialNumber = res.order |
|||
}) |
|||
} |
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
this.jobContent.subList = subList |
|||
this.jobContent.creator = creator; |
|||
return this.jobContent; |
|||
}, |
|||
|
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupLoseFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.losefocus(); |
|||
} |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
navigateBack(1) |
|||
}) |
|||
}, |
|||
|
|||
showQuestionMessage(hint, callback) { |
|||
this.$refs.comMessage.showQuestionMessage(hint, res => { |
|||
if (res) { |
|||
callback(true) |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
</style> |
@ -1,483 +1,491 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="page-header"> |
|||
<view class="header_job_top"> |
|||
<job-top :dataContent="jobContent"></job-top> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class="cen_card" style="padding: 5rpx;"> |
|||
<view class="cell_box uni-flex uni-row"> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">车间</view> |
|||
<view> |
|||
{{jobContent.workShopCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">生产线</view> |
|||
<view> |
|||
{{item.subList[0].productionLineCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班组</view> |
|||
<view> |
|||
{{jobContent.team}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班次</view> |
|||
<view> |
|||
{{jobContent.shift}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="split_line"></view> |
|||
</view> |
|||
|
|||
<view class=""> |
|||
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false" |
|||
@remove="updateData" @updateData="updateData" |
|||
:locationAreaTypeList='toLocationAreaTypeList'> |
|||
</comProductDetailCard> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode" |
|||
:locationCode="toLocationCode" @getLocation='scanLocationCode' |
|||
:locationAreaTypeList="toLocationAreaTypeList"></locationCompare> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'制品标签'" headerType="HMQ"></win-scan-pack> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getManagementPrecisions |
|||
} from '@/common/balance.js'; |
|||
|
|||
import { |
|||
getProductReceiptJobDetail, |
|||
takeProductReceiptJob, |
|||
cancleTakeProductReceiptJob, |
|||
productReceiptJobsubmit |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome, |
|||
navigateBack, |
|||
getPackingNumberAndBatch, |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDirectoryItemArray, |
|||
getInventoryStatusName |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
getDataSource, |
|||
createRecordInfo, |
|||
calcHandleQty, |
|||
getScanCount |
|||
} from '@/common/detail.js'; |
|||
import { |
|||
calc |
|||
} from '@/common/calc.js'; |
|||
|
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import locationCompare from '@/mycomponents/location/locationCompare.vue' |
|||
import winScanPack from "@/mycomponents/scan/winScanPack.vue" |
|||
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" |
|||
import jobTop from '@/mycomponents/job/jobTop.vue' |
|||
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" |
|||
|
|||
|
|||
export default { |
|||
name: 'receipt_detail', |
|||
components: { |
|||
winScanButton, |
|||
comDetailCard, |
|||
locationCompare, |
|||
winScanPack, |
|||
jobTop, |
|||
comProductDetailCard |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
receiptJob: {}, |
|||
toLocationCode: '', |
|||
isShowPackingCode: true, |
|||
scanCount: 0, |
|||
jobContent: {}, //任务内容 |
|||
subList: [], //接口返回的任务subList |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
toLocationAreaTypeList: [], |
|||
managementList: [], |
|||
jobStatus: "", |
|||
jobToLocationCode: "" |
|||
|
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
this.id = option.id; |
|||
if (this.id != undefined) { |
|||
//新建的任务自动接收 |
|||
if (option.status == "1") { |
|||
this.receive((callback => { |
|||
this.getDetail(); |
|||
})); |
|||
} else { |
|||
this.getDetail(); |
|||
} |
|||
} |
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) { |
|||
//已经接收但是没提交任务 |
|||
if (e.from == 'backbutton') { |
|||
if (this.jobStatus == "2") { |
|||
//取消承接任务 |
|||
cancleTakeProductReceiptJob(this.id).then(res => { |
|||
uni.navigateBack(); |
|||
}).catch(error => { |
|||
uni.navigateBack(); |
|||
}) |
|||
} else { |
|||
uni.navigateBack(); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getDetail(); |
|||
uni.stopPullDownRefresh(); |
|||
}, |
|||
|
|||
mounted() { |
|||
|
|||
}, |
|||
methods: { |
|||
//接收 |
|||
receive(callback) { |
|||
if (this.id != null) { |
|||
takeProductReceiptJob(this.id).then(res => { |
|||
callback(); |
|||
}).catch(error => { |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
getDetail() { |
|||
var that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getProductReceiptJobDetail(that.id).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data == null) { |
|||
that.showMessage('未获取到详情'); |
|||
} else { |
|||
if (res.data.subList.length > 0) { |
|||
that.jobContent = res.data; |
|||
that.subList = res.data.subList; |
|||
that.jobStatus = res.data.status |
|||
that.jobToLocationCode = that.subList[0].toLocationCode |
|||
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes) |
|||
that.detailSource = getDataSource(that.subList) |
|||
} else { |
|||
that.showMessage('列表数据为0'); |
|||
} |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
let label = result.label; |
|||
var packingNumber = label.packingNumber; |
|||
var batch = label.batch; |
|||
var qty = label.qty; |
|||
var itemCode = label.itemCode; |
|||
|
|||
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|||
if (detail == undefined) { |
|||
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|||
} else { |
|||
var itemDetail = detail.subList.find(r => |
|||
r.packingNumber == packingNumber && |
|||
r.batch == batch); |
|||
if (itemDetail == undefined) { |
|||
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中") |
|||
} else { |
|||
if (itemDetail.scaned) { |
|||
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") |
|||
} else { |
|||
itemDetail.scaned = true; |
|||
itemDetail.handleQty = Number(result.label.qty); |
|||
itemDetail.toLocationCode = this.toLocationCode; |
|||
itemDetail.labelQty = Number(result.label.qty); |
|||
calcHandleQty(this.detailSource); |
|||
this.continueScan() |
|||
this.$forceUpdate() |
|||
} |
|||
|
|||
} |
|||
} |
|||
}, |
|||
|
|||
//继续扫描 |
|||
continueScan() { |
|||
this.scanCount = getScanCount(this.subList); |
|||
if (this.scanCount == this.subList.length) { |
|||
this.closeScanPopup(); |
|||
} else { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}, |
|||
|
|||
|
|||
updateData() { |
|||
calcHandleQty(this.detailSource); |
|||
}, |
|||
|
|||
|
|||
openScanPopup() { |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
|
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
}, |
|||
|
|||
|
|||
scanLocationCode(location, code) { |
|||
this.toLocationCode = code |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
detail.toLocationCode = code |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
checkLocation() { |
|||
var isPass = true; |
|||
if (this.toLocationCode == "" || this.toLocationCode == null) { |
|||
this.showMessageHint('请扫描收货库位', callback => { |
|||
this.$refs.comScanLocation.showLocation(); |
|||
}) |
|||
|
|||
return isPass = false; |
|||
} |
|||
return isPass; |
|||
}, |
|||
|
|||
showMessageHint(hint, callback) { |
|||
this.$refs.comMessage.showErrorMessage(hint, res => { |
|||
if (res) { |
|||
callback() |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
commit() { |
|||
this.scanCount = getScanCount(this.subList); |
|||
if (this.scanCount == 0) { |
|||
this.showErrorMessage("扫描数为0,请先扫描") |
|||
return; |
|||
} |
|||
//校验库位、 |
|||
if (!this.checkLocation()) { |
|||
return |
|||
} |
|||
|
|||
|
|||
//扫描数量和任务数量相等,直接提交 |
|||
if (this.scanCount == this.subList.length) { |
|||
if (this.checkCount()) { |
|||
this.submitJob(); |
|||
} |
|||
|
|||
} else if (this.scanCount < this.subList.length) { |
|||
//扫描数量小于任务数量,判断是否允许部分提交 |
|||
if (this.jobContent.allowPartialComplete == "TRUE") { |
|||
//提交 |
|||
if (this.checkCount()) { |
|||
this.submitJob(); |
|||
} |
|||
} else { |
|||
//不允许部分提交,提示 |
|||
this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList |
|||
.length + |
|||
"]"); |
|||
} |
|||
} |
|||
|
|||
}, |
|||
|
|||
checkCount() { |
|||
var isCheck = true; |
|||
var hint = "" |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
var item = this.detailSource[i]; |
|||
for (var j = 0; j < item.subList.length; j++) { |
|||
var subItem = item.subList[i] |
|||
if (calc.sub(subItem.handleQty, subItem.qty) < 0) { |
|||
isCheck = false; |
|||
hint = "包装【" + subItem.packingNumber + "】实际收货数量:" + subItem.handleQty + "与包装数量" + subItem.qty + |
|||
"不相等,是否继续收货?" |
|||
break |
|||
} |
|||
} |
|||
} |
|||
if (!isCheck) { |
|||
this.showQuestMessage(hint, res => { |
|||
if (res) { |
|||
this.submitJob(); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
return isCheck; |
|||
|
|||
}, |
|||
|
|||
submitJob() { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
var itemCodes = [] |
|||
this.detailSource.forEach(item => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
|||
if (res.success) { |
|||
this.managementList = res.list; |
|||
var params = this.setParams(); |
|||
console.log("提交参数", JSON.stringify(params)); |
|||
productReceiptJobsubmit(params).then(res => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage("提交成功<br>生成预生产收货记录<br>" + res.data, ) |
|||
} else { |
|||
this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
uni.hideLoading(); |
|||
this.showErrorMessage(res.message); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
setParams() { |
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
|
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
if (detail.scaned) { |
|||
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|||
detail.packingNumber, detail.batch); |
|||
detail.toPackingNumber = info.packingNumber; |
|||
detail.toBatch = info.batch; |
|||
detail.toContainerNumber = ''; |
|||
detail.toInventoryStatus = detail.inventoryStatus |
|||
detail.toLocationCode = this.toLocationCode |
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
this.jobContent.subList = subList |
|||
this.jobContent.creator = creator; |
|||
return this.jobContent; |
|||
}, |
|||
|
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupLoseFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.losefocus(); |
|||
} |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
navigateBack(1) |
|||
}) |
|||
}, |
|||
showQuestMessage(hint, callBack) { |
|||
this.$refs.comMessage.showQuestionMessage(hint, res => { |
|||
if (res) { |
|||
callBack(true) |
|||
} |
|||
}) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="page-header"> |
|||
<view class="header_job_top"> |
|||
<job-top :dataContent="jobContent"></job-top> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class="cen_card" style="padding: 5rpx;"> |
|||
<view class="cell_box uni-flex uni-row"> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">车间</view> |
|||
<view> |
|||
{{jobContent.workShopCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">生产线</view> |
|||
<view> |
|||
{{item.subList[0].productionLineCode}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班组</view> |
|||
<view> |
|||
{{jobContent.team}} |
|||
</view> |
|||
</view> |
|||
<view class="cell_info"> |
|||
<view class="text_lightblue">班次</view> |
|||
<view> |
|||
{{jobContent.shift}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="split_line"></view> |
|||
</view> |
|||
|
|||
<view class=""> |
|||
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false" |
|||
@remove="updateData" @updateData="updateData" |
|||
:locationAreaTypeList='toLocationAreaTypeList'> |
|||
</comProductDetailCard> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode" |
|||
:locationCode="toLocationCode" @getLocation='scanLocationCode' |
|||
:locationAreaTypeList="toLocationAreaTypeList"></locationCompare> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'制品标签'" headerType="HMQ"></win-scan-pack> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getManagementPrecisions |
|||
} from '@/common/balance.js'; |
|||
|
|||
import { |
|||
getProductReceiptJobDetail, |
|||
takeProductReceiptJob, |
|||
cancleTakeProductReceiptJob, |
|||
productReceiptJobsubmit |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome, |
|||
navigateBack, |
|||
getPackingNumberAndBatch, |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDirectoryItemArray, |
|||
getInventoryStatusName |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
getDataSource, |
|||
createRecordInfo, |
|||
calcHandleQty, |
|||
getScanCount |
|||
} from '@/common/detail.js'; |
|||
import { |
|||
calc |
|||
} from '@/common/calc.js'; |
|||
|
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import locationCompare from '@/mycomponents/location/locationCompare.vue' |
|||
import winScanPack from "@/mycomponents/scan/winScanPack.vue" |
|||
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" |
|||
import jobTop from '@/mycomponents/job/jobTop.vue' |
|||
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" |
|||
|
|||
|
|||
export default { |
|||
name: 'receipt_detail', |
|||
components: { |
|||
winScanButton, |
|||
comDetailCard, |
|||
locationCompare, |
|||
winScanPack, |
|||
jobTop, |
|||
comProductDetailCard |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
receiptJob: {}, |
|||
toLocationCode: '', |
|||
isShowPackingCode: true, |
|||
scanCount: 0, |
|||
jobContent: {}, //任务内容 |
|||
subList: [], //接口返回的任务subList |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
toLocationAreaTypeList: [], |
|||
managementList: [], |
|||
jobStatus: "", |
|||
jobToLocationCode: "", |
|||
scanedPackingNumber: '' |
|||
|
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
this.id = option.id; |
|||
this.scanedPackingNumber = option.scaned || ''; |
|||
if (this.id != undefined) { |
|||
//新建的任务自动接收 |
|||
if (option.status == "1") { |
|||
this.receive((callback => { |
|||
this.getDetail(); |
|||
})); |
|||
} else { |
|||
this.getDetail(); |
|||
} |
|||
} |
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) { |
|||
//已经接收但是没提交任务 |
|||
if (e.from == 'backbutton') { |
|||
if (this.jobStatus == "2") { |
|||
//取消承接任务 |
|||
cancleTakeProductReceiptJob(this.id).then(res => { |
|||
uni.navigateBack(); |
|||
}).catch(error => { |
|||
uni.navigateBack(); |
|||
}) |
|||
} else { |
|||
uni.navigateBack(); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getDetail(); |
|||
uni.stopPullDownRefresh(); |
|||
}, |
|||
|
|||
mounted() { |
|||
|
|||
}, |
|||
methods: { |
|||
//接收 |
|||
receive(callback) { |
|||
if (this.id != null) { |
|||
takeProductReceiptJob(this.id).then(res => { |
|||
callback(); |
|||
}).catch(error => { |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
getDetail() { |
|||
var that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getProductReceiptJobDetail(that.id).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data == null) { |
|||
that.showMessage('未获取到详情'); |
|||
} else { |
|||
if (res.data.subList.length > 0) { |
|||
that.jobContent = res.data; |
|||
that.subList = res.data.subList; |
|||
that.jobStatus = res.data.status |
|||
that.jobToLocationCode = that.subList[0].toLocationCode |
|||
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes) |
|||
that.detailSource = getDataSource(that.subList) |
|||
that.detailSource.forEach(r => { |
|||
r.subList.forEach(s => { |
|||
if (this.scanedPackingNumber && this.scanedPackingNumber == s |
|||
.packingNumber) s.scaned = true |
|||
}) |
|||
}) |
|||
} else { |
|||
that.showMessage('列表数据为0'); |
|||
} |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
let label = result.label; |
|||
var packingNumber = label.packingNumber; |
|||
var batch = label.batch; |
|||
var qty = label.qty; |
|||
var itemCode = label.itemCode; |
|||
|
|||
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|||
if (detail == undefined) { |
|||
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") |
|||
} else { |
|||
var itemDetail = detail.subList.find(r => |
|||
r.packingNumber == packingNumber && |
|||
r.batch == batch); |
|||
if (itemDetail == undefined) { |
|||
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中") |
|||
} else { |
|||
if (itemDetail.scaned) { |
|||
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") |
|||
} else { |
|||
itemDetail.scaned = true; |
|||
itemDetail.handleQty = Number(result.label.qty); |
|||
itemDetail.toLocationCode = this.toLocationCode; |
|||
itemDetail.labelQty = Number(result.label.qty); |
|||
calcHandleQty(this.detailSource); |
|||
this.continueScan() |
|||
this.$forceUpdate() |
|||
} |
|||
|
|||
} |
|||
} |
|||
}, |
|||
|
|||
//继续扫描 |
|||
continueScan() { |
|||
this.scanCount = getScanCount(this.subList); |
|||
if (this.scanCount == this.subList.length) { |
|||
this.closeScanPopup(); |
|||
} else { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}, |
|||
|
|||
|
|||
updateData() { |
|||
calcHandleQty(this.detailSource); |
|||
}, |
|||
|
|||
|
|||
openScanPopup() { |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
|
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
}, |
|||
|
|||
|
|||
scanLocationCode(location, code) { |
|||
this.toLocationCode = code |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
detail.toLocationCode = code |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
checkLocation() { |
|||
var isPass = true; |
|||
if (this.toLocationCode == "" || this.toLocationCode == null) { |
|||
this.showMessageHint('请扫描收货库位', callback => { |
|||
this.$refs.comScanLocation.showLocation(); |
|||
}) |
|||
|
|||
return isPass = false; |
|||
} |
|||
return isPass; |
|||
}, |
|||
|
|||
showMessageHint(hint, callback) { |
|||
this.$refs.comMessage.showErrorMessage(hint, res => { |
|||
if (res) { |
|||
callback() |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
commit() { |
|||
this.scanCount = getScanCount(this.subList); |
|||
if (this.scanCount == 0) { |
|||
this.showErrorMessage("扫描数为0,请先扫描") |
|||
return; |
|||
} |
|||
//校验库位、 |
|||
if (!this.checkLocation()) { |
|||
return |
|||
} |
|||
|
|||
|
|||
//扫描数量和任务数量相等,直接提交 |
|||
if (this.scanCount == this.subList.length) { |
|||
if (this.checkCount()) { |
|||
this.submitJob(); |
|||
} |
|||
|
|||
} else if (this.scanCount < this.subList.length) { |
|||
//扫描数量小于任务数量,判断是否允许部分提交 |
|||
if (this.jobContent.allowPartialComplete == "TRUE") { |
|||
//提交 |
|||
if (this.checkCount()) { |
|||
this.submitJob(); |
|||
} |
|||
} else { |
|||
//不允许部分提交,提示 |
|||
this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList |
|||
.length + |
|||
"]"); |
|||
} |
|||
} |
|||
|
|||
}, |
|||
|
|||
checkCount() { |
|||
var isCheck = true; |
|||
var hint = "" |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
var item = this.detailSource[i]; |
|||
for (var j = 0; j < item.subList.length; j++) { |
|||
var subItem = item.subList[i] |
|||
if (calc.sub(subItem.handleQty, subItem.qty) < 0) { |
|||
isCheck = false; |
|||
hint = "包装【" + subItem.packingNumber + "】实际收货数量:" + subItem.handleQty + "与包装数量" + subItem.qty + |
|||
"不相等,是否继续收货?" |
|||
break |
|||
} |
|||
} |
|||
} |
|||
if (!isCheck) { |
|||
this.showQuestMessage(hint, res => { |
|||
if (res) { |
|||
this.submitJob(); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
return isCheck; |
|||
|
|||
}, |
|||
|
|||
submitJob() { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
var itemCodes = [] |
|||
this.detailSource.forEach(item => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
getManagementPrecisions(itemCodes, this.toLocationCode, res => { |
|||
if (res.success) { |
|||
this.managementList = res.list; |
|||
var params = this.setParams(); |
|||
console.log("提交参数", JSON.stringify(params)); |
|||
productReceiptJobsubmit(params).then(res => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage("提交成功<br>生成预生产收货记录<br>" + res.data, ) |
|||
} else { |
|||
this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
uni.hideLoading(); |
|||
this.showErrorMessage(res.message); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
setParams() { |
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
|
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
if (detail.scaned) { |
|||
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, |
|||
detail.packingNumber, detail.batch); |
|||
detail.toPackingNumber = info.packingNumber; |
|||
detail.toBatch = info.batch; |
|||
detail.toContainerNumber = ''; |
|||
detail.toInventoryStatus = detail.inventoryStatus |
|||
detail.toLocationCode = this.toLocationCode |
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
this.jobContent.subList = subList |
|||
this.jobContent.creator = creator; |
|||
return this.jobContent; |
|||
}, |
|||
|
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupLoseFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.losefocus(); |
|||
} |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
navigateBack(1) |
|||
}) |
|||
}, |
|||
showQuestMessage(hint, callBack) { |
|||
this.$refs.comMessage.showQuestionMessage(hint, res => { |
|||
if (res) { |
|||
callBack(true) |
|||
} |
|||
}) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
</style> |
@ -1,337 +1,404 @@ |
|||
<template> |
|||
<view class=""> |
|||
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
|||
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
|||
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
|||
:checkedWaitTask="checkedWaitTask"> |
|||
</job-filter> |
|||
|
|||
<view v-if="jobList.length>0"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<view v-for="(item, index) in jobList" :key="index"> |
|||
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
|||
@click="swipeClick($event,item)"> |
|||
<com-product-job-card :dataContent="item" @click='openJobDetail(item)'></com-product-job-card> |
|||
</uni-swipe-action-item> |
|||
</view> |
|||
</uni-swipe-action> |
|||
|
|||
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
|||
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
|||
|
|||
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getProductReceiptJobList, |
|||
cancleTakeProductReceiptJob |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
updateTitle |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailGiveupOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
|
|||
import comProductJobCard from '@/pages/productReceipt/coms/comProductJobCard.vue' |
|||
import jobListPopup from '@/pages/productReceipt/coms/jobListPopup.vue' |
|||
import jobInfoPopup from '@/pages/productReceipt/coms/jobInfoPopup.vue' |
|||
|
|||
export default { |
|||
name: 'receipt', |
|||
components: { |
|||
comEmptyView, |
|||
jobFilter, |
|||
comProductJobCard, |
|||
jobListPopup, |
|||
jobInfoPopup |
|||
}, |
|||
data() { |
|||
return { |
|||
jobList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
totalCount: 0, |
|||
loadingType: "nomore", |
|||
checkedToday: false, |
|||
checkedWaitTask: false, |
|||
todayTime: "", |
|||
status: '1,2', //待处理 、进行中 |
|||
detailOptions: [], |
|||
detailGiveupOptions: [], |
|||
}; |
|||
}, |
|||
// 装配收货:type = 'assemble' |
|||
// 预生产收货:type = 'predict' |
|||
props: { |
|||
type: 'assemble', |
|||
}, |
|||
|
|||
onReady() { |
|||
this.detailOptions = getDetailOption(); |
|||
this.detailGiveupOptions = getDetailGiveupOption(); |
|||
}, |
|||
|
|||
|
|||
mounted() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
onReachBottom() { |
|||
//避免多次触发 |
|||
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
return; |
|||
} |
|||
this.getList("more"); |
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
|
|||
//后退按钮 |
|||
onBackPress(options) { |
|||
if (options.from === 'navigateBack') { |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}) |
|||
return false; |
|||
} |
|||
}, |
|||
|
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index == 1) { |
|||
this.$refs.filter.openFilter(); |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
refresh(){ |
|||
this.getList('refresh'); |
|||
}, |
|||
getList(type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
this.loadingType = "loading"; |
|||
if (type === "refresh") { |
|||
this.pageNo = 1; |
|||
this.jobList = []; |
|||
} |
|||
var filters = [] |
|||
if (this.checkedToday) { |
|||
filters.push({ |
|||
column: "request_time", |
|||
action: "betweeen", |
|||
value: this.todayTime |
|||
}) |
|||
} |
|||
|
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: this.status |
|||
}) |
|||
|
|||
filters.push({ |
|||
column: "type", |
|||
action: "==", |
|||
value: this.type |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: this.pageNo, |
|||
pageSize: this.pageSize, |
|||
} |
|||
|
|||
getProductReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
var list = res.data.list; |
|||
this.totalCount = res.data.total |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产收货任务(" + this.totalCount + ")"); |
|||
} else if(this.type == 'assemble'){ |
|||
updateTitle("装配收货任务(" + this.totalCount + ")"); |
|||
}else { |
|||
updateTitle("报废收货任务(" + this.totalCount + ")"); |
|||
} |
|||
this.loadingType = "loadmore"; |
|||
if (list == null || list.length == 0) { |
|||
this.loadingType = "nomore"; |
|||
return; |
|||
} |
|||
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
|||
this.pageNo++; |
|||
|
|||
|
|||
}).catch(error => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产收货任务(" + this.totalCount + ")"); |
|||
} else if(this.type == 'assemble'){ |
|||
updateTitle("装配收货任务(" + this.totalCount + ")"); |
|||
}else { |
|||
updateTitle("报废收货任务(" + this.totalCount + ")"); |
|||
} |
|||
this.loadingType = ""; |
|||
uni.hideLoading(); |
|||
that.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
openJobDetail(item) { |
|||
if (this.type == 'predict') { |
|||
uni.navigateTo({ |
|||
url: './productReceiptDetail?id=' + item.masterId + '&status=' + item.status |
|||
}); |
|||
} else if(this.type == 'assemble'){ |
|||
uni.navigateTo({ |
|||
url: './fgProductReceiptDetail?id=' + item.masterId + '&status=' + item.status |
|||
}); |
|||
}else { |
|||
uni.navigateTo({ |
|||
url: './scrapReceiptDetail?id=' + item.masterId + '&status=' + item.status |
|||
}); |
|||
} |
|||
<template> |
|||
<view class=""> |
|||
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
|||
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" |
|||
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" |
|||
:checkedWaitTask="checkedWaitTask"> |
|||
</job-filter> |
|||
|
|||
<view v-if="jobList.length>0"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<view v-for="(item, index) in jobList" :key="index"> |
|||
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
|||
@click="swipeClick($event,item)"> |
|||
<com-product-job-card :dataContent="item" @click='openJobDetail(item)'></com-product-job-card> |
|||
</uni-swipe-action-item> |
|||
</view> |
|||
</uni-swipe-action> |
|||
|
|||
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> |
|||
<job-info-popup ref='jobInfoPopup'></job-info-popup> |
|||
|
|||
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
|||
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button> |
|||
<winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true"></winScanPackJob> |
|||
<jobList ref="jobList" @selectItem="selectItem"></jobList> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getProductReceiptJobList, |
|||
cancleTakeProductReceiptJob |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
updateTitle |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailGiveupOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
|
|||
import comProductJobCard from '@/pages/productReceipt/coms/comProductJobCard.vue' |
|||
import jobListPopup from '@/pages/productReceipt/coms/jobListPopup.vue' |
|||
import jobInfoPopup from '@/pages/productReceipt/coms/jobInfoPopup.vue' |
|||
import jobList from '@/mycomponents/jobList/jobList.vue' |
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue" |
|||
|
|||
export default { |
|||
name: 'receipt', |
|||
components: { |
|||
comEmptyView, |
|||
jobFilter, |
|||
comProductJobCard, |
|||
jobListPopup, |
|||
jobInfoPopup, |
|||
winScanButton, |
|||
winScanPackJob, |
|||
jobList |
|||
}, |
|||
data() { |
|||
return { |
|||
jobList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
totalCount: 0, |
|||
loadingType: "nomore", |
|||
checkedToday: false, |
|||
checkedWaitTask: false, |
|||
todayTime: "", |
|||
status: '1,2', //待处理 、进行中 |
|||
detailOptions: [], |
|||
detailGiveupOptions: [], |
|||
}; |
|||
}, |
|||
// 装配收货:type = 'assemble' |
|||
// 预生产收货:type = 'predict' |
|||
props: { |
|||
type: 'assemble', |
|||
}, |
|||
|
|||
onReady() { |
|||
this.detailOptions = getDetailOption(); |
|||
this.detailGiveupOptions = getDetailGiveupOption(); |
|||
}, |
|||
|
|||
|
|||
mounted() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
onReachBottom() { |
|||
//避免多次触发 |
|||
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
return; |
|||
} |
|||
this.getList("more"); |
|||
}, |
|||
|
|||
onPullDownRefresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
|
|||
|
|||
//后退按钮 |
|||
onBackPress(options) { |
|||
if (options.from === 'navigateBack') { |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}) |
|||
return false; |
|||
} |
|||
}, |
|||
|
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index == 1) { |
|||
this.$refs.filter.openFilter(); |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
refresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
getList(type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
this.loadingType = "loading"; |
|||
if (type === "refresh") { |
|||
this.pageNo = 1; |
|||
this.jobList = []; |
|||
} |
|||
var filters = [] |
|||
if (this.checkedToday) { |
|||
filters.push({ |
|||
column: "request_time", |
|||
action: "betweeen", |
|||
value: this.todayTime |
|||
}) |
|||
} |
|||
|
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: this.status |
|||
}) |
|||
|
|||
filters.push({ |
|||
column: "type", |
|||
action: "==", |
|||
value: this.type |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: this.pageNo, |
|||
pageSize: this.pageSize, |
|||
} |
|||
|
|||
getProductReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
var list = res.data.list; |
|||
this.totalCount = res.data.total |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产收货任务(" + this.totalCount + ")"); |
|||
} else if (this.type == 'assemble') { |
|||
updateTitle("装配收货任务(" + this.totalCount + ")"); |
|||
} else { |
|||
updateTitle("报废收货任务(" + this.totalCount + ")"); |
|||
} |
|||
this.loadingType = "loadmore"; |
|||
if (list == null || list.length == 0) { |
|||
this.loadingType = "nomore"; |
|||
return; |
|||
} |
|||
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
|||
this.pageNo++; |
|||
|
|||
|
|||
}).catch(error => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
if (this.type == 'predict') { |
|||
updateTitle("预生产收货任务(" + this.totalCount + ")"); |
|||
} else if (this.type == 'assemble') { |
|||
updateTitle("装配收货任务(" + this.totalCount + ")"); |
|||
} else { |
|||
updateTitle("报废收货任务(" + this.totalCount + ")"); |
|||
} |
|||
this.loadingType = ""; |
|||
uni.hideLoading(); |
|||
that.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
openJobDetail(item,packingNumber='') { |
|||
if (this.type == 'predict') { |
|||
uni.navigateTo({ |
|||
url: './productReceiptDetail?id=' + item.masterId + '&status=' + item.status + '&scaned=' + packingNumber |
|||
}); |
|||
} else if (this.type == 'assemble') { |
|||
uni.navigateTo({ |
|||
url: './fgProductReceiptDetail?id=' + item.masterId + '&status=' + item.status + '&scaned=' + packingNumber |
|||
}); |
|||
} else { |
|||
uni.navigateTo({ |
|||
url: './scrapReceiptDetail?id=' + item.masterId + '&status=' + item.status + '&scaned=' + packingNumber |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
showItemList(itemList) { |
|||
this.$refs.jobListPopup.openPopup(itemList); |
|||
}, |
|||
|
|||
selectedItem(item) { |
|||
this.openJobDetail(item); |
|||
}, |
|||
|
|||
swipeClick(e, dataContent) { |
|||
if (e.content.text == "详情") { |
|||
this.openjobInfoPopup(dataContent); |
|||
} else if (e.content.text == "放弃") { |
|||
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
|||
res => { |
|||
if (res) { |
|||
this.cancleJob(dataContent.masterId); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
openjobInfoPopup(item) { |
|||
this.$refs.jobInfoPopup.openPopup(item) |
|||
}, |
|||
|
|||
cancleJob(id) { |
|||
cancleTakeProductReceiptJob(id).then(res => { |
|||
if (res.data) { |
|||
this.getList("refresh") |
|||
uni.showToast({ |
|||
title: "放弃任务成功" |
|||
}) |
|||
} else { |
|||
this.showMessage("放弃任务失败") |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
switchChangeToday(state, creationTime) { |
|||
this.checkedToday = state; |
|||
this.todayTime = creationTime; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
switchChangeWait(state, jobStatus) { |
|||
this.checkedWaitTask = state; |
|||
this.status = jobStatus; |
|||
this.getList("refresh"); |
|||
}, |
|||
getScanNumber(code) { |
|||
this.getDataListByType(code) |
|||
}, |
|||
getDataListByType(code) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
var filters = [] |
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: '1,2' |
|||
}) |
|||
filters.push({ |
|||
column: "number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
} |
|||
getProductReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data.list.length == 0) { |
|||
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
|||
} else if (res.data.list.length == 1) { |
|||
that.openJobDetail(res.data.list[0]); |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading(); |
|||
that.showMessage(error); |
|||
}) |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
openFilter() { |
|||
this.$refs.filter.openFilter(); |
|||
}, |
|||
toHome() { |
|||
goHome() |
|||
}, |
|||
onReach() { |
|||
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
return; |
|||
} |
|||
this.getList("more"); |
|||
}, |
|||
|
|||
showItemList(itemList) { |
|||
this.$refs.jobListPopup.openPopup(itemList); |
|||
}, |
|||
|
|||
selectedItem(item) { |
|||
this.openJobDetail(item); |
|||
}, |
|||
|
|||
swipeClick(e, dataContent) { |
|||
if (e.content.text == "详情") { |
|||
this.openjobInfoPopup(dataContent); |
|||
} else if (e.content.text == "放弃") { |
|||
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
|||
res => { |
|||
if (res) { |
|||
this.cancleJob(dataContent.masterId); |
|||
} |
|||
}); |
|||
} |
|||
openScanPopup() { |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
|
|||
openjobInfoPopup(item) { |
|||
this.$refs.jobInfoPopup.openPopup(item) |
|||
selectItem(item) { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
this.openJobDetail(item,item.packingNumber); |
|||
}, |
|||
|
|||
cancleJob(id) { |
|||
cancleTakeProductReceiptJob(id).then(res => { |
|||
if (res.data) { |
|||
this.getList("refresh") |
|||
uni.showToast({ |
|||
title: "放弃任务成功" |
|||
getScanResult(result) { |
|||
try { |
|||
var filters = [{ |
|||
column: "packingNumber", |
|||
action: "==", |
|||
value: result.label.packingNumber |
|||
}, |
|||
{ |
|||
column: "batch", |
|||
action: "==", |
|||
value: result.label.batch |
|||
}, |
|||
{ |
|||
column: "qty", |
|||
action: "==", |
|||
value: result.label.qty |
|||
}, { |
|||
column: "itemCode", |
|||
action: "==", |
|||
value: result.label.itemCode |
|||
}, { |
|||
column: "fromLocationCode", |
|||
action: "==", |
|||
value: result.label.fromLocationCode |
|||
} |
|||
] |
|||
getProductReceiptJobList({ |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
}).then(res => { |
|||
var list = res.data.list; |
|||
list.forEach(item => { |
|||
item.title = item.number; |
|||
item.selected = false |
|||
}) |
|||
} else { |
|||
this.showMessage("放弃任务失败") |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
switchChangeToday(state, creationTime) { |
|||
this.checkedToday = state; |
|||
this.todayTime = creationTime; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
switchChangeWait(state, jobStatus) { |
|||
this.checkedWaitTask = state; |
|||
this.status = jobStatus; |
|||
this.getList("refresh"); |
|||
}, |
|||
getScanNumber(code) { |
|||
this.getDataListByType(code) |
|||
}, |
|||
getDataListByType(code) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
var filters = [] |
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: '1,2' |
|||
}) |
|||
filters.push({ |
|||
column: "number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
} |
|||
getProductReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data.list.length == 0) { |
|||
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
|||
} else if (res.data.list.length == 1) { |
|||
that.openJobDetail(res.data.list[0]); |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading(); |
|||
that.showMessage(error); |
|||
}) |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
openFilter() { |
|||
this.$refs.filter.openFilter(); |
|||
}, |
|||
toHome() { |
|||
goHome() |
|||
}, |
|||
onReach(){ |
|||
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
return; |
|||
console.log('list', list.length) |
|||
if (list.length > 1) { |
|||
this.$refs.jobList.openList(list) |
|||
} else { |
|||
this.selectItem(list[0]) |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
|
|||
} catch (e) { |
|||
this.showMessage(e.message) |
|||
} |
|||
this.getList("more"); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
}, |
|||
} |
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
File diff suppressed because it is too large
@ -1,321 +1,389 @@ |
|||
<template> |
|||
<view class=""> |
|||
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
|||
<job-filter ref="filter" :isShowAsn="true" @switchChangeToday="switchChangeToday" |
|||
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" @onScanAsnNumber="getScanAsnNumber" |
|||
:checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> |
|||
</job-filter> |
|||
<view v-if="jobList.length>0"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<view v-for="(item, index) in jobList" :key="index"> |
|||
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
|||
@click="swipeClick($event,item)"> |
|||
<com-receipt-job-card :dataContent="item" @click='openJobDetail(item)'></com-receipt-job-card> |
|||
</uni-swipe-action-item> |
|||
</view> |
|||
</uni-swipe-action> |
|||
|
|||
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
|||
<receipt-info-popup ref='jobInfoPopup'></receipt-info-popup> |
|||
<receipt-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></receipt-job-list-popup> |
|||
</view> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getPurchaseReceiptJobList, |
|||
cancleTakePurchaseReceiptJob |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
updateTitle |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailGiveupOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
|
|||
import comReceiptJobCard from '@/pages/purchaseReceipt/coms/comReceiptJobCard.vue' |
|||
import receiptJobListPopup from '@/pages/purchaseReceipt/coms/receiptJobListPopup.vue' |
|||
import receiptInfoPopup from '@/pages/purchaseReceipt/coms/receiptInfoPopup.vue' |
|||
|
|||
export default { |
|||
name: 'receipt', |
|||
components: { |
|||
comEmptyView, |
|||
jobFilter, |
|||
comReceiptJobCard, |
|||
receiptInfoPopup, |
|||
receiptJobListPopup, |
|||
}, |
|||
data() { |
|||
return { |
|||
jobList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
totalCount: 0, |
|||
loadingType: "nomore", |
|||
checkedToday: false, |
|||
checkedWaitTask: false, |
|||
todayTime: "", |
|||
status: '1,2', //待处理 、进行中 |
|||
detailOptions: [], |
|||
detailGiveupOptions: [], |
|||
}; |
|||
}, |
|||
|
|||
props: { |
|||
operation: "receipt" //reject 收货 拒绝 |
|||
}, |
|||
|
|||
// onShow() { |
|||
// this.getList('refresh'); |
|||
// }, |
|||
|
|||
// onReady() { |
|||
// this.detailOptions = getDetailOption(); |
|||
// this.detailGiveupOptions = getDetailGiveupOption(); |
|||
// }, |
|||
|
|||
// onReachBottom() { |
|||
// //避免多次触发 |
|||
// if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
// return; |
|||
// } |
|||
// this.getList("more"); |
|||
// }, |
|||
|
|||
// onPullDownRefresh() { |
|||
// this.refresh(); |
|||
// }, |
|||
|
|||
// //后退按钮 |
|||
// onBackPress(options) { |
|||
// if (options.from === 'navigateBack') { |
|||
// uni.navigateBack({ |
|||
// delta: 1 |
|||
// }) |
|||
// return false; |
|||
// } |
|||
// }, |
|||
|
|||
// //返回首页 |
|||
// onNavigationBarButtonTap(e) { |
|||
// if (e.index === 0) { |
|||
// goHome(); |
|||
// } else if (e.index == 1) { |
|||
// this.$refs.filter.openFilter(); |
|||
// } |
|||
// }, |
|||
mounted() { |
|||
this.refresh(); |
|||
}, |
|||
|
|||
methods: { |
|||
refresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
openFilter() { |
|||
this.$refs.filter.openFilter(); |
|||
}, |
|||
goHome() { |
|||
goHome(); |
|||
}, |
|||
getList(type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
this.loadingType = "loading"; |
|||
if (type === "refresh") { |
|||
this.pageNo = 1; |
|||
this.jobList = []; |
|||
} |
|||
var filters = [] |
|||
if (this.checkedToday) { |
|||
filters.push({ |
|||
column: "request_time", |
|||
action: "betweeen", |
|||
value: this.todayTime |
|||
}) |
|||
} |
|||
|
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: this.status |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: this.pageNo, |
|||
pageSize: this.pageSize, |
|||
} |
|||
getPurchaseReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
var list = res.data.list; |
|||
this.totalCount = res.data.total |
|||
updateTitle("采购收货任务(" + this.totalCount + ")"); |
|||
this.loadingType = "loadmore"; |
|||
if (list == null || list.length == 0) { |
|||
this.loadingType = "nomore"; |
|||
return; |
|||
} |
|||
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
|||
this.pageNo++; |
|||
|
|||
}).catch(error => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
updateTitle("采购收货"); |
|||
this.loadingType = ""; |
|||
uni.hideLoading(); |
|||
that.showMessage(error) |
|||
|
|||
}) |
|||
}, |
|||
|
|||
getScanAsnNumber(code) { |
|||
this.getDataListByType(code, "asnNumber") |
|||
}, |
|||
|
|||
getScanNumber(code) { |
|||
this.getDataListByType(code, "number") |
|||
}, |
|||
|
|||
getDataListByType(code, type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
var filters = [] |
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: '1,2' |
|||
}) |
|||
if (type == "asnNumber") { |
|||
filters.push({ |
|||
column: "asn_number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
} else if (type == "number") { |
|||
filters.push({ |
|||
column: "number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
} |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
} |
|||
getPurchaseReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data.list.length == 0) { |
|||
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
|||
} else if (res.data.list.length == 1) { |
|||
that.openJobDetail(res.data.list[0]); |
|||
} else { |
|||
if (type == "asnNumber") { |
|||
that.showItemList(res.data.list); |
|||
} |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading(); |
|||
that.showMessage(error); |
|||
}) |
|||
}, |
|||
|
|||
openJobDetail(item) { |
|||
uni.navigateTo({ |
|||
url: './receiptDetail?id=' + item.masterId + '&status=' + item.status + '&operation=' + this.operation |
|||
}); |
|||
}, |
|||
|
|||
showItemList(itemList) { |
|||
this.$refs.jobListPopup.openPopup(itemList); |
|||
}, |
|||
|
|||
selectedItem(item) { |
|||
this.openJobDetail(item); |
|||
}, |
|||
|
|||
swipeClick(e, dataContent) { |
|||
if (e.content.text == "详情") { |
|||
this.openjobInfoPopup(dataContent); |
|||
} else if (e.content.text == "放弃") { |
|||
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
|||
res => { |
|||
if (res) { |
|||
var id = dataContent.masterId |
|||
this.cancleJob(id); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
openjobInfoPopup(item) { |
|||
this.$refs.jobInfoPopup.openPopup(item) |
|||
}, |
|||
|
|||
cancleJob(id) { |
|||
cancleTakePurchaseReceiptJob(id).then(res => { |
|||
if (res.data) { |
|||
this.getList("refresh") |
|||
uni.showToast({ |
|||
title: "放弃任务成功" |
|||
}) |
|||
} else { |
|||
this.showMessage("放弃任务失败") |
|||
} |
|||
|
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
switchChangeToday(state, creationTime) { |
|||
this.checkedToday = state; |
|||
this.todayTime = creationTime; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
switchChangeWait(state, jobStatus) { |
|||
this.checkedWaitTask = state; |
|||
this.status = jobStatus; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
|
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
<template> |
|||
<view class=""> |
|||
<com-empty-view v-if="jobList.length==0"></com-empty-view> |
|||
<job-filter ref="filter" :isShowAsn="true" @switchChangeToday="switchChangeToday" |
|||
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" @onScanAsnNumber="getScanAsnNumber" |
|||
:checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> |
|||
</job-filter> |
|||
<view v-if="jobList.length>0"> |
|||
<uni-swipe-action ref="swipeAction"> |
|||
<view v-for="(item, index) in jobList" :key="index"> |
|||
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" |
|||
@click="swipeClick($event,item)"> |
|||
<com-receipt-job-card :dataContent="item" @click='openJobDetail(item)'></com-receipt-job-card> |
|||
</uni-swipe-action-item> |
|||
</view> |
|||
</uni-swipe-action> |
|||
|
|||
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> |
|||
<receipt-info-popup ref='jobInfoPopup'></receipt-info-popup> |
|||
<receipt-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></receipt-job-list-popup> |
|||
</view> |
|||
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button> |
|||
<winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true"> |
|||
</winScanPackJob> |
|||
<jobList ref="jobList" @selectItem="selectItem"></jobList> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getPurchaseReceiptJobList, |
|||
cancleTakePurchaseReceiptJob |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
updateTitle |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailGiveupOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|||
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|||
|
|||
import comReceiptJobCard from '@/pages/purchaseReceipt/coms/comReceiptJobCard.vue' |
|||
import receiptJobListPopup from '@/pages/purchaseReceipt/coms/receiptJobListPopup.vue' |
|||
import receiptInfoPopup from '@/pages/purchaseReceipt/coms/receiptInfoPopup.vue' |
|||
import jobList from '@/mycomponents/jobList/jobList.vue' |
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue" |
|||
|
|||
export default { |
|||
name: 'receipt', |
|||
components: { |
|||
comEmptyView, |
|||
jobFilter, |
|||
comReceiptJobCard, |
|||
receiptInfoPopup, |
|||
receiptJobListPopup, |
|||
winScanButton, |
|||
winScanPackJob, |
|||
jobList |
|||
}, |
|||
data() { |
|||
return { |
|||
jobList: [], |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
totalCount: 0, |
|||
loadingType: "nomore", |
|||
checkedToday: false, |
|||
checkedWaitTask: false, |
|||
todayTime: "", |
|||
status: '1,2', //待处理 、进行中 |
|||
detailOptions: [], |
|||
detailGiveupOptions: [], |
|||
}; |
|||
}, |
|||
|
|||
props: { |
|||
operation: "receipt" //reject 收货 拒绝 |
|||
}, |
|||
|
|||
// onShow() { |
|||
// this.getList('refresh'); |
|||
// }, |
|||
|
|||
// onReady() { |
|||
// this.detailOptions = getDetailOption(); |
|||
// this.detailGiveupOptions = getDetailGiveupOption(); |
|||
// }, |
|||
|
|||
// onReachBottom() { |
|||
// //避免多次触发 |
|||
// if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|||
// return; |
|||
// } |
|||
// this.getList("more"); |
|||
// }, |
|||
|
|||
// onPullDownRefresh() { |
|||
// this.refresh(); |
|||
// }, |
|||
|
|||
// //后退按钮 |
|||
// onBackPress(options) { |
|||
// if (options.from === 'navigateBack') { |
|||
// uni.navigateBack({ |
|||
// delta: 1 |
|||
// }) |
|||
// return false; |
|||
// } |
|||
// }, |
|||
|
|||
// //返回首页 |
|||
// onNavigationBarButtonTap(e) { |
|||
// if (e.index === 0) { |
|||
// goHome(); |
|||
// } else if (e.index == 1) { |
|||
// this.$refs.filter.openFilter(); |
|||
// } |
|||
// }, |
|||
mounted() { |
|||
this.refresh(); |
|||
}, |
|||
|
|||
methods: { |
|||
refresh() { |
|||
this.getList('refresh'); |
|||
}, |
|||
openFilter() { |
|||
this.$refs.filter.openFilter(); |
|||
}, |
|||
goHome() { |
|||
goHome(); |
|||
}, |
|||
getList(type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
this.loadingType = "loading"; |
|||
if (type === "refresh") { |
|||
this.pageNo = 1; |
|||
this.jobList = []; |
|||
} |
|||
var filters = [] |
|||
if (this.checkedToday) { |
|||
filters.push({ |
|||
column: "request_time", |
|||
action: "betweeen", |
|||
value: this.todayTime |
|||
}) |
|||
} |
|||
|
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: this.status |
|||
}) |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: this.pageNo, |
|||
pageSize: this.pageSize, |
|||
} |
|||
getPurchaseReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
|
|||
var list = res.data.list; |
|||
this.totalCount = res.data.total |
|||
updateTitle("采购收货任务(" + this.totalCount + ")"); |
|||
this.loadingType = "loadmore"; |
|||
if (list == null || list.length == 0) { |
|||
this.loadingType = "nomore"; |
|||
return; |
|||
} |
|||
this.jobList = type === "refresh" ? list : this.jobList.concat(list); |
|||
this.pageNo++; |
|||
|
|||
}).catch(error => { |
|||
if (type === "refresh") { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
updateTitle("采购收货"); |
|||
this.loadingType = ""; |
|||
uni.hideLoading(); |
|||
that.showMessage(error) |
|||
|
|||
}) |
|||
}, |
|||
|
|||
getScanAsnNumber(code) { |
|||
this.getDataListByType(code, "asnNumber") |
|||
}, |
|||
|
|||
getScanNumber(code) { |
|||
this.getDataListByType(code, "number") |
|||
}, |
|||
|
|||
getDataListByType(code, type) { |
|||
let that = this; |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
var filters = [] |
|||
filters.push({ |
|||
column: "status", |
|||
action: "in", |
|||
value: '1,2' |
|||
}) |
|||
if (type == "asnNumber") { |
|||
filters.push({ |
|||
column: "asn_number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
} else if (type == "number") { |
|||
filters.push({ |
|||
column: "number", |
|||
action: "==", |
|||
value: code |
|||
}) |
|||
} |
|||
|
|||
var params = { |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
} |
|||
getPurchaseReceiptJobList(params).then(res => { |
|||
uni.hideLoading(); |
|||
if (res.data.list.length == 0) { |
|||
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
|||
} else if (res.data.list.length == 1) { |
|||
that.openJobDetail(res.data.list[0]); |
|||
} else { |
|||
if (type == "asnNumber") { |
|||
that.showItemList(res.data.list); |
|||
} |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading(); |
|||
that.showMessage(error); |
|||
}) |
|||
}, |
|||
|
|||
openJobDetail(item,packingNumber='') { |
|||
uni.navigateTo({ |
|||
url: './receiptDetail?id=' + item.masterId + '&status=' + item.status + '&operation=' + this |
|||
.operation + '&scaned=' + packingNumber |
|||
}); |
|||
}, |
|||
|
|||
showItemList(itemList) { |
|||
this.$refs.jobListPopup.openPopup(itemList); |
|||
}, |
|||
|
|||
selectedItem(item) { |
|||
this.openJobDetail(item); |
|||
}, |
|||
|
|||
swipeClick(e, dataContent) { |
|||
if (e.content.text == "详情") { |
|||
this.openjobInfoPopup(dataContent); |
|||
} else if (e.content.text == "放弃") { |
|||
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", |
|||
res => { |
|||
if (res) { |
|||
var id = dataContent.masterId |
|||
this.cancleJob(id); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
openjobInfoPopup(item) { |
|||
this.$refs.jobInfoPopup.openPopup(item) |
|||
}, |
|||
|
|||
cancleJob(id) { |
|||
cancleTakePurchaseReceiptJob(id).then(res => { |
|||
if (res.data) { |
|||
this.getList("refresh") |
|||
uni.showToast({ |
|||
title: "放弃任务成功" |
|||
}) |
|||
} else { |
|||
this.showMessage("放弃任务失败") |
|||
} |
|||
|
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
switchChangeToday(state, creationTime) { |
|||
this.checkedToday = state; |
|||
this.todayTime = creationTime; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
switchChangeWait(state, jobStatus) { |
|||
this.checkedWaitTask = state; |
|||
this.status = jobStatus; |
|||
this.getList("refresh"); |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
|
|||
}, |
|||
openScanPopup() { |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
selectItem(item) { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
this.openJobDetail(item, item.packingNumber); |
|||
}, |
|||
getScanResult(result) { |
|||
try { |
|||
var filters = [{ |
|||
column: "packingNumber", |
|||
action: "==", |
|||
value: result.label.packingNumber |
|||
}, |
|||
{ |
|||
column: "batch", |
|||
action: "==", |
|||
value: result.label.batch |
|||
}, |
|||
{ |
|||
column: "qty", |
|||
action: "==", |
|||
value: result.label.qty |
|||
}, { |
|||
column: "itemCode", |
|||
action: "==", |
|||
value: result.label.itemCode |
|||
}, { |
|||
column: "fromLocationCode", |
|||
action: "==", |
|||
value: result.label.fromLocationCode |
|||
} |
|||
] |
|||
getPurchaseReceiptJobList({ |
|||
filters: filters, |
|||
pageNo: 1, |
|||
pageSize: 100, |
|||
}).then(res => { |
|||
var list = res.data.list; |
|||
list.forEach(item => { |
|||
item.title = item.number; |
|||
item.selected = false |
|||
}) |
|||
console.log('list', list) |
|||
if (list.length > 1) { |
|||
this.$refs.jobList.openList(list) |
|||
} else { |
|||
this.selectItem(list[0]) |
|||
} |
|||
}).catch(error => { |
|||
this.showMessage(error) |
|||
}) |
|||
|
|||
} catch (e) { |
|||
this.showMessage(e.message) |
|||
} |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
Loading…
Reference in new issue