Browse Source

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

hella_vue3
王志国 3 weeks ago
parent
commit
11304e965d
  1. 158
      src/pages/scrap/coms/comScrapDetailCardBatch.vue
  2. 93
      src/pages/scrap/job/scrapJobDetail.vue
  3. 34
      src/pages/scrap/record/scrapRecord.vue
  4. 9
      src/pages/scrap/request/scrapRequestCreate.vue

158
src/pages/scrap/coms/comScrapDetailCardBatch.vue

@ -0,0 +1,158 @@
<template>
<view class="" style="background-color: #fff;">
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"></item-qty>
<view class='split_line'></view>
<view class="" v-for="(item,index) in dataContent.subList">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions">
<recommendBatch :detail="item"></recommendBatch>
</uni-swipe-action-item>
</uni-swipe-action>
<view class='split_line'></view>
</view>
<balance-qty-edit ref="qtyEdit" :settingParam="settingParam" @confirm="confirm"></balance-qty-edit>
<scrap-detail-info-popup ref="jobDetailPopup" :dataContent="showItem"></scrap-detail-info-popup>
<comMessage ref="message"></comMessage>
</view>
</template>
<script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendBatch from '@/mycomponents/recommend/recommendBatch.vue'
import jobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue'
import scrapDetailInfoPopup from '@/pages/scrap/coms/scrapDetailInfoPopup.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.vue'
import toLocation from '@/mycomponents/balance/toLocation.vue'
import batch from '@/mycomponents/balance/batch.vue'
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import config from '@/static/config.js'
import {
getRemoveOption,
getEditRemoveOption,
getDetailEditRemoveOption,
} from '@/common/array.js';
import {ref, watch, onMounted} from 'vue';
// props
const props = defineProps({
dataContent: {
type: Object,
default: () => ({})
},
settingParam: {
type: Object,
default: () => ({})
},
isEdit: {
type: Boolean,
default: true
}
});
const emit = defineEmits(['remove', 'updateData']);
const showItem = ref({});
const editItem = ref({
record: {}
});
const detailOptions = ref([]);
const scanOptions = ref([]);
const options = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
const qtyEdit = ref(null);
const jobDetailPopup = ref(null);
const message = ref(null);
onMounted(() => {
scanOptions.value = getDetailEditRemoveOption();
removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption();
});
const swipeClick = (e, item) => {
if (e.content.text == "详情") {
detail(item);
} else if (e.content.text == "编辑") {
edit(item);
} else if (e.content.text == "移除") {
remove(item);
}
};
const edit = (item) => {
editItem.value = item;
qtyEdit.value.openEditPopup(item.balance, item.handleQty);
};
const detail = (item) => {
showItem.value = item;
console.log("提交参数", JSON.stringify(item));
jobDetailPopup.value.openPopup(item);
};
const remove = (item) => {
message.value.showQuestionMessage("确定移除扫描信息?", res => {
if (res) {
item.scaned = false;
emit('remove', item);
}
});
};
const confirm = (qty) => {
editItem.value.handleQty = qty;
emit('updateData');
};
const isDevlement = () => {
return config.isDevelopment;
};
const copy = (detail) => {
console.log(detail);
const content = `HPQ;V1.0;I${detail.itemCode};P${detail.packingNumber};B${detail.batch};Q${detail.qty}`;
// #ifdef H5
navigator.clipboard.writeText(content).then(
() => {
uni.showToast({
title: '复制采购标签成功',
icon: 'none'
});
},
() => {
uni.showToast({
title: '复制失败',
icon: 'none'
});
}
);
// #endif
// #ifndef H5
uni.setClipboardData({
data: content,
success: () => {
uni.showToast({
title: '复制采购标签成功'
});
}
});
// #endif
};
</script>
<style>
</style>

93
src/pages/scrap/job/scrapJobDetail.vue

