Browse Source

制品回收

hella_vue3
lijuncheng 6 months ago
parent
commit
8d354069eb
  1. 82
      src/api/request2.js
  2. 52
      src/pages.json
  3. 40
      src/pages/productRecycle/coms/comRecycleJobCard.vue
  4. 39
      src/pages/productRecycle/coms/comReturnRequestCard.vue
  5. 57
      src/pages/productRecycle/coms/recycleDetailInfoPopup.vue
  6. 105
      src/pages/productRecycle/coms/requestDetailInfoPopup.vue
  7. 102
      src/pages/productRecycle/coms/requestInfoPopup.vue
  8. 79
      src/pages/productRecycle/coms/returnInfoPopup.vue
  9. 52
      src/pages/productRecycle/coms/returnJobListPopup.vue
  10. 306
      src/pages/productRecycle/job/productRecycleJob.vue
  11. 474
      src/pages/productRecycle/job/productRecycleJobDetail.vue
  12. 395
      src/pages/productRecycle/record/productRecycleRecord.vue
  13. 4
      src/pages/setter/index.vue

82
src/api/request2.js

@ -2393,6 +2393,88 @@ export function deliverRecordSubmit(params) {
});
}
/**
* 制品回收 任务
* status 任务状态
* 开始日期
* 结束日期
* 获取日期任务列表
* @param {*}
*/
export function getProductRecycleJobList(params) {
return request({
url: baseApi + "/wms/productredress-job-main/senior",
method: "post",
data: params,
});
}
/**
* 制品回收 承接任务
* @param {*} id
*
*/
export function takeProductRecycleJob(id) {
return request({
url: baseApi + "/wms/productredress-job-main/accept?id=" + id,
method: "put",
data: {},
});
}
/**
* 制品收货任务 放弃承接
* @param {*} id
*
*/
export function cancleTakeProductRecycleJob(id) {
return request({
url: baseApi + "/wms/productredress-job-main/abandon?id=" + id,
method: "put",
data: {},
});
}
/**
* 制品回收 获取任务明细
* @param {*} id 任务id
*
*/
export function getProductRecycleDetail(id) {
return request({
url: baseApi + "/wms/productredress-job-main/getProductredressJobById?id=" + id,
method: "get",
data: {},
});
}
/**
* 制品回收 任务提交
* @param {*} params
*/
export function productRecycleJobsubmit(params) {
return request({
url: baseApi + "/wms/productredress-job-main/execute",
method: "put",
data: params,
});
}
/**
* 制品回收 记录提交
* @param {*} params
*/
export function productRecycleRecordSubmit(params) {
return request({
url: baseApi + "/wms/productredress-record-main/create",
method: "post",
data: params,
});
}
/**
* 客户退货 任务
* status 任务状态

52
src/pages.json

@ -109,6 +109,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/setter/test",
"style": {
"navigationBarTitleText": "修改密码",
"enablePullDownRefresh": false
}
},
{
"path": "pages/supplierDeliver/record/supplierDeliverRecord",
"style": {
@ -1023,6 +1030,51 @@
}
},
{
"path": "pages/productRecycle/job/productRecycleJob",
"style": {
"navigationBarTitleText": "制品回收任务",
"enablePullDownRefresh": true,
"titleNView": {
// "autoBackButton": "true",
"buttons": [
//
{
"float": "right",
"fontSize": "58rpx", //
"text": "\ue696",
"fontSrc": "/static/ali_icon/iconfont.ttf"
},
{
"float": "right",
"fontSize": "52rpx", //
"text": "\ue6e2",
"fontSrc": "/static/ali_icon/iconfont.ttf"
}
]
}
}
},
{
"path": "pages/productRecycle/job/productRecycleJobDetail",
"style": {
"navigationBarTitleText": "制品回收任务详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/productRecycle/record/productRecycleRecord",
"style": {
"navigationBarTitleText": "制品回收记录",
"enablePullDownRefresh": false
}
},
{
"path": "pages/deliver/request/deliverRequest",
"style": {

40
src/pages/productRecycle/coms/comRecycleJobCard.vue

@ -0,0 +1,40 @@
<template>
<job-com-main-card :dataContent="dataContent">
<view class="task_item">
<view class="task_item">
<view class="task_text">
<view class="">
申请单号 : {{dataContent.requestNumber}}
</view>
</view>
</view>
</view>
</job-com-main-card>
</template>
<script>
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue'
export default {
components: {
jobComMainCard,
},
data() {
return {};
},
props: {
dataContent: {
type: Object,
default: {}
},
},
methods: {
}
}
</script>
<style lang="scss">
</style>

39
src/pages/productRecycle/coms/comReturnRequestCard.vue

@ -0,0 +1,39 @@
<template>
<request-com-main-card :dataContent="dataContent">
<view class="task_item">
<view class="task_text">
收货单号 : {{dataContent.purchaseReceiptRecordNumber}}
</view>
<view class="task_text">
供应商代码 : {{dataContent.supplierCode}}
</view>
</view>
</request-com-main-card>
</template>
<script>
import requestComMainCard from '@/mycomponents/request/requestComMainCard.vue'
export default {
components: {
requestComMainCard,
},
data() {
return {};
},
props: {
dataContent: {
type: Object,
default: {}
},
},
methods: {
}
}
</script>
<style lang="scss">
</style>

57
src/pages/productRecycle/coms/recycleDetailInfoPopup.vue

@ -0,0 +1,57 @@
<template>
<view class="">
<uni-popup ref="popup">
<detail-common-info :dataContent="dataContent" @onClose="closePopup">
<view class="">
<view class="uni-flex uni-column">
<view class="item">
<text class="item_title">订单号 : </text>
<text class="text_wrap">{{dataContent.poNumber}} </text>
</view>
<view class="item">
<text class="item_title">订单行 : </text>
<text class="text_wrap">{{dataContent.poLine}} </text>
</view>
</view>
</view>
</detail-common-info>
</uni-popup>
</view>
</template>
<script>
import detailCommonInfo from '@/mycomponents/detail/detailCommonInfo.vue'
export default {
components: {
detailCommonInfo
},
data() {
return {
dataContent: {
type: Object,
default: {}
}
}
},
mounted() {},
props: {},
methods: {
openPopup(val) {
this.dataContent = val;
setTimeout(res=>{
this.$refs.popup.open('bottom')
},500)
},
closePopup() {
this.$refs.popup.close()
},
}
}
</script>
<style>
</style>

105
src/pages/productRecycle/coms/requestDetailInfoPopup.vue

@ -0,0 +1,105 @@
<template>
<view class="">
<uni-popup ref="popup">
<request-detail-common-info :dataContent="dataContent" @onClose="closePopup">
<view class="">
<u-line></u-line>
<view class="uni-flex uni-column">
<view class="item">
<text class="item_title">订单号 : </text>
<text class="text_wrap">{{dataContent.poNumber}} </text>
</view>
<view class="item">
<text class="item_title">订单行 : </text>
<text class="text_wrap">{{dataContent.poLine}} </text>
</view>
</view>
</view>
</request-detail-common-info>
</uni-popup>
</view>
</template>
<script>
import requestDetailCommonInfo from '@/mycomponents/detail/requestDetailCommonInfo.vue'
import comListItem from '@/mycomponents/common/comListItem.vue';
export default {
components: {
requestDetailCommonInfo,
comListItem
},
data() {
return {
dataContent: {
type: Object,
default: {}
},
dataList: []
}
},
watch: {
dataContent: {
handler(newName, oldName) {
this.dataList = [{
title: '包装号',
content: this.dataContent.packingNumber
}, {
title: '器具号',
content: this.dataContent.containerNumber
}, {
title: '批次',
content: this.dataContent.batch
}, {
title: '替代批次',
content: this.dataContent.altBatch,
}, {
title: '到库位代码',
content: this.dataContent.toLocationCode
}, {
title: '库存状态',
content: this.dataContent.inventoryStatus,
type: "inventoryStatus"
}, {
title: '订单号',
content: this.dataContent.poNumber
}, {
title: '订单行',
content: this.dataContent.poLine
}, {
title: '原因',
content: this.dataContent.reason
}, {
title: '从货主代码',
content: this.dataContent.fromOwnerCode,
}, {
title: '到货主代码',
content: this.dataContent.toOwnerCode,
}];
},
immediate: true,
deep: true
}
},
mounted() {},
props: {},
methods: {
openPopup(val) {
this.dataContent = val;
setTimeout(res => {
this.$refs.popup.open('bottom')
}, 500)
},
closePopup() {
this.$refs.popup.close()
},
}
}
</script>
<style>
</style>

102
src/pages/productRecycle/coms/requestInfoPopup.vue

@ -0,0 +1,102 @@
<template>
<view class="">
<uni-popup ref="popup">
<request-common-info :dataContent="dataContent" @onClose="closePopup">
<view class="">
<comListItem :dataList="dataList"></comListItem>
</view>
<u-line></u-line>
</request-common-info>
</uni-popup>
</view>
</template>
<script>
import requestCommonInfo from '@/mycomponents/request/requestCommonInfo.vue'
import comListItem from '@/mycomponents/common/comListItem.vue';
export default {
components: {
requestCommonInfo,
comListItem
},
data() {
return {
dataContent:{},
dataList:[]
}
},
watch:{
},
mounted() {},
props: {
},
methods: {
openPopup(val) {
this.dataContent = val;
this.dataList=[{
title: '采购收货记录单号',
content: this.dataContent.purchaseReceiptRecordNumber
}, {
title: '发货单号',
content: this.dataContent.asnNumber
},{
title: '要货计划单号',
content: this.dataContent.ppNumber,
},{
title: '供应商代码',
content: this.dataContent.supplierCode,
},{
title: '承运商',
content: this.dataContent.carrierCode,
},{
title: '运输方式',
content: this.dataContent.transferMode,
type:"transferMode",
},{
title: '车牌号',
content: this.dataContent.vehiclePlateNumber,
},{
title: '从仓库代码',
content: this.dataContent.fromWarehouseCode,
},{
title: '到仓库代码',
content: this.dataContent.toWarehouseCode,
},{
title: '从库位类型范围',
content: this.dataContent.fromLocationTypes,
type:"locationType"
},
{
title: '到库位类型范围',
content: this.dataContent.toLocationTypes,
type:"locationType"
},
{
title: '从库区代码范围',
content: this.dataContent.fromAreaCodes,
},
{
title: '到库区代码范围',
content: this.dataContent.toAreaCodes
},
{
title: '从月台代码',
content: this.dataContent.fromDockCode
}];
setTimeout(res => {
this.$refs.popup.open('bottom')
}, 500)
},
closePopup() {
this.$refs.popup.close()
},
}
}
</script>
<style>
</style>

79
src/pages/productRecycle/coms/returnInfoPopup.vue

@ -0,0 +1,79 @@
<template>
<view class="">
<uni-popup ref="popup">
<job-common-info :dataContent="dataContent" @onClose="closePopup">
<view class="">
<view class="uni-flex uni-column">
<view class="item">
<text class="item_title">发货单号 : </text>
<text class="text_wrap">{{dataContent.asnNumber}} </text>
</view>
<view class="item">
<text class="item_title">要货计划单号 : </text>
<text class="text_wrap">{{dataContent.ppNumber}} </text>
</view>
<view class="item">
<text class="item_title">供应商代码 : </text>
<text class="text_wrap">{{dataContent.supplierCode}} </text>
</view>
<view class="item">
<text class="item_title">承运商 : </text>
<text class="text_wrap">{{dataContent.carrierCode}} </text>
</view>
<view class="item">
<text class="item_title">运输方式 : </text>
<text class="text_wrap">{{getTransferModeName(dataContent.transferMode)}} </text>
</view>
<view class="item">
<text class="item_title">车牌号 : </text>
<text class="text_wrap">{{dataContent.vehiclePlateNumber}} </text>
</view>
</view>
</view>
<u-line></u-line>
</job-common-info>
</uni-popup>
</view>
</template>
<script>
import jobCommonInfo from '@/mycomponents/job/jobCommonInfo.vue'
import {getTransferModeName} from '@/common/directory.js'
export default {
components: {
jobCommonInfo,
},
data() {
return {
dataContent: {
type: Object,
default: {}
}
}
},
mounted() {},
props: {},
methods: {
openPopup(val) {
this.dataContent = val;
setTimeout(res=>{
this.$refs.popup.open('bottom')
},500)
},
closePopup() {
this.$refs.popup.close()
},
getTransferModeName(value){
return getTransferModeName(value)
}
}
}
</script>
<style>
</style>

52
src/pages/productRecycle/coms/returnJobListPopup.vue

@ -0,0 +1,52 @@
<template>
<uni-popup ref="popupItems">
<com-popup @onClose="closePopup">
<view v-for="(item, index) in receiptList" :key="index">
<com-return-job-card :dataContent="item" @click='selectItem(item)'></com-return-job-card>
<u-line></u-line>
</view>
</com-popup>
</uni-popup>
</template>
<script>
import comPopup from '@/mycomponents/common/comPopup.vue'
import comReturnJobCard from '@/pages/purchaseReturn/coms/comReturnJobCard.vue'
export default {
emits: ["selectedItem"],
components: {
comPopup,
comReturnJobCard
},
props: {
},
data() {
return {
receiptList: []
}
},
methods: {
openPopup(items) {
this.receiptList = items;
this.$refs['popupItems'].open("center");
// setTimeout(res=>{
// this.receiptList = items;
// this.$refs['popupItems'].open("center");
// },100)
},
closePopup() {
this.$refs.popupItems.close()
},
selectItem(item) {
this.$emit("selectedItem", item);
this.$refs['popupItems'].close();
},
}
}
</script>
<style>
</style>

306
src/pages/productRecycle/job/productRecycleJob.vue

@ -0,0 +1,306 @@
<template>
<view class="">
<com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter ref="filter" otherTitle="ASN" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" @onScanAsnNumber="getScanAsnNumber"
:checkedToday="checkedToday" :checkedWaitTask="checkedWaitTask">
</job-filter>
<view v-if="jobList.length>0">
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item
:right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)">
<comRecycleJobCard :dataContent="item" @click='openJobDetail(item)'></comRecycleJobCard>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<return-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></return-job-list-popup>
<return-info-popup ref='jobInfoPopup'></return-info-popup>
<uni-load-more :status="loadingType" v-if="jobList.length>0" />
</view>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
getProductRecycleJobList,
cancleTakeProductRecycleJob
} from '@/api/request2.js';
import {
goHome,
updateTitle
} from '@/common/basic.js';
import {
getDetailOption,
getDetailGiveupOption
} from '@/common/array.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comRecycleJobCard from '@/pages/productRecycle/coms/comRecycleJobCard.vue'
import returnJobListPopup from '@/pages/productRecycle/coms/returnJobListPopup.vue'
import returnInfoPopup from '@/pages/productRecycle/coms/returnInfoPopup.vue'
export default {
name: 'receipt',
components: {
comEmptyView,
jobFilter,
comRecycleJobCard,
returnInfoPopup,
returnJobListPopup,
},
data() {
return {
jobList: [],
pageNo: 1,
pageSize: 10,
totalCount: 0,
loadingType: "nomore",
checkedToday: false,
checkedWaitTask: false,
todayTime: "",
status: '1,2', //
detailOptions: [],
detailGiveupOptions: []
};
},
onShow() {
this.getList('refresh');
},
onReady() {
this.detailOptions = getDetailOption();
this.detailGiveupOptions = getDetailGiveupOption();
},
onReachBottom() {
//
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList("more");
},
onPullDownRefresh() {
this.getList('refresh');
},
//退
onBackPress(options) {
if (options.from === 'navigateBack') {
uni.navigateBack({
delta: 1
})
return false;
}
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
} else if (e.index == 1) {
this.$refs.filter.openFilter();
}
},
methods: {
getList(type) {
let that = this;
uni.showLoading({
title: "加载中­....",
mask: true
});
this.loadingType = "loading";
if (type === "refresh") {
this.pageNo = 1;
this.jobList = [];
}
var filters = []
if (this.checkedToday) {
filters.push({
column: "request_time",
action: "betweeen",
value: this.todayTime
})
}
filters.push({
column: "status",
action: "in",
value: this.status
})
var params = {
filters: filters,
pageNo: this.pageNo,
pageSize: this.pageSize,
}
getProductRecycleJobList(params).then(res => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
}
var list = res.data.list;
this.totalCount = res.data.total
updateTitle("制品回收任务(" + this.totalCount + ")");
this.loadingType = "loadmore";
if (list == null || list.length == 0) {
this.loadingType = "nomore";
return;
}
this.jobList = type === "refresh" ? list : this.jobList.concat(list);
this.pageNo++;
}).catch(error => {
if (type === "refresh") {
uni.stopPullDownRefresh();
}
updateTitle("制品回收任务");
this.loadingType = "";
uni.hideLoading();
that.showErrorMessage(error)
})
},
openJobDetail(item) {
uni.navigateTo({
url: './productRecycleJobDetail?id=' + item.id + '&status=' + item.status
});
},
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.id);
}
});
}
},
openjobInfoPopup(item) {
this.$refs.jobInfoPopup.openPopup(item)
},
cancleJob(id) {
cancleTakeProductRecycleJob(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");
},
getScanAsnNumber(code) {
this.getDataListByType(code, "asnNumber")
},
getScanNumber(code) {
this.getDataListByType(code, "number")
},
getDataListByType(code, type) {
let that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
var filters = []
filters.push({
column: "status",
action: "in",
value: '1,2'
})
if (type == "asnNumber") {
filters.push({
column: "asn_number",
action: "==",
value: code
})
} else if (type == "number") {
filters.push({
column: "number",
action: "==",
value: code
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getProductRecycleJobList(params).then(res => {
uni.hideLoading();
if (res.data.list.length == 0) {
that.showMessage('未查找到' + '【' + code + '】的收货任务');
} else if (res.data.list.length == 1) {
that.openJobDetail(res.data.list[0]);
} else {
if (type == "asnNumber") {
that.showItemList(res.data.list);
}
}
}).catch(error => {
uni.hideLoading();
that.showMessage(error);
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
}
}
</script>
<style scoped lang="scss">
</style>

474
src/pages/productRecycle/job/productRecycleJobDetail.vue

@ -0,0 +1,474 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<view class="header_item">
申请单号{{jobContent.requestNumber}}
</view>
<u-line color="#D8D8D8"></u-line>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-detail-card :dataContent="item" :settingParam="jobContent" @remove="updateData"
@updateData='updateData' @openDetail="openDetail">
</com-detail-card>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
<win-scan-pack-and-location ref="scanPopup" title="制品标签" @getResult='getScanResult'></win-scan-pack-and-location>
<recycleDetailInfoPopup ref="jobDetailPopup"></recycleDetailInfoPopup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
getBasicLocationByCode,
getProductRecycleDetail,
productRecycleJobsubmit,
cancleTakeProductRecycleJob,
takeProductRecycleJob
} from '@/api/request2.js';
import {
goHome,
getCurrDateTime,
getPackingNumberAndBatch,
navigateBack
} from '@/common/basic.js';
import {
getInventoryStatusName
} from '@/common/directory.js';
import {
getDataSource,
createRecordInfo,
calcHandleQty,
getScanCount
} from '@/common/detail.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import comDetailCard from "@/mycomponents/detail/comDetailCard.vue"
import recycleDetailInfoPopup from '@/pages/productRecycle/coms/recycleDetailInfoPopup.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
export default {
name: 'returnDetail',
components: {
winScanButton,
winScanPackAndLocation,
comDetailCard,
recycleDetailInfoPopup,
jobTop
},
data() {
return {
id: '',
scanCount: 0,
jobContent: {}, //
subList: [], //subList
detailSource: [], //
businessTypeInfo: {},
managementList: [],
jobStatus: ""
};
},
onLoad(option) {
this.id = option.id;
if (this.id != undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
} else {
this.getDetail();
}
}
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
onBackPress(e) {
//
if (e.from == 'backbutton') {
if (this.jobStatus == "2") {
//
cancleTakeProductRecycleJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
}
},
onPullDownRefresh() {
this.getDetail();
uni.stopPullDownRefresh();
},
mounted() {
},
methods: {
//
receive(callback) {
uni.showLoading({
title: "加载中....",
mask: true
});
if (this.id != null) {
takeProductRecycleJob(this.id).then(res => {
uni.hideLoading();
callback();
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getProductRecycleDetail(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.subList.forEach(res=>{
res.fromLocationCode =res.toLocationCode
})
that.toLocationCode = that.jobContent.toLocationCode
that.detailSource = getDataSource(that.subList);
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
calcHandleQty() {
calcHandleQty(this.detailSource)
this.continueScan()
this.$forceUpdate();
},
calcScanCount(closeScan) {
let items = this.subList.filter(r => {
if (r.scaned) {
return r;
}
})
this.scanCount = items != null ? items.length : 0;
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
}
},
//
continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
} else {
this.scanPopupGetFocus();
}
},
updateData() {
this.calcHandleQty();
},
getScanResult(result) {
try {
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
var qty = result.label.qty;
var itemCode = result.label.itemCode;
var itemDetail = undefined;
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showMessage("物料号【" + itemCode + "】不在列表中")
} else {
//
itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber &&
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
//
if (itemDetail == undefined) {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
.fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描")
return;
} else {
itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber &&
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode &&
r.inventoryStatus == result.balance.inventoryStatus
})
//
if (itemDetail == undefined) {
itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber &&
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail.scaned) {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
.fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描")
return;
}
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus);
if (this.jobContent.allowModifyInventoryStatus == "TRUE") {
this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus +
']不一致,是否继续退货?', res => {
if (res) {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.balance.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus =result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = result.balance.qty;
itemDetail.balance.packQty = result.package.packQty
itemDetail.balance.packUnit = result.package.packUnit
this.calcHandleQty();
} else {
this.scanPopupGetFocus();
}
});
} else {
this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' +
itemStatus +
']不一致,不允许转移!', res => {
this.scanPopupGetFocus();
});
}
} else {
//
if (itemDetail.scaned) {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
.fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描")
return;
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.balance.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus =result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = Number(result.balance.qty);
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
this.calcHandleQty();
}
}
}
}
this.scanPopupGetFocus();
} catch (e) {
this.showErrorMessage(e.message);
}
},
commit() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == 0) {
this.showErrorMessage("扫描数为0,请先扫描")
return;
}
//
//
if (this.scanCount == this.subList.length) {
this.submitJob();
} else if (this.scanCount < this.subList.length) {
//
if (this.jobContent.allowPartialComplete == "TRUE") {
//
this.submitJob();
} else {
//
this.$refs.comMessage.showErrorMessage('请完成扫描后,再进行提交<br>' + "已经扫描[" + this.scanCount +
"]箱总共[" + this
.subList.length + "]箱", res => {
if (res) {
this.openScanPopup();
}
});
}
}
},
submitJob() {
uni.showLoading({
title: "提交中....",
mask: true
});
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
productRecycleJobsubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage(res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toPackingNumber = detail.packingNumber;
detail.toContainerNumber = detail.containerNumber;
detail.toBatch = detail.batch;
detail.toLocationCode = detail.toLocationCode;
subList.push(detail)
}
})
})
this.jobContent.subList = subList
this.jobContent.creator = creator;
return this.jobContent;
},
openScanPopup() {
let fromlocationCode = '';
let fromlocationList = [];
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
item.subList.forEach(l => {
//
var location = fromlocationList.find(res => res == l.fromLocationCode)
if (location == undefined) {
fromlocationList.push(l.fromLocationCode);
}
//
if (fromlocationCode == '') {
if (!l.scaned) {
fromlocationCode = l.fromLocationCode;
}
}
})
}
this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent);
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
scanPopupGetFocus() {
this.$refs.scanPopup.packGetFocus();
},
scanPopupLoseFocus() {
this.$refs.scanPopup.packLoseFocus();
},
openDetail(item) {
this.$refs.jobDetailPopup.openPopup(item)
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.scanPopupGetFocus()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus()
}
});
},
showQuestionMessage(message, callback) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showQuestionMessage(message, res => {
if (res) {
callback(res);
}
});
})
},
showCommitSuccessMessage(number) {
this.$refs.comMessage.showSuccessMessage('提交成功<br>生成退货记录:' + number, res => {
navigateBack(1)
})
}
}
}
</script>
<style scoped lang="scss">
</style>

395
src/pages/productRecycle/record/productRecycleRecord.vue

@ -0,0 +1,395 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-header">
<view class="header_item">
供应商代码{{supplierCode}}
</view>
<view class="header_item">
采购订单{{poNumber}}
</view>
<u-line color="#D8D8D8"></u-line>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<record-com-detail-card :dataContent="item" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack" :isShowToLocation="false">
</record-com-detail-card>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult'>
</win-scan-pack-and-location>
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
productRecycleRecordSubmit,
} from '@/api/request2.js';
import {
goHome,
updateTitle,
navigateBack,
deepCopyData
} from '@/common/basic.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty
} from '@/common/record.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
export default {
components: {
winScanButton,
comBlankView,
winScanLocation,
winScanPackAndLocation,
recordComDetailCard
},
data() {
return {
id: '',
submitMainContent: {}, //
subList: [], //subList
detailSource: [], //
fromLocationCode: "",
fromLocationAreaTypeList: [],
businessType: {}, //
supplierCode: '', //
poNumber: '',
fromType: "",
dataContent: {}
};
},
onLoad(option) {
this.fromType = option.fromType
if (this.fromType == "requestType") {
updateTitle("采购退货申请")
} else {
updateTitle("采购退货记录")
}
var typeCode = "PurchaseReturn"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {
},
methods: {
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanFromLocationCode.openScanPopup();
})
},
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
getScanResult(result) {
if (this.supplierCode == '') {
this.supplierCode = result.label.supplierCode;
} else {
if (this.supplierCode != result.label.supplierCode) {
this.showErrorMessage('扫描的供应商代码[' + result.label.supplierCode + ']与默认供应商代码[' + this.poNumber + ']不一致')
return;
}
}
if (this.poNumber == '') {
this.poNumber = result.label.poNumber;
} else {
if (this.poNumber != result.label.poNumber) {
this.showErrorMessage('扫描的采购订单号[' + result.label.poNumber + ']与默认采购订单号[' + this.poNumber + ']不一致')
return;
}
}
this.getDataSource(result)
},
getDataSource(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemInfo = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack);
itemInfo.subList.push(newDetail);
this.detailSource.push(itemInfo)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus &&
r.scaned == true) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
this.showErrorMessage('箱码[' + balance.packingNumber + "]已经在列表中")
}
}
calcHandleQty(this.detailSource);
},
updateData() {
calcHandleQty(this.detailSource);
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
if (item.qty == 0) {
this.detailSource.splice(i, 1)
}
}
},
removePack() {
for (var i = 0; i < this.detailSource.length; i++) {
var item = this.detailSource[i];
if (item.subList.length == 0) {
this.detailSource.splice(i, 1)
}
}
this.updateData();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
commit() {
uni.showLoading({
title: "提交中....",
mask: true
});
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
//
//
//退
var params = this.setRecordParams(true)
console.log("提交参数", JSON.stringify(params));
productRecycleRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成采购退货记录<br>" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg+"]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
this.showErrorMessage("没有要提交的数据")
}
},
setRecordParams(queryModel) {
var subList = []
var creator = this.$store.state.user.id
this.dataContent.creator = creator;
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var submitItem = deepCopyData(detail)
submitItem.itemCode = detail.itemCode;
submitItem.inventoryStatus = detail.inventoryStatus;
submitItem.fromPackingNumber = detail.packingNumber;
submitItem.toPackingNumber = detail.packingNumber;;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.toContainerNumber = detail.containerNumber
submitItem.fromBatch = detail.batch;
submitItem.toBatch = detail.batch;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = ''; //退
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem)
}
})
})
this.dataContent.subList = subList
this.dataContent.creator = creator;
// this.dataContent.jobNumber = '';
return this.dataContent;
},
showMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.scanPopupGetFocus();
}
});
})
},
showErrorMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus();
}
});
})
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
scanPopupGetFocus() {
this.$refs.scanPopup.packGetFocus();
},
scanPopupLoseFocus() {
this.$refs.scanPopup.packLoseFocus();
},
getFromLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
if (this.fromType == "requestType") {
navigateBack(1)
} else {
//
this.subList = [];
this.detailSource = [];
this.toLocationInfo = {}
}
})
}
}
}
</script>
<style scoped lang="scss">
page {
width: 100%;
height: 100%;
background-color: #fff;
}
.page-wraper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.page-main-list {
/* height: 80rpx;
line-height: 80rpx; */
text-align: center;
background: #e0e0e0;
}
</style>

4
src/pages/setter/index.vue

@ -23,6 +23,7 @@
<view>
<button class="footbtn" @click="handlerlogout">退出登录</button>
</view>
<navigator url="./test" >跳转</navigator>
</view>
</template>
@ -72,6 +73,9 @@
// })
})
uni.$on('getName', function(data) {
console.log('我在B页面选择了:', data);
})
});

Loading…
Cancel
Save