Browse Source

page/issue/job 文件迁移 8/8-10/25

pull/1/head
王志国 3 months ago
parent
commit
47c6716e47
  1. 114
      src/pages/issue/job/issueDetail.vue
  2. 608
      src/pages/issue/job/issueDetail0816.vue
  3. 456
      src/pages/issue/job/issueJob.vue
  4. 746
      src/pages/issue/job/issueJob0816.vue

114
src/pages/issue/job/issueDetail.vue

@ -23,8 +23,16 @@
<!-- <view class="u-p-20">
<work-station :workshopCode="jobContent.workShopCode" :productionLineCode="toLocation.productionLineCode" :workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode"> </work-station>
</view> -->
<com-issue-detail-card ref="comIssueDetailCardRef" :dataContent="toLocation" @updateData="updateData"> </com-issue-detail-card>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comIssueDetailCardBatch ref='comIssueDetailCard' :dataContent="toLocation"
:settingParam="jobContent"
@updateData='updateData' v-if="managementType == 'BY_BATCH'">
</comIssueDetailCardBatch>
<com-issue-detail-card
ref='comIssueDetailCard'
:dataContent="toLocation"
:settingParam="jobContent"
@updateData='updateData' v-else>
</com-issue-detail-card>
<view class="split_line"></view>
</view>
</scroll-view>
@ -32,7 +40,7 @@
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_20" style="background-color: ghostwhite; width: 100%">
<button class="btn_single_commit" hover-class="btn_commit_after" style="flex: 1" @click="submit()">提交</button>
<button class="btn_single_commit" hover-class="btn_commit_after" style="flex: 1" @click="autoCommit()">提交</button>
</view>
</view>
@ -55,13 +63,12 @@ import { getManagementPrecisions } from '@/common/balance.js'
import { calc } from '@/common/calc.js'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import workStation from '@/mycomponents/workStation/workStation.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import comIssueDetailCardBatch from '@/pages/issue/coms/comIssueDetailCardBatch.vue'
import { useCountStore } from '@/store'
// store
const store = useCountStore()
@ -74,12 +81,12 @@ const detailOptions = ref([])
const scanOptions = ref([])
const jobStatus = ref('')
const scanMessage = ref('')
const scanPopup = ref()
const comScanIssuePackRef = ref()
const comMessageRef = ref()
const managementList = ref([])
const managementType = ref('')
const comIssueDetailCardRef = ref()
const fromLocationCode = ref()
onLoad((option) => {
uni.setNavigationBarTitle({
title: `${option.title}详情`
@ -154,10 +161,26 @@ const getDetail = () => {
subList.value = res.data.subList
detailSource.value = getDataSource(detailSource.value, subList.value)
jobContent.value.detailToLocationCode = res.data.subList[0].toLocationCode
fromLocationCode.value = subList.value[0].fromLocationCode
//
if (scanMessage.value) {
openScanPopupSimulate(scanMessage.value)
}
//
let itemCodes = []
detailSource.value.forEach(item => {
item.Items.forEach((cur) => {
itemCodes.push(cur.itemCode)
})
item.scaned = false
})
getManagementPrecisions(itemCodes, fromLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
setTimeout((r) => {
resizeCollapse()
}, 100)
@ -210,7 +233,7 @@ const submitJob = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成发料记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成发料记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -259,6 +282,8 @@ const setParams = () => {
} else {
const info = getPackingNumberAndBatch(managementList.value, r.itemCode, r.packingNumber, r.batch)
record.toPackingNumber = info.packingNumber
record.packingNumber = info.packingNumber;
record.fromPackingNumber = info.packingNumber;
record.toBatch = info.batch
}
record.fromParentPackingNumber = r.parentPackingNumber
@ -324,38 +349,77 @@ const updateData = (record) => {
}
const afterScan = () => {
resizeCollapse()
autoCommit()
}
const autoCommit = ()=>{
let str = ""
let totalQty = 0;
let taskQty = 0;
detailSource.value.forEach((detail) => {
const s = ''
detail.Items.forEach((item) => {
let totalHandleQty = 0
let isHandleEmpty = false // handleQty =0;
taskQty = calc.add(taskQty,item.qty)
item.Locations.forEach((lco) => {
lco.Batchs.forEach((batch) => {
if (batch.handleQty != 0) {
totalHandleQty = calc.add(totalHandleQty, batch.handleQty)
batch.Records.forEach(record => {
if (batch.qty != record.qty) {
let tempHandleQty
if (record.qty) {
tempHandleQty = record.qty
} else {
isHandleEmpty = true
tempHandleQty = 0
}
if (batch.qty != 0) {
str +=
`包装号【${record.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${batch.qty}】不一致\n`
}
}
if(record){
let hanleQty = record.qty?record.qty:0
totalQty = calc.add(totalQty,hanleQty)
}
})
})
if (item.qty == totalHandleQty) {
if (isHandleEmpty) {
return
})
})
})
if(str){
str = '任务明细未全部完成,是否提交?\n' + str
}
submit()
} else {
comMessageRef.value.showQuestionMessage(`实际扫描数量【${totalHandleQty}】与物料需求数量【${item.qty}】不一致,是否继续提交`, (res) => {
if(totalQty != taskQty){
str =`扫描数量[${totalQty}]与任务数量不一致[${taskQty}],是否提交"`
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
submit()
}
//
proxy.$throttle(submit, 2000, proxy)()
} else {
// let record = this.creatRecord(label, balance, packageInfo);
// batch.Records.push(record);
// this.issueRecord.unshift(record)
// this.calcBatchHandleQty(batch);
// this.getfocus();
// this.$emit("afterScan");
detailSource.value.forEach(detail => {
detail.Items.forEach(item => {
taskQty = calc.add(taskQty,item.qty)
item.Locations.forEach(lco => {
lco.Batchs.forEach(batch => {
batch.Records = []
})
}
})
})
})
comScanIssuePackRef.value.clearList()
scanPopupGetFocus()
}
})
}else {
//
proxy.$throttle(submit, 2000, proxy)()
}
}
const scanPopupGetFocus = () => {
if (!scanPopup.value) {
scanPopup.value.getfocus()
if (comScanIssuePackRef.value) {
comScanIssuePackRef.value.getfocus()
}
}
const showMessage = (message) => {

608
src/pages/issue/job/issueDetail0816.vue

@ -0,0 +1,608 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header-view">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="jobContent.detailProductionLineCode"
:workStationCode="jobContent.detailWorkStationCode"
:rawLocationCode="jobContent.detailToLocationCode">
</work-station>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource">
<!-- <work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="toLocation.productionLineCode"
:workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode">
</work-station> -->
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation" @updateData='updateData'>
</com-issue-detail-card>
<view class="split_line"></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="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="autoCommit()">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'
@afterScan='afterScan'>
</com-scan-issue-pack>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
takeIssueJob,
cancleTakeIssueJob,
getIssueJobDetail,
issueJobSubmit
} from '@/api/request2.js';
import {
goHome,
navigateBack,
getRemoveOption,
getCurrDateTime,
getDirectoryItemArray,
getPackingNumberAndBatch,
deepCopyData
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import {
calc
} from '@/common/calc.js';
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import workStation from '@/mycomponents/workStation/workStation.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
export default {
name: 'issueDetail',
components: {
jobDetailPopup,
winScanButton,
comIssueDetailCard,
comScanIssuePack,
jobTop,
workStation,
balanceSelect
},
data() {
return {
id: '',
jobContent: {}, //
subList: [], //subList
detailSource: [], //
detailOptions: [],
scanOptions: [],
jobStatus: "",
scanMessage: ''
};
},
props: {
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title + '详情'
});
this.id = option.id;
this.scanMessage = option.scanMessage || '';
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") {
//
cancleTakeIssueJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
}
},
watch: {
locationTypes(newVal) {
let value = newVal;
},
},
mounted: function() {
// this.resizeCollapse();
},
methods: {
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comIssueDetailCard.forEach(r => {
r.resizeCollapse();
})
});
},
//
receive(callback) {
if (this.id != null) {
takeIssueJob(this.id).then(res => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getIssueJobDetail(that.id).then(res => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
that.jobContent = res.data;
that.jobStatus = res.data.status
that.subList = res.data.subList;
that.detailSource = getDataSource(that.detailSource, that.subList)
that.jobContent.detailToLocationCode = res.data.subList[0].toLocationCode
//
if (this.scanMessage) {
this.openScanPopupSimulate(this.scanMessage);
}
setTimeout(r => {
that.resizeCollapse();
}, 100)
// that.detailSource.forEach(r => {
// r.subList.forEach(s => {
// if (this.scanedPackingNumber && this.scanedPackingNumber == s
// .packingNumber) {
// s.scaned = true
// s.cancleScanedHiht = true
// //
// this.openScanPopupSimulate(s);
// this.scanedPackingNumber = ''
// }
// })
// })
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
this.resizeCollapse();
},
// submit() {
//3.
//:XXX
// var isOutIn = getApp().globalData.feed_configList.filter(
// res => {
// if (res.name == 'feed_isOutIn') {
// return res;
// }
// });
// this.dataContent.itemCodeList.forEach(res => {
// if (res.handleQty > res.recommendQty) {
// this.$refs.modal.showConfirmMessageModal(',?', confirm => {
// if (confirm) {
// //
// uni.showToast({
// title: ""
// })
// }
// })
// } else {
// uni.showToast({
// title: "" + res.handleQty + "][" + res.recommendQty + "]"
// })
// }
// })
// },
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
this.detailSource.forEach(toLocation => {
toLocation.Items.forEach(item => {
itemCodes.push(item.itemCode)
})
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
if (!params.subList || params.subList.length == 0) {
uni.hideLoading()
this.showErrorMessage("请扫描您需要提交的发料任务")
return
}
console.log("提交参数", JSON.stringify(params));
issueJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成发料记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
setParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => {
toLocationCode.Items.forEach(item => {
item.Locations.forEach(fromLocation => {
fromLocation.Batchs.forEach(batch => {
let subItem = batch.detail;
if (subItem != undefined) {
subItem.recordList = [];
if (batch.Records.length > 0) {
batch.Records.forEach(r => {
let record = {};
record.handleQty = r.qty;
record.fromPackingNumber = r
.packingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
record.toContainerNumber = r
.ContainerNumber;
record.toInventoryStatus = r
.inventoryStatus;
// record.toLocationCode = subItem
// .toLocationCode;
record.toLocationCode = this.jobContent
.detailToLocationCode;
record.supplierCode = r.supplierCode;
let single_price = r.balance
.singlePrice == null ? 0 : r
.balance
.singlePrice;
record.singlePrice = single_price;
record.amount = single_price * r.qty;
//使
if (item.onTheWayLocationCode) {
record.toPackingNumber = r
.packingNumber;
record.toBatch = r.batch;
} else {
var info =
getPackingNumberAndBatch(
this.managementList, r
.itemCode,
r.packingNumber, r
.batch);
record.toPackingNumber = info
.packingNumber;
record.toBatch = info.batch;
}
record.fromParentPackingNumber = r
.parentPackingNumber;
subItem.recordList.push(record);
})
subList.push(deepCopyData(subItem));
}
}
})
})
})
})
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {
if (res) {
that.clearInfo();
}
});
},
clearInfo() {
this.dataContent.itemCodeList.forEach(res => {
if (res.recommendList != null) {
res.recommendList.forEach(res1 => {
if (res1.locationCodeList != null) {
res1.locationCodeList.forEach(res2 => {
if (res2.packingCodeList != null) {
res2.packingCodeList.forEach(res3 => {
res3.itemCode = "";
res3.qty = 0;
})
}
})
}
})
}
})
},
updateData(record) {
console.log('updateData', record)
console.log('this.detailSource', this.detailSource)
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode);
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
let itemHandleQty = 0;
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
.packingNumber == null || b.packingNumber == '') && b.batch == record.batch);
let handleQty = 0;
if (batch != undefined) {
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
itemHandleQty = calc.add(itemHandleQty, handleQty)
}
})
}
this.resizeCollapse();
item.handleQty = itemHandleQty;
},
afterScan() {
this.resizeCollapse();
this.autoCommit()
},
autoCommit(){
let str=""
var totalQty =0;
var taskQty =0;
this.detailSource.forEach(detail => {
detail.Items.forEach(item => {
taskQty =calc.add(taskQty,item.qty)
item.Locations.forEach(lco => {
lco.Batchs.forEach(batch => {
batch.Records.forEach(record => {
if (batch.qty != record.qty) {
var tempHandleQty = 0
if (record.qty) {
tempHandleQty = record.qty
} else {
tempHandleQty = 0
}
if (batch.qty != 0) {
str +=
`包装号【${record.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${batch.qty}】不一致\n`
}
}
if(record){
var hanleQty =record.qty?record.qty:0
totalQty = calc.add(totalQty,hanleQty)
}
})
})
})
})
})
if(str){
str = '任务明细未全部完成,是否提交?\n' + str
}
if(totalQty!=taskQty){
str ="扫描数量["+totalQty+"]与任务数量不一致["+taskQty+"],是否提交"
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
if (res) {
//
this.$throttle(this.submit, 2000, this)()
} else {
this.scanPopupGetFocus()
}
});
}else {
//
this.$throttle(this.submit, 2000, this)()
}
},
scanPopupGetFocus() {
if (this.$refs.comScanIssuePack) {
this.$refs.comScanIssuePack.getfocus();
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
showCommitSuccess() {
this.$refs.comMessage.showCommitSuccess();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
confirm(data) {
this.dataContent = data;
},
confirmResult(result) {
this.dataContent = result;
this.$forceUpdate();
},
openScanDetailPopup() {
var datacontent = {}
//
// Object.assign(datacontent, this.detailSource);
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent);
},
openScanPopupSimulate(scanMessage) {
this.$refs.comScanIssuePack.openScanPopupForJobSimulate(this.detailSource, this.jobContent, scanMessage);
},
closeScanPopup() {
this.updateCommitBtn();
},
}
};
</script>
<style scoped lang="scss">
.uni-numbox__value {
width: 40px;
}
button[disabled] {
background-color: #3C9CFF;
color: #fff;
opacity: 0.7;
}
// /deep/ .input-value {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
</style>

