Browse Source

store引用 文件迁移Vue2升级Vue3 8/2-10/25

hella_vue3
王志国 3 weeks ago
parent
commit
cee85c60ff
  1. 569
      src/pages/count/job/countBlindDetail.vue
  2. 577
      src/pages/count/job/countDetail1.vue
  3. 563
      src/pages/count/job/fuzzyCountDetail.vue
  4. 6
      src/pages/issue/record/directIssue2.vue
  5. 15
      src/pages/package/record/splitPackageRecord.vue
  6. 11
      src/pages/productReceipt/job/completeReceiveJobDetail.vue
  7. 3
      src/pages/productReceipt/job/productReceiptJob.vue
  8. 5
      src/pages/purchaseReturn/job/returnDetailBatch.vue
  9. 5
      src/pages/putaway/job/quantityPutawayJobDetail.vue

569
src/pages/count/job/countBlindDetail.vue

@ -32,15 +32,15 @@
<u-line color="#D8D8D8" style="margin-bottom: 15rpx"></u-line>
<scroll-view scroll-y="true" class="" style="margin-bottom: 50px">
<view class="detail-list" v-for="(item, index) in showList" :key="item.id">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event, item)" :right-options="item.scaned ? scanOptions : detailOptions">
<u-swipe-action ref="swipeAction"
:options="item.scaned ? scanOptions : detailOptions"
@click="(...event)=>swipeClick(event, item)">
<view class="uni-flex uni-row" style="align-items: center" :class="item.scaned ? 'scan_view' : 'item'">
<view class="" style="font-size: 30rpx; font-weight: bold"> {{ index + 1 }}. </view>
<comCountDetailcards :ref="'countDetail_' + index" :dataContent="item" :index="index" @editItem="editItem" :settingParam="jobContent" @remove="updateData" :isShowRecommendQty="false" @updateData="updateData"> </comCountDetailcards>
</view>
<view class="split_line"></view>
</uni-swipe-action-item>
</uni-swipe-action>
</u-swipe-action>
</view>
</scroll-view>
<uni-load-more :status="loadingType" v-if="showList.length > 0" />
@ -63,7 +63,7 @@
</view>
</template>
<script>
<script setup>
import { Decimal } from 'decimal.js' //
import { getCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js'
import { calc } from '@/common/calc.js'
@ -80,311 +80,251 @@ import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.v
import countQtyEdit from '@/mycomponents/qty/countQtyEdit.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import detailInfoPopup from '@/pages/count/coms/detailInfoPopup.vue'
export default {
name: 'receipt_detail',
components: {
winScanButton,
winScanPack,
comCountDetailcards,
winScanPackAndLocation,
countQtyEdit,
jobTop,
detailInfoPopup
},
data() {
return {
id: '',
receiptJob: {},
fromLocationCode: '',
isShowPackingCode: true,
jobContent: {}, //
subList: [], // subList
detailSource: [], //
balance: {}, //
editInventoryStatus: false,
package: {}, //
label: {}, //
currentEditItem: {},
jobStatus: '',
allCount: 0,
scanCount: 0,
index: 0,
pageSize: 20,
showList: [],
loadingType: '',
allDetails: [],
scanOptions: [],
detailOptions: []
}
},
onLoad(option) {
uni.setNavigationBarTitle({
title: `${option.title}详情`
})
this.id = option.id
if (this.id != undefined) {
//
if (option.status == '1') {
this.receive((callback) => {
this.getDetail()
})
import { ref } from 'vue'
import { onLoad, onPullDownRefresh, onReachBottom, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app'
import { useCountStore } from "@/store";
const store = useCountStore()
const id = ref(null)
const jobStatus = ref('')
const detailOptions = ref(getDetailOption())
const scanOptions = ref(getDetailEditRemoveOption())
const loadingType = ref('')
const index = ref(1)
const showList = ref([])
const allDetails = ref([])
const allCount = ref(0)
const fromLocationCode = ref('')
const jobContent = ref({})
const currentEditItem = ref(null)
const showItem = ref(null)
const detailInfoPopup = ref(null)
const scanPopup = ref(null)
const comMessage = ref(null)
const countQtyEdit = ref(null)
onLoad(option => {
uni.setNavigationBarTitle({ title: `${option.title}详情` })
id.value = option.id
if (id.value !== undefined) {
if (option.status === '1') {
receive(() => getDetail())
} else {
this.getDetail()
getDetail()
}
}
this.detailOptions = getDetailOption()
this.scanOptions = getDetailEditRemoveOption()
},
//
onNavigationBarButtonTap(e) {
detailOptions.value = getDetailOption()
scanOptions.value = getDetailEditRemoveOption()
})
onNavigationBarButtonTap(e => {
if (e.index === 0) {
goHome()
}
},
//
onBackPress(e) {
//
if (e.from === 'backbutton') {
if (this.jobStatus == '2') {
//
cancleTakeCountJob(this.id)
.then((res) => {
uni.navigateBack()
})
.catch((error) => {
uni.navigateBack()
})
onBackPress(e => {
if (e.from === 'backbutton') {
if (jobStatus.value === '2') {
cancleTakeCountJob(id.value)
.then(() => uni.navigateBack())
.catch(() => uni.navigateBack())
} else {
uni.navigateBack()
}
return true
}
},
})
onPullDownRefresh() {
this.initList()
onPullDownRefresh(() => {
initList()
uni.stopPullDownRefresh()
},
})
mounted() {},
onReachBottom() {
onReachBottom(() => {
console.log('onReachBottom')
//
if (this.loadingType == 'nomore') {
return
}
this.index++
const list = this.getDataPage(this.index, this.pageSize)
if (loadingType.value === 'nomore') return
index.value++
const list = getDataPage(index.value, pageSize)
if (list.length > 0) {
// this.showList=list
this.showList = this.showList.concat(list)
showList.value = showList.value.concat(list)
} else {
//
this.loadingType = 'nomore'
}
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeCountJob(this.id)
.then((res) => {
callback()
})
.catch((error) => {
this.showErrorMessage(error)
loadingType.value = 'nomore'
}
})
const receive = (callback) => {
if (id.value !== null) {
takeCountJob(id.value)
.then(callback)
.catch(error => showErrorMessage(error))
}
}
},
getDetail() {
const that = this
uni.showLoading({
title: '加载中....',
mask: true
})
getCountJobDetail(that.id)
.then((res) => {
const getDetail = () => {
uni.showLoading({ title: '加载中....', mask: true })
getCountJobDetail(id.value)
.then(res => {
uni.hideLoading()
if (res.data == null) {
that.showMessage('未获取到详情')
if (res.data === null) {
showMessage('未获取到详情')
} else {
that.jobContent = res.data
that.jobStatus = res.data.status
that.fromLocationCode = that.jobContent.countSplitCode
res.data.subList.forEach((item) => {
jobContent.value = res.data
jobStatus.value = res.data.status
fromLocationCode.value = jobContent.value.countSplitCode
res.data.subList.forEach(item => {
item.recommendQty = item.qty
item.handleQty = 0
item.countTime = new Date()
item.fromLocationCode = that.fromLocationCode
item.fromLocationCode = fromLocationCode.value
})
that.allDetails = res.data.subList
that.allCount = res.data.subList.length
that.initList()
allDetails.value = res.data.subList
allCount.value = res.data.subList.length
initList()
}
})
.catch((error) => {
.catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
showErrorMessage(error)
})
},
initList() {
this.index = 1
this.showList = []
this.loadingType = ''
this.showList = this.getDataPage(this.index, this.pageSize)
},
getDataPage(pageNo, pageSize) {
//
const totalPages = Math.ceil(this.allCount / pageSize)
//
}
const initList = () => {
index.value = 1
showList.value = []
loadingType.value = ''
showList.value = getDataPage(index.value, pageSize)
}
const getDataPage = (pageNo, pageSize) => {
const totalPages = Math.ceil(allCount.value / pageSize)
const start = (pageNo - 1) * pageSize
const end = start + pageSize //
return this.allDetails.slice(start, end)
},
swipeClick(e, item) {
if (e.content.text == '详情') {
this.detail(item)
} else if (e.content.text == '编辑') {
this.editItem(item)
} else if (e.content.text == '移除') {
this.remove(item)
}
},
detail(item) {
this.showItem = item
this.$refs.detailInfoPopup.openPopup(item)
},
remove(item, index) {
this.$refs.comMessage.showQuestionMessage('确定移除扫描信息?', (res) => {
const end = start + pageSize
return allDetails.value.slice(start, end)
}
const swipeClick = (e, item) => {
if (e.content.text === '详情') {
detail(item)
} else if (e.content.text === '编辑') {
editItem(item)
} else if (e.content.text === '移除') {
remove(item)
}
}
const detail = (item) => {
showItem.value = item
detailInfoPopup.value.openPopup(item)
}
const remove = (item, index) => {
comMessage.value.showQuestionMessage('确定移除扫描信息?', res => {
if (res) {
item.scaned = false
item.handleQty = 0
this.$emit('removePack')
emit('removePack')
}
})
},
updateData() {},
}
openScanPopup() {
const fromlocationList = []
fromlocationList.push(this.fromLocationCode)
this.$refs.scanPopup.openScanPopupForJob(this.fromLocationCode, fromlocationList, this.jobContent)
},
const updateData = () => {}
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup()
const openScanPopup = () => {
const fromlocationList = [fromLocationCode.value]
scanPopup.value.openScanPopupForJob(fromLocationCode.value, fromlocationList, jobContent.value)
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.packGetFocus()
const closeScanPopup = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.closeScanPopup()
}
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.packLoseFocus()
const scanPopupGetFocus = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.packGetFocus()
}
}
},
//
getScanResult(result) {
const { itemCode } = result.label
const { packingNumber } = result.label
const pack = result.package
const { batch } = result.label
const inventoryStatus = result.balance ? result.balance.inventoryStatus : 'OK'
const qty = result.balance ? result.balance.qty : 0
const scanPopupLoseFocus = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.packLoseFocus()
}
}
//
const items = this.allDetails.filter((r) => r.itemCode === itemCode && r.packingNumber === packingNumber && r.batch === batch && r.inventoryStatus === inventoryStatus)
// ,
if (items.length == 0) {
this.$refs.comMessage.showQuestionMessage(`包装【${result.label.packingNumber}】不在任务列表中,是否要添加到列表中?`, (res) => {
//
const getScanResult = (result) => {
const { itemCode, packingNumber, batch, inventoryStatus, qty } = result.label
const items = allDetails.value.filter(r => r.itemCode === itemCode && r.packingNumber === packingNumber && r.batch === batch && r.inventoryStatus === inventoryStatus)
if (items.length === 0) {
comMessage.value.showQuestionMessage(`包装【${packingNumber}】不在任务列表中,是否要添加到列表中?`, res => {
if (res) {
const detail = this.createAddDetailInfo(pack, qty)
const detail = createAddDetailInfo(result.package, qty)
detail.countTime = new Date()
this.allDetails.push(detail)
this.updateList()
this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, null)
allDetails.value.push(detail)
updateList()
countQtyEdit.value.openEditPopupShowSeconds(detail, null)
} else {
this.scanPopupGetFocus()
scanPopupGetFocus()
}
})
} else {
const selectItem = items[0]
//
if (selectItem.scaned) {
this.$refs.comMessage.showQuestionMessage(`包装【${result.label.packingNumber}】已经完成盘点,是否要编辑盘点结果?`, (res) => {
comMessage.value.showQuestionMessage(`包装【${packingNumber}】已经完成盘点,是否要编辑盘点结果?`, res => {
if (res) {
this.currentEditItem = selectItem
this.$refs.countQtyEdit.openEditPopup(selectItem, null)
currentEditItem.value = selectItem
countQtyEdit.value.openEditPopup(selectItem, null)
} else {
this.scanPopupGetFocus()
scanPopupGetFocus()
}
})
} else {
//
selectItem.scaned = true
selectItem.balanceQty = Number(qty)
selectItem.handleQty = Number(qty)
selectItem.packQty = pack.packQty
selectItem.packUnit = pack.packUnit
this.$refs.countQtyEdit.openEditPopupShowSeconds(selectItem, null)
selectItem.packQty = result.package.packQty
selectItem.packUnit = result.package.packUnit
countQtyEdit.value.openEditPopupShowSeconds(selectItem, null)
selectItem.countTime = new Date()
this.updateList()
}
}
},
editConfirm(qty, inventoryStatus, mode) {
const that = this
//
if (mode == 'edit') {
this.currentEditItem.handleQty = qty
this.currentEditItem.inventoryStatus = inventoryStatus
}
//
this.currentEditItem.countTime = new Date()
this.updateList()
this.scanPopupGetFocus()
},
updateList() {
this.allDetails.sort(compare('countTime')) //
this.initList()
this.scanPopupLoseFocus()
this.calcAllCount()
this.calcScanCount()
},
calcAllCount() {
this.allCount = this.allDetails.length
},
calcScanCount() {
this.scanCount = this.allDetails.filter((r) => r.scaned === true).length
},
editClose() {
this.scanPopupGetFocus()
},
//
createAddDetailInfo(pack, qty) {
const detail = {
masterId: this.jobContent.id, //
updateList()
}
}
}
const editConfirm = (qty, inventoryStatus, mode) => {
if (mode === 'edit') {
currentEditItem.value.handleQty = qty
currentEditItem.value.inventoryStatus = inventoryStatus
}
currentEditItem.value.countTime = new Date()
updateList()
scanPopupGetFocus()
}
const updateList = () => {
allDetails.value.sort(compare('countTime'))
initList()
scanPopupLoseFocus()
calcAllCount()
calcScanCount()
}
const calcAllCount = () => {
allCount.value = allDetails.value.length
}
const calcScanCount = () => {
scanCount.value = allDetails.value.filter(r => r.scaned === true).length
}
const editClose = () => {
scanPopupGetFocus()
}
const createAddDetailInfo = (pack, qty) => {
return {
masterId: jobContent.value.id,
scaned: true,
countDetailNumber: '',
ownerCode: '',
@ -407,128 +347,119 @@ export default {
remark: '',
countQty: 0,
balanceQty: 0,
fromLocationCode: this.fromLocationCode,
locationCode: this.fromLocationCode,
creator: this.$store.state.user.id,
fromLocationCode: fromLocationCode.value,
locationCode: fromLocationCode.value,
creator: store.id,
countTime: new Date()
}
return detail
},
commit() {
this.calcAllCount()
this.calcScanCount()
}
if (this.scanCount == this.allCount) {
this.submitJob()
} else if (this.scanCount < this.allCount) {
//
if (this.jobContent.allowPartialComplete == 'TRUE') {
//
this.$refs.comMessage.showQuestionMessage(`已经扫描[${this.scanCount}]总共[${this.allCount}],是否把未扫描的盘点数量设置为0?`, (res) => {
const commit = () => {
calcAllCount()
calcScanCount()
if (scanCount.value === allCount.value) {
submitJob()
} else if (scanCount.value < allCount.value) {
if (jobContent.value.allowPartialComplete === 'TRUE') {
comMessage.value.showQuestionMessage(`已经扫描[${scanCount.value}]总共[${allCount.value}],是否把未扫描的盘点数量设置为0?`, res => {
if (res) {
this.allDetails.forEach((item) => {
allDetails.value.forEach(item => {
if (!item.scaned) {
item.scaned = true
item.handleQty = 0
}
})
this.submitJob()
submitJob()
}
})
} else {
//
this.$refs.comMessage.showErrorMessage('请完成扫描后,再进行提交\n' + `已经扫描[${this.scanCount}]总共[${this.getTotalCount()}]`, (res) => {
comMessage.value.showErrorMessage(`请完成扫描后,再进行提交\n已经扫描[${scanCount.value}]总共[${allCount.value}]`, res => {
if (res) {
this.openScanPopup()
openScanPopup()
}
})
}
}
},
}
submitJob() {
uni.showLoading({
title: '提交中....',
mask: true
})
const params = this.setParams()
const submitJob = () => {
uni.showLoading({ title: '提交中....', mask: true })
const params = setParams()
console.log('提交参数', JSON.stringify(params))
countJobSubmit(params)
.then((res) => {
.then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage(`提交成功\n生成盘点记录\n${res.data}`)
showCommitSuccessMessage(`提交成功\n生成盘点记录\n${res.data}`)
} else {
this.showErrorMessage(`提交失败[${res.msg}]`)
showErrorMessage(`提交失败[${res.msg}]`)
}
})
.catch((error) => {
.catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
showErrorMessage(error)
})
},
}
setParams() {
const setParams = () => {
const subList = []
const creator = this.$store.state.user.id
this.allDetails.forEach((item) => {
const creator = store.id
allDetails.value.forEach(item => {
if (item.scaned) {
item.countQty = item.handleQty
}
subList.push(item)
})
jobContent.value.subList = subList
jobContent.value.creator = creator
return jobContent.value
}
this.jobContent.subList = subList
this.jobContent.creator = creator
return this.jobContent
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, (res) => {
const showMessage = (message) => {
comMessage.value.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
afterCloseMessage()
}
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, (res) => {
}
const showErrorMessage = (message) => {
comMessage.value.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
afterCloseMessage()
}
})
},
}
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message)
},
const showScanMessage = (message) => {
comMessage.value.showScanMessage(message)
}
afterCloseMessage() {
this.scanPopupGetFocus()
},
const afterCloseMessage = () => {
scanPopupGetFocus()
}
closeScanMessage() {
this.scanPopupGetFocus()
},
const closeScanMessage = () => {
scanPopupGetFocus()
}
editItem(item) {
this.currentEditItem = item
this.$refs.countQtyEdit.openEditPopup(this.currentEditItem, null)
},
const editItem = (item) => {
currentEditItem.value = item
countQtyEdit.value.openEditPopup(currentEditItem.value, null)
}
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, (res) => {
const showCommitSuccessMessage = (hint) => {
comMessage.value.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
getCountStageName(value) {
return getCountStageName(value)
},
isOpenCount(value) {
return value == 'TRUE' ? '明盘' : '盲盘'
}
const getCountStageName = (value) => {
return getCountStageName(value)
}
const isOpenCount = (value) => {
return value === 'TRUE' ? '明盘' : '盲盘'
}
</script>

577
src/pages/count/job/countDetail1.vue

@ -34,15 +34,15 @@
<u-line color="#D8D8D8" style="margin-bottom: 15rpx"></u-line>
<scroll-view scroll-y="true" class="" style="margin-bottom: 50px">
<view class="detail-list" v-for="(item, index) in showList" :key="item.id">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event, item)" :right-options="item.scaned ? scanOptions : detailOptions">
<u-swipe-action ref="swipeAction"
:options="item.scaned ? scanOptions : detailOptions"
@click="(...event)=>swipeClick(event, item)">
<view class="uni-flex uni-row" style="align-items: center" :class="item.scaned ? 'scan_view' : 'item'">
<view class="" style="font-size: 30rpx; font-weight: bold"> {{ index + 1 }}. </view>
<comCountDetailcards :ref="'countDetail_' + index" :dataContent="item" :index="index" @editItem="editItem" :settingParam="jobContent" @remove="updateData" @updateData="updateData"> </comCountDetailcards>
</view>
<view class="split_line"></view>
</uni-swipe-action-item>
</uni-swipe-action>
</u-swipe-action>
</view>
</scroll-view>
<uni-load-more :status="loadingType" v-if="showList.length > 0" />
@ -65,7 +65,7 @@
</view>
</template>
<script>
<script setup>
import { Decimal } from 'decimal.js' //
import { getCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js'
import { calc } from '@/common/calc.js'
@ -83,306 +83,249 @@ import countQtyEdit from '@/mycomponents/qty/countQtyEdit.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import detailInfoPopup from '@/pages/count/coms/detailInfoPopup.vue'
export default {
name: 'receipt_detail',
components: {
winScanButton,
winScanPack,
comCountDetailcards,
winScanPackAndLocation,
countQtyEdit,
jobTop,
detailInfoPopup
},
data() {
return {
id: '',
receiptJob: {},
fromLocationCode: '',
isShowPackingCode: true,
jobContent: {}, //
subList: [], // subList
detailSource: [], //
balance: {}, //
editInventoryStatus: false,
package: {}, //
label: {}, //
currentEditItem: {},
jobStatus: '',
allCount: 0,
scanCount: 0,
index: 0,
pageSize: 20,
showList: [],
loadingType: '',
allDetails: [],
scanOptions: [],
detailOptions: []
}
},
onLoad(option) {
this.id = option.id
if (this.id != undefined) {
//
if (option.status == '1') {
this.receive((callback) => {
this.getDetail()
})
import { ref, onMounted } from 'vue'
import { onLoad, onPullDownRefresh, onReachBottom, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app'
import { useCountStore } from '@/store'
const store = useCountStore()
const id = ref(null)
const jobStatus = ref('')
const detailOptions = ref(getDetailOption())
const scanOptions = ref(getDetailEditRemoveOption())
const loadingType = ref('')
const index = ref(1)
const showList = ref([])
const allDetails = ref([])
const allCount = ref(0)
const fromLocationCode = ref('')
const jobContent = ref({})
const currentEditItem = ref(null)
const showItem = ref(null)
const detailInfoPopup = ref(null)
const scanPopup = ref(null)
const comMessage = ref(null)
const countQtyEdit = ref(null)
onLoad(option => {
id.value = option.id
if (id.value !== undefined) {
if (option.status === '1') {
receive(() => getDetail())
} else {
this.getDetail()
getDetail()
}
}
this.detailOptions = getDetailOption()
this.scanOptions = getDetailEditRemoveOption()
},
//
onNavigationBarButtonTap(e) {
detailOptions.value = getDetailOption()
scanOptions.value = getDetailEditRemoveOption()
})
onNavigationBarButtonTap(e => {
if (e.index === 0) {
goHome()
}
},
//
onBackPress(e) {
//
if (e.from === 'backbutton') {
if (this.jobStatus == '2') {
//
cancleTakeCountJob(this.id)
.then((res) => {
uni.navigateBack()
})
.catch((error) => {
uni.navigateBack()
})
onBackPress(e => {
if (e.from === 'backbutton') {
if (jobStatus.value === '2') {
cancleTakeCountJob(id.value)
.then(() => uni.navigateBack())
.catch(() => uni.navigateBack())
} else {
uni.navigateBack()
}
return true
}
},
})
onPullDownRefresh() {
this.initList()
onPullDownRefresh(() => {
initList()
uni.stopPullDownRefresh()
},
})
mounted() {},
onReachBottom() {
onReachBottom(() => {
console.log('onReachBottom')
//
if (this.loadingType == 'nomore') {
return
}
this.index++
const list = this.getDataPage(this.index, this.pageSize)
if (loadingType.value === 'nomore') return
index.value++
const list = getDataPage(index.value, pageSize)
if (list.length > 0) {
// this.showList=list
this.showList = this.showList.concat(list)
showList.value = showList.value.concat(list)
} else {
//
this.loadingType = 'nomore'
}
},
methods: {
//
receive(callback) {
if (this.id != null) {
takeCountJob(this.id)
.then((res) => {
callback()
})
.catch((error) => {
this.showErrorMessage(error)
loadingType.value = 'nomore'
}
})
const receive = (callback) => {
if (id.value !== null) {
takeCountJob(id.value)
.then(callback)
.catch(error => showErrorMessage(error))
}
}
},
getDetail() {
const that = this
uni.showLoading({
title: '加载中....',
mask: true
})
getCountJobDetail(that.id)
.then((res) => {
const getDetail = () => {
uni.showLoading({ title: '加载中....', mask: true })
getCountJobDetail(id.value)
.then(res => {
uni.hideLoading()
if (res.data == null) {
that.showMessage('未获取到详情')
if (res.data === null) {
showMessage('未获取到详情')
} else {
that.jobContent = res.data
that.jobStatus = res.data.status
that.fromLocationCode = that.jobContent.locationCode
res.data.subList.forEach((item) => {
jobContent.value = res.data
jobStatus.value = res.data.status
fromLocationCode.value = jobContent.value.locationCode
res.data.subList.forEach(item => {
item.recommendQty = item.qty
item.handleQty = 0
item.countTime = new Date()
item.fromLocationCode = that.fromLocationCode
item.fromLocationCode = fromLocationCode.value
})
that.allDetails = res.data.subList
that.allCount = res.data.subList.length
that.initList()
allDetails.value = res.data.subList
allCount.value = res.data.subList.length
initList()
}
})
.catch((error) => {
.catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
showErrorMessage(error)
})
},
initList() {
this.index = 1
this.showList = []
this.loadingType = ''
this.showList = this.getDataPage(this.index, this.pageSize)
},
getDataPage(pageNo, pageSize) {
//
const totalPages = Math.ceil(this.allCount / pageSize)
//
}
const initList = () => {
index.value = 1
showList.value = []
loadingType.value = ''
showList.value = getDataPage(index.value, pageSize)
}
const getDataPage = (pageNo, pageSize) => {
const totalPages = Math.ceil(allCount.value / pageSize)
const start = (pageNo - 1) * pageSize
const end = start + pageSize //
return this.allDetails.slice(start, end)
},
swipeClick(e, item) {
if (e.content.text == '详情') {
this.detail(item)
} else if (e.content.text == '编辑') {
this.editItem(item)
} else if (e.content.text == '移除') {
this.remove(item)
}
},
detail(item) {
this.showItem = item
this.$refs.detailInfoPopup.openPopup(item)
},
remove(item, index) {
this.$refs.comMessage.showQuestionMessage('确定移除扫描信息?', (res) => {
const end = start + pageSize
return allDetails.value.slice(start, end)
}
const swipeClick = (e, item) => {
if (e.content.text === '详情') {
detail(item)
} else if (e.content.text === '编辑') {
editItem(item)
} else if (e.content.text === '移除') {
remove(item)
}
}
const detail = (item) => {
showItem.value = item
detailInfoPopup.value.openPopup(item)
}
const remove = (item, index) => {
comMessage.value.showQuestionMessage('确定移除扫描信息?', res => {
if (res) {
item.scaned = false
item.handleQty = 0
this.$emit('removePack')
emit('removePack')
}
})
},
updateData() {},
}
openScanPopup() {
const fromlocationList = []
fromlocationList.push(this.fromLocationCode)
this.$refs.scanPopup.openScanPopupForJob(this.fromLocationCode, fromlocationList, this.jobContent)
},
const updateData = () => {}
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup()
const openScanPopup = () => {
const fromlocationList = [fromLocationCode.value]
scanPopup.value.openScanPopupForJob(fromLocationCode.value, fromlocationList, jobContent.value)
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.packGetFocus()
const closeScanPopup = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.closeScanPopup()
}
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.packLoseFocus()
const scanPopupGetFocus = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.packGetFocus()
}
}
},
//
getScanResult(result) {
const { itemCode } = result.label
const { packingNumber } = result.label
const pack = result.package
const { batch } = result.label
const inventoryStatus = result.balance ? result.balance.inventoryStatus : 'OK'
const qty = result.balance ? result.balance.qty : 0
const scanPopupLoseFocus = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.packLoseFocus()
}
}
//
const items = this.allDetails.filter((r) => r.itemCode === itemCode && r.packingNumber === packingNumber && r.batch === batch && r.inventoryStatus === inventoryStatus)
// ,
if (items.length == 0) {
this.$refs.comMessage.showQuestionMessage(`包装【${result.label.packingNumber}】不在任务列表中,是否要添加到列表中?`, (res) => {
//
const getScanResult = (result) => {
const { itemCode, packingNumber, batch, inventoryStatus, qty } = result.label
const items = allDetails.value.filter(r => r.itemCode === itemCode && r.packingNumber === packingNumber && r.batch === batch && r.inventoryStatus === inventoryStatus)
if (items.length === 0) {
comMessage.value.showQuestionMessage(`包装【${packingNumber}】不在任务列表中,是否要添加到列表中?`, res => {
if (res) {
const detail = this.createAddDetailInfo(pack)
const detail = createAddDetailInfo(result.package)
detail.countTime = new Date()
this.allDetails.push(detail)
this.updateList()
this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, null)
allDetails.value.push(detail)
updateList()
countQtyEdit.value.openEditPopupShowSeconds(detail, null)
} else {
this.scanPopupGetFocus()
scanPopupGetFocus()
}
})
} else {
const selectItem = items[0]
//
if (selectItem.scaned) {
this.$refs.comMessage.showQuestionMessage(`包装【${result.label.packingNumber}】已经完成盘点,是否要编辑盘点结果?`, (res) => {
comMessage.value.showQuestionMessage(`包装【${packingNumber}】已经完成盘点,是否要编辑盘点结果?`, res => {
if (res) {
this.currentEditItem = selectItem
this.$refs.countQtyEdit.openEditPopup(selectItem, null)
currentEditItem.value = selectItem
countQtyEdit.value.openEditPopup(selectItem, null)
} else {
this.scanPopupGetFocus()
scanPopupGetFocus()
}
})
} else {
//
selectItem.scaned = true
selectItem.handleQty = Number(qty)
selectItem.packQty = pack.packQty
selectItem.packUnit = pack.packUnit
this.$refs.countQtyEdit.openEditPopupShowSeconds(selectItem, null)
selectItem.packQty = result.package.packQty
selectItem.packUnit = result.package.packUnit
countQtyEdit.value.openEditPopupShowSeconds(selectItem, null)
selectItem.countTime = new Date()
this.updateList()
}
}
},
editConfirm(qty, inventoryStatus, mode) {
const that = this
//
if (mode == 'edit') {
this.currentEditItem.handleQty = qty
this.currentEditItem.inventoryStatus = inventoryStatus
}
//
this.currentEditItem.countTime = new Date()
this.updateList()
this.scanPopupGetFocus()
},
updateList() {
this.allDetails.sort(compare('countTime')) //
this.initList()
this.scanPopupLoseFocus()
this.calcAllCount()
this.calcScanCount()
},
calcAllCount() {
this.allCount = this.allDetails.length
},
calcScanCount() {
this.scanCount = this.allDetails.filter((r) => r.scaned === true).length
},
editClose() {
this.scanPopupGetFocus()
},
//
createAddDetailInfo(pack) {
const detail = {
id: this.jobContent.masterId, //
updateList()
}
}
}
const editConfirm = (qty, inventoryStatus, mode) => {
if (mode === 'edit') {
currentEditItem.value.handleQty = qty
currentEditItem.value.inventoryStatus = inventoryStatus
}
currentEditItem.value.countTime = new Date()
updateList()
scanPopupGetFocus()
}
const updateList = () => {
allDetails.value.sort(compare('countTime'))
initList()
scanPopupLoseFocus()
calcAllCount()
calcScanCount()
}
const calcAllCount = () => {
allCount.value = allDetails.value.length
}
const calcScanCount = () => {
scanCount.value = allDetails.value.filter(r => r.scaned === true).length
}
const editClose = () => {
scanPopupGetFocus()
}
const createAddDetailInfo = (pack) => {
return {
id: jobContent.value.masterId,
scaned: true,
countDetailNumber: '',
ownerCode: '',
@ -404,125 +347,119 @@ export default {
remark: '',
countQty: 0,
balanceQty: 0,
fromLocationCode: this.fromLocationCode,
creator: this.$store.state.user.id,
fromLocationCode: fromLocationCode.value,
creator: store.id,
countTime: new Date()
}
return detail
},
}
commit() {
this.calcAllCount()
this.calcScanCount()
const commit = () => {
calcAllCount()
calcScanCount()
if (this.scanCount == this.allCount) {
this.submitJob()
} else if (this.scanCount < this.allCount) {
//
if (this.jobContent.allowPartialComplete == 'TRUE') {
//
this.$refs.comMessage.showQuestionMessage(`已经扫描[${this.scanCount}]总共[${this.allCount}],是否把未扫描的盘点数量设置为0?`, (res) => {
if (scanCount.value === allCount.value) {
submitJob()
} else if (scanCount.value < allCount.value) {
if (jobContent.value.allowPartialComplete === 'TRUE') {
comMessage.value.showQuestionMessage(`已经扫描[${scanCount.value}]总共[${allCount.value}],是否把未扫描的盘点数量设置为0?`, res => {
if (res) {
this.allDetails.forEach((item) => {
allDetails.value.forEach(item => {
if (!item.scaned) {
item.scaned = true
item.handleQty = 0
}
})
this.submitJob()
submitJob()
}
})
} else {
//
this.$refs.comMessage.showErrorMessage('请完成扫描后,再进行提交\n' + `已经扫描[${this.scanCount}]总共[${this.getTotalCount()}]`, (res) => {
comMessage.value.showErrorMessage(`请完成扫描后,再进行提交\n已经扫描[${scanCount.value}]总共[${allCount.value}]`, res => {
if (res) {
this.openScanPopup()
openScanPopup()
}
})
}
}
},
}
submitJob() {
uni.showLoading({
title: '提交中....',
mask: true
})
const params = this.setParams()
const submitJob = () => {
uni.showLoading({ title: '提交中....', mask: true })
const params = setParams()
console.log('提交参数', JSON.stringify(params))
// countJobSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("\n\n" + res.data)
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
// }).catch(error => {
// uni.hideLoading()
// this.showErrorMessage(error)
// })
},
setParams() {
const subList = []
const creator = this.$store.state.user.id
countJobSubmit(params)
.then(res => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功\n生成盘点记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
})
.catch(error => {
uni.hideLoading()
showErrorMessage(error)
})
}
this.allDetails.forEach((item) => {
const setParams = () => {
const subList = []
const creator = store.id
allDetails.value.forEach(item => {
if (item.scaned) {
item.countQty = item.handleQty
}
subList.push(item)
})
jobContent.value.subList = subList
jobContent.value.creator = creator
return jobContent.value
}
this.jobContent.subList = subList
this.jobContent.creator = creator
return this.jobContent
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, (res) => {
const showMessage = (message) => {
comMessage.value.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
afterCloseMessage()
}
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, (res) => {
}
const showErrorMessage = (message) => {
comMessage.value.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
afterCloseMessage()
}
})
},
}
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message)
},
const showScanMessage = (message) => {
comMessage.value.showScanMessage(message)
}
afterCloseMessage() {
this.scanPopupGetFocus()
},
const afterCloseMessage = () => {
scanPopupGetFocus()
}
closeScanMessage() {
this.scanPopupGetFocus()
},
const closeScanMessage = () => {
scanPopupGetFocus()
}
editItem(item) {
this.currentEditItem = item
this.$refs.countQtyEdit.openEditPopup(this.currentEditItem, null)
},
const editItem = (item) => {
currentEditItem.value = item
countQtyEdit.value.openEditPopup(currentEditItem.value, null)
}
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, (res) => {
const showCommitSuccessMessage = (hint) => {
comMessage.value.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
getCountStageName(value) {
return getCountStageName(value)
},
isOpenCount(value) {
return value == 'TRUE' ? '明盘' : '盲盘'
}
const getCountStageName = (value) => {
return getCountStageName(value)
}
const isOpenCount = (value) => {
return value === 'TRUE' ? '明盘' : '盲盘'
}
</script>

563
src/pages/count/job/fuzzyCountDetail.vue

@ -4,8 +4,8 @@
<view class="header_job_top">
<view class="header-view">
<job-top :dataContent="jobContent"></job-top>
<uni-collapse ref="collapse">
<uni-collapse-item :open="true">
<u-collapse ref="collapse">
<u-collapse-item :open="true">
<template v-slot:title>
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx"> 盘点范围 </view>
</template>
@ -15,8 +15,8 @@
<text class="card_content">{{ range.value }}</text>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</u-collapse-item>
</u-collapse>
</view>
</view>
<view class="card_view" v-if="fromLocationCode != ''">
@ -27,16 +27,17 @@
<com-blank-view @goScan="showFromLocationPopup" v-if="detailSource.length == 0"></com-blank-view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<uni-swipe-action ref="swipeAction">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<uni-swipe-action-item @click="swipeClick($event, item, index)" :right-options="editRemoveOption">
<u-swipe-action ref="swipeAction"
v-for="(item, index) in detailSource" :key="item.id"
:options="editRemoveOption"
@click="(...event)=>swipeClick(event, item, index)">
<view class="detail-list">
<view class="">
<package-and-item-card :dataContent="item"></package-and-item-card>
</view>
<view class="split_line"></view>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
</u-swipe-action>
</scroll-view>
</view>
@ -63,7 +64,7 @@
</view>
</template>
<script>
<script setup>
import { Decimal } from 'decimal.js' //
import { getFuuzyCountJobDetail, takeCountJob, cancleTakeCountJob, countJobSubmit } from '@/api/request2.js'
import { calc } from '@/common/calc.js'
@ -84,169 +85,135 @@ import jobTop from '@/mycomponents/job/jobTop.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue'
export default {
name: 'fuzzycountdetail',
components: {
winScanButton,
winScanPack,
comCountDetailCard,
// winScanPackAndLocation,
winScanLocation,
countQtyEdit,
jobTop,
comBlankView,
PackageAndItemCard
},
data() {
return {
id: '',
scanCount: 0,
jobContent: {}, //
subList: [], // subList
detailSource: [], //
balance: {}, //
editInventoryStatus: false,
package: {}, //
label: {}, //
currentEditItem: {},
jobStatus: '',
fromLocation: {},
fromLocationCode: '',
editRemoveOption: [],
itemRangeValue: ''
}
},
onLoad(option) {
this.id = option.id
if (this.id != undefined) {
//
if (option.status == '1') {
this.receive((callback) => {
this.getDetail((r) => {
this.showFromLocationPopup()
})
})
import { ref, nextTick } from 'vue'
import { onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app'
import {useCountStore} from '@/store'
const store = useCountStore()
const id = ref(null)
const jobStatus = ref('')
const editRemoveOption = ref(getEditRemoveOption())
const jobContent = ref({})
const itemRangeValue = ref('')
const fromLocation = ref({})
const fromLocationCode = ref('')
const detailSource = ref([])
const managementList = ref([])
const managementType = ref('')
const currentEditItem = ref(null)
const showItem = ref(null)
const scanLocationCode = ref(null)
const scanPopup = ref(null)
const comMessage = ref(null)
const countQtyEdit = ref(null)
const detailInfoPopup = ref(null)
onLoad(option => {
id.value = option.id
if (id.value !== undefined) {
if (option.status === '1') {
receive(() => getDetail(() => showFromLocationPopup()))
} else {
this.getDetail((r) => {
this.showFromLocationPopup()
})
getDetail(() => showFromLocationPopup())
}
}
this.editRemoveOption = getEditRemoveOption()
},
//
onNavigationBarButtonTap(e) {
editRemoveOption.value = getEditRemoveOption()
})
onNavigationBarButtonTap(e => {
if (e.index === 0) {
goHome()
}
},
//
onBackPress(e) {
//
if (e.from === 'backbutton') {
if (this.jobStatus == '2') {
//
cancleTakeCountJob(this.id)
.then((res) => {
uni.navigateBack()
})
.catch((error) => {
uni.navigateBack()
})
onBackPress(e => {
if (e.from === 'backbutton') {
if (jobStatus.value === '2') {
cancleTakeCountJob(id.value)
.then(() => uni.navigateBack())
.catch(() => uni.navigateBack())
} else {
uni.navigateBack()
}
return true
}
},
})
onPullDownRefresh() {
onPullDownRefresh(() => {
// uni.stopPullDownRefresh();
},
mounted() {},
methods: {
//
receive(callback) {
if (this.id != null) {
takeCountJob(this.id)
.then((res) => {
callback()
})
.catch((error) => {
this.showErrorMessage(error)
})
const receive = (callback) => {
if (id.value !== null) {
takeCountJob(id.value)
.then(callback)
.catch(error => showErrorMessage(error))
}
}
},
getDetail(callback) {
const that = this
uni.showLoading({
title: '加载中....',
mask: true
})
getFuuzyCountJobDetail(that.id)
.then((res) => {
const getDetail = (callback) => {
uni.showLoading({ title: '加载中....', mask: true })
getFuuzyCountJobDetail(id.value)
.then(res => {
uni.hideLoading()
that.jobContent = res.data
that.jobStatus = res.data.status
const range = that.jobContent.countRange.find((r) => r.type == 'ITEM_CODE')
if (range != undefined) {
that.itemRangeValue = range.value
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
}
callback()
})
.catch((error) => {
.catch(error => {
uni.hideLoading()
that.showErrorMessage(error)
showErrorMessage(error)
})
},
}
showFromLocationPopup() {
const as = ''
const showFromLocationPopup = () => {
// this.$refs.scanLocationCode.openScanPopup();
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup()
nextTick(() => {
scanLocationCode.value.openScanPopup()
})
},
}
getLocation(location, code) {
const { countRange } = this.jobContent
const getLocation = (location, code) => {
const { countRange } = jobContent.value
if (countRange != null) {
let range = countRange.find((r) => r.type == 'LOCATION_CODE')
if (range != undefined) {
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) {
this.afterScanLocation(`库位代码【${location.code}】,不在盘点库位范围【${rangeValue}】内`)
afterScanLocation(`库位代码【${location.code}】,不在盘点库位范围【${rangeValue}】内`)
return
}
} else {
range = countRange.find((r) => r.type == 'LOCATIONGROUP_CODE')
if (range != undefined) {
range = countRange.find(r => r.type === 'LOCATIONGROUP_CODE')
if (range !== undefined) {
const rangeValue = range.value
const index = rangeValue.indexOf(location.locationGroupCode)
if (index < 0) {
this.afterScanLocation(`库位组代码【${location.locationGroupCode}】,不在盘点库位组范围【${rangeValue}】内`)
afterScanLocation(`库位组代码【${location.locationGroupCode}】,不在盘点库位组范围【${rangeValue}】内`)
return
}
} else {
range = countRange.find((r) => r.type == 'AREABASIC_CODE')
if (range != undefined) {
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}】内`)
afterScanLocation(`库区代码【${location.areaCode}】,不在盘点库区范围【${rangeValue}】内`)
return
}
} else {
range = countRange.find((r) => r.type == 'WAREHOUSE_CODE')
if (range != undefined) {
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}】内`)
afterScanLocation(`仓库代码【${location.warehouseCode}】,不在盘点仓库范围【${rangeValue}】内`)
return
}
}
@ -254,116 +221,108 @@ export default {
}
}
}
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code)
}
afterScanLocation(message) {
this.showErrorMessage(message)
this.showFromLocationPopup()
},
const afterScanLocation = (message) => {
showErrorMessage(message)
showFromLocationPopup()
}
getFromLocationCode(location, code) {
this.fromLocation = location
this.fromLocationCode = code
this.openScanPopup()
},
const getFromLocationCode = (location, code) => {
fromLocation.value = location
fromLocationCode.value = code
openScanPopup()
}
openScanPopup() {
this.$refs.scanPopup.openScanPopup()
},
const openScanPopup = () => {
scanPopup.value.openScanPopup()
}
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus()
const scanPopupGetFocus = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.getfocus()
}
}
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup()
const closeScanPopup = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.closeScanPopup()
}
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus()
const scanPopupLoseFocus = () => {
if (scanPopup.value !== undefined) {
scanPopup.value.losefocus()
}
}
},
getScanResult(result) {
const that = this
const getScanResult = (result) => {
const packInfo = result.package
if (this.itemRangeValue != '') {
const index = this.itemRangeValue.indexOf(packInfo.itemCode)
if (itemRangeValue.value !== '') {
const index = itemRangeValue.value.indexOf(packInfo.itemCode)
if (index < 0) {
this.showErrorMessage(`物料代码【${packInfo.itemCode}】,不在盘点范围【${this.itemRangeValue}】内`)
showErrorMessage(`物料代码【${packInfo.itemCode}】,不在盘点范围【${itemRangeValue.value}】内`)
} else {
this.onScan(packInfo)
onScan(packInfo)
}
} else {
this.onScan(packInfo)
onScan(packInfo)
}
}
},
async onScan(packInfo) {
const onScan = async (packInfo) => {
console.log(packInfo)
//\
//
await getManagementPrecisions([packInfo.itemCode], packInfo.toLocationCode, res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
if (this.managementType == 'BY_BATCH') {
let detail = this.detailSource.find(r => r.itemCode == packInfo.itemCode && r.batch == packInfo
.batch && r.inventoryStatus == "OK");
if (detail == undefined) {
detail = this.createDetailInfo(packInfo);
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 = ''
this.detailSource.unshift(detail)
this.scanPopupGetFocus();
detailSource.value.unshift(detail)
scanPopupGetFocus()
} else {
let index = this.detailSource.findIndex(r => r.itemCode == packInfo.itemCode && r.batch == packInfo
.batch && r.inventoryStatus == "OK");
let index = detailSource.value.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)
detailSource.value.unshift(detailSource.value.splice(index, 1)[0]) //
detailSource.value[0].qty = calc.add(detailSource.value[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();
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)
scanPopupGetFocus()
} else {
let index = this.detailSource.findIndex(r => r.itemCode == packInfo.itemCode && r.packingNumber ==
packInfo.number && r.batch == packInfo.batch && r.inventoryStatus == "OK");
let index = detailSource.value.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]); //
detailSource.value.unshift(detailSource.value.splice(index, 1)[0]) //
//
this.$refs.comMessage.showQuestionMessage('该箱码已经扫描,是否要编辑盘点明细?', res => {
comMessage.value.showQuestionMessage('该箱码已经扫描,是否要编辑盘点明细?', res => {
if (res) {
this.closeScanPopup();
this.edit(detail);
closeScanPopup()
edit(detail)
} else {
this.scanPopupGetFocus();
scanPopupGetFocus()
}
});
})
}
}
}
}
})
},
}
//
createDetailInfo(packInfo) {
const detail = {
const createDetailInfo = (packInfo) => {
return {
scaned: true,
// countDetailNumber: "",
number: this.jobContent.number,
number: jobContent.value.number,
packingNumber: packInfo.number,
batch: packInfo.batch,
inventoryStatus: 'OK',
@ -378,160 +337,154 @@ export default {
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,
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: this.$store.state.user.id,
countUser: store.id,
countDescription: '',
countQty: packInfo.qty
}
return detail
},
}
swipeClick(e, item, index) {
if (e.content.text == '编辑') {
this.edit(item)
} else if (e.content.text == '移除') {
this.remove(item)
const swipeClick = (e, item, index) => {
if (e.content.text === '编辑') {
edit(item)
} else if (e.content.text === '移除') {
remove(item, index)
}
}
},
//
edit(item) {
const that = this
this.currentEditItem = item
const edit = (item) => {
currentEditItem.value = item
item.handleQty = item.qty
this.$refs.countQtyEdit.openEditPopup(item, null)
},
editConfirm(qty, inventoryStatus, mode) {
const that = this
this.currentEditItem.countQty = qty
this.currentEditItem.qty = qty
this.currentEditItem.inventoryStatus = inventoryStatus
this.openScanPopup()
},
editClose() {
this.scanPopupGetFocus()
},
remove(item, index) {
this.scanPopupLoseFocus();
this.showQuestionMessage('是否要移除扫描信息?', (res) => {
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) {
this.detailSource.splice(index, 1)
detailSource.value.splice(index, 1)
}
this.scanPopupGetFocus();
scanPopupGetFocus()
})
},
}
detail(item) {
this.showItem = item
this.$refs.detailInfoPopup.openPopup(item)
},
const detail = (item) => {
showItem.value = item
detailInfoPopup.value.openPopup(item)
}
commit() {
if (this.detailSource.length == 0) {
this.$refs.comMessage.showMessage('还未扫描,是否要继续提交', (res) => {
const commit = () => {
if (detailSource.value.length === 0) {
comMessage.value.showMessage('还未扫描,是否要继续提交', res => {
if (res) {
this.commitJob()
commitJob()
}
})
} else {
this.commitJob()
commitJob()
}
}
},
commitJob() {
uni.showLoading({
title: '提交中....',
mask: true
})
const params = this.setParams()
const commitJob = () => {
uni.showLoading({ title: '提交中....', mask: true })
const params = setParams()
console.log('提交参数', JSON.stringify(params))
countJobSubmit(params)
.then((res) => {
.then(res => {
uni.hideLoading()
if (res.data == null) {
this.showCommitSuccessMessage('提交成功')
if (res.data === null) {
showCommitSuccessMessage('提交成功')
} else {
this.showErrorMessage(`提交失败[${res.msg}]`)
showErrorMessage(`提交失败[${res.msg}]`)
}
})
.catch((error) => {
.catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
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) => {
}
const setParams = () => {
const creator = store.id
jobContent.value.subList = detailSource.value
// jobContent.value.creator = creator;
return jobContent.value
}
const showMessage = (message) => {
scanPopupLoseFocus()
comMessage.value.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
afterCloseMessage()
}
})
},
showErrorMessage(message) {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, (res) => {
}
const showErrorMessage = (message) => {
scanPopupLoseFocus()
comMessage.value.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
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()
}
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()
})
},
getCountStageName(value) {
}
const getCountStageName = (value) => {
return getCountStageName(value)
},
isOpenCount(value) {
return value == 'TRUE' ? '明盘' : '盲盘'
},
}
const isOpenCount = (value) => {
return value === 'TRUE' ? '明盘' : '盲盘'
}
getCountScopeName(value) {
const getCountScopeName = (value) => {
const item = getCountScopeType(value)
return item.label
},
}
showQuestionMessage(message, callback) {
this.$refs.comMessage.showQuestionMessage(message, (res) => {
const showQuestionMessage = (message, callback) => {
comMessage.value.showQuestionMessage(message, res => {
callback(res)
})
}
}
}
</script>
<style scoped lang="scss">

6
src/pages/issue/record/directIssue2.vue

@ -101,7 +101,8 @@ import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {ref, onMounted} from 'vue';
import {onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh} from '@dcloudio/uni-app';
import {useCountStore} from '@/store'
const store = useCountStore();
const id = ref('');
const dataContent = ref({});
const detailSource = ref([]);
@ -132,6 +133,7 @@ const managementList = ref([]);
const scanPopupRef = ref(null);
const scanLocationCodeRef = ref(null);
const comMessageRef = ref(null);
const fromInventoryStatus = ref('')
const getBusinessType = (code, callback) => {
//
@ -522,7 +524,7 @@ const commit = () => {
const setRecordParams = () => {
let subList = [];
let creator = store.state.user.id;
let creator = store.id;
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {

15
src/pages/package/record/splitPackageRecord.vue

@ -1,7 +1,7 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan="getBusinessType" v-if="detailSource.length == 0"></com-blank-view>
<com-blank-view @goScan="getBusinessTypeFun" v-if="detailSource.length == 0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length > 0">
@ -65,7 +65,8 @@ import numberBox from '@/mycomponents/qty/numberBox.vue'
import { ref, onMounted, nextTick } from 'vue';
import { onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh } from '@dcloudio/uni-app';
import {useCountStore} from '@/store'
const store = useCountStore()
const id = ref('');
const detailSource = ref([]); //
const fromLocationCode = ref('');
@ -89,7 +90,7 @@ onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title
});
getBusinessType();
getBusinessTypeFun();
});
onNavigationBarButtonTap((e) => {
@ -99,8 +100,8 @@ onNavigationBarButtonTap((e) => {
});
const getBusinessType = () => {
getBusinessTypeApi(typeCode.value, (res) => {
const getBusinessTypeFun = () => {
getBusinessType(typeCode.value, (res) => {
if (res.success) {
businessType.value = res.businessType;
fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses);
@ -125,7 +126,7 @@ const openScanPopup = () => {
scanPopupRef.value.openScanPopup(businessType.value);
}
} else {
getBusinessType();
getBusinessTypeFun();
}
};
@ -267,7 +268,7 @@ const commit = () => {
const setParams = () => {
const subList = [];
const creator = store.state.user.id;
const creator = store.id;
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
const subItem = { ...detail };

11
src/pages/productReceipt/job/completeReceiveJobDetail.vue

@ -83,8 +83,8 @@
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app';
//
import {useCountStore} from '@/store'
const store = useCountStore();
const id = ref('');
const receiptJob = ref({});
const toLocationCode = ref('');
@ -98,12 +98,11 @@ const managementList = ref([]);
const jobStatus = ref("");
const jobToLocationCode = ref("");
//
const scanPopupRef = ref(null);
const comMessageRef = ref(null);
const comScanLocationRef = ref(null);
//
onLoad((option) => {
id.value = option.id;
if (id.value !== undefined) {
@ -146,7 +145,7 @@ onPullDownRefresh(() => {
uni.stopPullDownRefresh();
});
//
const receive = (callback) => {
if (id.value !== null) {
takeProductReceiptJob(id.value).then(() => {
@ -323,7 +322,7 @@ const submitJob = () => {
const setParams = () => {
const subList = [];
const creator = store.state.user.id;
const creator = store.id;
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {

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

@ -39,7 +39,6 @@ import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackJob from '@/mycomponents/scan/winScanPackJob.vue'
import { useCountStore } from '@/store'
// store
const store = useCountStore()
const { proxy } = getCurrentInstance()
@ -385,7 +384,7 @@ const getJobInfoByNumber = (number,scanMessage)=>{
showMessage('未查找到' + '【' + number + '】的发料任务');
} else {
let result = res.data.list[0];
if(result.acceptUserId&&result.acceptUserId!=this.$store.state.user.id){
if(result.acceptUserId&&result.acceptUserId!=store.id){
comMessageRef.value.showErrorMessage("任务号["+result.number+"]已经被["+result.acceptUserName+"]承接,无法执行", res => {
if (res) {
getList('refresh')

5
src/pages/purchaseReturn/job/returnDetailBatch.vue

@ -99,7 +99,8 @@
import { ref, onMounted } from 'vue';
import { onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh } from '@dcloudio/uni-app';
import {useCountStore} from '@/store'
const store = useCountStore();
const id = ref('');
const scanCount = ref(0);
const jobContent = ref({});
@ -334,7 +335,7 @@ const submitJob = () => {
const setParams = () => {
const subList = [];
const createTime = getCurrDateTime();
const creator = $store.state.user.id;
const creator = store.id;
detailSource.value.subList.forEach(r => {
if (r.scaned) {
const subItem = { ...r };

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

@ -91,7 +91,8 @@ import jobTop from '@/mycomponents/job/jobTop.vue'
import {ref, onMounted, onBeforeUnmount} from 'vue';
import {onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap} from '@dcloudio/uni-app';
import {useCountStore} from '@/store'
const store = useCountStore();
const id = ref('');
const scanCount = ref(0);
const jobContent = ref({});
@ -426,7 +427,7 @@ const submitJob = () => {
const setParams = () => {
const subList = [];
const creator = store.state.user.id;
const creator = store.id;
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {

Loading…
Cancel
Save