zhang_li
3 months ago
9 changed files with 872 additions and 17 deletions
@ -0,0 +1,452 @@ |
|||
<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 ref="comScanLocation" title="收货库位" :isShowEdit="jobContent.allowModifyLocation == 'TRUE'" :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> |
|||
<com-message ref="comMessageRef" /> |
|||
</view> |
|||
</template> |
|||
|
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, getCurrentInstance, nextTick, onMounted } from 'vue' |
|||
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|||
import { getManagementPrecisions } from '@/common/balance.js' |
|||
|
|||
import { getProductReceiptJobDetail, takeProductReceiptJob, cancleTakeProductReceiptJob, ccProductReceiptJobsubmit } 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' |
|||
const id= ref('') |
|||
const receiptJob= ref({}) |
|||
const toLocationCode= ref('') |
|||
const isShowPackingCode= ref(true) |
|||
const scanCount= ref(0) |
|||
const jobContent= ref({})// 任务内容 |
|||
const subList= ref([])// 接口返回的任务subList |
|||
const detailSource= ref([])// 绑定在页面上的数据源 |
|||
const toLocationAreaTypeList= ref([]) |
|||
const managementList= ref([]) |
|||
const jobStatus= ref('') |
|||
const jobToLocationCode= ref('') |
|||
const scanedPackingNumber= ref('') |
|||
const status= ref('') |
|||
const comScanLocation= ref() |
|||
const scanPopup= ref() |
|||
const comMessageRef= ref() |
|||
|
|||
onLoad((option)=> { |
|||
uni.setNavigationBarTitle({ |
|||
title: `${option.title}详情` |
|||
}) |
|||
|
|||
id.value = option.id |
|||
scanedPackingNumber.value = option.scaned || '' |
|||
status.value = option.status || '' |
|||
}) |
|||
onShow(() =>{ |
|||
if (id.value != undefined) { |
|||
// 新建的任务自动接收 |
|||
if (status.value == '1') { |
|||
receive((callback) => { |
|||
getDetail() |
|||
}) |
|||
} else { |
|||
getDetail() |
|||
} |
|||
} |
|||
}) |
|||
// 返回首页 |
|||
onNavigationBarButtonTap((e) =>{ |
|||
if (e.index === 0) { |
|||
goHome() |
|||
} |
|||
}) |
|||
// 拦截返回按钮事件 |
|||
onBackPress((e)=> { |
|||
// 已经接收但是没提交任务 |
|||
if (e.from == 'backbutton') { |
|||
if (jobStatus.value == '2') { |
|||
// 取消承接任务 |
|||
cancleTakeProductReceiptJob(id.value ) |
|||
.then((res) => { |
|||
uni.navigateBack() |
|||
}) |
|||
.catch((error) => { |
|||
uni.navigateBack() |
|||
}) |
|||
} else { |
|||
uni.navigateBack() |
|||
} |
|||
|
|||
return true |
|||
} |
|||
}) |
|||
|
|||
onPullDownRefresh(() =>{ |
|||
getDetail() |
|||
uni.stopPullDownRefresh() |
|||
}) |
|||
|
|||
// 接收 |
|||
const receive=(callback)=> { |
|||
if (id.value != null) { |
|||
takeProductReceiptJob(id.value) |
|||
.then((res) => { |
|||
callback() |
|||
}) |
|||
.catch((error) => { |
|||
showErrorMessage(error) |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const getDetail=() =>{ |
|||
uni.showLoading({ |
|||
title: '加载中....', |
|||
mask: true |
|||
}) |
|||
getProductReceiptJobDetail(that.id) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data == null) { |
|||
showMessage('未获取到详情') |
|||
} else if (res.data.subList.length > 0) { |
|||
jobContent.value = res.data |
|||
subList.value = res.data.subList |
|||
jobStatus.value = res.data.status |
|||
jobToLocationCode.value = subList.value[0].toLocationCode |
|||
if (jobContent.value.allowModifyLocation == 'FALSE') { |
|||
toLocationCode.value = subList.value[0].toLocationCode |
|||
} |
|||
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes) |
|||
detailSource.value = getDataSource(subList.value) |
|||
detailSource.value.forEach((r) => { |
|||
r.subList.forEach((s) => { |
|||
if (scanedPackingNumber.value && scanedPackingNumber.value == s.packingNumber) { |
|||
s.scaned = true |
|||
s.cancleScanedHiht = true |
|||
s.copyContent = `HMQ;V1.0;I${s.itemCode};P${s.packingNumber};B${s.batch};Q${s.qty}` |
|||
|
|||
scanPopup.value.simulateScan(s) |
|||
scanedPackingNumber.value = '' |
|||
// s.handleQty =s.qty |
|||
} |
|||
}) |
|||
}) |
|||
} else { |
|||
showMessage('列表数据为0') |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
showErrorMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const getScanResult=(result) =>{ |
|||
const { label } = result |
|||
const { packingNumber } = label |
|||
const { batch } = label |
|||
const { qty } = label |
|||
const { itemCode } = label |
|||
|
|||
const detail = detailSource.find((r) => r.itemCode == itemCode) |
|||
if (detail == undefined) { |
|||
showErrorMessage(`物料号【${itemCode}】不在列表中`) |
|||
} else { |
|||
const itemDetail = detail.subList.find((r) => r.packingNumber == packingNumber && r.batch == batch) |
|||
if (itemDetail == undefined) { |
|||
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]不在任务列表中`) |
|||
} else if (!itemDetail.cancleScanedHiht && itemDetail.scaned) { |
|||
showErrorMessage(`箱码[${packingNumber}]` + `批次[${batch}]已经扫描`) |
|||
} else { |
|||
itemDetail.scaned = true |
|||
itemDetail.handleQty = Number(result.label.qty) |
|||
itemDetail.toLocationCode = toLocationCode.value |
|||
itemDetail.labelQty = Number(result.label.qty) |
|||
calcHandleQty(detailSource.value) |
|||
continueScan() |
|||
$forceUpdate() |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 继续扫描 |
|||
const continueScan=()=> { |
|||
scanCount.value = getScanCount(subList.value) |
|||
if (scanCount.value == subList.value.length) { |
|||
closeScanPopup() |
|||
} else { |
|||
scanPopupGetFocus() |
|||
} |
|||
} |
|||
|
|||
const updateData=() =>{ |
|||
calcHandleQty(detailSource.value) |
|||
} |
|||
|
|||
const openScanPopup=() =>{ |
|||
scanPopup.value.openScanPopup() |
|||
} |
|||
|
|||
const closeScanPopup=() =>{ |
|||
scanPopup.value.closeScanPopup() |
|||
} |
|||
|
|||
const scanLocationCode=(location, code) =>{ |
|||
toLocationCode.value = code |
|||
detailSource.value.forEach((item) => { |
|||
item.subList.forEach((detail) => { |
|||
detail.toLocationCode = code |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
const checkLocation=() =>{ |
|||
let isPass = true |
|||
if (toLocationCode.value == '' || toLocationCode.value == null) { |
|||
showMessageHint('请扫描收货库位', (callback) => { |
|||
comScanLocation.value.showLocation() |
|||
}) |
|||
|
|||
return (isPass = false) |
|||
} |
|||
return isPass |
|||
} |
|||
|
|||
const showMessageHint(hint, callback) { |
|||
this.$refs.comMessage.showErrorMessage(hint, (res) => { |
|||
if (res) { |
|||
callback() |
|||
} |
|||
}) |
|||
} |
|||
const commit=() =>{ |
|||
scanCount.value = getScanCount(subList.value) |
|||
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() { |
|||
let isCheck = true |
|||
let hint = '' |
|||
for (let i = 0; i < this.detailSource.length; i++) { |
|||
const item = this.detailSource[i] |
|||
for (let j = 0; j < item.subList.length; j++) { |
|||
const 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 |
|||
}) |
|||
const itemCodes = [] |
|||
this.detailSource.forEach((item) => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
getManagementPrecisions(itemCodes, this.toLocationCode, (res) => { |
|||
if (res.success) { |
|||
this.managementList = res.list |
|||
const params = this.setParams() |
|||
console.log('提交参数', JSON.stringify(params)) |
|||
ccProductReceiptJobsubmit(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() { |
|||
const subList = [] |
|||
const creator = this.$store.state.user.id |
|||
|
|||
this.detailSource.forEach((item) => { |
|||
item.subList.forEach((detail) => { |
|||
if (detail.scaned) { |
|||
const 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> |
@ -0,0 +1,382 @@ |
|||
<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="jobListPopupRef" @selectedItem="selectedItem"></job-list-popup> |
|||
<job-info-popup ref="jobInfoPopupRef"></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"></winScanPackJob> |
|||
<jobList ref="jobList" @selectItem="selectItem"></jobList> |
|||
<com-message ref="comMessageRef" /> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, getCurrentInstance, onMounted,nextTick } from 'vue' |
|||
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|||
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' |
|||
|
|||
import { useCountStore } from '@/store' |
|||
// 获取自定义的store |
|||
const store = useCountStore() |
|||
const props = defineProps({ |
|||
type: { |
|||
type: String, |
|||
default: '' |
|||
} |
|||
}) |
|||
const jobList = ref([]) |
|||
const pageNo = ref(1) |
|||
const pageSize = ref(10) |
|||
const totalCount = ref(0) |
|||
const loadingType = ref('noMore') |
|||
const checkedToday = ref(false) |
|||
const checkedWaitTask = ref(false) |
|||
const todayTime = ref('') |
|||
const status = ref('1,2') // 待处理 、进行中 |
|||
const detailOptions = ref([]) |
|||
const detailGiveupOptions = ref([]) |
|||
const type = ref('assemble') |
|||
const filter = ref() |
|||
const comMessageRef = ref() |
|||
const jobListPopupRef = ref() |
|||
const jobInfoPopupRef = ref() |
|||
const scanPopup = ref() |
|||
|
|||
onMounted(() => { |
|||
detailOptions.value = getDetailOption() |
|||
detailGiveupOptions.value = getDetailGiveupOption() |
|||
getList('refresh') |
|||
}) |
|||
onPullDownRefresh(() => { |
|||
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) { |
|||
filter.value.openFilter() |
|||
} |
|||
} |
|||
|
|||
onReachBottom(() => { |
|||
// 避免多次触发 |
|||
if (loadingType.value == 'loading' || loadingType.value == 'noMore') { |
|||
return |
|||
} |
|||
getList('more') |
|||
}) |
|||
const refresh = () => { |
|||
getList('refresh') |
|||
} |
|||
const getList = (type) => { |
|||
uni.showLoading({ |
|||
title: '加载中....', |
|||
mask: true |
|||
}) |
|||
loadingType.value = 'loading' |
|||
if (type === 'refresh') { |
|||
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 |
|||
}) |
|||
filters.push({ |
|||
column: 'type', |
|||
action: '==', |
|||
value: type.value |
|||
}) |
|||
|
|||
const params = { |
|||
filters, |
|||
pageNo: pageNo.value, |
|||
pageSize: pageSize.value |
|||
} |
|||
|
|||
getProductReceiptJobList(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (type === 'refresh') { |
|||
uni.stopPullDownRefresh() |
|||
} |
|||
|
|||
const { list } = res.data |
|||
totalCount.value = res.data.total |
|||
// 预生产收货任务 装配收货任务 报废收货任务 |
|||
updateTitle(`${title.value}(${totalCount.value})`) |
|||
loadingType.value = 'more' |
|||
if (list == null || list.length == 0) { |
|||
loadingType.value = 'noMore' |
|||
return |
|||
} |
|||
jobList.value = type === 'refresh' ? list : jobList.value.concat(list) |
|||
pageNo.value++ |
|||
}) |
|||
.catch((error) => { |
|||
if (type === 'refresh') { |
|||
uni.stopPullDownRefresh() |
|||
} |
|||
updateTitle(`${title.value}(${totalCount.value})`) |
|||
loadingType.value = '' |
|||
uni.hideLoading() |
|||
showMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const openJobDetail = (item, packingNumber = '') => { |
|||
uni.navigateTo({ |
|||
url: `./ccProductReceiptDetail?id=${item.masterId}&status=${item.status}&scaned=${packingNumber}&title=${title.value}` |
|||
}) |
|||
|
|||
} |
|||
|
|||
const showItemList = (itemList) => { |
|||
jobListPopupRef.value.openPopup(itemList) |
|||
} |
|||
|
|||
const selectedItem = (item) => { |
|||
openJobDetail(item) |
|||
} |
|||
|
|||
const swipeClick = (e, dataContent) => { |
|||
if (e.content.text == '详情') { |
|||
openjobInfoPopup(dataContent) |
|||
} else if (e.content.text == '放弃') { |
|||
comMessageRef.value.showQuestionMessage('确定要放弃当前任务?', (res) => { |
|||
if (res) { |
|||
cancleJob(dataContent.masterId) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const openjobInfoPopup = (item) => { |
|||
jobInfoPopupRef.value.openPopup(item) |
|||
} |
|||
|
|||
const cancleJob = (id) => { |
|||
cancleTakeProductReceiptJob(id) |
|||
.then((res) => { |
|||
if (res.data) { |
|||
getList('refresh') |
|||
uni.showToast({ |
|||
title: '放弃任务成功' |
|||
}) |
|||
} else { |
|||
showMessage('放弃任务失败') |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
showMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const switchChangeToday = (state, creationTime) => { |
|||
checkedToday.value = state |
|||
todayTime.value = creationTime |
|||
getList('refresh') |
|||
} |
|||
|
|||
const switchChangeWait = (state, jobStatus) => { |
|||
checkedWaitTask.value = state |
|||
status.value = jobStatus |
|||
getList('refresh') |
|||
} |
|||
const getScanNumber = (code) => { |
|||
getDataListByType(code) |
|||
} |
|||
const getDataListByType = (code) => { |
|||
uni.showLoading({ |
|||
title: '加载中....', |
|||
mask: true |
|||
}) |
|||
const filters = [] |
|||
filters.push({ |
|||
column: 'status', |
|||
action: 'in', |
|||
value: '1,2' |
|||
}) |
|||
filters.push({ |
|||
column: 'number', |
|||
action: '==', |
|||
value: code |
|||
}) |
|||
|
|||
const params = { |
|||
filters, |
|||
pageNo: 1, |
|||
pageSize: 100 |
|||
} |
|||
getProductReceiptJobList(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data.list.length == 0) { |
|||
showMessage('未查找到' + `【${code}】的收货任务`) |
|||
} else if (res.data.list.length == 1) { |
|||
openJobDetail(res.data.list[0]) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
showMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const showMessage = (message) => { |
|||
comMessageRef.value.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
} |
|||
const openFilter = () => { |
|||
filter.value.openFilter() |
|||
} |
|||
const toHome = () => { |
|||
goHome() |
|||
} |
|||
const onReach = () => { |
|||
if loadingType.value == 'loading' || loadingType.valu == 'noMore') { |
|||
return |
|||
} |
|||
getList('more') |
|||
} |
|||
const openScanPopup = () => { |
|||
scanPopup.value.openScanPopup() |
|||
} |
|||
const selectItem = (item) => { |
|||
scanPopup.value.closeScanPopup() |
|||
openJobDetail(item, item.packingNumber) |
|||
} |
|||
const getScanResult = (result) => { |
|||
try { |
|||
const 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: 'type', |
|||
action: '==', |
|||
value: type.value |
|||
}, |
|||
{ |
|||
column: 'status', |
|||
action: 'in', |
|||
value: '1,2' |
|||
} |
|||
// { |
|||
// column: "fromLocationCode", |
|||
// action: "==", |
|||
// value: result.label.fromLocationCode |
|||
// } |
|||
] |
|||
getProductReceiptJobList({ |
|||
filters, |
|||
pageNo: 1, |
|||
pageSize: 100 |
|||
}) |
|||
.then((res) => { |
|||
const resultList = res.data.list |
|||
if (resultList.length > 0) { |
|||
resultList.forEach((item) => { |
|||
item.title = item.number |
|||
item.selected = false |
|||
}) |
|||
const list = [] |
|||
resultList.forEach((item) => { |
|||
if (!list.find((subItem) => subItem.title == item.title)) { |
|||
list.push(item) |
|||
} |
|||
}) |
|||
if (list.length > 1) { |
|||
jobListRef.value.openList(list) |
|||
} else { |
|||
selectItem(list[0]) |
|||
} |
|||
} else { |
|||
showMessage('未查找到任务<br>' + `扫描[${result.scanMessage}]`) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
showMessage(`${error}<br>扫描[${result.scanMessage}]`) |
|||
}) |
|||
} catch (e) { |
|||
showMessage(e.message) |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"></style> |
Loading…
Reference in new issue