|
|
@ -1,7 +1,9 @@ |
|
|
|
<template> |
|
|
|
<view class=""> |
|
|
|
<com-empty-view v-if="jobList.length == 0"></com-empty-view> |
|
|
|
<job-filter ref="filter" otherTitle="" @switchChangeToday="switchChangeToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> </job-filter> |
|
|
|
<job-filter ref="filter" otherTitle="" |
|
|
|
@onQuery="getListByFilter" :isShowQurery='true'> |
|
|
|
</job-filter> |
|
|
|
<view v-if="jobList.length > 0" class="u-m-20"> |
|
|
|
<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in jobList" :key="index" :options="item.status == '2' ? detailGiveupOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="swipeClick"> |
|
|
|
<comOverPackJobCard :dataContent="item" @click="openJobDetail(item)"></comOverPackJobCard> |
|
|
@ -10,21 +12,32 @@ |
|
|
|
|
|
|
|
<uni-load-more :status="loadingType" v-if="jobList.length > 0" /> |
|
|
|
</view> |
|
|
|
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button> |
|
|
|
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' |
|
|
|
:isCheckLocationBalance="false" |
|
|
|
:bussinessCode="businessTypeCode"> |
|
|
|
</winComScanBalance> |
|
|
|
<!-- <winScanPackJob ref="scanPopup" @getResult='getScanResult'></winScanPackJob>--> |
|
|
|
<jobList ref="jobList" @selectItem="selectItem"></jobList> |
|
|
|
<com-message ref="comMessageRef" /> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { ref, getCurrentInstance, nextTick } from 'vue' |
|
|
|
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
|
|
import { cancleTakeOverPageJob, getOverPageJobList } from '@/api/request2.js' |
|
|
|
import { cancleTakeOverPageJob, getOverPageJobList, packageoverRequestClose } from '@/api/request2.js' |
|
|
|
import { goHome, updateTitle } from '@/common/basic.js' |
|
|
|
|
|
|
|
import {getBusinessType} from '@/common/record.js'; |
|
|
|
import {planRefreshTime, overPackageJobFilter} from '@/common/config.js'; |
|
|
|
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js' |
|
|
|
|
|
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|
|
|
import jobFilter from '@/mycomponents/job/jobFilter.vue' |
|
|
|
import comOverPackJobCard from '@/pages/package/coms/comOverPackJobCard.vue' |
|
|
|
import jobInfoPopup from '@/pages/issue/coms/jobInfoPopup.vue' |
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
|
|
|
import jobList from '@/mycomponents/jobList/jobList.vue' |
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() |
|
|
|
const jobList = ref([]) |
|
|
@ -42,6 +55,11 @@ const filter = ref() |
|
|
|
const title = ref('') |
|
|
|
const comMessageRef = ref() |
|
|
|
const jobInfoPopupRef = ref() |
|
|
|
const businessTypeCode = ref('OverPackage') |
|
|
|
const businessType = ref(null) |
|
|
|
const timer = ref(null) |
|
|
|
const scanMessage = ref('') |
|
|
|
const scanPopup = ref(null) |
|
|
|
onShow(() => { |
|
|
|
nextTick(() => { |
|
|
|
getList('refresh') |
|
|
@ -53,6 +71,12 @@ onLoad((option) => { |
|
|
|
onReady(() => { |
|
|
|
detailOptions.value = getDetailOption() |
|
|
|
detailGiveupOptions.value = getDetailGiveupOption() |
|
|
|
detailOptions.value = [...detailOptions.value,{ |
|
|
|
text:"关闭", |
|
|
|
style:{ |
|
|
|
backgroundColor:"#F56C6C" |
|
|
|
} |
|
|
|
}] |
|
|
|
}) |
|
|
|
onReachBottom(() => { |
|
|
|
// 避免多次触发 |
|
|
@ -78,9 +102,61 @@ onNavigationBarButtonTap((e) => { |
|
|
|
if (e.index === 0) { |
|
|
|
goHome() |
|
|
|
} else if (e.index == 1) { |
|
|
|
filter.value.openFilter() |
|
|
|
filter.value.openFilterParams(uni.getStorageSync(overPackageJobFilter)); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
const getBusinessTypeFunc = ()=> { |
|
|
|
getBusinessType(this.businessTypeCode, res => { |
|
|
|
if (res.success) { |
|
|
|
businessType.value = res.businessType; |
|
|
|
openScanPopup(); |
|
|
|
} else { |
|
|
|
showMessage(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
const timerRefresh = ()=> { |
|
|
|
getList('refresh') |
|
|
|
stopRefresh(); |
|
|
|
timer.value = setInterval(function() { |
|
|
|
getList('refresh') |
|
|
|
}, planRefreshTime) |
|
|
|
} |
|
|
|
const stopRefresh = ()=> { |
|
|
|
if (timer.value) { |
|
|
|
clearInterval(timer.value); |
|
|
|
timer.value = null; |
|
|
|
} |
|
|
|
} |
|
|
|
const setQueryParam = ()=> { |
|
|
|
let filterParams = [] |
|
|
|
let queryParams = uni.getStorageSync(overPackageJobFilter) |
|
|
|
|
|
|
|
//只看当天 |
|
|
|
if (queryParams.creationTime ) { |
|
|
|
filterParams.push({ |
|
|
|
column: "create_time", |
|
|
|
action: "betweeen", |
|
|
|
value: queryParams.creationTime |
|
|
|
}) |
|
|
|
} |
|
|
|
//只看待处理 |
|
|
|
if (queryParams.status) { |
|
|
|
filterParams.push({ |
|
|
|
column: "status", |
|
|
|
action: "in", |
|
|
|
value: queryParams.status |
|
|
|
}) |
|
|
|
}else { |
|
|
|
filterParams.push({ |
|
|
|
column: "status", |
|
|
|
action: "in", |
|
|
|
value: "1,2" |
|
|
|
}) |
|
|
|
} |
|
|
|
return filterParams; |
|
|
|
} |
|
|
|
const getList = (type) => { |
|
|
|
proxy.$modal.loading('加载中....') |
|
|
|
loadingType.value = 'loading' |
|
|
@ -88,28 +164,9 @@ const getList = (type) => { |
|
|
|
pageNo.value = 1 |
|
|
|
jobList.value = [] |
|
|
|
} |
|
|
|
|
|
|
|
const filters = [] |
|
|
|
if (checkedToday.value) { |
|
|
|
filters.push({ |
|
|
|
column: 'create_time', |
|
|
|
action: 'betweeen', |
|
|
|
value: todayTime.value |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
filters.push({ |
|
|
|
column: 'status', |
|
|
|
action: 'in', |
|
|
|
value: status.value |
|
|
|
}) |
|
|
|
filters.push({ |
|
|
|
column: 'accept_user_id', |
|
|
|
action: '==', |
|
|
|
value: store.id |
|
|
|
}) |
|
|
|
let queryFiltersParams = setQueryParam() |
|
|
|
const params = { |
|
|
|
filters, |
|
|
|
filters:queryFiltersParams, |
|
|
|
pageNo: pageNo.value, |
|
|
|
pageSize: pageSize.value |
|
|
|
} |
|
|
@ -118,8 +175,8 @@ const getList = (type) => { |
|
|
|
uni.hideLoading() |
|
|
|
if (type === 'refresh') { |
|
|
|
uni.stopPullDownRefresh() |
|
|
|
openScanPopup() |
|
|
|
} |
|
|
|
|
|
|
|
const { list } = res.data |
|
|
|
totalCount.value = res.data.total |
|
|
|
updateTitle(`${title.value}(${totalCount.value})`) |
|
|
@ -129,6 +186,12 @@ const getList = (type) => { |
|
|
|
loadingType.value = 'nomore' |
|
|
|
return |
|
|
|
} |
|
|
|
if (list && list.length > 0) { |
|
|
|
list.forEach(item => { |
|
|
|
item.fromPackCount = Math.ceil(item.qty / item.fromPackQty) |
|
|
|
item.toPackCount = Math.ceil(item.qty / item.toPackQty) |
|
|
|
}) |
|
|
|
} |
|
|
|
jobList.value = type === 'refresh' ? list : jobList.value.concat(list) |
|
|
|
pageNo.value++ |
|
|
|
}) |
|
|
@ -139,39 +202,20 @@ const getList = (type) => { |
|
|
|
loadingType.value = '' |
|
|
|
updateTitle(title.value) |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error) |
|
|
|
showMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
const getByAsnNumber = (code) => { |
|
|
|
proxy.$modal.loading('加载中....') |
|
|
|
getPurchasereceiptByAsnNumber(code) |
|
|
|
.then((res) => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data.total == 0) { |
|
|
|
showMessage('未查找到' + `【${code}】的收货任务`) |
|
|
|
} else if (res.data.total == 1) { |
|
|
|
scanAsnNumber.value.closeScanPopup() |
|
|
|
openJobDetail(res.data.list[0]) |
|
|
|
} else { |
|
|
|
scanAsnNumber.value.closeScanPopup() |
|
|
|
showItemList(res.data.list) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error) |
|
|
|
}) |
|
|
|
const getListByFilter = (params)=> { |
|
|
|
uni.setStorageSync(overPackageJobFilter,params) |
|
|
|
getList('refresh') |
|
|
|
} |
|
|
|
const openJobDetail = (item) => { |
|
|
|
proxy.$tab.navigateTo(`./overPackageJobDetail?id=${item.masterId}&status=${item.status}`) |
|
|
|
const openJobDetail = (item,scanMessage = '') => { |
|
|
|
getJobInfoByNumber(item.number,scanMessage) |
|
|
|
} |
|
|
|
const selectedItem = (item) => { |
|
|
|
openJobDetail(item) |
|
|
|
openJobDetail(item.number) |
|
|
|
} |
|
|
|
|
|
|
|
const showItemList = (itemList) => { |
|
|
|
scanList.value.openPopup(itemList) |
|
|
|
} |
|
|
|
const swipeClick = (index, index1) => { |
|
|
|
// var text = clearTirmAndWrap(requestList.value[index].options[index].text) |
|
|
|
let text = '' |
|
|
@ -189,8 +233,29 @@ const swipeClick = (index, index1) => { |
|
|
|
cancleJob(dataContent.masterId) |
|
|
|
} |
|
|
|
}) |
|
|
|
}else if (e.content.text == "关闭") { |
|
|
|
comMessageRef.value.showQuestionMessage("确定要关闭当前任务?", |
|
|
|
res => { |
|
|
|
if (res) { |
|
|
|
closeJob(dataContent.masterId); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
const closeJob = (id)=>{ |
|
|
|
packageoverRequestClose(id).then(res => { |
|
|
|
if(res.data){ |
|
|
|
getList("refresh") |
|
|
|
uni.showToast({ |
|
|
|
title:"关闭任务成功" |
|
|
|
}) |
|
|
|
}else { |
|
|
|
showMessage("关闭任务失败") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
showMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
const openjobInfoPopup = (item) => { |
|
|
|
jobInfoPopupRef.value.openPopup(item) |
|
|
|
} |
|
|
@ -210,6 +275,19 @@ const cancleJob = (id) => { |
|
|
|
showMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
const showMessage = (message)=> { |
|
|
|
comMessageRef.value.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
const openScanPopup = ()=> { |
|
|
|
if (businessType.value == null) { |
|
|
|
getBusinessTypeFunc() |
|
|
|
} else { |
|
|
|
scanPopup.value.openScanPopup(businessType.value); |
|
|
|
} |
|
|
|
} |
|
|
|
const switchChangeToday = (state, creationTime) => { |
|
|
|
checkedToday.value = state |
|
|
|
todayTime.value = creationTime |
|
|
@ -223,7 +301,7 @@ const switchChangeWait = (state, jobStatus) => { |
|
|
|
const getScanNumber = (code) => { |
|
|
|
getDataListByType(code) |
|
|
|
} |
|
|
|
const getDataListByType = (code) => { |
|
|
|
const getJobInfoByNumber = (number,scanMessage) => { |
|
|
|
proxy.$modal.loading('加载中....') |
|
|
|
const filters = [] |
|
|
|
filters.push({ |
|
|
@ -234,7 +312,7 @@ const getDataListByType = (code) => { |
|
|
|
filters.push({ |
|
|
|
column: 'number', |
|
|
|
action: '==', |
|
|
|
value: code |
|
|
|
value: number |
|
|
|
}) |
|
|
|
const params = { |
|
|
|
filters, |
|
|
@ -245,9 +323,22 @@ const getDataListByType = (code) => { |
|
|
|
.then((res) => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data.list.length == 0) { |
|
|
|
showMessage('未查找到' + `【${code}】的收货任务`) |
|
|
|
} else if (res.data.list.length == 1) { |
|
|
|
openJobDetail(res.data.list[0]) |
|
|
|
showMessage(`未查找到【${number}】的发料任务`) |
|
|
|
} else { |
|
|
|
let result = res.data.list[0]; |
|
|
|
if (result.acceptUserId && result.acceptUserId != store.id) { |
|
|
|
comMessageRef.value.showErrorMessage("任务号[" + result.number + "]已经被[" + result.acceptUserName + "]承接,无法执行", res => { |
|
|
|
if (res) { |
|
|
|
getList('refresh') |
|
|
|
} |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
uni.navigateTo({ |
|
|
|
url: './overPackageJobDetail?id=' + result.masterId + '&status=' + result.status + '&title=' + title.value + '&scanMessage=' + |
|
|
|
scanMessage + '&fromLocationCode=' + result.fromLocationCode |
|
|
|
}); |
|
|
|
scanMessage.value = "" |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
@ -255,11 +346,80 @@ const getDataListByType = (code) => { |
|
|
|
showMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
const showMessage = (message) => { |
|
|
|
comMessageRef.value.showErrorMessage(message, (res) => { |
|
|
|
if (res) { |
|
|
|
const selectItem = (item)=> { |
|
|
|
scanPopup.value.closeScanPopup(); |
|
|
|
openJobDetail(item, this.scanMessage); |
|
|
|
} |
|
|
|
const getScanResult = (result)=> { |
|
|
|
let balance = result.balance; |
|
|
|
if (balance != null) { |
|
|
|
scanMessage.value = "" |
|
|
|
if (!result.label.batch) { |
|
|
|
showMessage("批次为空") |
|
|
|
return; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (!result.label.itemCode) { |
|
|
|
showMessage("物料号为空") |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
let filters = [{ |
|
|
|
column: "status", |
|
|
|
action: "in", |
|
|
|
value: '1,2' |
|
|
|
}, |
|
|
|
{ |
|
|
|
column: "batch", |
|
|
|
action: "==", |
|
|
|
value: result.label.batch |
|
|
|
}, |
|
|
|
{ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: result.label.itemCode |
|
|
|
}, |
|
|
|
{ |
|
|
|
column: "fromLocationCode", |
|
|
|
action: "==", |
|
|
|
value: balance.locationCode |
|
|
|
} |
|
|
|
] |
|
|
|
getOverPageJobList({ |
|
|
|
filters: filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 1000, |
|
|
|
sort: 'createTime', |
|
|
|
by: 'asc' |
|
|
|
}).then(res => { |
|
|
|
scanMessage.value = result.scanMessage |
|
|
|
let resultList = res.data.list; |
|
|
|
if (resultList.length > 0) { |
|
|
|
resultList.forEach(item => { |
|
|
|
item.title = item.number; |
|
|
|
item.selected = false |
|
|
|
}) |
|
|
|
let list = [] |
|
|
|
resultList.forEach(item => { |
|
|
|
if (!list.find(subItem => subItem.title == item.title)) { |
|
|
|
list.push(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
if (list.length > 0) { |
|
|
|
selectItem(list[0]) |
|
|
|
} |
|
|
|
} else { |
|
|
|
showMessage("按来源库位[" + balance.locationCode + "]批次[" + result.label.batch + |
|
|
|
"]物料号[" + result.label.itemCode + "]未查找到任务\n" + "扫描[" + result |
|
|
|
.scanMessage + "]") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
showMessage(error + "\n扫描[" + result.scanMessage + "]") |
|
|
|
}) |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
showMessage(e.message) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|