@ -14,7 +14,12 @@
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-scrap-detail-card :dataContent="item" :index="index" :settingParam="jobContent" @remove="updateData" @updateData="updateData"> </com-scrap-detail-card>
<comScrapDetailCardBatch :dataContent="item" :index="index" :settingParam="jobContent" @remove="updateData"
@updateData="updateData" v-if="managementType=='BY_BATCH'">
</comScrapDetailCardBatch>
<com-scrap-detail-card :dataContent="item" :index="index" :settingParam="jobContent"
@remove="updateData" @updateData="updateData" v-else>
</com-scrap-detail-card>
</view>
<view class="split_line"></view>
</view>
@ -51,6 +56,7 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comScrapDetailCard from '@/pages/scrap/coms/comScrapDetailCard.vue'
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import comScrapDetailCardBatch from '@/pages/scrap/coms/comScrapDetailCardBatch.vue'
import { useCountStore } from '@/store'
// store
const store = useCountStore()
@ -67,6 +73,9 @@ const businessTypeInfo = ref({})
const jobStatus = ref('')
const comMessageRef = ref()
const scanPopup = ref()
const managementType = ref('')
const jobStatus = ref('')
const fromLocationCode = ref('')
onLoad((option) => {
uni.setNavigationBarTitle({
title: `${option.title}详情`
@ -133,7 +142,7 @@ const receive = (callback) => {
const getDetail = () => {
proxy.$modal.loading('加载中...')
getScrapJobDetail(id.value)
.then((res) => {
.then(async (res) => {
uni.hideLoading()
if (res.data == null) {
showMessage('未获取到详情')
@ -141,7 +150,21 @@ const getDetail = () => {
jobContent.value = res.data
jobStatus.value = res.data.status
subList.value = res.data.subList
detailSource.value = getDataSource(subList.value)
detailSource.value = await getDataSource(subList.value)
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
fromLocationCode.value = subList.value[0].fromLocationCode
await getManagementPrecisions(itemCodes, fromLocationCode.value, res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
} else {
showMessage('列表数据为0')
}
@ -177,6 +200,7 @@ const getScanResult = (result) => {
const itemStatus = getInventoryStatusName(itemDetail.inventoryStatus)
if (itemDetail.inventoryStatus != result.balance.inventoryStatus) {
if (jobContent.value.allowModifyInventoryStatus == 'TRUE') {
scanPopupLoseFocus()
showQuestionMessage(`任务中允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,是否继续出库?`, (res) => {
if (res) {
itemDetail.scaned = true
@ -192,6 +216,7 @@ const getScanResult = (result) => {
}
})
} else {
scanPopupLoseFocus()
showQuestionMessage(`任务中不允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,不允许转移!`, (res) => {
scanPopupGetFocus()
})
@ -238,17 +263,42 @@ const commit = () => {
showErrorMessage('扫描数为0,请先扫描')
return
}
// //
if (scanCount.value == subList.value.length) {
checkCount();
} else if (scanCount.value < subList.value.length) {
//
if (jobContent.value.allowPartialComplete == "TRUE") {
//
checkCount();
} else {
//
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
openScanPopup();
}
});
}
}
}
const checkCount = ()=>{
//
let str = ''
detailSource.value.forEach((item) => {
item.subList.forEach(cur => {
if (cur.qty != cur.handleQty) {
let tempHandleQty
if (cur.handleQty) {
tempHandleQty = cur.handleQty
} else {
tempHandleQty = 0
}
str += `包装号【${cur.packingNumber}】提交数量【${cur.handleQty}】与任务物料数量【${cur.qty}】不一致`
}
})
})
if (str) {
str += ',是否确认提交?'
str = '任务明细未全部完成,是否提交?\n'+str
comMessageRef.value.showQuestionMessage1(str, 'red', res => {
if (res) {
submitJob()
@ -257,27 +307,18 @@ const commit = () => {
} else {
submitJob()
}
// //
// if (scanCount.value == subList.value.length) {
// submitJob()
// } else if (scanCount.value < subList.value.length) {
// //
// if (jobContent.value.allowPartialComplete == 'TRUE') {
// //
// submitJob()
// } else {
// //
// comMessageRef.value.showErrorMessage(',<br>' + `[${scanCount.value}][${subList.value.length}]`, (res) => {
// if (res) {
// openScanPopup()
// }
// })
// }
// }
}
const submitJob = () => {
const submitJob = async () => {
proxy.$modal.loading('提交中...')
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
await getManagementPrecisions(itemCodes, fromLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
//
const params = setParams()
scrapJobSubmit(params)
@ -294,6 +335,8 @@ const submitJob = () => {
showErrorMessage(error)
})
}
})
}
const setParams = () => {
const subList = []
@ -306,6 +349,10 @@ const setParams = () => {
detail.toInventoryStatus = ''
detail.toLocationCode = ''
detail.toBatch = detail.batch
let info = getPackingNumberAndBatch(managementList.value, detail.itemCode,detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber;
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber;
subList.push(detail)
}
})

34
src/pages/scrap/record/scrapRecord.vue

@ -10,14 +10,11 @@
class='uni-data-picker' placeholder="请选择原因" popup-title="选择报废原因" :localdata="reasonList"
@change="reasonChange">
</uni-data-picker> -->
<view class="choose-box1" style="background: white; flex: 1" @click="show = true">
<view class="choose-item1">
<view class="choose-text1"> {{ reasonText }}</view>
<u-icon name="arrow-down-fill" color="#b4b4b4" size="24"></u-icon>
<view class="" style="width: 75%;">
<u-input v-if="detailSource.length>0" v-model="reasonText" placeholder="请输入报废原因" maxlength='24'></u-input>
</view>
</view>
<u-select v-model="show" :list="reasonList" @confirm="reasonChange"></u-select>
</view>
<view class='split_line'></view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
@ -76,7 +73,6 @@ const outInventoryStatus = ref('') // 来源出库库存状态
const businessType = ref({})
const reasonList = ref([])
const reasonText = ref('请选择')
const reasonCode = ref('')
const comMessageRef = ref()
const scanPopup = ref()
const scanLocationCode = ref()
@ -130,13 +126,13 @@ const getScanResult = (result) => {
const newDetail = createDetailInfo(balance, pack)
item.subList.push(newDetail)
} else if (detail.scaned == true) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`)
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]重复扫描`)
}
}
handleCalcHandleQty()
}
const showErrorMessage = (message) => {
comMessageRef.value.showErrorMessage(scanResult.message, (res) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
}
})
@ -185,18 +181,13 @@ const scanPopupGetFocus = () => {
}
const commit = () => {
if (reasonText.value == '') {
showErrorMessage('请先选择报废原因')
return
}
proxy.$modal.loading('提交中....')
const params = setParams()
scrapRecordSubmit(params)
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成报废出库记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成报废出库记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -233,7 +224,7 @@ const setParams = () => {
submitItem.fromLocationCode = detail.locationCode
submitItem.toLocationCode = ''
submitItem.reason = reasonCode.value
submitItem.reason = reasonText.value
submitItem.qty = detail.handleQty
submitItem.package = ''
subList.push(submitItem)
@ -287,17 +278,6 @@ const updateData = () => {
}
}
}
const reasonChange = (e) => {
console.log(e)
if (e.length == 0) {
reasonCode.value = ''
reasonText.value = ''
} else {
reasonCode.value = e[0].value
reasonText.value = e[0].label
}
}
</script>
<style scoped lang="scss">

9
src/pages/scrap/request/scrapRequestCreate.vue

@ -125,6 +125,7 @@ const getScanResult = (result) => {
const newDetail = createDetailInfo(balance, pack) //
itemp.subList.push(newDetail)
detailSource.value.push(itemp)
scanPopupGetFocus()
} else {
const detail = item.subList.find((r) => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
@ -134,8 +135,9 @@ const getScanResult = (result) => {
if (detail == undefined) {
const newDetail = createDetailInfo(balance, pack)
item.subList.push(newDetail)
scanPopupGetFocus()
} else if (detail.scaned == true) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`)
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]重复扫描`)
}
}
handleCalcHandleQty()
@ -179,7 +181,7 @@ const closeScanPopup = () => {
const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.getfocus()
scanPopup.value.packGetFocus()
}
}
@ -201,7 +203,7 @@ const commit = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成报废出库申请<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成报废出库申请\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@ -238,6 +240,7 @@ const showMessage = (message) => {
const showErrorMessage = (message) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
scanPopupGetFocus()
}
})
}

Loading…
Cancel
Save