Browse Source

任务列表添加扫描功能

hella_online_20240829
yufei0306 4 months ago
parent
commit
ad1f917aae
  1. 68
      src/mycomponents/jobList/jobList.vue
  2. 128
      src/mycomponents/scan/winScanPackJob.vue
  3. 1045
      src/pages/productPutaway/job/productPutawayDetail.vue
  4. 691
      src/pages/productPutaway/job/productPutawayJob.vue
  5. 951
      src/pages/productReceipt/job/fgProductReceiptDetail.vue
  6. 972
      src/pages/productReceipt/job/productReceiptDetail.vue
  7. 729
      src/pages/productReceipt/job/productReceiptJob.vue
  8. 1260
      src/pages/purchaseReceipt/job/receiptDetail.vue
  9. 708
      src/pages/purchaseReceipt/job/receiptJob.vue
  10. 5
      src/pages/putaway/job/putawayDetail.vue
  11. 71
      src/pages/putaway/job/putawayJob.vue

68
src/mycomponents/jobList/jobList.vue

@ -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>

128
src/mycomponents/scan/winScanPackJob.vue

@ -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>

1045
src/pages/productPutaway/job/productPutawayDetail.vue

File diff suppressed because it is too large

691
src/pages/productPutaway/job/productPutawayJob.vue

@ -1,313 +1,380 @@
<template> <template>
<view class=""> <view class="">
<com-empty-view v-if="jobList.length==0"></com-empty-view> <com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" <job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask"> :checkedWaitTask="checkedWaitTask">
</job-filter> </job-filter>
<view v-if="jobList.length>0"> <view v-if="jobList.length>0">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index"> <view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" <uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)"> @click="swipeClick($event,item)">
<com-product-job-card :dataContent="item" @click='openJobDetail(item)'> <com-product-job-card :dataContent="item" @click='openJobDetail(item)'>
</com-product-job-card> </com-product-job-card>
</uni-swipe-action-item> </uni-swipe-action-item>
</view> </view>
</uni-swipe-action> </uni-swipe-action>
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> <job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref='jobInfoPopup'></job-info-popup> <job-info-popup ref='jobInfoPopup'></job-info-popup>
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> <uni-load-more :status="loadingType" v-if="jobList.length>0" />
</view> </view>
<comMessage ref="comMessage"></comMessage> <win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
</view> <winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true">
</template> </winScanPackJob>
<jobList ref="jobList" @selectItem="selectItem"></jobList>
<script> <comMessage ref="comMessage"></comMessage>
import { </view>
cancleTakeProductPutawayJob, </template>
getProductPutawayJobList
} from '@/api/request2.js'; <script>
import {
import { cancleTakeProductPutawayJob,
goHome, getProductPutawayJobList
updateTitle, } from '@/api/request2.js';
getSwitchInfoByCode
} from '@/common/basic.js'; import {
goHome,
import { updateTitle,
getDetailOption, getSwitchInfoByCode
getDetailGiveupOption } from '@/common/basic.js';
} from '@/common/array.js';
import {
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' getDetailOption,
import jobFilter from '@/mycomponents/job/jobFilter.vue' getDetailGiveupOption
import comProductJobCard from '@/pages/productPutaway/coms/comProductJobCard.vue' } from '@/common/array.js';
import jobListPopup from '@/pages/productPutaway/coms/jobListPopup.vue'
import jobInfoPopup from '@/pages/productPutaway/coms/jobInfoPopup.vue' import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
export default { import comProductJobCard from '@/pages/productPutaway/coms/comProductJobCard.vue'
components: { import jobListPopup from '@/pages/productPutaway/coms/jobListPopup.vue'
comEmptyView, import jobInfoPopup from '@/pages/productPutaway/coms/jobInfoPopup.vue'
jobFilter, import jobList from '@/mycomponents/jobList/jobList.vue'
comProductJobCard, import winScanButton from '@/mycomponents/scan/winScanButton.vue'
jobListPopup, import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
jobInfoPopup export default {
}, components: {
data() { comEmptyView,
return { jobFilter,
jobList: [], comProductJobCard,
pageNo: 1, jobListPopup,
pageSize: 10, jobInfoPopup,
totalCount: 0, winScanButton,
loadingType: "nomore", winScanPackJob,
checkedToday: false, jobList
checkedWaitTask: false,
todayTime: "", },
status: '1,2', // data() {
detailOptions: [], return {
detailGiveupOptions: [], jobList: [],
}; pageNo: 1,
}, pageSize: 10,
props: { totalCount: 0,
type: 'assemble', loadingType: "nomore",
}, checkedToday: false,
checkedWaitTask: false,
mounted() { todayTime: "",
this.getList('refresh'); status: '1,2', //
}, detailOptions: [],
detailGiveupOptions: [],
onReady() { };
this.detailOptions = getDetailOption(); },
this.detailGiveupOptions = getDetailGiveupOption(); props: {
}, type: 'assemble',
},
onReachBottom() {
// mounted() {
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { this.getList('refresh');
return; },
}
this.getList("more"); onReady() {
}, this.detailOptions = getDetailOption();
this.detailGiveupOptions = getDetailGiveupOption();
onPullDownRefresh() { },
this.getList('refresh');
}, onReachBottom() {
//
//退 if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
onBackPress(options) { return;
if (options.from === 'navigateBack') { }
uni.navigateBack({ this.getList("more");
delta: 1 },
})
return false; onPullDownRefresh() {
} this.getList('refresh');
}, },
// //退
onNavigationBarButtonTap(e) { onBackPress(options) {
if (e.index === 0) { if (options.from === 'navigateBack') {
goHome(); uni.navigateBack({
} else if (e.index == 1) { delta: 1
this.$refs.filter.openFilter(); })
} return false;
}, }
},
methods: {
toHome() { //
goHome() onNavigationBarButtonTap(e) {
}, if (e.index === 0) {
openFilter() { goHome();
this.$refs.filter.openFilter(); } else if (e.index == 1) {
}, this.$refs.filter.openFilter();
refresh() { }
this.getList('refresh'); },
},
getList(type) { methods: {
let that = this; toHome() {
uni.showLoading({ goHome()
title: "加载中­....", },
mask: true openFilter() {
}); this.$refs.filter.openFilter();
},
this.loadingType = "loading"; refresh() {
if (type === "refresh") { this.getList('refresh');
this.pageNo = 1; },
this.jobList = []; getList(type) {
} let that = this;
var filters = [] uni.showLoading({
if (this.checkedToday) { title: "加载中­....",
filters.push({ mask: true
column: "request_time", });
action: "betweeen",
value: this.todayTime this.loadingType = "loading";
}) if (type === "refresh") {
} this.pageNo = 1;
this.jobList = [];
filters.push({ }
column: "status", var filters = []
action: "in", if (this.checkedToday) {
value: this.status filters.push({
}) column: "request_time",
action: "betweeen",
filters.push({ value: this.todayTime
column: "type", })
action: "==", }
value: this.type
}) filters.push({
column: "status",
var params = { action: "in",
filters: filters, value: this.status
pageNo: this.pageNo, })
pageSize: this.pageSize,
} filters.push({
getProductPutawayJobList(params).then(res => { column: "type",
uni.hideLoading(); action: "==",
if (type === "refresh") { value: this.type
uni.stopPullDownRefresh(); })
}
var params = {
var list = res.data.list; filters: filters,
this.totalCount = res.data.total pageNo: this.pageNo,
this.loadingType = "loadmore"; pageSize: this.pageSize,
if (this.type == 'predict') { }
updateTitle("预生产上架任务(" + this.totalCount + ")"); getProductPutawayJobList(params).then(res => {
} else if (this.type == 'assemble') { uni.hideLoading();
updateTitle("装配上架任务(" + this.totalCount + ")"); if (type === "refresh") {
} uni.stopPullDownRefresh();
if (list == null || list.length == 0) { }
this.loadingType = "nomore";
return; var list = res.data.list;
} this.totalCount = res.data.total
this.jobList = type === "refresh" ? list : this.jobList.concat(list); this.loadingType = "loadmore";
this.pageNo++; if (this.type == 'predict') {
updateTitle("预生产上架任务(" + this.totalCount + ")");
} else if (this.type == 'assemble') {
}).catch(error => { updateTitle("装配上架任务(" + this.totalCount + ")");
if (type === "refresh") { }
uni.stopPullDownRefresh(); if (list == null || list.length == 0) {
} this.loadingType = "nomore";
if (this.type == 'predict') { return;
updateTitle("预生产上架任务(" + this.totalCount + ")"); }
} else if (this.type == 'assemble') { this.jobList = type === "refresh" ? list : this.jobList.concat(list);
updateTitle("装配上架任务(" + this.totalCount + ")"); this.pageNo++;
}
this.loadingType = "";
uni.hideLoading(); }).catch(error => {
that.showMessage(error) if (type === "refresh") {
}) uni.stopPullDownRefresh();
}, }
if (this.type == 'predict') {
openJobDetail(item) { updateTitle("预生产上架任务(" + this.totalCount + ")");
uni.navigateTo({ } else if (this.type == 'assemble') {
url: './productPutawayDetail?id=' + item.masterId + '&status=' + item.status + '&type=' + item updateTitle("装配上架任务(" + this.totalCount + ")");
.type }
}); this.loadingType = "";
}, uni.hideLoading();
that.showMessage(error)
showItemList(itemList) { })
this.$refs.scanList.openPopup(itemList); },
},
openJobDetail(item,packingNumber='') {
selectedItem(item) { uni.navigateTo({
this.openJobDetail(item); url: './productPutawayDetail?id=' + item.masterId + '&status=' + item.status + '&type=' + item
}, .type + '&scaned=' + packingNumber
});
swipeClick(e, dataContent) { },
if (e.content.text == "详情") {
this.openjobInfoPopup(dataContent); showItemList(itemList) {
} else if (e.content.text == "放弃") { this.$refs.scanList.openPopup(itemList);
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", },
res => {
if (res) { selectedItem(item) {
this.cancleJob(dataContent.id); this.openJobDetail(item);
} },
});
} swipeClick(e, dataContent) {
}, if (e.content.text == "详情") {
this.openjobInfoPopup(dataContent);
openjobInfoPopup(item) { } else if (e.content.text == "放弃") {
this.$refs.jobInfoPopup.openPopup(item) this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?",
}, res => {
if (res) {
cancleJob(id) { this.cancleJob(dataContent.id);
cancleTakeProductPutawayJob(id).then(res => { }
if (res.data) { });
this.getList("refresh") }
uni.showToast({ },
title: "放弃任务成功"
}) openjobInfoPopup(item) {
} else { this.$refs.jobInfoPopup.openPopup(item)
this.showMessage("放弃任务失败") },
}
}).catch(error => { cancleJob(id) {
this.showMessage(error) cancleTakeProductPutawayJob(id).then(res => {
}) if (res.data) {
}, this.getList("refresh")
uni.showToast({
switchChangeToday(state, creationTime) { title: "放弃任务成功"
this.checkedToday = state; })
this.todayTime = creationTime; } else {
this.getList("refresh"); this.showMessage("放弃任务失败")
}, }
}).catch(error => {
switchChangeWait(state, jobStatus) { this.showMessage(error)
this.checkedWaitTask = state; })
this.status = jobStatus; },
this.getList("refresh");
}, switchChangeToday(state, creationTime) {
getScanNumber(code) { this.checkedToday = state;
this.getDataListByType(code) this.todayTime = creationTime;
}, this.getList("refresh");
getDataListByType(code) { },
let that = this;
uni.showLoading({ switchChangeWait(state, jobStatus) {
title: "加载中....", this.checkedWaitTask = state;
mask: true this.status = jobStatus;
}); this.getList("refresh");
var filters = [] },
filters.push({ getScanNumber(code) {
column: "status", this.getDataListByType(code)
action: "in", },
value: '1,2' getDataListByType(code) {
}) let that = this;
filters.push({ uni.showLoading({
column: "number", title: "加载中....",
action: "==", mask: true
value: code });
}) var filters = []
filters.push({
var params = { column: "status",
filters: filters, action: "in",
pageNo: 1, value: '1,2'
pageSize: 100, })
} filters.push({
getProductPutawayJobList(params).then(res => { column: "number",
uni.hideLoading(); action: "==",
if (res.data.list.length == 0) { value: code
that.showMessage('未查找到' + '【' + code + '】的收货任务'); })
} else if (res.data.list.length == 1) {
that.openJobDetail(res.data.list[0]); var params = {
} filters: filters,
}).catch(error => { pageNo: 1,
uni.hideLoading(); pageSize: 100,
that.showMessage(error); }
}) getProductPutawayJobList(params).then(res => {
}, uni.hideLoading();
if (res.data.list.length == 0) {
showMessage(message) { that.showMessage('未查找到' + '【' + code + '】的收货任务');
this.$refs.comMessage.showErrorMessage(message, res => { } else if (res.data.list.length == 1) {
if (res) { that.openJobDetail(res.data.list[0]);
}
} }).catch(error => {
}); uni.hideLoading();
}, that.showMessage(error);
} })
} },
</script>
showMessage(message) {
<style scoped lang="scss"> 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> </style>

951
src/pages/productReceipt/job/fgProductReceiptDetail.vue

@ -1,472 +1,481 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper">
<view class="page-header"> <view class="page-header">
<view class="header_job_top"> <view class="header_job_top">
<job-top :dataContent="jobContent"></job-top> <job-top :dataContent="jobContent"></job-top>
</view> </view>
</view> </view>
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="cen_card" style="padding: 5rpx;"> <view class="cen_card" style="padding: 5rpx;">
<view class="cell_box uni-flex uni-row"> <view class="cell_box uni-flex uni-row">
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">车间</view> <view class="text_lightblue">车间</view>
<view> <view>
{{jobContent.workShopCode}} {{jobContent.workShopCode}}
</view> </view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">生产线</view> <view class="text_lightblue">生产线</view>
<view> <view>
{{item.subList[0].productionLineCode}} {{item.subList[0].productionLineCode}}
</view> </view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">班组</view> <view class="text_lightblue">班组</view>
<view> <view>
{{jobContent.team}} {{jobContent.team}}
</view> </view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">班次</view> <view class="text_lightblue">班次</view>
<view> <view>
{{jobContent.shift}} {{jobContent.shift}}
</view> </view>
</view> </view>
</view> </view>
<view class="split_line"></view> <view class="split_line"></view>
</view> </view>
<view class=""> <view class="">
<com-product-detail-card :dataContent="item" :settingParam="jobContent" :isShowLocation="false" <com-product-detail-card :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList'> @remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList'>
</com-product-detail-card> </com-product-detail-card>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="page-footer"> <view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" <view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; "> style="background-color:ghostwhite; width: 100%; ">
<view class=""> <view class="">
<locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode" <locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode"
:locationCode="toLocationCode" @getLocation='scanLocationCode' :locationCode="toLocationCode" @getLocation='scanLocationCode'
:locationTypeList="toLocationTypeList"></locationCompare> :locationTypeList="toLocationTypeList"></locationCompare>
</view> </view>
<view class=" uni-flex uni-row"> <view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> <button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view> </view>
</view> </view>
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
<win-scan-fg-label ref="scanPopup" @getResult='getScanResult' title='制品标签'></win-scan-fg-label> <win-scan-fg-label ref="scanPopup" @getResult='getScanResult' title='制品标签'></win-scan-fg-label>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
<script> <script>
import { import {
getManagementPrecisions getManagementPrecisions
} from '@/common/balance.js'; } from '@/common/balance.js';
import { import {
getProductReceiptJobDetail, getProductReceiptJobDetail,
takeProductReceiptJob, takeProductReceiptJob,
cancleTakeProductReceiptJob, cancleTakeProductReceiptJob,
productReceiptJobsubmit productReceiptJobsubmit
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
goHome, goHome,
navigateBack, navigateBack,
getPackingNumberAndBatch, getPackingNumberAndBatch,
} from '@/common/basic.js'; } from '@/common/basic.js';
import { import {
getDirectoryItemArray, getDirectoryItemArray,
getInventoryStatusName getInventoryStatusName
} from '@/common/directory.js'; } from '@/common/directory.js';
import { import {
getDataSource, getDataSource,
createRecordInfo, createRecordInfo,
calcHandleQty, calcHandleQty,
getScanCount getScanCount
} from '@/common/detail.js'; } from '@/common/detail.js';
import { import {
Decimal Decimal
} from 'decimal.js'; // } from 'decimal.js'; //
import { import {
calc calc
} from '@/common/calc' } from '@/common/calc'
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue'
import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue" import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue"
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" import comDetailCard from "@/mycomponents/detail/comDetailCard.vue"
import jobTop from '@/mycomponents/job/jobTop.vue' import jobTop from '@/mycomponents/job/jobTop.vue'
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue"
export default { export default {
name: 'receipt_detail', name: 'receipt_detail',
components: { components: {
winScanButton, winScanButton,
comDetailCard, comDetailCard,
locationCompare, locationCompare,
winScanFgLabel, winScanFgLabel,
jobTop, jobTop,
comProductDetailCard, comProductDetailCard,
}, },
data() { data() {
return { return {
id: '', id: '',
receiptJob: {}, receiptJob: {},
toLocationCode: '', toLocationCode: '',
isShowPackingCode: true, isShowPackingCode: true,
scanCount: 0, scanCount: 0,
jobContent: {}, // jobContent: {}, //
subList: [], //subList subList: [], //subList
detailSource: [], // detailSource: [], //
toLocationTypeList: [], toLocationTypeList: [],
managementList: [], managementList: [],
jobStatus: "", jobStatus: "",
jobToLocationCode: "", jobToLocationCode: "",
fgList: [], fgList: [],
itemCode: "" itemCode: "",
}; scanedPackingNumber: ''
}, };
onLoad(option) { },
this.id = option.id; onLoad(option) {
if (this.id != undefined) { this.id = option.id;
// this.scanedPackingNumber = option.scaned || '';
if (option.status == "1") { if (this.id != undefined) {
this.receive((callback => { //
this.getDetail(); if (option.status == "1") {
})); this.receive((callback => {
} else { this.getDetail();
this.getDetail(); }));
} } else {
this.getDetail();
} }
},
// }
onNavigationBarButtonTap(e) { },
if (e.index === 0) { //
goHome(); onNavigationBarButtonTap(e) {
} if (e.index === 0) {
}, goHome();
// }
onBackPress(e) { },
// //
if (e.from == 'backbutton') { onBackPress(e) {
if (this.jobStatus == "2") { //
// if (e.from == 'backbutton') {
cancleTakeProductReceiptJob(this.id).then(res => { if (this.jobStatus == "2") {
uni.navigateBack(); //
}).catch(error => { cancleTakeProductReceiptJob(this.id).then(res => {
uni.navigateBack(); uni.navigateBack();
}) }).catch(error => {
} else { uni.navigateBack();
uni.navigateBack(); })
} } else {
uni.navigateBack();
return true; }
}
return true;
}, }
onPullDownRefresh() { },
this.getDetail();
uni.stopPullDownRefresh(); onPullDownRefresh() {
}, this.getDetail();
uni.stopPullDownRefresh();
mounted() { },
}, mounted() {
methods: {
// },
receive(callback) { methods: {
if (this.id != null) { //
takeProductReceiptJob(this.id).then(res => { receive(callback) {
callback(); if (this.id != null) {
}).catch(error => { takeProductReceiptJob(this.id).then(res => {
this.showErrorMessage(error) callback();
}) }).catch(error => {
} this.showErrorMessage(error)
}, })
}
getDetail() { },
var that = this;
uni.showLoading({ getDetail() {
title: "加载中....", var that = this;
mask: true uni.showLoading({
}); title: "加载中....",
getProductReceiptJobDetail(that.id).then(res => { mask: true
uni.hideLoading(); });
if (res.data == null) { getProductReceiptJobDetail(that.id).then(res => {
that.showMessage('未获取到详情'); uni.hideLoading();
} else { if (res.data == null) {
if (res.data.subList.length > 0) { that.showMessage('未获取到详情');
that.jobContent = res.data; } else {
that.subList = res.data.subList; if (res.data.subList.length > 0) {
that.jobStatus = res.data.status that.jobContent = res.data;
that.jobToLocationCode = that.subList[0].toLocationCode that.subList = res.data.subList;
that.toLocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes) that.jobStatus = res.data.status
that.detailSource = getDataSource(that.subList) that.jobToLocationCode = that.subList[0].toLocationCode
that.toLocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes)
} else { that.detailSource = getDataSource(that.subList)
that.showMessage('列表数据为0'); that.detailSource.forEach(r => {
} r.subList.forEach(s => {
} if (this.scanedPackingNumber && this.scanedPackingNumber == s
}).catch(error => { .packingNumber) s.scaned = true
uni.hideLoading() })
this.showErrorMessage(error) })
})
},
} else {
getScanResult(result) { that.showMessage('列表数据为0');
//TODO }
let that = this; }
if (that.detailSource.length > 0) { }).catch(error => {
let item = that.detailSource[0]; // uni.hideLoading()
result.uom = item.uom; this.showErrorMessage(error)
if (item.subList.length > 0) { })
let subItem = item.subList[0]; },
subItem.scaned = true;
if (subItem.fgList == undefined) { getScanResult(result) {
subItem.fgList = []; //TODO
} let that = this;
if (that.detailSource.length > 0) {
if (subItem.fgList.length == 0) { let item = that.detailSource[0]; //
subItem.fgList.push(result); result.uom = item.uom;
that.calcFgQty(this.detailSource); if (item.subList.length > 0) {
} else { let subItem = item.subList[0];
var itemIndex = subItem.fgList.findIndex(r => subItem.scaned = true;
r.itemCode == result.itemCode && if (subItem.fgList == undefined) {
r.productDate == result.productDate && subItem.fgList = [];
r.order == result.order); }
if (itemIndex == -1) {
subItem.fgList.push(result); if (subItem.fgList.length == 0) {
that.calcFgQty(this.detailSource); subItem.fgList.push(result);
} else { that.calcFgQty(this.detailSource);
this.showQuestionMessage("标签【" + result.content + '】已经扫描,是否移除', confirm => { } else {
subItem.fgList.splice(itemIndex, 1) var itemIndex = subItem.fgList.findIndex(r =>
that.calcFgQty(this.detailSource); r.itemCode == result.itemCode &&
}) r.productDate == result.productDate &&
} r.order == result.order);
} if (itemIndex == -1) {
subItem.fgList.push(result);
setTimeout(r => { that.calcFgQty(this.detailSource);
this.scanPopupGetFocus(); } else {
}, 500) this.showQuestionMessage("标签【" + result.content + '】已经扫描,是否移除', confirm => {
} subItem.fgList.splice(itemIndex, 1)
} that.calcFgQty(this.detailSource);
}, })
}
calcFgQty() { }
let that = this;
that.detailSource.forEach(item => { setTimeout(r => {
item.subList.forEach(pack => { this.scanPopupGetFocus();
pack.handleQty = new Decimal(0).toNumber(); }, 500)
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); 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) {
updateData() { fg.qty = new Decimal(fg.qty).toNumber();
calcHandleQty(this.detailSource); pack.handleQty = calc.add(pack.handleQty, fg.qty);
}, // item.qty = calc.add(item.qty, detail.qty);
}
openScanPopup() { })
var itemCode = this.detailSource[0].subList[0].itemCode })
})
// itemCode = "015553147" },
console.log("物料", itemCode)
this.$refs.scanPopup.openScanPopup(itemCode); updateData() {
}, calcHandleQty(this.detailSource);
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup(); openScanPopup() {
}, var itemCode = this.detailSource[0].subList[0].itemCode
scanLocationCode(location, code) { // itemCode = "015553147"
this.toLocationCode = code console.log("物料", itemCode)
this.detailSource.forEach(item => { this.$refs.scanPopup.openScanPopup(itemCode);
item.subList.forEach(detail => { },
detail.toLocationCode = code
}) closeScanPopup() {
}) this.$refs.scanPopup.closeScanPopup();
}, },
checkLocation() { scanLocationCode(location, code) {
var isPass = true; this.toLocationCode = code
if (this.toLocationCode == "" || this.toLocationCode == null) { this.detailSource.forEach(item => {
this.showMessageHint('请扫描收货库位', callback => { item.subList.forEach(detail => {
this.$refs.comScanLocation.showLocation(); detail.toLocationCode = code
}) })
return isPass = false; })
} },
return isPass;
}, checkLocation() {
var isPass = true;
showMessageHint(hint, callback) { if (this.toLocationCode == "" || this.toLocationCode == null) {
this.$refs.comMessage.showErrorMessage(hint, res => { this.showMessageHint('请扫描收货库位', callback => {
if (res) { this.$refs.comScanLocation.showLocation();
callback() })
} return isPass = false;
}); }
}, return isPass;
},
commit() {
// this.scanCount = getScanCount(this.subList); showMessageHint(hint, callback) {
// if (this.scanCount == 0) { this.$refs.comMessage.showErrorMessage(hint, res => {
// this.showErrorMessage("0,") if (res) {
// return; callback()
// } }
// });
if (!this.checkLocation()) { },
return
} commit() {
this.detailSource.forEach(item => { // this.scanCount = getScanCount(this.subList);
item.subList.forEach(subitem => { // if (this.scanCount == 0) {
if (subitem.handleQty == undefined) { // this.showErrorMessage("0,")
this.showMessage("还没扫码成品不能提交") // return;
} else { // }
if (subitem.handleQty != subitem.packQty) { //
this.showQuestionMessage('制品数量不等于包装数量,是否继续提交?', res => { if (!this.checkLocation()) {
if (res) { return
this.submitJob(); }
} this.detailSource.forEach(item => {
}); item.subList.forEach(subitem => {
} else { if (subitem.handleQty == undefined) {
this.submitJob(); this.showMessage("还没扫码成品不能提交")
} } else {
} if (subitem.handleQty != subitem.packQty) {
}) this.showQuestionMessage('制品数量不等于包装数量,是否继续提交?', res => {
}) if (res) {
}, this.submitJob();
}
submitJob() { });
uni.showLoading({ } else {
title: "提交中....", this.submitJob();
mask: true }
}); }
var itemCodes = [] })
this.detailSource.forEach(item => { })
itemCodes.push(item.itemCode) },
})
getManagementPrecisions(itemCodes, this.toLocationCode, res => { submitJob() {
if (res.success) { uni.showLoading({
this.managementList = res.list; title: "提交中....",
var params = this.setParams(); mask: true
console.log("提交参数", JSON.stringify(params)); });
productReceiptJobsubmit(params).then(res => { var itemCodes = []
uni.hideLoading() this.detailSource.forEach(item => {
if (res.data) { itemCodes.push(item.itemCode)
this.showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + res.data, ) })
} else { getManagementPrecisions(itemCodes, this.toLocationCode, res => {
this.showErrorMessage("提交失败[" + res.msg + "]") if (res.success) {
} this.managementList = res.list;
}).catch(error => { var params = this.setParams();
uni.hideLoading() console.log("提交参数", JSON.stringify(params));
this.showErrorMessage(error) productReceiptJobsubmit(params).then(res => {
}) uni.hideLoading()
} else { if (res.data) {
uni.hideLoading(); this.showCommitSuccessMessage("提交成功<br>生成装配收货记录<br>" + res.data, )
this.showErrorMessage(res.message); } else {
} this.showErrorMessage("提交失败[" + res.msg + "]")
}); }
}, }).catch(error => {
uni.hideLoading()
setParams() { this.showErrorMessage(error)
var subList = [] })
var creator = this.$store.state.user.id } else {
this.detailSource.forEach(item => { uni.hideLoading();
item.subList.forEach(detail => { this.showErrorMessage(res.message);
if (detail.scaned) { }
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, });
detail.packingNumber, detail.batch); },
detail.toPackingNumber = info.packingNumber;
detail.toBatch = info.batch; setParams() {
detail.toContainerNumber = ''; var subList = []
detail.toInventoryStatus = detail.inventoryStatus var creator = this.$store.state.user.id
detail.toLocationCode = this.toLocationCode this.detailSource.forEach(item => {
if (detail.fgList) { item.subList.forEach(detail => {
detail.fgList.forEach(res => { if (detail.scaned) {
res.outsideItemCode = res.itemCode var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
res.outsideProduceDate = res.productDate detail.packingNumber, detail.batch);
res.outsideSerialNumber = res.order detail.toPackingNumber = info.packingNumber;
}) detail.toBatch = info.batch;
} detail.toContainerNumber = '';
subList.push(detail) detail.toInventoryStatus = detail.inventoryStatus
} detail.toLocationCode = this.toLocationCode
}) if (detail.fgList) {
}) detail.fgList.forEach(res => {
this.jobContent.subList = subList res.outsideItemCode = res.itemCode
this.jobContent.creator = creator; res.outsideProduceDate = res.productDate
return this.jobContent; res.outsideSerialNumber = res.order
}, })
}
subList.push(detail)
scanPopupGetFocus() { }
if (this.$refs.scanPopup != undefined) { })
this.$refs.scanPopup.getfocus(); })
} this.jobContent.subList = subList
}, this.jobContent.creator = creator;
return this.jobContent;
scanPopupLoseFocus() { },
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
} scanPopupGetFocus() {
}, if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
showMessage(message) { }
setTimeout(r => { },
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => { scanPopupLoseFocus() {
if (res) { if (this.$refs.scanPopup != undefined) {
this.scanPopupGetFocus(); this.$refs.scanPopup.losefocus();
} }
}); },
})
}, showMessage(message) {
setTimeout(r => {
showErrorMessage(message) { this.scanPopupLoseFocus();
setTimeout(r => { this.$refs.comMessage.showMessage(message, res => {
this.scanPopupLoseFocus(); if (res) {
this.$refs.comMessage.showErrorMessage(message, res => { this.scanPopupGetFocus();
if (res) { }
this.scanPopupGetFocus(); });
} })
}); },
})
}, showErrorMessage(message) {
setTimeout(r => {
showCommitSuccessMessage(hint) { this.scanPopupLoseFocus();
this.$refs.comMessage.showSuccessMessage(hint, res => { this.$refs.comMessage.showErrorMessage(message, res => {
navigateBack(1) if (res) {
}) this.scanPopupGetFocus();
}, }
});
showQuestionMessage(hint, callback) { })
this.$refs.comMessage.showQuestionMessage(hint, res => { },
if (res) {
callback(true) showCommitSuccessMessage(hint) {
} this.$refs.comMessage.showSuccessMessage(hint, res => {
}); navigateBack(1)
} })
} },
}
</script> showQuestionMessage(hint, callback) {
this.$refs.comMessage.showQuestionMessage(hint, res => {
<style scoped lang="scss"> if (res) {
callback(true)
}
});
}
}
}
</script>
<style scoped lang="scss">
</style> </style>

972
src/pages/productReceipt/job/productReceiptDetail.vue

@ -1,483 +1,491 @@
<template> <template>
<view class="page-wraper"> <view class="page-wraper">
<view class="page-header"> <view class="page-header">
<view class="header_job_top"> <view class="header_job_top">
<job-top :dataContent="jobContent"></job-top> <job-top :dataContent="jobContent"></job-top>
</view> </view>
</view> </view>
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="cen_card" style="padding: 5rpx;"> <view class="cen_card" style="padding: 5rpx;">
<view class="cell_box uni-flex uni-row"> <view class="cell_box uni-flex uni-row">
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">车间</view> <view class="text_lightblue">车间</view>
<view> <view>
{{jobContent.workShopCode}} {{jobContent.workShopCode}}
</view> </view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">生产线</view> <view class="text_lightblue">生产线</view>
<view> <view>
{{item.subList[0].productionLineCode}} {{item.subList[0].productionLineCode}}
</view> </view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">班组</view> <view class="text_lightblue">班组</view>
<view> <view>
{{jobContent.team}} {{jobContent.team}}
</view> </view>
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">班次</view> <view class="text_lightblue">班次</view>
<view> <view>
{{jobContent.shift}} {{jobContent.shift}}
</view> </view>
</view> </view>
</view> </view>
<view class="split_line"></view> <view class="split_line"></view>
</view> </view>
<view class=""> <view class="">
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false" <comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" @remove="updateData" @updateData="updateData"
:locationAreaTypeList='toLocationAreaTypeList'> :locationAreaTypeList='toLocationAreaTypeList'>
</comProductDetailCard> </comProductDetailCard>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="page-footer"> <view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10" <view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; "> style="background-color:ghostwhite; width: 100%; ">
<view class=""> <view class="">
<locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode" <locationCompare title="收货库位" :recommendLocationCode="jobToLocationCode"
:locationCode="toLocationCode" @getLocation='scanLocationCode' :locationCode="toLocationCode" @getLocation='scanLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></locationCompare> :locationAreaTypeList="toLocationAreaTypeList"></locationCompare>
</view> </view>
<view class=" uni-flex uni-row"> <view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> <button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view> </view>
</view> </view>
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'制品标签'" headerType="HMQ"></win-scan-pack> <win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'制品标签'" headerType="HMQ"></win-scan-pack>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
<script> <script>
import { import {
getManagementPrecisions getManagementPrecisions
} from '@/common/balance.js'; } from '@/common/balance.js';
import { import {
getProductReceiptJobDetail, getProductReceiptJobDetail,
takeProductReceiptJob, takeProductReceiptJob,
cancleTakeProductReceiptJob, cancleTakeProductReceiptJob,
productReceiptJobsubmit productReceiptJobsubmit
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
goHome, goHome,
navigateBack, navigateBack,
getPackingNumberAndBatch, getPackingNumberAndBatch,
} from '@/common/basic.js'; } from '@/common/basic.js';
import { import {
getDirectoryItemArray, getDirectoryItemArray,
getInventoryStatusName getInventoryStatusName
} from '@/common/directory.js'; } from '@/common/directory.js';
import { import {
getDataSource, getDataSource,
createRecordInfo, createRecordInfo,
calcHandleQty, calcHandleQty,
getScanCount getScanCount
} from '@/common/detail.js'; } from '@/common/detail.js';
import { import {
calc calc
} from '@/common/calc.js'; } from '@/common/calc.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue'
import winScanPack from "@/mycomponents/scan/winScanPack.vue" import winScanPack from "@/mycomponents/scan/winScanPack.vue"
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" import comDetailCard from "@/mycomponents/detail/comDetailCard.vue"
import jobTop from '@/mycomponents/job/jobTop.vue' import jobTop from '@/mycomponents/job/jobTop.vue'
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue"
export default { export default {
name: 'receipt_detail', name: 'receipt_detail',
components: { components: {
winScanButton, winScanButton,
comDetailCard, comDetailCard,
locationCompare, locationCompare,
winScanPack, winScanPack,
jobTop, jobTop,
comProductDetailCard comProductDetailCard
}, },
data() { data() {
return { return {
id: '', id: '',
receiptJob: {}, receiptJob: {},
toLocationCode: '', toLocationCode: '',
isShowPackingCode: true, isShowPackingCode: true,
scanCount: 0, scanCount: 0,
jobContent: {}, // jobContent: {}, //
subList: [], //subList subList: [], //subList
detailSource: [], // detailSource: [], //
toLocationAreaTypeList: [], toLocationAreaTypeList: [],
managementList: [], managementList: [],
jobStatus: "", jobStatus: "",
jobToLocationCode: "" jobToLocationCode: "",
scanedPackingNumber: ''
};
}, };
onLoad(option) { },
this.id = option.id; onLoad(option) {
if (this.id != undefined) { this.id = option.id;
// this.scanedPackingNumber = option.scaned || '';
if (option.status == "1") { if (this.id != undefined) {
this.receive((callback => { //
this.getDetail(); if (option.status == "1") {
})); this.receive((callback => {
} else { this.getDetail();
this.getDetail(); }));
} } else {
} this.getDetail();
}, }
// }
onNavigationBarButtonTap(e) { },
if (e.index === 0) { //
goHome(); onNavigationBarButtonTap(e) {
} if (e.index === 0) {
}, goHome();
// }
onBackPress(e) { },
// //
if (e.from == 'backbutton') { onBackPress(e) {
if (this.jobStatus == "2") { //
// if (e.from == 'backbutton') {
cancleTakeProductReceiptJob(this.id).then(res => { if (this.jobStatus == "2") {
uni.navigateBack(); //
}).catch(error => { cancleTakeProductReceiptJob(this.id).then(res => {
uni.navigateBack(); uni.navigateBack();
}) }).catch(error => {
} else { uni.navigateBack();
uni.navigateBack(); })
} } else {
uni.navigateBack();
return true; }
}
return true;
}, }
onPullDownRefresh() { },
this.getDetail();
uni.stopPullDownRefresh(); onPullDownRefresh() {
}, this.getDetail();
uni.stopPullDownRefresh();
mounted() { },
}, mounted() {
methods: {
// },
receive(callback) { methods: {
if (this.id != null) { //
takeProductReceiptJob(this.id).then(res => { receive(callback) {
callback(); if (this.id != null) {
}).catch(error => { takeProductReceiptJob(this.id).then(res => {
this.showErrorMessage(error) callback();
}) }).catch(error => {
} this.showErrorMessage(error)
}, })
}
getDetail() { },
var that = this;
uni.showLoading({ getDetail() {
title: "加载中....", var that = this;
mask: true uni.showLoading({
}); title: "加载中....",
getProductReceiptJobDetail(that.id).then(res => { mask: true
uni.hideLoading(); });
if (res.data == null) { getProductReceiptJobDetail(that.id).then(res => {
that.showMessage('未获取到详情'); uni.hideLoading();
} else { if (res.data == null) {
if (res.data.subList.length > 0) { that.showMessage('未获取到详情');
that.jobContent = res.data; } else {
that.subList = res.data.subList; if (res.data.subList.length > 0) {
that.jobStatus = res.data.status that.jobContent = res.data;
that.jobToLocationCode = that.subList[0].toLocationCode that.subList = res.data.subList;
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes) that.jobStatus = res.data.status
that.detailSource = getDataSource(that.subList) that.jobToLocationCode = that.subList[0].toLocationCode
} else { that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes)
that.showMessage('列表数据为0'); that.detailSource = getDataSource(that.subList)
} that.detailSource.forEach(r => {
} r.subList.forEach(s => {
}).catch(error => { if (this.scanedPackingNumber && this.scanedPackingNumber == s
uni.hideLoading() .packingNumber) s.scaned = true
this.showErrorMessage(error) })
}) })
}, } else {
that.showMessage('列表数据为0');
getScanResult(result) { }
let label = result.label; }
var packingNumber = label.packingNumber; }).catch(error => {
var batch = label.batch; uni.hideLoading()
var qty = label.qty; this.showErrorMessage(error)
var itemCode = label.itemCode; })
},
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) { getScanResult(result) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") let label = result.label;
} else { var packingNumber = label.packingNumber;
var itemDetail = detail.subList.find(r => var batch = label.batch;
r.packingNumber == packingNumber && var qty = label.qty;
r.batch == batch); var itemCode = label.itemCode;
if (itemDetail == undefined) {
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中") var detail = this.detailSource.find(r => r.itemCode == itemCode);
} else { if (detail == undefined) {
if (itemDetail.scaned) { this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") } else {
} else { var itemDetail = detail.subList.find(r =>
itemDetail.scaned = true; r.packingNumber == packingNumber &&
itemDetail.handleQty = Number(result.label.qty); r.batch == batch);
itemDetail.toLocationCode = this.toLocationCode; if (itemDetail == undefined) {
itemDetail.labelQty = Number(result.label.qty); this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中")
calcHandleQty(this.detailSource); } else {
this.continueScan() if (itemDetail.scaned) {
this.$forceUpdate() 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()
continueScan() { this.$forceUpdate()
this.scanCount = getScanCount(this.subList); }
if (this.scanCount == this.subList.length) {
this.closeScanPopup(); }
} else { }
this.scanPopupGetFocus(); },
}
}, //
continueScan() {
this.scanCount = getScanCount(this.subList);
updateData() { if (this.scanCount == this.subList.length) {
calcHandleQty(this.detailSource); this.closeScanPopup();
}, } else {
this.scanPopupGetFocus();
}
openScanPopup() { },
this.$refs.scanPopup.openScanPopup();
},
updateData() {
closeScanPopup() { calcHandleQty(this.detailSource);
this.$refs.scanPopup.closeScanPopup(); },
},
openScanPopup() {
scanLocationCode(location, code) { this.$refs.scanPopup.openScanPopup();
this.toLocationCode = code },
this.detailSource.forEach(item => {
item.subList.forEach(detail => { closeScanPopup() {
detail.toLocationCode = code this.$refs.scanPopup.closeScanPopup();
}) },
})
},
scanLocationCode(location, code) {
checkLocation() { this.toLocationCode = code
var isPass = true; this.detailSource.forEach(item => {
if (this.toLocationCode == "" || this.toLocationCode == null) { item.subList.forEach(detail => {
this.showMessageHint('请扫描收货库位', callback => { detail.toLocationCode = code
this.$refs.comScanLocation.showLocation(); })
}) })
},
return isPass = false;
} checkLocation() {
return isPass; var isPass = true;
}, if (this.toLocationCode == "" || this.toLocationCode == null) {
this.showMessageHint('请扫描收货库位', callback => {
showMessageHint(hint, callback) { this.$refs.comScanLocation.showLocation();
this.$refs.comMessage.showErrorMessage(hint, res => { })
if (res) {
callback() return isPass = false;
} }
}); return isPass;
}, },
commit() { showMessageHint(hint, callback) {
this.scanCount = getScanCount(this.subList); this.$refs.comMessage.showErrorMessage(hint, res => {
if (this.scanCount == 0) { if (res) {
this.showErrorMessage("扫描数为0,请先扫描") callback()
return; }
} });
// },
if (!this.checkLocation()) {
return commit() {
} this.scanCount = getScanCount(this.subList);
if (this.scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
// return;
if (this.scanCount == this.subList.length) { }
if (this.checkCount()) { //
this.submitJob(); if (!this.checkLocation()) {
} return
}
} else if (this.scanCount < this.subList.length) {
//
if (this.jobContent.allowPartialComplete == "TRUE") { //
// if (this.scanCount == this.subList.length) {
if (this.checkCount()) { if (this.checkCount()) {
this.submitJob(); this.submitJob();
} }
} else {
// } else if (this.scanCount < this.subList.length) {
this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList //
.length + if (this.jobContent.allowPartialComplete == "TRUE") {
"]"); //
} if (this.checkCount()) {
} this.submitJob();
}
}, } else {
//
checkCount() { this.showMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount + "]总共[" + this.subList
var isCheck = true; .length +
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; checkCount() {
hint = "包装【" + subItem.packingNumber + "】实际收货数量:" + subItem.handleQty + "与包装数量" + subItem.qty + var isCheck = true;
"不相等,是否继续收货?" var hint = ""
break 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 (!isCheck) { if (calc.sub(subItem.handleQty, subItem.qty) < 0) {
this.showQuestMessage(hint, res => { isCheck = false;
if (res) { hint = "包装【" + subItem.packingNumber + "】实际收货数量:" + subItem.handleQty + "与包装数量" + subItem.qty +
this.submitJob(); "不相等,是否继续收货?"
} break
}) }
} }
}
return isCheck; if (!isCheck) {
this.showQuestMessage(hint, res => {
}, if (res) {
this.submitJob();
submitJob() { }
uni.showLoading({ })
title: "提交中....", }
mask: true
}); return isCheck;
var itemCodes = []
this.detailSource.forEach(item => { },
itemCodes.push(item.itemCode)
}) submitJob() {
getManagementPrecisions(itemCodes, this.toLocationCode, res => { uni.showLoading({
if (res.success) { title: "提交中....",
this.managementList = res.list; mask: true
var params = this.setParams(); });
console.log("提交参数", JSON.stringify(params)); var itemCodes = []
productReceiptJobsubmit(params).then(res => { this.detailSource.forEach(item => {
uni.hideLoading() itemCodes.push(item.itemCode)
if (res.data) { })
this.showCommitSuccessMessage("提交成功<br>生成预生产收货记录<br>" + res.data, ) getManagementPrecisions(itemCodes, this.toLocationCode, res => {
} else { if (res.success) {
this.showErrorMessage("提交失败[" + res.msg + "]") this.managementList = res.list;
} var params = this.setParams();
}).catch(error => { console.log("提交参数", JSON.stringify(params));
uni.hideLoading() productReceiptJobsubmit(params).then(res => {
this.showErrorMessage(error) uni.hideLoading()
}) if (res.data) {
} else { this.showCommitSuccessMessage("提交成功<br>生成预生产收货记录<br>" + res.data, )
uni.hideLoading(); } else {
this.showErrorMessage(res.message); this.showErrorMessage("提交失败[" + res.msg + "]")
} }
}); }).catch(error => {
}, uni.hideLoading()
this.showErrorMessage(error)
setParams() { })
var subList = [] } else {
var creator = this.$store.state.user.id uni.hideLoading();
this.showErrorMessage(res.message);
this.detailSource.forEach(item => { }
item.subList.forEach(detail => { });
if (detail.scaned) { },
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
detail.packingNumber, detail.batch); setParams() {
detail.toPackingNumber = info.packingNumber; var subList = []
detail.toBatch = info.batch; var creator = this.$store.state.user.id
detail.toContainerNumber = '';
detail.toInventoryStatus = detail.inventoryStatus this.detailSource.forEach(item => {
detail.toLocationCode = this.toLocationCode item.subList.forEach(detail => {
subList.push(detail) if (detail.scaned) {
} var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
}) detail.packingNumber, detail.batch);
}) detail.toPackingNumber = info.packingNumber;
this.jobContent.subList = subList detail.toBatch = info.batch;
this.jobContent.creator = creator; detail.toContainerNumber = '';
return this.jobContent; detail.toInventoryStatus = detail.inventoryStatus
}, detail.toLocationCode = this.toLocationCode
subList.push(detail)
}
scanPopupGetFocus() { })
if (this.$refs.scanPopup != undefined) { })
this.$refs.scanPopup.getfocus(); this.jobContent.subList = subList
} this.jobContent.creator = creator;
}, return this.jobContent;
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus(); scanPopupGetFocus() {
} if (this.$refs.scanPopup != undefined) {
}, this.$refs.scanPopup.getfocus();
}
showMessage(message) { },
setTimeout(r => {
this.scanPopupLoseFocus(); scanPopupLoseFocus() {
this.$refs.comMessage.showMessage(message, res => { if (this.$refs.scanPopup != undefined) {
if (res) { this.$refs.scanPopup.losefocus();
this.scanPopupGetFocus(); }
} },
});
}) showMessage(message) {
}, setTimeout(r => {
this.scanPopupLoseFocus();
showErrorMessage(message) { this.$refs.comMessage.showMessage(message, res => {
setTimeout(r => { if (res) {
this.scanPopupLoseFocus(); this.scanPopupGetFocus();
this.$refs.comMessage.showErrorMessage(message, res => { }
if (res) { });
this.scanPopupGetFocus(); })
} },
});
}) showErrorMessage(message) {
}, setTimeout(r => {
this.scanPopupLoseFocus();
showCommitSuccessMessage(hint) { this.$refs.comMessage.showErrorMessage(message, res => {
this.$refs.comMessage.showSuccessMessage(hint, res => { if (res) {
navigateBack(1) this.scanPopupGetFocus();
}) }
}, });
showQuestMessage(hint, callBack) { })
this.$refs.comMessage.showQuestionMessage(hint, res => { },
if (res) {
callBack(true) showCommitSuccessMessage(hint) {
} this.$refs.comMessage.showSuccessMessage(hint, res => {
}) navigateBack(1)
}, })
} },
} showQuestMessage(hint, callBack) {
</script> this.$refs.comMessage.showQuestionMessage(hint, res => {
if (res) {
<style scoped lang="scss"> callBack(true)
}
})
},
}
}
</script>
<style scoped lang="scss">
</style> </style>

729
src/pages/productReceipt/job/productReceiptJob.vue

@ -1,337 +1,404 @@
<template> <template>
<view class=""> <view class="">
<com-empty-view v-if="jobList.length==0"></com-empty-view> <com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday" <job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask"> :checkedWaitTask="checkedWaitTask">
</job-filter> </job-filter>
<view v-if="jobList.length>0"> <view v-if="jobList.length>0">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index"> <view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" <uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)"> @click="swipeClick($event,item)">
<com-product-job-card :dataContent="item" @click='openJobDetail(item)'></com-product-job-card> <com-product-job-card :dataContent="item" @click='openJobDetail(item)'></com-product-job-card>
</uni-swipe-action-item> </uni-swipe-action-item>
</view> </view>
</uni-swipe-action> </uni-swipe-action>
<job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup> <job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref='jobInfoPopup'></job-info-popup> <job-info-popup ref='jobInfoPopup'></job-info-popup>
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> <uni-load-more :status="loadingType" v-if="jobList.length>0" />
<comMessage ref="comMessage"></comMessage> <win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
</view> <winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true"></winScanPackJob>
</view> <jobList ref="jobList" @selectItem="selectItem"></jobList>
</template> <comMessage ref="comMessage"></comMessage>
</view>
<script> </view>
import { </template>
getProductReceiptJobList,
cancleTakeProductReceiptJob <script>
} from '@/api/request2.js'; import {
getProductReceiptJobList,
import { cancleTakeProductReceiptJob
goHome, } from '@/api/request2.js';
updateTitle
} from '@/common/basic.js'; import {
goHome,
import { updateTitle
getDetailOption, } from '@/common/basic.js';
getDetailGiveupOption
} from '@/common/array.js'; import {
getDetailOption,
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' getDetailGiveupOption
import jobFilter from '@/mycomponents/job/jobFilter.vue' } from '@/common/array.js';
import comProductJobCard from '@/pages/productReceipt/coms/comProductJobCard.vue' import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobListPopup from '@/pages/productReceipt/coms/jobListPopup.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue'
import jobInfoPopup from '@/pages/productReceipt/coms/jobInfoPopup.vue'
import comProductJobCard from '@/pages/productReceipt/coms/comProductJobCard.vue'
export default { import jobListPopup from '@/pages/productReceipt/coms/jobListPopup.vue'
name: 'receipt', import jobInfoPopup from '@/pages/productReceipt/coms/jobInfoPopup.vue'
components: { import jobList from '@/mycomponents/jobList/jobList.vue'
comEmptyView, import winScanButton from '@/mycomponents/scan/winScanButton.vue'
jobFilter, import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
comProductJobCard,
jobListPopup, export default {
jobInfoPopup name: 'receipt',
}, components: {
data() { comEmptyView,
return { jobFilter,
jobList: [], comProductJobCard,
pageNo: 1, jobListPopup,
pageSize: 10, jobInfoPopup,
totalCount: 0, winScanButton,
loadingType: "nomore", winScanPackJob,
checkedToday: false, jobList
checkedWaitTask: false, },
todayTime: "", data() {
status: '1,2', // return {
detailOptions: [], jobList: [],
detailGiveupOptions: [], pageNo: 1,
}; pageSize: 10,
}, totalCount: 0,
// type = 'assemble' loadingType: "nomore",
// type = 'predict' checkedToday: false,
props: { checkedWaitTask: false,
type: 'assemble', todayTime: "",
}, status: '1,2', //
detailOptions: [],
onReady() { detailGiveupOptions: [],
this.detailOptions = getDetailOption(); };
this.detailGiveupOptions = getDetailGiveupOption(); },
}, // type = 'assemble'
// type = 'predict'
props: {
mounted() { type: 'assemble',
this.getList('refresh'); },
},
onReady() {
onReachBottom() { this.detailOptions = getDetailOption();
// this.detailGiveupOptions = getDetailGiveupOption();
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { },
return;
}
this.getList("more"); mounted() {
}, this.getList('refresh');
},
onPullDownRefresh() {
this.getList('refresh'); onReachBottom() {
}, //
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
//退 }
onBackPress(options) { this.getList("more");
if (options.from === 'navigateBack') { },
uni.navigateBack({
delta: 1 onPullDownRefresh() {
}) this.getList('refresh');
return false; },
}
},
//退
// onBackPress(options) {
onNavigationBarButtonTap(e) { if (options.from === 'navigateBack') {
if (e.index === 0) { uni.navigateBack({
goHome(); delta: 1
} else if (e.index == 1) { })
this.$refs.filter.openFilter(); return false;
} }
}, },
methods: { //
refresh(){ onNavigationBarButtonTap(e) {
this.getList('refresh'); if (e.index === 0) {
}, goHome();
getList(type) { } else if (e.index == 1) {
let that = this; this.$refs.filter.openFilter();
uni.showLoading({ }
title: "加载中­....", },
mask: true
}); methods: {
this.loadingType = "loading"; refresh() {
if (type === "refresh") { this.getList('refresh');
this.pageNo = 1; },
this.jobList = []; getList(type) {
} let that = this;
var filters = [] uni.showLoading({
if (this.checkedToday) { title: "加载中­....",
filters.push({ mask: true
column: "request_time", });
action: "betweeen", this.loadingType = "loading";
value: this.todayTime if (type === "refresh") {
}) this.pageNo = 1;
} this.jobList = [];
}
filters.push({ var filters = []
column: "status", if (this.checkedToday) {
action: "in", filters.push({
value: this.status column: "request_time",
}) action: "betweeen",
value: this.todayTime
filters.push({ })
column: "type", }
action: "==",
value: this.type filters.push({
}) column: "status",
action: "in",
var params = { value: this.status
filters: filters, })
pageNo: this.pageNo,
pageSize: this.pageSize, filters.push({
} column: "type",
action: "==",
getProductReceiptJobList(params).then(res => { value: this.type
uni.hideLoading(); })
if (type === "refresh") {
uni.stopPullDownRefresh(); var params = {
} filters: filters,
pageNo: this.pageNo,
var list = res.data.list; pageSize: this.pageSize,
this.totalCount = res.data.total }
if (this.type == 'predict') {
updateTitle("预生产收货任务(" + this.totalCount + ")"); getProductReceiptJobList(params).then(res => {
} else if(this.type == 'assemble'){ uni.hideLoading();
updateTitle("装配收货任务(" + this.totalCount + ")"); if (type === "refresh") {
}else { uni.stopPullDownRefresh();
updateTitle("报废收货任务(" + this.totalCount + ")"); }
}
this.loadingType = "loadmore"; var list = res.data.list;
if (list == null || list.length == 0) { this.totalCount = res.data.total
this.loadingType = "nomore"; if (this.type == 'predict') {
return; updateTitle("预生产收货任务(" + this.totalCount + ")");
} } else if (this.type == 'assemble') {
this.jobList = type === "refresh" ? list : this.jobList.concat(list); updateTitle("装配收货任务(" + this.totalCount + ")");
this.pageNo++; } else {
updateTitle("报废收货任务(" + this.totalCount + ")");
}
}).catch(error => { this.loadingType = "loadmore";
if (type === "refresh") { if (list == null || list.length == 0) {
uni.stopPullDownRefresh(); this.loadingType = "nomore";
} return;
if (this.type == 'predict') { }
updateTitle("预生产收货任务(" + this.totalCount + ")"); this.jobList = type === "refresh" ? list : this.jobList.concat(list);
} else if(this.type == 'assemble'){ this.pageNo++;
updateTitle("装配收货任务(" + this.totalCount + ")");
}else {
updateTitle("报废收货任务(" + this.totalCount + ")"); }).catch(error => {
} if (type === "refresh") {
this.loadingType = ""; uni.stopPullDownRefresh();
uni.hideLoading(); }
that.showMessage(error) if (this.type == 'predict') {
}) updateTitle("预生产收货任务(" + this.totalCount + ")");
}, } else if (this.type == 'assemble') {
updateTitle("装配收货任务(" + this.totalCount + ")");
openJobDetail(item) { } else {
if (this.type == 'predict') { updateTitle("报废收货任务(" + this.totalCount + ")");
uni.navigateTo({ }
url: './productReceiptDetail?id=' + item.masterId + '&status=' + item.status this.loadingType = "";
}); uni.hideLoading();
} else if(this.type == 'assemble'){ that.showMessage(error)
uni.navigateTo({ })
url: './fgProductReceiptDetail?id=' + item.masterId + '&status=' + item.status },
});
}else { openJobDetail(item,packingNumber='') {
uni.navigateTo({ if (this.type == 'predict') {
url: './scrapReceiptDetail?id=' + item.masterId + '&status=' + item.status 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");
}, },
openScanPopup() {
showItemList(itemList) { this.$refs.scanPopup.openScanPopup();
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);
}
});
}
}, },
selectItem(item) {
openjobInfoPopup(item) { this.$refs.scanPopup.closeScanPopup();
this.$refs.jobInfoPopup.openPopup(item) this.openJobDetail(item,item.packingNumber);
}, },
getScanResult(result) {
cancleJob(id) { try {
cancleTakeProductReceiptJob(id).then(res => { var filters = [{
if (res.data) { column: "packingNumber",
this.getList("refresh") action: "==",
uni.showToast({ value: result.label.packingNumber
title: "放弃任务成功" },
{
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 { console.log('list', list.length)
this.showMessage("放弃任务失败") if (list.length > 1) {
} this.$refs.jobList.openList(list)
}).catch(error => { } else {
this.showMessage(error) this.selectItem(list[0])
}) }
}, }).catch(error => {
this.showMessage(error)
switchChangeToday(state, creationTime) { })
this.checkedToday = state;
this.todayTime = creationTime; } catch (e) {
this.getList("refresh"); this.showMessage(e.message)
},
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"); },
} }
}
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>

1260
src/pages/purchaseReceipt/job/receiptDetail.vue

File diff suppressed because it is too large

708
src/pages/purchaseReceipt/job/receiptJob.vue

@ -1,321 +1,389 @@
<template> <template>
<view class=""> <view class="">
<com-empty-view v-if="jobList.length==0"></com-empty-view> <com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter ref="filter" :isShowAsn="true" @switchChangeToday="switchChangeToday" <job-filter ref="filter" :isShowAsn="true" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" @onScanAsnNumber="getScanAsnNumber" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" @onScanAsnNumber="getScanAsnNumber"
:checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask"> :checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask">
</job-filter> </job-filter>
<view v-if="jobList.length>0"> <view v-if="jobList.length>0">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index"> <view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions" <uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)"> @click="swipeClick($event,item)">
<com-receipt-job-card :dataContent="item" @click='openJobDetail(item)'></com-receipt-job-card> <com-receipt-job-card :dataContent="item" @click='openJobDetail(item)'></com-receipt-job-card>
</uni-swipe-action-item> </uni-swipe-action-item>
</view> </view>
</uni-swipe-action> </uni-swipe-action>
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> <uni-load-more :status="loadingType" v-if="jobList.length>0" />
<receipt-info-popup ref='jobInfoPopup'></receipt-info-popup> <receipt-info-popup ref='jobInfoPopup'></receipt-info-popup>
<receipt-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></receipt-job-list-popup> <receipt-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></receipt-job-list-popup>
</view> </view>
<comMessage ref="comMessage"></comMessage> <win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
</view> <winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true">
</template> </winScanPackJob>
<jobList ref="jobList" @selectItem="selectItem"></jobList>
<script> <comMessage ref="comMessage"></comMessage>
import { </view>
getPurchaseReceiptJobList, </template>
cancleTakePurchaseReceiptJob
} from '@/api/request2.js'; <script>
import {
import { getPurchaseReceiptJobList,
goHome, cancleTakePurchaseReceiptJob
updateTitle } from '@/api/request2.js';
} from '@/common/basic.js';
import {
import { goHome,
getDetailOption, updateTitle
getDetailGiveupOption } from '@/common/basic.js';
} from '@/common/array.js';
import {
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' getDetailOption,
import jobFilter from '@/mycomponents/job/jobFilter.vue' getDetailGiveupOption
} from '@/common/array.js';
import comReceiptJobCard from '@/pages/purchaseReceipt/coms/comReceiptJobCard.vue'
import receiptJobListPopup from '@/pages/purchaseReceipt/coms/receiptJobListPopup.vue' import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import receiptInfoPopup from '@/pages/purchaseReceipt/coms/receiptInfoPopup.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue'
export default { import comReceiptJobCard from '@/pages/purchaseReceipt/coms/comReceiptJobCard.vue'
name: 'receipt', import receiptJobListPopup from '@/pages/purchaseReceipt/coms/receiptJobListPopup.vue'
components: { import receiptInfoPopup from '@/pages/purchaseReceipt/coms/receiptInfoPopup.vue'
comEmptyView, import jobList from '@/mycomponents/jobList/jobList.vue'
jobFilter, import winScanButton from '@/mycomponents/scan/winScanButton.vue'
comReceiptJobCard, import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
receiptInfoPopup,
receiptJobListPopup, export default {
}, name: 'receipt',
data() { components: {
return { comEmptyView,
jobList: [], jobFilter,
pageNo: 1, comReceiptJobCard,
pageSize: 10, receiptInfoPopup,
totalCount: 0, receiptJobListPopup,
loadingType: "nomore", winScanButton,
checkedToday: false, winScanPackJob,
checkedWaitTask: false, jobList
todayTime: "", },
status: '1,2', // data() {
detailOptions: [], return {
detailGiveupOptions: [], jobList: [],
}; pageNo: 1,
}, pageSize: 10,
totalCount: 0,
props: { loadingType: "nomore",
operation: "receipt" //reject checkedToday: false,
}, checkedWaitTask: false,
todayTime: "",
// onShow() { status: '1,2', //
// this.getList('refresh'); detailOptions: [],
// }, detailGiveupOptions: [],
};
// onReady() { },
// this.detailOptions = getDetailOption();
// this.detailGiveupOptions = getDetailGiveupOption(); props: {
// }, operation: "receipt" //reject
},
// onReachBottom() {
// // // onShow() {
// if (this.loadingType == 'loading' || this.loadingType == 'nomore') { // this.getList('refresh');
// return; // },
// }
// this.getList("more"); // onReady() {
// }, // this.detailOptions = getDetailOption();
// this.detailGiveupOptions = getDetailGiveupOption();
// onPullDownRefresh() { // },
// this.refresh();
// }, // onReachBottom() {
// //
// //退 // if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
// onBackPress(options) { // return;
// if (options.from === 'navigateBack') { // }
// uni.navigateBack({ // this.getList("more");
// delta: 1 // },
// })
// return false; // onPullDownRefresh() {
// } // this.refresh();
// }, // },
// // // //退
// onNavigationBarButtonTap(e) { // onBackPress(options) {
// if (e.index === 0) { // if (options.from === 'navigateBack') {
// goHome(); // uni.navigateBack({
// } else if (e.index == 1) { // delta: 1
// this.$refs.filter.openFilter(); // })
// } // return false;
// }, // }
mounted() { // },
this.refresh();
}, // //
// onNavigationBarButtonTap(e) {
methods: { // if (e.index === 0) {
refresh() { // goHome();
this.getList('refresh'); // } else if (e.index == 1) {
}, // this.$refs.filter.openFilter();
openFilter() { // }
this.$refs.filter.openFilter(); // },
}, mounted() {
goHome() { this.refresh();
goHome(); },
},
getList(type) { methods: {
let that = this; refresh() {
uni.showLoading({ this.getList('refresh');
title: "加载中­....", },
mask: true openFilter() {
}); this.$refs.filter.openFilter();
this.loadingType = "loading"; },
if (type === "refresh") { goHome() {
this.pageNo = 1; goHome();
this.jobList = []; },
} getList(type) {
var filters = [] let that = this;
if (this.checkedToday) { uni.showLoading({
filters.push({ title: "加载中­....",
column: "request_time", mask: true
action: "betweeen", });
value: this.todayTime this.loadingType = "loading";
}) if (type === "refresh") {
} this.pageNo = 1;
this.jobList = [];
filters.push({ }
column: "status", var filters = []
action: "in", if (this.checkedToday) {
value: this.status filters.push({
}) column: "request_time",
action: "betweeen",
var params = { value: this.todayTime
filters: filters, })
pageNo: this.pageNo, }
pageSize: this.pageSize,
} filters.push({
getPurchaseReceiptJobList(params).then(res => { column: "status",
uni.hideLoading(); action: "in",
if (type === "refresh") { value: this.status
uni.stopPullDownRefresh(); })
}
var params = {
var list = res.data.list; filters: filters,
this.totalCount = res.data.total pageNo: this.pageNo,
updateTitle("采购收货任务(" + this.totalCount + ")"); pageSize: this.pageSize,
this.loadingType = "loadmore"; }
if (list == null || list.length == 0) { getPurchaseReceiptJobList(params).then(res => {
this.loadingType = "nomore"; uni.hideLoading();
return; if (type === "refresh") {
} uni.stopPullDownRefresh();
this.jobList = type === "refresh" ? list : this.jobList.concat(list); }
this.pageNo++;
var list = res.data.list;
}).catch(error => { this.totalCount = res.data.total
if (type === "refresh") { updateTitle("采购收货任务(" + this.totalCount + ")");
uni.stopPullDownRefresh(); this.loadingType = "loadmore";
} if (list == null || list.length == 0) {
updateTitle("采购收货"); this.loadingType = "nomore";
this.loadingType = ""; return;
uni.hideLoading(); }
that.showMessage(error) this.jobList = type === "refresh" ? list : this.jobList.concat(list);
this.pageNo++;
})
}, }).catch(error => {
if (type === "refresh") {
getScanAsnNumber(code) { uni.stopPullDownRefresh();
this.getDataListByType(code, "asnNumber") }
}, updateTitle("采购收货");
this.loadingType = "";
getScanNumber(code) { uni.hideLoading();
this.getDataListByType(code, "number") that.showMessage(error)
},
})
getDataListByType(code, type) { },
let that = this;
uni.showLoading({ getScanAsnNumber(code) {
title: "加载中....", this.getDataListByType(code, "asnNumber")
mask: true },
});
var filters = [] getScanNumber(code) {
filters.push({ this.getDataListByType(code, "number")
column: "status", },
action: "in",
value: '1,2' getDataListByType(code, type) {
}) let that = this;
if (type == "asnNumber") { uni.showLoading({
filters.push({ title: "加载中....",
column: "asn_number", mask: true
action: "==", });
value: code var filters = []
}) filters.push({
} else if (type == "number") { column: "status",
filters.push({ action: "in",
column: "number", value: '1,2'
action: "==", })
value: code if (type == "asnNumber") {
}) filters.push({
} column: "asn_number",
action: "==",
var params = { value: code
filters: filters, })
pageNo: 1, } else if (type == "number") {
pageSize: 100, filters.push({
} column: "number",
getPurchaseReceiptJobList(params).then(res => { action: "==",
uni.hideLoading(); value: code
if (res.data.list.length == 0) { })
that.showMessage('未查找到' + '【' + code + '】的收货任务'); }
} else if (res.data.list.length == 1) {
that.openJobDetail(res.data.list[0]); var params = {
} else { filters: filters,
if (type == "asnNumber") { pageNo: 1,
that.showItemList(res.data.list); pageSize: 100,
} }
} getPurchaseReceiptJobList(params).then(res => {
}).catch(error => { uni.hideLoading();
uni.hideLoading(); if (res.data.list.length == 0) {
that.showMessage(error); that.showMessage('未查找到' + '【' + code + '】的收货任务');
}) } else if (res.data.list.length == 1) {
}, that.openJobDetail(res.data.list[0]);
} else {
openJobDetail(item) { if (type == "asnNumber") {
uni.navigateTo({ that.showItemList(res.data.list);
url: './receiptDetail?id=' + item.masterId + '&status=' + item.status + '&operation=' + this.operation }
}); }
}, }).catch(error => {
uni.hideLoading();
showItemList(itemList) { that.showMessage(error);
this.$refs.jobListPopup.openPopup(itemList); })
}, },
selectedItem(item) { openJobDetail(item,packingNumber='') {
this.openJobDetail(item); uni.navigateTo({
}, url: './receiptDetail?id=' + item.masterId + '&status=' + item.status + '&operation=' + this
.operation + '&scaned=' + packingNumber
swipeClick(e, dataContent) { });
if (e.content.text == "详情") { },
this.openjobInfoPopup(dataContent);
} else if (e.content.text == "放弃") { showItemList(itemList) {
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?", this.$refs.jobListPopup.openPopup(itemList);
res => { },
if (res) {
var id = dataContent.masterId selectedItem(item) {
this.cancleJob(id); this.openJobDetail(item);
} },
});
} swipeClick(e, dataContent) {
}, if (e.content.text == "详情") {
this.openjobInfoPopup(dataContent);
openjobInfoPopup(item) { } else if (e.content.text == "放弃") {
this.$refs.jobInfoPopup.openPopup(item) this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?",
}, res => {
if (res) {
cancleJob(id) { var id = dataContent.masterId
cancleTakePurchaseReceiptJob(id).then(res => { this.cancleJob(id);
if (res.data) { }
this.getList("refresh") });
uni.showToast({ }
title: "放弃任务成功" },
})
} else { openjobInfoPopup(item) {
this.showMessage("放弃任务失败") this.$refs.jobInfoPopup.openPopup(item)
} },
}).catch(error => { cancleJob(id) {
this.showMessage(error) cancleTakePurchaseReceiptJob(id).then(res => {
}) if (res.data) {
}, this.getList("refresh")
uni.showToast({
switchChangeToday(state, creationTime) { title: "放弃任务成功"
this.checkedToday = state; })
this.todayTime = creationTime; } else {
this.getList("refresh"); this.showMessage("放弃任务失败")
}, }
switchChangeWait(state, jobStatus) { }).catch(error => {
this.checkedWaitTask = state; this.showMessage(error)
this.status = jobStatus; })
this.getList("refresh"); },
},
switchChangeToday(state, creationTime) {
showMessage(message) { this.checkedToday = state;
this.$refs.comMessage.showErrorMessage(message, res => { this.todayTime = creationTime;
if (res) { this.getList("refresh");
},
}
}); switchChangeWait(state, jobStatus) {
this.checkedWaitTask = state;
}, this.status = jobStatus;
} this.getList("refresh");
} },
</script>
showMessage(message) {
<style scoped lang="scss"> 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> </style>

5
src/pages/putaway/job/putawayDetail.vue

@ -107,11 +107,13 @@
toLocationAreaTypeList: [], toLocationAreaTypeList: [],
jobStatus: "", jobStatus: "",
jobToLocationCode: "", jobToLocationCode: "",
isCheckLocation: false isCheckLocation: false,
scanedPackingNumber : ''
}; };
}, },
onLoad(option) { onLoad(option) {
this.id = option.id; this.id = option.id;
this.scanedPackingNumber = option.scaned || '';
if (this.id != undefined) { if (this.id != undefined) {
// //
if (option.status == "1") { if (option.status == "1") {
@ -188,6 +190,7 @@
that.detailSource.forEach(r => { that.detailSource.forEach(r => {
r.subList.forEach(s => { r.subList.forEach(s => {
if(this.scanedPackingNumber&&this.scanedPackingNumber==s.packingNumber) s.scaned = true
s.inventoryStatus = s.inspectResult;// s.inventoryStatus = s.inspectResult;//
}) })
}) })

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

@ -22,11 +22,18 @@
<uni-load-more :status="loadingType" v-if="jobList.length>0" /> <uni-load-more :status="loadingType" v-if="jobList.length>0" />
</view> </view>
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
<winScanPackJob ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true">
</winScanPackJob>
<jobList ref="jobList" @selectItem="selectItem"></jobList>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
<script> <script>
import jobList from '@/mycomponents/jobList/jobList.vue'
import { import {
getPutawayJobList, getPutawayJobList,
@ -42,12 +49,14 @@
getDetailOption, getDetailOption,
getDetailGiveupOption getDetailGiveupOption
} from '@/common/array.js'; } from '@/common/array.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comPutawayJobCard from '@/pages/putaway/coms/comPutawayJobCard.vue' import comPutawayJobCard from '@/pages/putaway/coms/comPutawayJobCard.vue'
import putawayJobListPopup from '@/pages/putaway/coms/putawayJobListPopup.vue' import putawayJobListPopup from '@/pages/putaway/coms/putawayJobListPopup.vue'
import putawayInfoPopup from '@/pages/putaway/coms/putawayInfoPopup.vue' import putawayInfoPopup from '@/pages/putaway/coms/putawayInfoPopup.vue'
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
export default { export default {
name: 'Putaway', name: 'Putaway',
@ -57,6 +66,9 @@
comPutawayJobCard, comPutawayJobCard,
putawayJobListPopup, putawayJobListPopup,
putawayInfoPopup, putawayInfoPopup,
winScanButton,
winScanPackJob,
jobList
}, },
data() { data() {
return { return {
@ -281,6 +293,65 @@
} }
}); });
}, },
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
selectItem(item){
this.$refs.scanPopup.closeScanPopup();
uni.navigateTo({
url: './putawayDetail?id=' + item.masterId + '&status=' + item.status+'&scaned=' + 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
}]
getPutawayJobList({
filters: filters,
pageNo: 1,
pageSize: 100,
}).then(res => {
console.log('getPutawayJobList',getPutawayJobList)
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> </script>

Loading…
Cancel
Save