|
@ -4,8 +4,8 @@ |
|
|
<view class="header_job_top"> |
|
|
<view class="header_job_top"> |
|
|
<view class="header-view"> |
|
|
<view class="header-view"> |
|
|
<job-top :dataContent="jobContent"></job-top> |
|
|
<job-top :dataContent="jobContent"></job-top> |
|
|
<uni-collapse ref="collapse"> |
|
|
<u-collapse ref="collapse"> |
|
|
<uni-collapse-item :open="true"> |
|
|
<u-collapse-item :open="true"> |
|
|
<template v-slot:title> |
|
|
<template v-slot:title> |
|
|
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx"> 盘点范围 </view> |
|
|
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx"> 盘点范围 </view> |
|
|
</template> |
|
|
</template> |
|
@ -15,8 +15,8 @@ |
|
|
<text class="card_content">{{ range.value }}</text> |
|
|
<text class="card_content">{{ range.value }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</uni-collapse-item> |
|
|
</u-collapse-item> |
|
|
</uni-collapse> |
|
|
</u-collapse> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="card_view" v-if="fromLocationCode != ''"> |
|
|
<view class="card_view" v-if="fromLocationCode != ''"> |
|
@ -27,16 +27,17 @@ |
|
|
<com-blank-view @goScan="showFromLocationPopup" v-if="detailSource.length == 0"></com-blank-view> |
|
|
<com-blank-view @goScan="showFromLocationPopup" v-if="detailSource.length == 0"></com-blank-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"> |
|
|
<uni-swipe-action ref="swipeAction"> |
|
|
<u-swipe-action ref="swipeAction" |
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
v-for="(item, index) in detailSource" :key="item.id" |
|
|
<uni-swipe-action-item @click="swipeClick($event, item, index)" :right-options="editRemoveOption"> |
|
|
:options="editRemoveOption" |
|
|
<view class=""> |
|
|
@click="(...event)=>swipeClick(event, item, index)"> |
|
|
<package-and-item-card :dataContent="item"></package-and-item-card> |
|
|
<view class="detail-list"> |
|
|
</view> |
|
|
<view class=""> |
|
|
<view class="split_line"></view> |
|
|
<package-and-item-card :dataContent="item"></package-and-item-card> |
|
|
</uni-swipe-action-item> |
|
|
</view> |
|
|
|
|
|
<view class="split_line"></view> |
|
|
</view> |
|
|
</view> |
|
|
</uni-swipe-action> |
|
|
</u-swipe-action> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
@ -63,7 +64,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script setup> |
|
|
import { Decimal } from 'decimal.js' // 引入 |
|
|
import { Decimal } from 'decimal.js' // 引入 |
|
|
import { getFuuzyCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js' |
|
|
import { getFuuzyCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js' |
|
|
import { calc } from '@/common/calc.js' |
|
|
import { calc } from '@/common/calc.js' |
|
@ -84,453 +85,405 @@ import jobTop from '@/mycomponents/job/jobTop.vue' |
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue' |
|
|
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue' |
|
|
|
|
|
|
|
|
export default { |
|
|
import { ref, nextTick } from 'vue' |
|
|
name: 'fuzzycountdetail', |
|
|
import { onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app' |
|
|
components: { |
|
|
import {useCountStore} from '@/store' |
|
|
winScanButton, |
|
|
const store = useCountStore() |
|
|
winScanPack, |
|
|
const id = ref(null) |
|
|
comCountDetailCard, |
|
|
const jobStatus = ref('') |
|
|
// winScanPackAndLocation, |
|
|
const editRemoveOption = ref(getEditRemoveOption()) |
|
|
winScanLocation, |
|
|
const jobContent = ref({}) |
|
|
countQtyEdit, |
|
|
const itemRangeValue = ref('') |
|
|
jobTop, |
|
|
const fromLocation = ref({}) |
|
|
comBlankView, |
|
|
const fromLocationCode = ref('') |
|
|
PackageAndItemCard |
|
|
const detailSource = ref([]) |
|
|
}, |
|
|
const managementList = ref([]) |
|
|
data() { |
|
|
const managementType = ref('') |
|
|
return { |
|
|
const currentEditItem = ref(null) |
|
|
id: '', |
|
|
const showItem = ref(null) |
|
|
scanCount: 0, |
|
|
|
|
|
jobContent: {}, // 任务内容 |
|
|
const scanLocationCode = ref(null) |
|
|
subList: [], // 接口返回的任务subList |
|
|
const scanPopup = ref(null) |
|
|
detailSource: [], // 绑定在页面上的数据源 |
|
|
const comMessage = ref(null) |
|
|
balance: {}, // 库存余额 |
|
|
const countQtyEdit = ref(null) |
|
|
editInventoryStatus: false, |
|
|
const detailInfoPopup = ref(null) |
|
|
package: {}, // 包装 |
|
|
|
|
|
label: {}, // 标签 |
|
|
onLoad(option => { |
|
|
currentEditItem: {}, |
|
|
id.value = option.id |
|
|
jobStatus: '', |
|
|
if (id.value !== undefined) { |
|
|
fromLocation: {}, |
|
|
if (option.status === '1') { |
|
|
fromLocationCode: '', |
|
|
receive(() => getDetail(() => showFromLocationPopup())) |
|
|
editRemoveOption: [], |
|
|
} else { |
|
|
itemRangeValue: '' |
|
|
getDetail(() => showFromLocationPopup()) |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
onLoad(option) { |
|
|
|
|
|
this.id = option.id |
|
|
|
|
|
if (this.id != undefined) { |
|
|
|
|
|
// 新建的任务自动接收 |
|
|
|
|
|
if (option.status == '1') { |
|
|
|
|
|
this.receive((callback) => { |
|
|
|
|
|
this.getDetail((r) => { |
|
|
|
|
|
this.showFromLocationPopup() |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.getDetail((r) => { |
|
|
|
|
|
this.showFromLocationPopup() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
this.editRemoveOption = getEditRemoveOption() |
|
|
} |
|
|
}, |
|
|
editRemoveOption.value = getEditRemoveOption() |
|
|
// 返回首页 |
|
|
}) |
|
|
onNavigationBarButtonTap(e) { |
|
|
|
|
|
if (e.index === 0) { |
|
|
onNavigationBarButtonTap(e => { |
|
|
goHome() |
|
|
if (e.index === 0) { |
|
|
|
|
|
goHome() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onBackPress(e => { |
|
|
|
|
|
if (e.from === 'backbutton') { |
|
|
|
|
|
if (jobStatus.value === '2') { |
|
|
|
|
|
cancleTakeCountJob(id.value) |
|
|
|
|
|
.then(() => uni.navigateBack()) |
|
|
|
|
|
.catch(() => uni.navigateBack()) |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.navigateBack() |
|
|
} |
|
|
} |
|
|
}, |
|
|
return true |
|
|
// 拦截返回按钮事件 |
|
|
} |
|
|
onBackPress(e) { |
|
|
}) |
|
|
// 已经接收但是没提交任务 |
|
|
|
|
|
if (e.from === 'backbutton') { |
|
|
onPullDownRefresh(() => { |
|
|
if (this.jobStatus == '2') { |
|
|
// uni.stopPullDownRefresh(); |
|
|
// 取消承接任务 |
|
|
}) |
|
|
cancleTakeCountJob(this.id) |
|
|
|
|
|
.then((res) => { |
|
|
const receive = (callback) => { |
|
|
uni.navigateBack() |
|
|
if (id.value !== null) { |
|
|
}) |
|
|
takeCountJob(id.value) |
|
|
.catch((error) => { |
|
|
.then(callback) |
|
|
uni.navigateBack() |
|
|
.catch(error => showErrorMessage(error)) |
|
|
}) |
|
|
} |
|
|
} else { |
|
|
} |
|
|
uni.navigateBack() |
|
|
|
|
|
|
|
|
const getDetail = (callback) => { |
|
|
|
|
|
uni.showLoading({ title: '加载中....', mask: true }) |
|
|
|
|
|
getFuuzyCountJobDetail(id.value) |
|
|
|
|
|
.then(res => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
jobContent.value = res.data |
|
|
|
|
|
jobStatus.value = res.data.status |
|
|
|
|
|
const range = jobContent.value.countRange.find(r => r.type === 'ITEM_CODE') |
|
|
|
|
|
if (range !== undefined) { |
|
|
|
|
|
itemRangeValue.value = range.value |
|
|
} |
|
|
} |
|
|
return true |
|
|
callback() |
|
|
} |
|
|
}) |
|
|
}, |
|
|
.catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
onPullDownRefresh() { |
|
|
showErrorMessage(error) |
|
|
// uni.stopPullDownRefresh(); |
|
|
}) |
|
|
}, |
|
|
} |
|
|
|
|
|
|
|
|
mounted() {}, |
|
|
const showFromLocationPopup = () => { |
|
|
methods: { |
|
|
// this.$refs.scanLocationCode.openScanPopup(); |
|
|
// 接收 |
|
|
nextTick(() => { |
|
|
receive(callback) { |
|
|
scanLocationCode.value.openScanPopup() |
|
|
if (this.id != null) { |
|
|
}) |
|
|
takeCountJob(this.id) |
|
|
} |
|
|
.then((res) => { |
|
|
|
|
|
callback() |
|
|
const getLocation = (location, code) => { |
|
|
}) |
|
|
const { countRange } = jobContent.value |
|
|
.catch((error) => { |
|
|
|
|
|
this.showErrorMessage(error) |
|
|
if (countRange !== null) { |
|
|
}) |
|
|
let range = countRange.find(r => r.type === 'LOCATION_CODE') |
|
|
|
|
|
if (range !== undefined) { |
|
|
|
|
|
const rangeValue = range.value |
|
|
|
|
|
const index = rangeValue.indexOf(location.code) |
|
|
|
|
|
if (index < 0) { |
|
|
|
|
|
afterScanLocation(`库位代码【${location.code}】,不在盘点库位范围【${rangeValue}】内`) |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
}, |
|
|
} else { |
|
|
|
|
|
range = countRange.find(r => r.type === 'LOCATIONGROUP_CODE') |
|
|
getDetail(callback) { |
|
|
if (range !== undefined) { |
|
|
const that = this |
|
|
const rangeValue = range.value |
|
|
uni.showLoading({ |
|
|
const index = rangeValue.indexOf(location.locationGroupCode) |
|
|
title: '加载中....', |
|
|
if (index < 0) { |
|
|
mask: true |
|
|
afterScanLocation(`库位组代码【${location.locationGroupCode}】,不在盘点库位组范围【${rangeValue}】内`) |
|
|
}) |
|
|
return |
|
|
getFuuzyCountJobDetail(that.id) |
|
|
} |
|
|
.then((res) => { |
|
|
} else { |
|
|
uni.hideLoading() |
|
|
range = countRange.find(r => r.type === 'AREABASIC_CODE') |
|
|
that.jobContent = res.data |
|
|
if (range !== undefined) { |
|
|
that.jobStatus = res.data.status |
|
|
|
|
|
const range = that.jobContent.countRange.find((r) => r.type == 'ITEM_CODE') |
|
|
|
|
|
if (range != undefined) { |
|
|
|
|
|
that.itemRangeValue = range.value |
|
|
|
|
|
} |
|
|
|
|
|
callback() |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
that.showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showFromLocationPopup() { |
|
|
|
|
|
const as = '' |
|
|
|
|
|
// this.$refs.scanLocationCode.openScanPopup(); |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.$refs.scanLocationCode.openScanPopup() |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getLocation(location, code) { |
|
|
|
|
|
const { countRange } = this.jobContent |
|
|
|
|
|
|
|
|
|
|
|
if (countRange != null) { |
|
|
|
|
|
let range = countRange.find((r) => r.type == 'LOCATION_CODE') |
|
|
|
|
|
if (range != undefined) { |
|
|
|
|
|
const rangeValue = range.value |
|
|
const rangeValue = range.value |
|
|
const index = rangeValue.indexOf(location.code) |
|
|
const index = rangeValue.indexOf(location.areaCode) |
|
|
if (index < 0) { |
|
|
if (index < 0) { |
|
|
this.afterScanLocation(`库位代码【${location.code}】,不在盘点库位范围【${rangeValue}】内`) |
|
|
afterScanLocation(`库区代码【${location.areaCode}】,不在盘点库区范围【${rangeValue}】内`) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
range = countRange.find((r) => r.type == 'LOCATIONGROUP_CODE') |
|
|
range = countRange.find(r => r.type === 'WAREHOUSE_CODE') |
|
|
if (range != undefined) { |
|
|
if (range !== undefined) { |
|
|
const rangeValue = range.value |
|
|
const rangeValue = range.value |
|
|
const index = rangeValue.indexOf(location.locationGroupCode) |
|
|
const index = rangeValue.indexOf(location.warehouseCode) |
|
|
if (index < 0) { |
|
|
if (index < 0) { |
|
|
this.afterScanLocation(`库位组代码【${location.locationGroupCode}】,不在盘点库位组范围【${rangeValue}】内`) |
|
|
afterScanLocation(`仓库代码【${location.warehouseCode}】,不在盘点仓库范围【${rangeValue}】内`) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
range = countRange.find((r) => r.type == 'AREABASIC_CODE') |
|
|
|
|
|
if (range != undefined) { |
|
|
|
|
|
const rangeValue = range.value |
|
|
|
|
|
const index = rangeValue.indexOf(location.areaCode) |
|
|
|
|
|
if (index < 0) { |
|
|
|
|
|
this.afterScanLocation(`库区代码【${location.areaCode}】,不在盘点库区范围【${rangeValue}】内`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
range = countRange.find((r) => r.type == 'WAREHOUSE_CODE') |
|
|
|
|
|
if (range != undefined) { |
|
|
|
|
|
const rangeValue = range.value |
|
|
|
|
|
const index = rangeValue.indexOf(location.warehouseCode) |
|
|
|
|
|
if (index < 0) { |
|
|
|
|
|
this.afterScanLocation(`仓库代码【${location.warehouseCode}】,不在盘点仓库范围【${rangeValue}】内`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
this.getFromLocationCode(location, code) |
|
|
} |
|
|
}, |
|
|
} |
|
|
|
|
|
getFromLocationCode(location, code) |
|
|
afterScanLocation(message) { |
|
|
} |
|
|
this.showErrorMessage(message) |
|
|
|
|
|
this.showFromLocationPopup() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getFromLocationCode(location, code) { |
|
|
|
|
|
this.fromLocation = location |
|
|
|
|
|
this.fromLocationCode = code |
|
|
|
|
|
this.openScanPopup() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
|
|
this.$refs.scanPopup.openScanPopup() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
scanPopupGetFocus() { |
|
|
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
|
|
this.$refs.scanPopup.getfocus() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
const afterScanLocation = (message) => { |
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
showErrorMessage(message) |
|
|
this.$refs.scanPopup.closeScanPopup() |
|
|
showFromLocationPopup() |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
scanPopupLoseFocus() { |
|
|
const getFromLocationCode = (location, code) => { |
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
fromLocation.value = location |
|
|
this.$refs.scanPopup.losefocus() |
|
|
fromLocationCode.value = code |
|
|
} |
|
|
openScanPopup() |
|
|
}, |
|
|
} |
|
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
const openScanPopup = () => { |
|
|
const that = this |
|
|
scanPopup.value.openScanPopup() |
|
|
const packInfo = result.package |
|
|
} |
|
|
if (this.itemRangeValue != '') { |
|
|
|
|
|
const index = this.itemRangeValue.indexOf(packInfo.itemCode) |
|
|
const scanPopupGetFocus = () => { |
|
|
if (index < 0) { |
|
|
if (scanPopup.value !== undefined) { |
|
|
this.showErrorMessage(`物料代码【${packInfo.itemCode}】,不在盘点范围【${this.itemRangeValue}】内`) |
|
|
scanPopup.value.getfocus() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const closeScanPopup = () => { |
|
|
|
|
|
if (scanPopup.value !== undefined) { |
|
|
|
|
|
scanPopup.value.closeScanPopup() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const scanPopupLoseFocus = () => { |
|
|
|
|
|
if (scanPopup.value !== undefined) { |
|
|
|
|
|
scanPopup.value.losefocus() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
|
|
const packInfo = result.package |
|
|
|
|
|
if (itemRangeValue.value !== '') { |
|
|
|
|
|
const index = itemRangeValue.value.indexOf(packInfo.itemCode) |
|
|
|
|
|
if (index < 0) { |
|
|
|
|
|
showErrorMessage(`物料代码【${packInfo.itemCode}】,不在盘点范围【${itemRangeValue.value}】内`) |
|
|
|
|
|
} else { |
|
|
|
|
|
onScan(packInfo) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
onScan(packInfo) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onScan = async (packInfo) => { |
|
|
|
|
|
console.log(packInfo) |
|
|
|
|
|
// 获取管理模式,封装参数 |
|
|
|
|
|
await getManagementPrecisions([packInfo.itemCode], packInfo.toLocationCode, res => { |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
managementList.value = res.list |
|
|
|
|
|
managementType.value = managementList.value.some(item => item.ManagementPrecision === 'BY_BATCH') ? 'BY_BATCH' : '' |
|
|
|
|
|
if (managementType.value === 'BY_BATCH') { |
|
|
|
|
|
let detail = detailSource.value.find(r => r.itemCode === packInfo.itemCode && r.batch === packInfo.batch && r.inventoryStatus === 'OK') |
|
|
|
|
|
if (detail === undefined) { |
|
|
|
|
|
detail = createDetailInfo(packInfo) |
|
|
|
|
|
detail.packingNumber = '' |
|
|
|
|
|
detail.packUnit = '' |
|
|
|
|
|
detailSource.value.unshift(detail) |
|
|
|
|
|
scanPopupGetFocus() |
|
|
} else { |
|
|
} else { |
|
|
this.onScan(packInfo) |
|
|
let index = detailSource.value.findIndex(r => r.itemCode === packInfo.itemCode && r.batch === packInfo.batch && r.inventoryStatus === 'OK') |
|
|
|
|
|
if (index >= 0) { |
|
|
|
|
|
detailSource.value.unshift(detailSource.value.splice(index, 1)[0]) // 置顶 |
|
|
|
|
|
detailSource.value[0].qty = calc.add(detailSource.value[0].qty, packInfo.qty) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.onScan(packInfo) |
|
|
let detail = detailSource.value.find(r => r.itemCode === packInfo.itemCode && r.packingNumber === packInfo.number && r.batch === packInfo.batch && r.inventoryStatus === 'OK') |
|
|
} |
|
|
if (detail === undefined) { |
|
|
}, |
|
|
detail = createDetailInfo(packInfo) |
|
|
|
|
|
detailSource.value.unshift(detail) |
|
|
async onScan(packInfo) { |
|
|
scanPopupGetFocus() |
|
|
console.log(packInfo) |
|
|
} else { |
|
|
//获取管理模式,封装参数\ |
|
|
let index = detailSource.value.findIndex(r => r.itemCode === packInfo.itemCode && r.packingNumber === packInfo.number && r.batch === packInfo.batch && r.inventoryStatus === 'OK') |
|
|
await getManagementPrecisions([packInfo.itemCode], packInfo.toLocationCode, res => { |
|
|
if (index >= 0) { |
|
|
if (res.success) { |
|
|
detailSource.value.unshift(detailSource.value.splice(index, 1)[0]) // 置顶 |
|
|
this.managementList = res.list; |
|
|
// 提交 |
|
|
this.managementType = this.managementList.some(item => item.ManagementPrecision == |
|
|
comMessage.value.showQuestionMessage('该箱码已经扫描,是否要编辑盘点明细?', res => { |
|
|
'BY_BATCH') ? 'BY_BATCH' : '' |
|
|
if (res) { |
|
|
if (this.managementType == 'BY_BATCH') { |
|
|
closeScanPopup() |
|
|
let detail = this.detailSource.find(r => r.itemCode == packInfo.itemCode && r.batch == packInfo |
|
|
edit(detail) |
|
|
.batch && r.inventoryStatus == "OK"); |
|
|
} else { |
|
|
if (detail == undefined) { |
|
|
scanPopupGetFocus() |
|
|
detail = this.createDetailInfo(packInfo); |
|
|
|
|
|
detail.packingNumber = '' |
|
|
|
|
|
detail.packUnit = '' |
|
|
|
|
|
this.detailSource.unshift(detail) |
|
|
|
|
|
this.scanPopupGetFocus(); |
|
|
|
|
|
} else { |
|
|
|
|
|
let index = this.detailSource.findIndex(r => r.itemCode == packInfo.itemCode && r.batch == packInfo |
|
|
|
|
|
.batch && r.inventoryStatus == "OK"); |
|
|
|
|
|
if (index >= 0) { |
|
|
|
|
|
this.detailSource.unshift(this.detailSource.splice(index, 1)[0]); //置顶 |
|
|
|
|
|
this.detailSource[0].qty = calc.add(this.detailSource[0].qty, packInfo.qty) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
let detail = this.detailSource.find(r => r.itemCode == packInfo.itemCode && r.packingNumber == |
|
|
|
|
|
packInfo.number && r.batch == packInfo.batch && r.inventoryStatus == "OK"); |
|
|
|
|
|
if (detail == undefined) { |
|
|
|
|
|
detail = this.createDetailInfo(packInfo); |
|
|
|
|
|
this.detailSource.unshift(detail) |
|
|
|
|
|
this.scanPopupGetFocus(); |
|
|
|
|
|
} else { |
|
|
|
|
|
let index = this.detailSource.findIndex(r => r.itemCode == packInfo.itemCode && r.packingNumber == |
|
|
|
|
|
packInfo.number && r.batch == packInfo.batch && r.inventoryStatus == "OK"); |
|
|
|
|
|
if (index >= 0) { |
|
|
|
|
|
this.detailSource.unshift(this.detailSource.splice(index, 1)[0]); //置顶 |
|
|
|
|
|
//提交 |
|
|
|
|
|
this.$refs.comMessage.showQuestionMessage('该箱码已经扫描,是否要编辑盘点明细?', res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.closeScanPopup(); |
|
|
|
|
|
this.edit(detail); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.scanPopupGetFocus(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 创建盘盈的明细 |
|
|
|
|
|
createDetailInfo(packInfo) { |
|
|
|
|
|
const detail = { |
|
|
|
|
|
scaned: true, |
|
|
|
|
|
// countDetailNumber: "", |
|
|
|
|
|
number: this.jobContent.number, |
|
|
|
|
|
packingNumber: packInfo.number, |
|
|
|
|
|
batch: packInfo.batch, |
|
|
|
|
|
inventoryStatus: 'OK', |
|
|
|
|
|
itemCode: packInfo.itemCode, |
|
|
|
|
|
itemName: packInfo.itemName, |
|
|
|
|
|
itemDesc1: packInfo.itemDesc1, |
|
|
|
|
|
itemDesc2: packInfo.itemDesc2, |
|
|
|
|
|
projectCode: '', |
|
|
|
|
|
qty: packInfo.qty, |
|
|
|
|
|
packUnit: packInfo.packUnit, |
|
|
|
|
|
packQty: packInfo.packQty, |
|
|
|
|
|
packUom: packInfo.packUom, |
|
|
|
|
|
uom: packInfo.uom, |
|
|
|
|
|
remark: '', |
|
|
|
|
|
locationCode: this.fromLocationCode, |
|
|
|
|
|
creator: this.$store.state.user.id, |
|
|
|
|
|
warehouseCode: this.fromLocation.warehouseCode, |
|
|
|
|
|
areaCode: this.fromLocation.areaCode, |
|
|
|
|
|
locationGroupCode: this.fromLocation.locationGroupCode, |
|
|
|
|
|
createTime: new Date().getTime(), |
|
|
|
|
|
countTime: new Date().getTime(), |
|
|
|
|
|
countUser: this.$store.state.user.id, |
|
|
|
|
|
countDescription: '', |
|
|
|
|
|
countQty: packInfo.qty |
|
|
|
|
|
} |
|
|
} |
|
|
return detail |
|
|
} |
|
|
}, |
|
|
}) |
|
|
|
|
|
} |
|
|
swipeClick(e, item, index) { |
|
|
|
|
|
if (e.content.text == '编辑') { |
|
|
const createDetailInfo = (packInfo) => { |
|
|
this.edit(item) |
|
|
return { |
|
|
} else if (e.content.text == '移除') { |
|
|
scaned: true, |
|
|
this.remove(item) |
|
|
number: jobContent.value.number, |
|
|
|
|
|
packingNumber: packInfo.number, |
|
|
|
|
|
batch: packInfo.batch, |
|
|
|
|
|
inventoryStatus: 'OK', |
|
|
|
|
|
itemCode: packInfo.itemCode, |
|
|
|
|
|
itemName: packInfo.itemName, |
|
|
|
|
|
itemDesc1: packInfo.itemDesc1, |
|
|
|
|
|
itemDesc2: packInfo.itemDesc2, |
|
|
|
|
|
projectCode: '', |
|
|
|
|
|
qty: packInfo.qty, |
|
|
|
|
|
packUnit: packInfo.packUnit, |
|
|
|
|
|
packQty: packInfo.packQty, |
|
|
|
|
|
packUom: packInfo.packUom, |
|
|
|
|
|
uom: packInfo.uom, |
|
|
|
|
|
remark: '', |
|
|
|
|
|
locationCode: fromLocationCode.value, |
|
|
|
|
|
creator: store.id, |
|
|
|
|
|
warehouseCode: fromLocation.value.warehouseCode, |
|
|
|
|
|
areaCode: fromLocation.value.areaCode, |
|
|
|
|
|
locationGroupCode: fromLocation.value.locationGroupCode, |
|
|
|
|
|
createTime: new Date().getTime(), |
|
|
|
|
|
countTime: new Date().getTime(), |
|
|
|
|
|
countUser: store.id, |
|
|
|
|
|
countDescription: '', |
|
|
|
|
|
countQty: packInfo.qty |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const swipeClick = (e, item, index) => { |
|
|
|
|
|
if (e.content.text === '编辑') { |
|
|
|
|
|
edit(item) |
|
|
|
|
|
} else if (e.content.text === '移除') { |
|
|
|
|
|
remove(item, index) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const edit = (item) => { |
|
|
|
|
|
currentEditItem.value = item |
|
|
|
|
|
item.handleQty = item.qty |
|
|
|
|
|
countQtyEdit.value.openEditPopup(item, null) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const editConfirm = (qty, inventoryStatus, mode) => { |
|
|
|
|
|
currentEditItem.value.countQty = qty |
|
|
|
|
|
currentEditItem.value.qty = qty |
|
|
|
|
|
currentEditItem.value.inventoryStatus = inventoryStatus |
|
|
|
|
|
openScanPopup() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const editClose = () => { |
|
|
|
|
|
scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const remove = (item, index) => { |
|
|
|
|
|
scanPopupLoseFocus() |
|
|
|
|
|
comMessage.value.showQuestionMessage('是否要移除扫描信息?', res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
detailSource.value.splice(index, 1) |
|
|
|
|
|
} |
|
|
|
|
|
scanPopupGetFocus() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const detail = (item) => { |
|
|
|
|
|
showItem.value = item |
|
|
|
|
|
detailInfoPopup.value.openPopup(item) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const commit = () => { |
|
|
|
|
|
if (detailSource.value.length === 0) { |
|
|
|
|
|
comMessage.value.showMessage('还未扫描,是否要继续提交', res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
commitJob() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}) |
|
|
|
|
|
} else { |
|
|
// 编辑盘点结果 |
|
|
commitJob() |
|
|
edit(item) { |
|
|
} |
|
|
const that = this |
|
|
} |
|
|
this.currentEditItem = item |
|
|
|
|
|
item.handleQty = item.qty |
|
|
const commitJob = () => { |
|
|
this.$refs.countQtyEdit.openEditPopup(item, null) |
|
|
uni.showLoading({ title: '提交中....', mask: true }) |
|
|
}, |
|
|
const params = setParams() |
|
|
|
|
|
console.log('提交参数', JSON.stringify(params)) |
|
|
editConfirm(qty, inventoryStatus, mode) { |
|
|
countJobSubmit(params) |
|
|
const that = this |
|
|
.then(res => { |
|
|
this.currentEditItem.countQty = qty |
|
|
uni.hideLoading() |
|
|
this.currentEditItem.qty = qty |
|
|
if (res.data === null) { |
|
|
this.currentEditItem.inventoryStatus = inventoryStatus |
|
|
showCommitSuccessMessage('提交成功') |
|
|
this.openScanPopup() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
editClose() { |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
remove(item, index) { |
|
|
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
|
|
this.showQuestionMessage('是否要移除扫描信息?', (res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.detailSource.splice(index, 1) |
|
|
|
|
|
} |
|
|
|
|
|
this.scanPopupGetFocus(); |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
detail(item) { |
|
|
|
|
|
this.showItem = item |
|
|
|
|
|
this.$refs.detailInfoPopup.openPopup(item) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
commit() { |
|
|
|
|
|
if (this.detailSource.length == 0) { |
|
|
|
|
|
this.$refs.comMessage.showMessage('还未扫描,是否要继续提交', (res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.commitJob() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.commitJob() |
|
|
showErrorMessage(`提交失败[${res.msg}]`) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}) |
|
|
|
|
|
.catch(error => { |
|
|
commitJob() { |
|
|
uni.hideLoading() |
|
|
uni.showLoading({ |
|
|
showErrorMessage(error) |
|
|
title: '提交中....', |
|
|
}) |
|
|
mask: true |
|
|
} |
|
|
}) |
|
|
|
|
|
const params = this.setParams() |
|
|
const setParams = () => { |
|
|
console.log('提交参数', JSON.stringify(params)) |
|
|
const creator = store.id |
|
|
countJobSubmit(params) |
|
|
jobContent.value.subList = detailSource.value |
|
|
.then((res) => { |
|
|
// jobContent.value.creator = creator; |
|
|
uni.hideLoading() |
|
|
return jobContent.value |
|
|
if (res.data == null) { |
|
|
} |
|
|
this.showCommitSuccessMessage('提交成功') |
|
|
|
|
|
} else { |
|
|
const showMessage = (message) => { |
|
|
this.showErrorMessage(`提交失败[${res.msg}]`) |
|
|
scanPopupLoseFocus() |
|
|
} |
|
|
comMessage.value.showMessage(message, res => { |
|
|
}) |
|
|
if (res) { |
|
|
.catch((error) => { |
|
|
afterCloseMessage() |
|
|
uni.hideLoading() |
|
|
|
|
|
this.showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setParams() { |
|
|
|
|
|
const creator = this.$store.state.user.id |
|
|
|
|
|
this.jobContent.subList = this.detailSource |
|
|
|
|
|
// this.jobContent.creator = creator; |
|
|
|
|
|
return this.jobContent |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showMessage(message) { |
|
|
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
|
|
this.$refs.comMessage.showMessage(message, (res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.afterCloseMessage() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
|
|
this.scanPopupLoseFocus(); |
|
|
|
|
|
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.afterCloseMessage() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showScanMessage(message) { |
|
|
|
|
|
this.$refs.comMessage.showScanMessage(message) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
afterCloseMessage() { |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
closeScanMessage() { |
|
|
|
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
|
|
|
|
|
this.fromLocationCode = '' |
|
|
|
|
|
this.fromLocation = {} |
|
|
|
|
|
this.detailSource = [] |
|
|
|
|
|
this.showFromLocationPopup() |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
getCountStageName(value) { |
|
|
|
|
|
return getCountStageName(value) |
|
|
|
|
|
}, |
|
|
|
|
|
isOpenCount(value) { |
|
|
|
|
|
return value == 'TRUE' ? '明盘' : '盲盘' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCountScopeName(value) { |
|
|
|
|
|
const item = getCountScopeType(value) |
|
|
|
|
|
return item.label |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showQuestionMessage(message, callback) { |
|
|
|
|
|
this.$refs.comMessage.showQuestionMessage(message, (res) => { |
|
|
|
|
|
callback(res) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showErrorMessage = (message) => { |
|
|
|
|
|
scanPopupLoseFocus() |
|
|
|
|
|
comMessage.value.showErrorMessage(message, res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
afterCloseMessage() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showScanMessage = (message) => { |
|
|
|
|
|
comMessage.value.showScanMessage(message) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const afterCloseMessage = () => { |
|
|
|
|
|
scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const closeScanMessage = () => { |
|
|
|
|
|
scanPopupGetFocus() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showCommitSuccessMessage = (hint) => { |
|
|
|
|
|
comMessage.value.showSuccessMessage(hint, res => { |
|
|
|
|
|
fromLocationCode.value = '' |
|
|
|
|
|
fromLocation.value = {} |
|
|
|
|
|
detailSource.value = [] |
|
|
|
|
|
showFromLocationPopup() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getCountStageName = (value) => { |
|
|
|
|
|
return getCountStageName(value) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const isOpenCount = (value) => { |
|
|
|
|
|
return value === 'TRUE' ? '明盘' : '盲盘' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getCountScopeName = (value) => { |
|
|
|
|
|
const item = getCountScopeType(value) |
|
|
|
|
|
return item.label |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showQuestionMessage = (message, callback) => { |
|
|
|
|
|
comMessage.value.showQuestionMessage(message, res => { |
|
|
|
|
|
callback(res) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|