Commit 45a7a329 by linjinhong

feat:【工厂端】POD订单(CN)中CB和G类商品的拣胚流程优化,方便拣胚人员提前拣胚#1002186

parent 3f47eaaf
...@@ -790,3 +790,11 @@ export function updateProductOutOfStockApi(params: { ...@@ -790,3 +790,11 @@ export function updateProductOutOfStockApi(params: {
params, params,
) )
} }
// 打印普胚生产单
export function printNormalProducePdf(orderIds: number[]) {
return axios.post<never, BaseRespData<string>>(
'factory/podJomallOrderProductCn/printNormalProducePdf',
orderIds,
)
}
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, ref, watch, defineProps, defineEmits } from 'vue' import { computed, nextTick, ref, watch } from 'vue'
import useLodop from '@/utils/hooks/useLodop' import useLodop from '@/utils/hooks/useLodop'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { OrderData, ProductList, IorderItem } from '@/types/api/podMakeOrder' import { OrderData, ProductList, IorderItem } from '@/types/api/podMakeOrder'
...@@ -499,14 +499,12 @@ async function barcodeInput() { ...@@ -499,14 +499,12 @@ async function barcodeInput() {
console.log('pending', pending) console.log('pending', pending)
await submitInspection(pending, async () => { await submitInspection(pending, async () => {
await inputActive()
await getPackingData(code)
noObj.value = {} noObj.value = {}
}) })
} else {
await inputActive()
await getPackingData(code)
} }
await inputActive()
await getPackingData(code)
isLock.value = false isLock.value = false
} }
async function submitInspection(objs?: OrderData, callback?: () => void) { async function submitInspection(objs?: OrderData, callback?: () => void) {
...@@ -525,12 +523,10 @@ async function submitInspection(objs?: OrderData, callback?: () => void) { ...@@ -525,12 +523,10 @@ async function submitInspection(objs?: OrderData, callback?: () => void) {
ElMessage.success(res.message) ElMessage.success(res.message)
coverImage.value = '' coverImage.value = ''
testingData.value = {} testingData.value = {}
await inputActive()
isLock.value = false isLock.value = false
callback?.() callback?.()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
await inputActive()
isLock.value = false isLock.value = false
} }
} }
...@@ -591,7 +587,7 @@ async function getPackingData(code: string) { ...@@ -591,7 +587,7 @@ async function getPackingData(code: string) {
async function printFile(data: OrderData) { async function printFile(data: OrderData) {
// await props.printOrderOne(data) // await props.printOrderOne(data)
await printOrderOne(data) await printOrderOne(data)
noObj.value[data.id!] = data noObj.value[data.id as number] = data
await inputActive() await inputActive()
} }
function printOrderOne(item: OrderData): Promise<void> { function printOrderOne(item: OrderData): Promise<void> {
......
...@@ -879,6 +879,11 @@ ...@@ -879,6 +879,11 @@
<span v-if="['WAIT_SHIPMENT'].includes(status)" class="item"> <span v-if="['WAIT_SHIPMENT'].includes(status)" class="item">
<ElButton type="primary" @click="printNormal"> 普货拣货 </ElButton> <ElButton type="primary" @click="printNormal"> 普货拣货 </ElButton>
</span> </span>
<span v-if="['WAIT_SHIPMENT'].includes(status)" class="item">
<ElButton type="primary" @click="printNormalProductionOrder">
打印普胚生产单
</ElButton>
</span>
<span <span
v-if=" v-if="
status === 'STOCK_OUT' || status === 'STOCK_OUT' ||
...@@ -1829,7 +1834,9 @@ ...@@ -1829,7 +1834,9 @@
> >
<span class="operate-item"> <span class="operate-item">
<ElButton <ElButton
:disabled="!row.url && !row.tiffUrl" :disabled="
(!row.url && !row.tiffUrl) || row.enableArrange === false
"
link link
type="primary" type="primary"
@click="handleDownload(row)" @click="handleDownload(row)"
...@@ -1853,7 +1860,7 @@ ...@@ -1853,7 +1860,7 @@
type="primary" type="primary"
@click="printPickingOrderItem(row, 1)" @click="printPickingOrderItem(row, 1)"
> >
打印拣货单 拣货单
</ElButton> </ElButton>
</span> </span>
<span class="operate-item"> <span class="operate-item">
...@@ -1862,19 +1869,19 @@ ...@@ -1862,19 +1869,19 @@
type="primary" type="primary"
@click="printPickingOrderItem(row, 2)" @click="printPickingOrderItem(row, 2)"
> >
打印生产单 生产单
</ElButton> </ElButton>
</span> </span>
<span class="operate-item"> <span class="operate-item">
<ElButton <ElButton
:disabled="row.productNum > 50" :disabled="row.productNum > 50 || row.enableArrange === false"
link link
type="warning" type="warning"
:loading="reComposingLoadingMap[row.id]" :loading="reComposingLoadingMap[row.id]"
@click="showArrange(1, row)" @click="showArrange(1, row)"
> >
新排版
</ElButton> </ElButton>
</span> </span>
<span class="operate-item"> <span class="operate-item">
...@@ -2105,6 +2112,16 @@ ...@@ -2105,6 +2112,16 @@
</template> </template>
<template #operations> <template #operations>
<div <div
v-if="
cardItem?.productMark &&
(status == 'TO_BE_ARRANGE' || status == 'PICKING')
"
class="customizedQuantity"
:title="`类型:${getProductMarkt(cardItem?.productMark)}面`"
>
{{ getProductMarkt(cardItem?.productMark) }}
</div>
<div
v-if="cardItem?.customizedQuantity" v-if="cardItem?.customizedQuantity"
class="customizedQuantity" class="customizedQuantity"
:title="`类型:${getQuantityText( :title="`类型:${getQuantityText(
...@@ -2880,6 +2897,7 @@ import { ...@@ -2880,6 +2897,7 @@ import {
batchDownloadRecomposingApi, batchDownloadRecomposingApi,
getCustomTagListCnApi, getCustomTagListCnApi,
printNormalPdf, printNormalPdf,
printNormalProducePdf,
changeLogisticsApi, changeLogisticsApi,
getEmployeeListApi, getEmployeeListApi,
allErpCodeListApi, allErpCodeListApi,
...@@ -3327,6 +3345,42 @@ const printNormal = async () => { ...@@ -3327,6 +3345,42 @@ const printNormal = async () => {
window.open(filePath + res.message) window.open(filePath + res.message)
} }
const printNormalProductionOrder = async () => {
const orderIds: number[] = []
if (!selection.value.length) {
return ElMessage.warning('请选择订单')
}
selection.value.forEach((s) => {
s.productList &&
s.productList.forEach((p) => {
if (p.productMark === 'normal' || p.productMark === 'custom_normal') {
orderIds.push(p.id)
}
})
})
if (!orderIds.length) {
ElMessage.warning('暂无可打印的普胚生产单')
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await printNormalProducePdf(orderIds)
if (res.code !== 200) return
ElMessage.success('操作成功')
window.open(filePath + res.message)
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const completeDelivery = async () => { const completeDelivery = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择订单') return ElMessage.warning('请选择订单')
...@@ -3835,7 +3889,7 @@ const tableColumns = computed(() => { ...@@ -3835,7 +3889,7 @@ const tableColumns = computed(() => {
{ {
label: '操作', label: '操作',
slot: 'operate', slot: 'operate',
width: 350, width: 260,
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
prop: 'operate', prop: 'operate',
...@@ -4830,7 +4884,33 @@ const showArrange = async (type: number, data?: PodCnOrderListData) => { ...@@ -4830,7 +4884,33 @@ const showArrange = async (type: number, data?: PodCnOrderListData) => {
if (type === 1 || type === 3) { if (type === 1 || type === 3) {
typesettingRow.value = data typesettingRow.value = data
} else if (type === 2) { } else if (type === 2) {
const ALLOWED_PRODUCT_MARKS = ['custom_normal', 'normal']
const selectedIds = cardSelection.value.map((item) => item.id) const selectedIds = cardSelection.value.map((item) => item.id)
const isProductMark = cardSelection.value.find((item) =>
ALLOWED_PRODUCT_MARKS.includes(item.productMark as string),
)
if (isProductMark) {
const bool = cardSelection.value.every((item) =>
ALLOWED_PRODUCT_MARKS.includes(item.productMark as string),
)
if (!bool) {
return await ElMessageBox.confirm(
'无法排单,你选择的生产单包含多种商品类型,排单不支持多种商品类型混排,请选择同一类型的商品对应的生产单后再试!',
'错误提示',
{
confirmButtonText: '确定',
type: 'warning',
},
)
} else {
await ElMessageBox.confirm('确认对所选择的生产单进行排单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
return arrangeFinish()
}
}
if (selectedIds.length === 0) { if (selectedIds.length === 0) {
return ElMessage({ return ElMessage({
...@@ -5815,6 +5895,12 @@ function getQuantityText(qty: number) { ...@@ -5815,6 +5895,12 @@ function getQuantityText(qty: number) {
if (!qty || qty <= 0) return '' if (!qty || qty <= 0) return ''
return Math.floor(qty) === 1 ? '单' : '多' return Math.floor(qty) === 1 ? '单' : '多'
} }
function getProductMarkt(productMark: string) {
if (!productMark) return ''
if (productMark === 'custom_normal') return 'CB'
if (productMark === 'normal') return 'G'
return ''
}
const handleMark = (mark: string) => { const handleMark = (mark: string) => {
switch (mark) { switch (mark) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment