Browse Source

page/productionReceipt 文件迁移 8/8-10/25

pull/1/head
test 4 months ago
parent
commit
4a10ab1e6e
  1. 2
      src/pages/productionReceipt/coms/comProductionJobCard.vue
  2. 65
      src/pages/productionReceipt/job/productionReceiptDetail.vue
  3. 444
      src/pages/productionReceipt/job/productionReceiptJob.vue
  4. 14
      src/pages/productionReceipt/record/productionReceiptRecord.vue

2
src/pages/productionReceipt/coms/comProductionJobCard.vue

@ -1,7 +1,7 @@
<template>
<job-com-main-card :dataContent="dataContent">
<jobComMainDetailCard :dataContent="dataContent"></jobComMainDetailCard>
<view class="task_item" style="margin-left: 15px">
<view class="task_item" style="margin-left: 20px">
<view class="task_text">
<view class="card_view">
<text class="card_packing_code">生产线</text>

65
src/pages/productionReceipt/job/productionReceiptDetail.vue

@ -12,7 +12,11 @@
<scroll-view scroll-y="true">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-detail-card :dataContent="item" :index="index" :settingParam="jobContent" @remove="updateData" @updateData="updateData" @openDetail="openDetail" :locationAreaTypeList="toLocationAreaTypeList"> </com-detail-card>
<comDetailCardBatch :dataContent="item" :index="index" :settingParam="jobContent"
@remove="updateData" @updateData="updateData" @openDetail="openDetail"
:locationAreaTypeList='toLocationAreaTypeList'>
</comDetailCardBatch>
<!-- <com-detail-card :dataContent="item" :index="index" :settingParam="jobContent" @remove="updateData" @updateData="updateData" @openDetail="openDetail" :locationAreaTypeList="toLocationAreaTypeList"> </com-detail-card>-->
<view class="split_line"></view>
</view>
</view>
@ -25,7 +29,7 @@
<locationCompare ref="comScanLocation" title="目标库位" :recommendLocationCode="jobToLocationCode" :locationCode="toLocationCode" :isShowEdit="isCheckLocation" @getLocation="scanLocationCode" :locationAreaTypeList="toLocationAreaTypeList"></locationCompare>
</view>
<view class="uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
<button class="btn_single_commit" hover-class="btn_commit_after" @click="autoCommit">提交</button>
</view>
</view>
</view>
@ -52,7 +56,7 @@ import { getLocationTypeArray } from '@/common/array.js'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue'
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue'
import comDetailCardBatch from "@/mycomponents/detail/comDetailCardBatch.vue"
import comDetailCard from '@/mycomponents/detail/comDetailCard.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
@ -168,10 +172,44 @@ const getDetail = () => {
showErrorMessage(error)
})
}
const handleCalcHandleQty = () => {
const calcHandleQtyFun = () => {
calcHandleQty(detailSource.value)
continueScan()
}
const autoCommit = ()=>{
//
let str=""
detailSource.value.forEach((item) => {
item.subList.forEach(cur => {
if (cur.qty != cur.handleQty) {
let tempHandleQty = 0
if(cur.handleQty){
tempHandleQty=cur.handleQty
}else {
tempHandleQty =0
}
str += `包装号【${cur.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致\n`
}
})
})
if (str) {
str = '任务明细未全部完成,是否提交?\n'+str
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
setTimeout(res=>{
proxy.$throttle(commit,2000,proxy)()
},100)
}
});
} else {
setTimeout(res=>{
proxy.$throttle(commit,2000,proxy)()
},100)
}
}
const continueScan = () => {
scanCount.value = getScanCount(subList.value)
if (scanCount.value == subList.value.length) {
@ -181,7 +219,7 @@ const continueScan = () => {
}
}
const updateData = () => {
handleCalcHandleQty()
calcHandleQtyFun()
}
const openDetail = (item) => {
detailInfoPopupRef.value.openPopup(item)
@ -272,7 +310,8 @@ const getScanResult = (result) => {
itemDetail.balance.balanceQty = Number(result.balance.qty)
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
handleCalcHandleQty()
calcHandleQtyFun()
autoCommit()
} else {
scanPopupGetFocus()
}
@ -291,7 +330,8 @@ const getScanResult = (result) => {
itemDetail.balance.balanceQty = Number(result.balance.qty)
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
handleCalcHandleQty()
calcHandleQtyFun()
autoCommit()
}
}
}
@ -317,10 +357,15 @@ const commit = () => {
//
if (jobContent.value.allowPartialComplete == 'TRUE') {
//
submitJob()
comMessageRef.value.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
if (res) {
console.log("提交this.submitJob()")
submitJob()
}
});
} else {
//
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交<br>' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => {
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交\n' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => {
openScanPopup()
})
}
@ -352,7 +397,7 @@ const submitJob = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成发料接收记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成发料接收记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

444
src/pages/productionReceipt/job/productionReceiptJob.vue

@ -1,37 +1,69 @@
<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" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask" :isShowProductionLineCode="true" @productionLineCode="productionLineCode"
:productionline="productionLineList">
<view class="uni-flex" style="flex-direction: column;">
<job-filter ref="filter" otherTitle="ASN" :isShowProductionLineCode="false" :isShowItemCode="false"
:isShowQurery='true' @onQuery="getListByFilter">
</job-filter>
<view style="background-color: #fff; padding-left: 20rpx; border-radius: 15rpx;">
<view class="uni-flex space-between u-col-center" style="width: 100%;padding-top: 20rpx;">
<view class="" style="font-size: 32rpx; font-weight: bold;">
收料生产线 :
</view>
<uni-data-select class="uni-data-select" style="margin-left: 10rpx;" placeholder="请输入生产线"
v-model="productionLineCode" :clear="false" :localdata="productionLineList"
@change="productionLineCodeConfirm"></uni-data-select>
</view>
<view class="uni-flex space-between u-col-center" style="width: 100%;margin-top: 30rpx;">
<view class="" style="font-size: 32rpx;font-weight: bold;">
物料代码 :
</view>
<u-input style="margin-left: 20rpx;" confirmType="search" v-model="filterItemCode" :border="true"
placeholder="请输入物料代码" @confirm="itemCodeConfirm"/>
</view>
</view>
<com-empty-view v-if="jobList.length==0"></com-empty-view>
<view v-if="jobList.length > 0" class="u-m-20">
<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in jobList" :key="index" :options="item.status == '2' ? detailGiveupOptions : detailOptions" bg-color="rgba(255,255,255,0)" class="u-m-b-20" @click="swipeClick">
<com-production-job-card :dataContent="item" @click="openJobDetail(item)"> </com-production-job-card>
<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in jobList" :key="index"
:options="item.status == '2' ? detailGiveupOptions : detailOptions" bg-color="rgba(255,255,255,0)"
class="u-m-b-20" @click="swipeClick">
<com-production-job-card :dataContent="item" @click="openJobDetail(item)"></com-production-job-card>
</u-swipe-action>
<job-list-popup ref="jobListPopupRef" @selectedItem="selectedItem"></job-list-popup>
<job-info-popup ref="jobInfoPopupRef"></job-info-popup>
<u-loadmore :status="loadingType" />
<u-loadmore :status="loadingType"/>
</view>
<win-scan-button @goScan="openScanPopup" v-if="jobList.length > 0"></win-scan-button>
<winScanPackJob ref="scanPopup" @getResult="getScanResult"></winScanPackJob>
<jobList ref="jobListRef" @selectItem="selectItem"></jobList>
<com-message ref="comMessageRef" />
<com-message ref="comMessageRef"/>
</view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { getProductionReceiptJobList, cancleTakeProductionReceiptJob, getProductionReceiptJobByProductionline } from '@/api/request2.js'
import { goHome, updateTitle } from '@/common/basic.js'
import {ref, getCurrentInstance, nextTick} from 'vue'
import {
onLoad,
onShow,
onNavigationBarButtonTap,
onReady,
onBackPress,
onReachBottom,
onPullDownRefresh
} from '@dcloudio/uni-app'
import {
getProductionReceiptJobList,
cancleTakeProductionReceiptJob,
getProductionReceiptJobByProductionline
} from '@/api/request2.js'
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'
import {goHome, updateTitle} from '@/common/basic.js'
import {getDetailOption, getDetailGiveupOption} from '@/common/array.js'
import {
planRefreshTime,
productionReceiptJobFilter
} from '@/common/config.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
@ -42,11 +74,11 @@ import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackJob from '@/mycomponents/scan/winScanPackJob.vue'
import jobList from '@/mycomponents/jobList/jobList.vue'
import { useCountStore } from '@/store'
import {useCountStore} from '@/store'
// store
const store = useCountStore()
const { proxy } = getCurrentInstance()
const {proxy} = getCurrentInstance()
const jobList = ref([])
const pageNo = ref(1)
const pageSize = ref(10)
@ -67,14 +99,20 @@ const comMessageRef = ref()
const jobInfoPopupRef = ref()
const jobListPopupRef = ref()
const jobListRef = ref()
const filterItemCode = ref('')
const productionLineCode = ref('')
const scanPopup = ref(null)
onShow(() => {
nextTick(() => {
getList('refresh', productionLine.value)
})
if (productionLineList.value == 0) {
getProductionReceiptJobByProductionline()
} else {
nextTick(() => {
getList('refresh', productionLine.value)
})
}
})
onLoad((option) => {
title.value = option.title
getProductionReceiptJobByProductionline()
})
onReady(() => {
detailOptions.value = getDetailOption()
@ -85,10 +123,10 @@ onReachBottom(() => {
if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
return
}
getList('more', productionLine.value)
getList('more')
})
onPullDownRefresh(() => {
getList('refresh', productionLine.value)
getList('refresh')
})
// 退
onBackPress((options) => {
@ -104,30 +142,110 @@ onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
} else if (e.index == 1) {
filter.value.openFilter()
filter.value.openFilterParams(uni.getStorageSync(productionReceiptJobFilter));
}
})
const productionLineCode = (productionLineCode) => {
productionLine.value = productionLineCode
getList('refresh', productionLine.value)
const productionLineCodeConfirm = (productionLineCode) => {
var params = uni.getStorageSync(productionReceiptJobFilter)
productionLineCode.value = e;
//
if (!params) {
params = {
productionLineCode: "",
itemCode: ""
}
}
getListByFilter(params)
}
const getProductionReceiptJobByProductionline = () => {
uni.showLoading({
title: "获取生产线",
mask: true
})
getProductionReceiptJobByProductionline().then((res) => {
uni.hideLoading()
console.log('生产线', res)
if (res.code == 0) {
productionLineList.value = res.data.map((item) => ({
value: item.value,
text: item.name
}))
productionLineList.value.unshift({
value: '',
text: '全部'
if (res.data && res.data.length > 0) {
productionLineList.value = res.data;
res.data.forEach(item => {
item.value = item.value,
item.text = item.value + "(" + item.name + ")"
})
productionLineList.value = res.data
productionLineCode.value = this.productionLineList[0].value
} else {
productionLineList = []
productionLineList.value = []
}
getList('refresh')
}).catch(error => {
uni.hideLoading()
showMessage(error)
getList('refresh')
})
}
const setQueryParam = () => {
let filterParams = []
let queryParams = uni.getStorageSync(productionReceiptJobFilter)
//
if (queryParams.creationTime) {
filterParams.push({
column: "create_time",
action: "betweeen",
value: queryParams.creationTime
})
}
//
if (queryParams.status) {
filterParams.push({
column: "status",
action: "in",
value: queryParams.status
})
} else {
filterParams.push({
column: "status",
action: "in",
value: "1,2"
})
}
//线
if (queryParams.productionLineCode) {
filterParams.push({
column: "productionLineCode",
action: "==",
value: queryParams.productionLineCode
})
productionLineCode.value = queryParams.productionLineCode
} else {
if (this.productionLineCode) {
filterParams.push({
column: "productionLineCode",
action: "==",
value: productionLineCode.value
})
}
}
//
if (queryParams.itemCode) {
filterParams.push({
column: "itemCode",
action: "like",
value: queryParams.itemCode
})
filterItemCode.value = queryParams.itemCode
} else {
if (this.filterItemCode) {
filterParams.push({
column: "itemCode",
action: "like",
value: filterItemCode.value
})
}
}
return filterParams;
}
const getList = (type, productionLine = '') => {
proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
@ -135,66 +253,40 @@ const getList = (type, productionLine = '') => {
pageNo.value = 1
jobList.value = []
}
let queryFiltersParams = this.setQueryParam()
const filters = []
if (checkedToday.value) {
filters.push({
column: 'create_time',
action: 'betweeen',
value: todayTime.value
})
}
filters.push({
column: 'status',
action: 'in',
value: status.value
})
filters.push({
column: 'accept_user_id',
action: '==',
value: store.id
})
if (productionLine) {
// 线
filters.push({
column: 'productionLineCode',
action: '==',
value: productionLine
})
}
const params = {
filters,
filters: queryFiltersParams,
pageNo: pageNo.value,
pageSize: pageSize.value
}
getProductionReceiptJobList(params)
.then((res) => {
uni.hideLoading()
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
.then((res) => {
uni.hideLoading()
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
const { list } = res.data
totalCount.value = res.data.total
updateTitle(`${title.value}(${totalCount.value})`)
loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
}
jobList.value = type === 'refresh' ? list : jobList.value.concat(list)
pageNo.value++
})
.catch((error) => {
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
loadingType.value = ''
updateTitle(title.value)
uni.hideLoading()
showErrorMessage(error)
})
const {list} = res.data
totalCount.value = res.data.total
updateTitle(`${title.value}(${totalCount.value})`)
loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
}
jobList.value = type === 'refresh' ? list : jobList.value.concat(list)
pageNo.value++
})
.catch((error) => {
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
loadingType.value = ''
updateTitle(title.value)
uni.hideLoading()
showErrorMessage(error)
})
}
const openJobDetail = (item, scanMessage = '') => {
proxy.$tab.navigateTo(`./productionReceiptDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage}&title=${title.value}`)
@ -232,73 +324,30 @@ const openjobInfoPopup = (item) => {
}
const cancleJob = (id) => {
cancleTakeProductionReceiptJob(id)
.then((res) => {
if (res.data) {
getList('refresh', productionLine.value)
uni.showToast({
title: '放弃任务成功'
})
} else {
showMessage('放弃任务失败')
}
})
.catch((error) => {
showMessage(error)
})
}
const switchChangeToday = (state, creationTime) => {
checkedToday.value = state
todayTime.value = creationTime
getList('refresh', productionLine.value)
}
const switchChangeWait = (state, jobStatus) => {
checkedWaitTask.value = state
status.value = jobStatus
getList('refresh', productionLine.value)
}
const getScanNumber = (code) => {
getDataListByType(code)
}
const getDataListByType = (code) => {
proxy.$modal.loading('加载中­....')
const filters = []
filters.push({
column: 'status',
action: 'in',
value: '1,2'
})
filters.push({
column: 'number',
action: '==',
value: code
})
filters.push({
column: 'accept_user_id',
action: '==',
value: store.id
})
const params = {
filters,
pageNo: 1,
pageSize: 100
}
getProductionReceiptJobList(params)
.then((res) => {
uni.hideLoading()
if (res.data.list.length == 0) {
showMessage('未查找到' + `${code}】的收货任务`)
} else if (res.data.list.length == 1) {
openJobDetail(res.data.list[0])
}
})
.catch((error) => {
uni.hideLoading()
showMessage(error)
})
.then((res) => {
if (res.data) {
getList('refresh', productionLine.value)
uni.showToast({
title: '放弃任务成功'
})
} else {
showMessage('放弃任务失败')
}
})
.catch((error) => {
showMessage(error)
})
}
const showMessage = (message) => {
if (scanPopup.value) {
scanPopup.value.packLoseFocus()
}
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
if (scanPopup.value) {
scanPopup.value.packGetFocus()
}
}
})
}
@ -321,6 +370,11 @@ const getScanResult = (result) => {
action: "in",
value: result.package.number + "," + result.package.parentNumber
},
{
column: "status",
action: "in",
value: '1,2'
},
{
column: 'batch',
action: '==',
@ -337,41 +391,79 @@ const getScanResult = (result) => {
value: store.id
}
]
if (productionLineCode.value) {
filters.push({
column: "productionLineCode",
action: "==",
value: productionLineCode.value
})
}
getProductionReceiptJobList({
filters,
pageNo: 1,
pageSize: 100
})
.then((res) => {
scanMessage.value = result.scanMessage
const resultList = res.data.list
if (resultList.length > 0) {
resultList.forEach((item) => {
item.title = item.number
item.selected = false
})
const list = []
resultList.forEach((item) => {
if (!list.find((subItem) => subItem.title == item.title)) {
list.push(item)
.then((res) => {
scanMessage.value = result.scanMessage
const resultList = res.data.list
if (resultList.length > 0) {
resultList.forEach((item) => {
item.title = item.number
item.selected = false
})
const list = []
resultList.forEach((item) => {
if (!list.find((subItem) => subItem.title == item.title)) {
list.push(item)
}
})
if (list.length > 1) {
jobListRef.value.openList(list)
} else {
selectItem(list[0])
}
})
if (list.length > 1) {
jobListRef.value.openList(list)
} else {
selectItem(list[0])
showMessage('未查找到任务\n' + `扫描[${result.scanMessage}]`)
}
} else {
showMessage('未查找到任务<br>' + `扫描[${result.scanMessage}]`)
}
})
.catch((error) => {
showMessage(`${error}<br>扫描[${result.scanMessage}]`)
})
})
.catch((error) => {
showMessage(`${error}\n扫描[${result.scanMessage}]`)
})
} catch (e) {
showMessage(e.message)
}
}
const getListByFilter = (params) => {
params.productionLineCode = productionLineCode.value
params.itemCode = filterItemCode.value
uni.setStorageSync(productionReceiptJobFilter, params)
let test = uni.getStorageSync(productionReceiptJobFilter)
getList('refresh')
}
const productionLineCodeConfirm = (e) => {
let params = uni.getStorageSync(productionReceiptJobFilter)
productionLineCode.value = e;
//
if (!params) {
params = {
productionLineCode: "",
itemCode: ""
}
}
getListByFilter(params)
}
const itemCodeConfirm = (itemCode) => {
let params = uni.getStorageSync(productionReceiptJobFilter)
filterItemCode.value = itemCode;
//
if (!params) {
params = {
productionLineCode: "",
itemCode: ""
}
}
getListByFilter(params)
}
</script>
<style scoped lang="scss"></style>

14
src/pages/productionReceipt/record/productionReceiptRecord.vue

@ -155,7 +155,7 @@
item.subList.push(newDetail);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中")
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]重复扫描")
}
}
}
@ -171,9 +171,6 @@
});
},
updateData() {
calcHandleQty(this.detailSource);
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
@ -237,7 +234,7 @@
// productionReceiptRecordSubmit(params).then(res => {
// uni.hideLoading()
// if (res.data) {
// this.showCommitSuccessMessage("<br>" + res.data, )
// this.showCommitSuccessMessage("\n" + res.data, )
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
@ -269,13 +266,6 @@
if (res) {}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);

Loading…
Cancel
Save