456
src/pages/issue/job/issueJob.vue

@ -1,14 +1,11 @@
<template>
<view class="">
<com-empty-view v-if="jobList.length == 0"></com-empty-view>
<job-filter :isShowFromLocationCode="true" :isShowProductionLineCode="true" :productionline="productionlineList"
ref="filter" otherTitle="" :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"
:isShowItemCode="true" @onQuery="getListByFilter" :isShowQurery='true'>
<!-- <job-filter :isShowFromLocationCode="true" :isShowProductionLineCode="true"
:productionline="productionlineList" ref="filter" otherTitle="" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask" @productionLineCode="productionLineCode"
@fromLocationCode="fromLocationCode"> -->
<job-filter :isShowFromLocationCode="true" :isShowFromAreaCode="true" :isShowToAreaCode="true"
:isShowProductionLineCode="true"
:productionline="productionlineList"
ref="filter" otherTitle="" :isShowItemCode="true"
@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 : item.status == '1' ? detailCloseOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="swipeClick">
@ -38,6 +35,7 @@ import { getDetailOption, getDetailGiveupOption, getDetailCloseOption } from '@/
import {
getBusinessType
} from '@/common/record.js';
import {planRefreshTime, issueJobFilter} from '@/common/config.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comIssueJobCard from '@/pages/issue/coms/comIssueJobCard.vue'
@ -81,9 +79,13 @@ const businessType = ref(null)
const filterItemCode = ref('')
const fromInventoryStatuses = ref()
const fromLocationAreaTypeList = ref([])
const fromAreaCode = ref('')
const toAreaCode = ref('')
const timer = ref(null)
const productionLineCode = ref('')
onShow(() => {
nextTick(() => {
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
getList('refresh')
})
})
onLoad((option) => {
@ -100,10 +102,10 @@ onReachBottom(() => {
if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
return
}
getList('more', fromLocation.value, productionLine.value,filterItemCode.value)
getList('more')
})
onPullDownRefresh(() => {
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
getList('refresh')
})
// 退
onBackPress((options) => {
@ -119,9 +121,23 @@ onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
} else if (e.index == 1) {
filter.value.openFilter()
filter.value.openFilterParams(uni.getStorageSync(issueJobFilter))
}
})
const timerRefresh = ()=> {
getList('refresh')
stopRefresh();
timer.value = setInterval(function() {
getList('refresh')
console.log('发料刷新');
}, planRefreshTime)
}
const stopRefresh = ()=> {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
}
const getBusinessTypeFunc = ()=> {
getBusinessType(businessTypeCode.value, res => {
if (res.success) {
@ -129,6 +145,7 @@ const getBusinessTypeFunc = ()=> {
fromInventoryStatuses.value = res.fromInventoryStatuses.split(',');
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList
// this.openScanPopup();
scanPopup.value.openScanPopup(businessType.value)
} else {
comMessageRef.value.showErrorMessage(res.message)
}
@ -151,7 +168,7 @@ const getIssueJobByProductionline1 = () => {
}
})
}
const getList = (type, fromLocation = '', productionLine = '',filterItemCode = '') => {
const getList = (type) => {
proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
if (type === 'refresh') {
@ -159,51 +176,9 @@ const getList = (type, fromLocation = '', productionLine = '',filterItemCode = '
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
})
if (fromLocation) {
//
filters.push({
column: 'fromLocationCode',
action: '==',
value: fromLocation
})
}
if (productionLine) {
// 线
filters.push({
column: 'productionLineCode',
action: '==',
value: productionLine
})
}
if(filterItemCode){
//
filters.push({
column: "itemCode",
action: "like",
value: filterItemCode
})
}
let queryFiltersParams = setQueryParam()
const params = {
filters,
filters: queryFiltersParams,
pageNo: pageNo.value,
pageSize: 100,
}
@ -227,6 +202,9 @@ const getList = (type, fromLocation = '', productionLine = '',filterItemCode = '
if (type === "refresh") {
uni.stopPullDownRefresh();
}
if(jobList.value.length>0){
openScanPopup()
}
})
.catch((error) => {
if (type === 'refresh') {
@ -238,9 +216,84 @@ const getList = (type, fromLocation = '', productionLine = '',filterItemCode = '
comMessageRef.value.showErrorMessage(error)
})
}
const setQueryParam = ()=>{
let filterParams = []
let queryParams = uni.getStorageSync(issueJobFilter)
// if(!queryParams){
// queryParams={
// }
// queryParams.status="1,2"
// }
//
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"
})
}
//线
if (queryParams.productionLineCode) {
filterParams.push({
column: "productionLineCode",
action: "==",
value: queryParams.productionLineCode
})
}
//
if (queryParams.itemCode) {
filterParams.push({
column: "itemCode",
action: "like",
value: queryParams.itemCode
})
}
//
if (queryParams.fromLocationCode) {
filterParams.push({
column: "fromLocationCode",
action: "==",
value: queryParams.fromLocationCode
})
}
//
if (queryParams.fromAreaCode) {
filterParams.push({
column: "fromAreaCode",
action: "==",
value: queryParams.fromAreaCode
})
}
//
if (queryParams.toAreaCode) {
filterParams.push({
column: "toAreaCode",
action: "==",
value: queryParams.toAreaCode
})
}
return filterParams;
}
const openJobDetail = (item, scanMessage = '') => {
proxy.$tab.navigateTo(`./issueDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}`)
getJobInfoByNumber(item.number, scanMessage)
}
const showItemList = (itemList)=> {
jobListPopupRef.value.openPopup(itemList);
@ -277,114 +330,16 @@ const swipeClick = (index, index1) => {
})
}
}
const getListByFilter = ( param )=>{
uni.showLoading({
title: "加载中­....",
mask: true
});
let 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
})
if (param.fromLocationCode) {
fromLocation.value = param.fromLocationCode
//
filters.push({
column: "fromLocationCode",
action: "==",
value: param.fromLocationCode
})
}else{
fromLocation.value = ''
}
if (param.productionLineCode) {
productionLine.value = param.productionLineCode
// 线
filters.push({
column: "productionLineCode",
action: "==",
value: param.productionLineCode
})
}else{
productionLine.value = ''
}
if (param.itemCode) {
filterItemCode.value = param.itemCode
//
filters.push({
column: "itemCode",
action: "like",
value: param.itemCode
})
}else{
filterItemCode.value = ''
}
let params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getList('refresh', fromLocation.value, productionLine.value, filterItemCode.value)
// getIssueJobList(params).then(res => {
// uni.hideLoading();
// if (res.data.total == 0) {
// showMessage('' + '' + code + '');
// } else if (res.data.total == 1) {
// openJobDetail(res.data.list[0]);
// } else {
// showItemList(res.data.list);
// }
// }).catch(error => {
// showMessage(error)
// })
const getListByFilter = ( params )=>{
productionLineCode.value = params.productionLineCode
uni.setStorageSync(issueJobFilter,params)
getList('refresh')
}
const fromLocationCode = (fromLocationParams) => {
fromLocation.value = fromLocationParams
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
}
const productionLineCode = (productionLineCode) => {
productionLine.value = productionLineCode
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
}
const getByAsnNumber = (code) => {
proxy.$modal.loading('加载中­....')
getPurchasereceiptByAsnNumber(code)
.then((res) => {
uni.hideLoading()
if (res.data.total == 0) {
that.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()
comMessageRef.value.showErrorMessage(error)
})
}
const openjobInfoPopup = (item) => {
jobInfoPopupRef.value.openPopup(item)
}
@ -392,7 +347,7 @@ const cancleJob = (id) => {
cancleTakeIssueJob(id)
.then((res) => {
if (res.data) {
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
getList('refresh')
uni.showToast({
title: '放弃任务成功'
})
@ -427,61 +382,63 @@ const closeJob = (id) => {
showMessage(error)
})
}
const switchChangeToday = (state, creationTime) => {
checkedToday.value = state
todayTime.value = creationTime
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
}
const switchChangeWait = (state, jobStatus) => {
checkedWaitTask.value = state
status.value = jobStatus
getList('refresh', fromLocation.value, productionLine.value,filterItemCode.value)
}
const getScanNumber = (code) => {
getDataListByType(code)
}
const getDataListByType = (code) => {
proxy.$modal.loading('加载中­....')
const filters = []
const getJobInfoByNumber = (number, scanMessage)=>{
uni.showLoading({
title: "加载中....",
mask: true
});
let filters = []
filters.push({
column: 'status',
action: 'in',
column: "status",
action: "in",
value: '1,2'
})
filters.push({
column: 'number',
action: '==',
value: code
})
filters.push({
column: 'accept_user_id',
action: '==',
value: store.id
column: "number",
action: "==",
value: number
})
const params = {
filters,
var params = {
filters: filters,
pageNo: 1,
pageSize: 100
pageSize: pageSize.value,
}
getIssueJobList(params)
.then((res) => {
uni.hideLoading()
getIssueJobList(params).then(res => {
uni.hideLoading();
if (res.data.list.length == 0) {
showMessage('未查找到发料任务');
} else if (res.data.list.length == 1) {
openJobDetail(res.data.list[0])
showMessage(`未查找到【${number}】的发料任务`);
} else {
var result = res.data.list[0];
if (result.acceptUserId && result.acceptUserId != store.id) {
comMessageRef.value.showErrorMessage(`任务号[${result.number}]已经被[${result.acceptUserName}]承接,无法执行`, res => {
if (res) {
if (scanPopup.value) {
scanPopup.value.getfocus()
}
})
.catch((error) => {
uni.hideLoading()
showMessage(error)
getList('refresh')
}
});
return;
}
uni.navigateTo({
url: './issueDetail?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + title.value
});
scanMessage.value = ""
}
}).catch(error => {
uni.hideLoading();
showMessage(error);
})
}
const showMessage = (message) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
if (scanPopup.value) {
scanPopup.value.packGetFocus()
scanPopup.value.getfocus()
}
}
})
@ -495,6 +452,90 @@ const openScanPopup = () => {
}
}
const getScanResult = (result) => {
uni.showLoading({
title:"查询中",
mask:true
})
let balance = result.balance;
if (balance != null) {
scanMessage.value = ""
if (!result.label.batch) {
showMessage('批次为空')
return
}
if (!result.label.itemCode) {
showMessage('物料号为空')
return
}
try {
const 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
}
]
if(productionLineCode.value){
filters.push({
column: "productionLineCode",
action: "==",
value: productionLineCode.value
})
}
getIssueJobList({
filters,
pageNo: 1,
pageSize: 1000,
sort: 'createTime',
by: 'asc'
})
.then((res) => {
scanMessage.value = result.scanMessage
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 > 0) {
selectItem(list[0])
}
} else {
queryByItemCode(result)
}
})
.catch((error) => {
uni.hideLoading()
showMessage(`${error}\n扫描[${result.scanMessage}]`)
})
} catch (e) {
showMessage(e.message)
}
}
}
//
const queryByItemCode = (result) => {
let balance = result.balance;
if (balance != null) {
scanMessage.value = ""
@ -529,6 +570,13 @@ const getScanResult = (result) => {
value: balance.locationCode
}
]
if(productionLineCode.value){
filters.push({
column: "productionLineCode",
action: "==",
value: productionLineCode.value
})
}
getIssueJobList({
filters,
pageNo: 1,
@ -555,11 +603,13 @@ const getScanResult = (result) => {
}
} else {
showMessage("按来源库位[" + balance.locationCode + "]批次[" + result.label.batch +
"]物料号[" + result.label.itemCode + "]未查找到任务<br>" + "扫描[" + result.scanMessage + "]")
"]物料号[" + result.label.itemCode + "]未查找到任务\n" + "扫描[" + result
.scanMessage + "]")
}
})
.catch((error) => {
showMessage(`${error}<br>扫描[${result.scanMessage}]`)
uni.hideLoading()
showMessage(`${error}\n扫描[${result.scanMessage}]`)
})
} catch (e) {
showMessage(e.message)

746
src/pages/issue/job/issueJob0816.vue

@ -0,0 +1,746 @@
<template>
<view class="">
<com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter :isShowFromLocationCode="true" :isShowFromAreaCode="true" :isShowToAreaCode="true" :isShowProductionLineCode="true" :productionline="productionlineList"
ref="filter" otherTitle=""
:checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask"
@switchChangeWait="switchChangeWait"
@switchChangeToday="switchChangeToday"
:isShowItemCode="true" @onQuery="getListByFilter" :isShowQurery='true'>
<!-- <job-filter :isShowFromLocationCode="true" :isShowProductionLineCode="true"
:productionline="productionlineList" ref="filter" otherTitle="" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask" @productionLineCode="productionLineCode"
@fromLocationCode="fromLocationCode"> -->
</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:item.status=='1'?detailCloseOptions:detailOptions"
@click="swipeClick($event,item)">
<com-issue-job-card :dataContent="item" @click='openJobDetail(item)'></com-issue-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>
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance>
<!-- <winScanPackJob ref="scanPopup" @getResult='getScanResult'></winScanPackJob> -->
<jobList ref="jobList" @selectItem="selectItem"></jobList>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
cancleTakeIssueJob,
getIssueJobList,
getIssueJobByProductionline,
closeTakeIssueJob
} from '@/api/request2.js';
import {
goHome,
updateTitle
} from '@/common/basic.js';
import {
getBusinessType
} from '@/common/record.js';
import {
planRefreshTime
} from '@/common/config.js';
import {
getDetailOption,
getDetailGiveupOption,
getDetailCloseOption
} from '@/common/array.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comIssueJobCard from '@/pages/issue/coms/comIssueJobCard.vue'
import jobListPopup from '@/pages/issue/coms/jobListPopup.vue'
import jobInfoPopup from '@/pages/issue/coms/jobInfoPopup.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
import jobList from '@/mycomponents/jobList/jobList.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
export default {
name: 'issue',
components: {
comEmptyView,
jobFilter,
comIssueJobCard,
jobListPopup,
jobInfoPopup,
winScanPackJob,
winScanButton,
jobList,
winComScanBalance
},
data() {
return {
jobList: [],
pageNo: 1,
pageSize: 10,
totalCount: 0,
loadingType: "nomore",
checkedToday: false,
checkedWaitTask: false,
todayTime: "",
status: '1,2', //
detailOptions: [],
detailGiveupOptions: [],
productionlineList: [],
detailCloseOptions: [],
title: '',
productionLine: "",
fromLocation: "",
fromAreaCode: '', //
toAreaCode: '', //
filterItemCode: "",
businessTypeCode: "Issue",
businessType: null,
timer:null
};
},
onLoad(option) {
this.title = option.title
this.getIssueJobByProductionline()
},
onShow() {
this.timerRefresh();
},
onHide() {
this.stopRefresh();
},
onUnload(){
this.stopRefresh();
},
onReady() {
this.detailOptions = getDetailOption();
this.detailGiveupOptions = getDetailGiveupOption();
this.detailCloseOptions = getDetailCloseOption();
},
onReachBottom() {
//
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList('more', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
},
onPullDownRefresh() {
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
},
//退
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: {
timerRefresh() {
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
this.stopRefresh();
var that = this;
this.timer = setInterval(function() {
that.getList('refresh', that.fromLocation, that.productionLine, that.filterItemCode,this.fromAreaCode,this.toAreaCode)
console.log('发料刷新');
}, planRefreshTime)
},
stopRefresh() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
getBusinessTypeFunc() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromInventoryStatuses = res.fromInventoryStatuses.split(',');
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
// this.openScanPopup();
this.$refs.scanPopup.openScanPopup(this.businessType);
} else {
this.showErrorMessage(res.message)
}
});
},
getIssueJobByProductionline() {
getIssueJobByProductionline().then(res => {
if (res.code == 0) {
this.productionlineList = res.data.map(item => ({
value: item.value,
text: item.name
}))
this.productionlineList.unshift({
value: "",
text: "全部"
})
} else {
this.productionlineList = []
}
})
},
getList(type, fromLocation = '', productionLine = '',filterItemCode='',fromAreaCode='',toAreaCode='') {
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: "create_time",
action: "betweeen",
value: this.todayTime
})
}
filters.push({
column: "status",
action: "in",
value: this.status
})
if (fromLocation) {
//
filters.push({
column: "fromLocationCode",
action: "==",
value: fromLocation
})
}
if(fromAreaCode){
//
filters.push({
column: "fromAreaCode",
action: "==",
value: fromAreaCode
})
}
if(toAreaCode){
//
filters.push({
column: "toAreaCode",
action: "==",
value: toAreaCode
})
}
if (productionLine) {
// 线
filters.push({
column: "productionLineCode",
action: "==",
value: productionLine
})
}
if(filterItemCode){
//
filters.push({
column: "itemCode",
action: "like",
value: filterItemCode
})
}
var params = {
filters: filters,
pageNo: this.pageNo,
pageSize: 100,
}
getIssueJobList(params).then(res => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
this.openScanPopup()
}
var list = res.data.list;
this.totalCount = res.data.total
updateTitle(this.title + "(" + 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++;
if (type === "refresh") {
uni.stopPullDownRefresh();
}
}).catch(error => {
if (type === "refresh") {
uni.stopPullDownRefresh();
}
updateTitle(this.title);
this.loadingType = "";
uni.hideLoading();
that.showMessage(error)
})
},
getListByFilter(params) {
console.log('getListByFilter',params)
let that = this;
uni.showLoading({
title: "加载中­....",
mask: true
});
// var filters = []
// if (this.checkedToday) {
// filters.push({
// column: "create_time",
// action: "betweeen",
// value: this.todayTime
// })
// }
// filters.push({
// column: "status",
// action: "in",
// value: this.status
// })
if (params.status) {
this.status = params.status
}else{
this.status = "1,2"
}
if(params.creationTime==""){
this.checkedToday = false;
}
if (params.fromLocationCode) {
//
this.fromLocation = params.fromLocationCode
// filters.push({
// column: "fromLocationCode",
// action: "==",
// value: params.fromLocationCode
// })
}else{
this.fromLocation = ''
}
if (params.productionLineCode) {
// 线
this.productionLine = params.productionLineCode
// filters.push({
// column: "productionLineCode",
// action: "==",
// value: params.productionLineCode
// })
}else{
this.productionLine = ''
}
if (params.itemCode) {
//
this.filterItemCode = params.itemCode
// filters.push({
// column: "itemCode",
// action: "like",
// value: params.itemCode
// })
}else{
this.filterItemCode = ''
}
if (params.fromAreaCode) {
//
this.fromAreaCode = params.fromAreaCode
// filters.push({
// column: "fromAreaCode",
// action: "==",
// value: params.fromAreaCode
// })
}else{
this.fromAreaCode = ''
}
if (params.toAreaCode) {
//
this.toAreaCode = params.toAreaCode
// filters.push({
// column: "toAreaCode",
// action: "==",
// value: params.toAreaCode
// })
}else{
this.toAreaCode = ''
}
// var params = {
// filters: filters,
// pageNo: 1,
// pageSize: 100,
// }
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
// getIssueJobList(params).then(res => {
// uni.hideLoading();
// if (res.data.total == 0) {
// that.showMessage('');
// } else if (res.data.total == 1) {
// that.openJobDetail(res.data.list[0]);
// } else {
// that.showItemList(res.data.list);
// }
// }).catch(error => {
// that.showMessage(error)
// })
},
fromLocationCode(fromLocation) {
this.fromLocation = fromLocation;
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
},
productionLineCode(productionLineCode) {
this.productionLine = productionLineCode
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
},
getByAsnNumber(code) {
let that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getPurchasereceiptByAsnNumber(code).then(res => {
uni.hideLoading();
if (res.data.total == 0) {
that.showMessage('未查找到' + '【' + code + '】的收货任务');
} else if (res.data.total == 1) {
this.$refs.scanAsnNumber.closeScanPopup();
that.openJobDetail(res.data.list[0]);
} else {
this.$refs.scanAsnNumber.closeScanPopup();
that.showItemList(res.data.list);
}
}).catch(error => {
uni.hideLoading();
that.showErrorMessage(error);
})
},
openJobDetail(item, scanMessage = '') {
this.getJobInfoByNumber(item.number,scanMessage)
},
showItemList(itemList) {
this.$refs.jobListPopup.openPopup(itemList);
},
selectedItem(item) {
this.openJobDetail(item);
},
selectItem(item) {
this.$refs.scanPopup.closeScanPopup();
this.openJobDetail(item, this.scanMessage);
},
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);
}
});
} else if (e.content.text == "关闭") {
this.$refs.comMessage.showQuestionMessage("确定要关闭当前任务?",
res => {
if (res) {
this.closeJob(dataContent.masterId);
}
});
}
},
openjobInfoPopup(item) {
this.$refs.jobInfoPopup.openPopup(item)
},
cancleJob(id) {
cancleTakeIssueJob(id).then(res => {
if (res.data) {
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
uni.showToast({
title: "放弃任务成功"
})
} else {
this.showMessage("放弃任务失败")
}
}).catch(error => {
this.showMessage(error)
})
},
closeJob(id) {
uni.showLoading({
title: "加载中....",
mask: true
});
closeTakeIssueJob(id).then(res => {
uni.hideLoading()
if (res.data) {
this.getList("refresh")
uni.showToast({
title: "关闭任务成功"
})
} else {
this.showMessage("关闭任务失败")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
switchChangeToday(state, creationTime) {
this.checkedToday = state;
this.todayTime = creationTime;
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
},
switchChangeWait(state, jobStatus) {
this.checkedWaitTask = state;
this.status = jobStatus;
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
},
getJobInfoByNumber(number,scanMessage){
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: number
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getIssueJobList(params).then(res => {
uni.hideLoading();
if (res.data.list.length == 0) {
that.showMessage('未查找到' + '【' + number + '】的发料任务');
} else {
var result =res.data.list[0];
if(result.acceptUserId&&result.acceptUserId!=this.$store.state.user.id){
this.$refs.comMessage.showErrorMessage("任务号["+result.number+"]已经被["+result.acceptUserName+"]承接,无法执行", res => {
if (res) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus()
}
this.getList('refresh', this.fromLocation, this.productionLine, this.filterItemCode,this.fromAreaCode,this.toAreaCode)
}
});
return;
}
uni.navigateTo({
url: './issueDetail?id=' + result.masterId + '&status=' + result.status + '&scanMessage=' +
scanMessage + '&title=' + this.title
});
this.scanMessage=""
}
}).catch(error => {
uni.hideLoading();
that.showMessage(error);
})
},
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,
}
getIssueJobList(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) {
if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus()
}
}
});
},
openScanPopup() {
if (this.businessType == null) {
this.getBusinessTypeFunc()
} else {
this.$refs.scanPopup.openScanPopup(this.businessType);
}
},
getScanResult(result) {
let balance = result.balance;
if (balance != null) {
this.scanMessage = ""
if (!result.label.batch) {
this.showMessage("批次为空")
return;
}
if (!result.label.itemCode) {
this.showMessage("物料号为空")
return;
}
try {
var 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
}
]
getIssueJobList({
filters: filters,
pageNo: 1,
pageSize: 1000,
sort: 'createTime',
by: 'asc'
}).then(res => {
this.scanMessage = 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) {
this.selectItem(list[0])
}
} else {
this.showMessage("按来源库位[" + balance.locationCode + "]批次[" + result.label.batch +
"]物料号[" + result.label.itemCode + "]未查找到任务\n" + "扫描[" + result
.scanMessage + "]")
}
}).catch(error => {
this.showMessage(error + "\n扫描[" + result.scanMessage + "]")
})
} catch (e) {
this.showMessage(e.message)
}
}
},
}
}
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save