Commit 4da4545d by wusiyi

feat: 订单添加质检流程 #1009863

parent 262558ab
...@@ -591,6 +591,16 @@ export function getByOperationNoLogApi(operationNo: string) { ...@@ -591,6 +591,16 @@ export function getByOperationNoLogApi(operationNo: string) {
) )
} }
// 快捷质检 查询
export function getQualityScanByOperationNoApi(operationNo: string) {
return axios.get<never, BaseRespData<operateOrderListData>>(
'factory/podOrderOperation/qualityByOperationNo',
{
params: { operationNo },
},
)
}
// 校验库存 // 校验库存
export function checkInventoryApi(id: number | string, status: string) { export function checkInventoryApi(id: number | string, status: string) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
......
...@@ -313,6 +313,7 @@ export interface QualityParams { ...@@ -313,6 +313,7 @@ export interface QualityParams {
qualityIssues: string qualityIssues: string
qualify_problem_type: number | string qualify_problem_type: number | string
qualityPassed: boolean qualityPassed: boolean
source?: number // 0 列表页,1 快捷质检
} }
/** 质检不通过原因 */ /** 质检不通过原因 */
......
...@@ -46,9 +46,12 @@ ...@@ -46,9 +46,12 @@
<div class="right"> <div class="right">
<div <div
v-if=" v-if="
['fastProduction', 'fastReceipt', 'productionScan'].includes( [
fastKey, 'fastProduction',
) 'fastReceipt',
'productionScan',
'qualityScan',
].includes(fastKey)
" "
class="input" class="input"
> >
...@@ -59,13 +62,44 @@ ...@@ -59,13 +62,44 @@
style="width: 660px; margin-right: 10px" style="width: 660px; margin-right: 10px"
clearable clearable
@keydown.enter="trackCodeInput()" @keydown.enter="trackCodeInput()"
></el-input> />
<el-button type="primary" @click="trackCodeInput()"> <el-button type="primary" @click="trackCodeInput()">
查询 查询
</el-button> </el-button>
</div> </div>
<div v-if="fastKey === 'qualityScan'" class="input">
<el-select
v-model="printDevice"
placeholder="请选择打印机"
clearable
filterable
@change="handlePrinterChange"
>
<el-option
v-for="(item, i) in printList"
:key="i"
:label="item"
:value="item"
></el-option>
</el-select>
<el-button
style="margin-left: 5px"
type="primary"
@click="printPdf"
>
打印操作单
</el-button>
<el-checkbox
v-model="isPrint"
:disabled="!printDevice"
style="margin-left: 10px"
>
自动打印
</el-checkbox>
</div>
<div class="div-text"> <div class="div-text">
<div class="div-content"> <div v-if="fastKey !== 'qualityScan'" class="div-content">
<div :title="String(detail?.userMark)" class="div-item"> <div :title="String(detail?.userMark)" class="div-item">
<span class="div-item-label" style="font-size: 18px" <span class="div-item-label" style="font-size: 18px"
>客户:</span >客户:</span
...@@ -97,8 +131,8 @@ ...@@ -97,8 +131,8 @@
</div> </div>
</div> </div>
<div class="div-text"> <div class="div-text">
<b v-if="!showOperationNoRow">生产单信息</b> <b v-if="showOperationNoRow">操作单信息</b>
<b v-else>操作单信息</b> <b v-else>生产单信息</b>
<div class="div-content"> <div class="div-content">
<div <div
v-if="showOperationNoRow" v-if="showOperationNoRow"
...@@ -106,7 +140,18 @@ ...@@ -106,7 +140,18 @@
class="div-item" class="div-item"
> >
<span class="div-item-label">操作单号:</span> <span class="div-item-label">操作单号:</span>
<div class="div-item-value">{{ operationNoDisplay }}</div> <div class="div-item-value with-copy">
<span class="div-item-value-text">{{
operationNoDisplay
}}</span>
<el-icon
v-if="operationNoDisplay"
class="copy-icon"
@click="copy(operationNoDisplay)"
>
<DocumentCopy />
</el-icon>
</div>
</div> </div>
<div <div
v-else v-else
...@@ -119,16 +164,32 @@ ...@@ -119,16 +164,32 @@
</div> </div>
</div> </div>
<div <div
v-if="fastKey === 'fastReceipt'" v-if="fastKey !== 'fastReceipt'"
:title="setProductMark(String(detail.productMark))" :title="detail?.shopNumber ?? ''"
class="div-item" class="div-item"
> >
<span class="div-item-label">类型:</span> <span class="div-item-label">店铺单号:</span>
<div class="div-item-value with-copy">
<span class="div-item-value-text">{{
detail?.shopNumber ?? ''
}}</span>
<el-icon
v-if="detail?.shopNumber"
class="copy-icon"
@click="copy(String(detail.shopNumber))"
>
<DocumentCopy />
</el-icon>
</div>
</div>
<div <div
class="div-item-value" v-if="fastKey === 'qualityScan'"
style="font-weight: bold; color: red" :title="String(detail?.batchArrangeNumber) || ''"
class="div-item"
> >
{{ setProductMark(String(detail.productMark)) }} <span class="div-item-label">批次号:</span>
<div class="div-item-value">
{{ detail?.batchArrangeNumber }}
</div> </div>
</div> </div>
<div <div
...@@ -137,7 +198,9 @@ ...@@ -137,7 +198,9 @@
class="div-item" class="div-item"
> >
<span class="div-item-label">商品名称:</span> <span class="div-item-label">商品名称:</span>
<div class="div-item-value">{{ detail.productName || '' }}</div> <div class="div-item-value">
{{ detail.productName || '' }}
</div>
</div> </div>
<div <div
v-if="fastKey === 'fastReceipt'" v-if="fastKey === 'fastReceipt'"
...@@ -176,20 +239,27 @@ ...@@ -176,20 +239,27 @@
</div> </div>
</div> </div>
<div <div
v-if="fastKey !== 'fastReceipt'" v-if="fastKey !== 'fastReceipt' && fastKey !== 'qualityScan'"
:title="detail?.baseSku" :title="detail?.baseSku"
class="div-item" class="div-item"
> >
<span class="div-item-label">基版:</span> <span class="div-item-label">基版:</span>
<div class="div-item-value">{{ detail?.baseSku }}</div> <div class="div-item-value">{{ detail?.baseSku }}</div>
</div> </div>
<div
<div :title="detail?.variantSku" class="div-item"> v-if="fastKey === 'qualityScan'"
:title="detail?.baseSku"
class="div-item"
>
<span class="div-item-label">库存SKU:</span>
<div class="div-item-value">{{ detail?.baseSku }}</div>
</div>
<div v-else :title="detail?.variantSku" class="div-item">
<span class="div-item-label">变体SKU:</span> <span class="div-item-label">变体SKU:</span>
<div class="div-item-value">{{ detail?.variantSku }}</div> <div class="div-item-value">{{ detail?.variantSku }}</div>
</div> </div>
<div <div
v-if="fastKey !== 'fastReceipt'" v-if="fastKey !== 'fastReceipt' && fastKey !== 'qualityScan'"
:title=" :title="
String(showOperationNoRow ? detail?.quantity : detail?.num) String(showOperationNoRow ? detail?.quantity : detail?.num)
" "
...@@ -202,8 +272,8 @@ ...@@ -202,8 +272,8 @@
</div> </div>
<div <div
v-if="fastKey !== 'fastReceipt'" v-if="fastKey !== 'fastReceipt' && fastKey !== 'qualityScan'"
:title="String(detail?.size)" :title="String(detail?.size || '')"
class="div-item" class="div-item"
> >
<span class="div-item-label">尺寸:</span> <span class="div-item-label">尺寸:</span>
...@@ -211,7 +281,7 @@ ...@@ -211,7 +281,7 @@
</div> </div>
<div <div
v-if="detail?.sizeType && fastKey !== 'fastReceipt'" v-if="detail?.sizeType && fastKey !== 'fastReceipt'"
:title="String(detail?.sizeType)" :title="String(detail?.sizeType || '')"
class="div-item" class="div-item"
> >
<span class="div-item-label">尺码类型:</span> <span class="div-item-label">尺码类型:</span>
...@@ -219,16 +289,16 @@ ...@@ -219,16 +289,16 @@
{{ sizeList.find((i) => i.value === detail.sizeType)?.name }} {{ sizeList.find((i) => i.value === detail.sizeType)?.name }}
</div> </div>
</div> </div>
<div <div
v-if="fastKey !== 'fastReceipt'" v-if="fastKey === 'qualityScan'"
:title="detail?.shopNumber ?? ''" :title="String(detail?.statusName || '')"
class="div-item" class="div-item"
> >
<span class="div-item-label">店铺单号:</span> <span class="div-item-label">操作单状态:</span>
<div class="div-item-value">{{ detail?.shopNumber ?? '' }}</div> <div class="div-item-value" style="color: red">
{{ detail?.statusName }}
</div>
</div> </div>
<div :title="detail?.createTime" class="div-item"> <div :title="detail?.createTime" class="div-item">
<span class="div-item-label">创建时间:</span> <span class="div-item-label">创建时间:</span>
<div class="div-item-value">{{ detail?.createTime }}</div> <div class="div-item-value">{{ detail?.createTime }}</div>
...@@ -243,6 +313,7 @@ ...@@ -243,6 +313,7 @@
'fastProduction', 'fastProduction',
'fastReceipt', 'fastReceipt',
'productionScan', 'productionScan',
'qualityScan',
].includes(fastKey) ].includes(fastKey)
? 'visible' ? 'visible'
: 'hidden', : 'hidden',
...@@ -253,19 +324,29 @@ ...@@ -253,19 +324,29 @@
style="width: 100%; height: 100%; font-size: 18px" style="width: 100%; height: 100%; font-size: 18px"
size="large" size="large"
type="success" type="success"
@click="changeStatus" @click="
fastKey === 'qualityScan'
? handleQuality(true)
: changeStatus()
"
> >
{{ {{ sureButtonText }}
['fastProduction', 'productionScan'].includes(fastKey)
? '生产完成'
: '快捷入库'
}}
</el-button> </el-button>
<div class="check"> <div class="check">
<el-checkbox v-model="isAutoSure"> 自动完成上一单 </el-checkbox> <el-checkbox v-model="isAutoSure"> 自动完成上一单 </el-checkbox>
</div> </div>
</div> </div>
<div v-if="fastKey !== 'fastReceipt'" class="btn-down"> <div v-if="fastKey === 'qualityScan'" class="btn-down">
<el-button
style="width: 100%; height: 100%; font-size: 18px"
type="danger"
size="large"
@click="handleQuality(false)"
>
质检不通过
</el-button>
</div>
<div v-else-if="fastKey !== 'fastReceipt'" class="btn-down">
<div class="check"> <div class="check">
<el-checkbox v-model="isDownloadImage" size="large"> <el-checkbox v-model="isDownloadImage" size="large">
扫码下载素材 扫码下载素材
...@@ -311,6 +392,11 @@ ...@@ -311,6 +392,11 @@
</div> </div>
</div> </div>
</div> </div>
<QualityFailDialog
v-if="fastKey === 'qualityScan'"
ref="qualityFailDialogRef"
@success="handleQualitySuccess"
/>
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
...@@ -320,24 +406,46 @@ import { ...@@ -320,24 +406,46 @@ import {
downloadMaterialApi, downloadMaterialApi,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
import { cardImages, PodOrderRes } from '@/types/api/podCnOrder' import { cardImages, PodOrderRes } from '@/types/api/podCnOrder'
import { checkInventoryApi } from '@/api/factoryOrderNew' import {
checkInventoryApi,
qualityPodOrderOperationApi,
} from '@/api/factoryOrderNew'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
import { computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import { BaseRespData } from '@/types/api' import { BaseRespData } from '@/types/api'
import useLodop from '@/utils/hooks/useLodop'
import { print } from '@/components/print'
import { DocumentCopy } from '@element-plus/icons-vue'
import QualityFailDialog from '@/views/order/factoryOrderNew/component/QualityFailDialog.vue'
interface HistoryDataItem { interface HistoryDataItem {
orderNumber: string orderNumber: string
finished: boolean finished: boolean
} }
const title = computed(() => { const title = computed(() => {
if (['fastProduction', 'productionScan'].includes(props.fastKey)) { switch (props.fastKey) {
case 'fastProduction':
case 'productionScan':
return '快捷生产' return '快捷生产'
} else if (props.fastKey === 'fastReceipt') { case 'fastReceipt':
return props.dialogTitle return props.dialogTitle
} else { case 'qualityScan':
return '快捷质检'
default:
return '查看详情' return '查看详情'
} }
}) })
const sureButtonText = computed(() => {
switch (props.fastKey) {
case 'fastProduction':
case 'productionScan':
return '生产完成'
case 'qualityScan':
return '质检通过'
default:
return '快捷入库'
}
})
export type FastProductionDetail = PodOrderRes & { export type FastProductionDetail = PodOrderRes & {
operationNo?: string | null operationNo?: string | null
quantity?: number | null quantity?: number | null
...@@ -354,6 +462,10 @@ const placeholderText = ref('') ...@@ -354,6 +462,10 @@ const placeholderText = ref('')
const sendNum = ref(0) const sendNum = ref(0)
const isDownloadImage = ref(false) const isDownloadImage = ref(false)
const isAutoSure = ref(true) const isAutoSure = ref(true)
const printDevice = ref('')
const isPrint = ref(false)
const printList = ref<string[]>([])
const { getCLodop } = useLodop()
const emptyDetail = (): FastProductionDetail => ({ const emptyDetail = (): FastProductionDetail => ({
id: -1, id: -1,
podJomallOrderCnId: -1, podJomallOrderCnId: -1,
...@@ -402,6 +514,7 @@ const props = withDefaults( ...@@ -402,6 +514,7 @@ const props = withDefaults(
downloadApi?: ( downloadApi?: (
ids: number[], ids: number[],
) => Promise<{ code?: number; message?: string }> ) => Promise<{ code?: number; message?: string }>
printApi?: (ids: number[]) => Promise<{ code?: number; message?: string }>
defaultAutoSure?: boolean defaultAutoSure?: boolean
showOperationNoRow?: boolean showOperationNoRow?: boolean
notFoundMessage?: string notFoundMessage?: string
...@@ -434,11 +547,14 @@ const props = withDefaults( ...@@ -434,11 +547,14 @@ const props = withDefaults(
completeApi: (ids: number[], detailData: Record<string, unknown>) => completeApi: (ids: number[], detailData: Record<string, unknown>) =>
productionQueryApi(ids[0], Number(detailData.podJomallOrderCnId || -1)), productionQueryApi(ids[0], Number(detailData.podJomallOrderCnId || -1)),
downloadApi: (ids: number[]) => downloadMaterialApi(ids), downloadApi: (ids: number[]) => downloadMaterialApi(ids),
printApi: undefined,
dialogTitle: '', dialogTitle: '',
}, },
) )
const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess']) const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess'])
const qualityFailDialogRef = ref<InstanceType<typeof QualityFailDialog>>()
const historyKeyFromDetail = (d: FastProductionDetail): string => { const historyKeyFromDetail = (d: FastProductionDetail): string => {
const raw = d as unknown as Record<string, unknown> const raw = d as unknown as Record<string, unknown>
const op = raw.operationNo const op = raw.operationNo
...@@ -455,6 +571,12 @@ const operationNoDisplay = computed(() => { ...@@ -455,6 +571,12 @@ const operationNoDisplay = computed(() => {
return String(v) return String(v)
}) })
const copy = (text: string) => {
if (!text) return
navigator.clipboard.writeText(text)
ElMessage.success('复制成功')
}
const parseImages = (value: unknown): cardImages[] => { const parseImages = (value: unknown): cardImages[] => {
if (!value) return [] if (!value) return []
if (Array.isArray(value)) { if (Array.isArray(value)) {
...@@ -525,9 +647,12 @@ watch( ...@@ -525,9 +647,12 @@ watch(
const len = historyData.value const len = historyData.value
if ( if (
len.length > 0 && len.length > 0 &&
['fastProduction', 'fastReceipt', 'productionScan'].includes( [
props.fastKey, 'fastProduction',
) 'fastReceipt',
'productionScan',
'qualityScan',
].includes(props.fastKey)
) { ) {
confirmQuery(len, 0) confirmQuery(len, 0)
} }
...@@ -538,9 +663,47 @@ watch( ...@@ -538,9 +663,47 @@ watch(
TrackingNumber.value = '' TrackingNumber.value = ''
isAutoSure.value = props.defaultAutoSure isAutoSure.value = props.defaultAutoSure
sendNum.value = 0 sendNum.value = 0
if (props.fastKey === 'qualityScan') {
initPrintDevice()
}
} }
}, },
) )
const initPrintDevice = () => {
const lodop = getCLodop(null, null)
if (!lodop) {
printList.value = []
return
}
const arr: string[] = []
const length = lodop.GET_PRINTER_COUNT()
for (let i = 0; i < length; i++) {
const name = lodop.GET_PRINTER_NAME(i)
if (name) arr.push(name)
}
printList.value = arr
}
const getPrintData = async () => {
if (!detail.value || detail.value.id === -1 || !props.printApi) return
const res = await props.printApi([detail.value.id])
if (!res.message) return
print(filePath + res.message, printDevice.value)
}
const printPdf = () => {
if (!printDevice.value) return ElMessage.warning('请选择打印机')
if (!detail.value || detail.value.id === -1) {
return ElMessage.warning(props.pleaseScanTip)
}
getPrintData()
}
const handlePrinterChange = (value: string) => {
printDevice.value = value
if (!value) isPrint.value = false
}
watch( watch(
() => props.detailData, () => props.detailData,
(newVal) => { (newVal) => {
...@@ -557,12 +720,30 @@ watch( ...@@ -557,12 +720,30 @@ watch(
) )
const confirmQuery = (len: HistoryDataItem[], i: number) => { const confirmQuery = (len: HistoryDataItem[], i: number) => {
const el = len[i] const el = len[i]
const pendingText = (() => {
switch (props.fastKey) {
case 'fastProduction':
case 'productionScan':
return '未生产'
case 'qualityScan':
return '未质检'
default:
return '未入库'
}
})()
const successText = (() => {
switch (props.fastKey) {
case 'fastProduction':
case 'productionScan':
return '生产完成'
case 'qualityScan':
return '质检通过'
default:
return '入库完成'
}
})()
showConfirm( showConfirm(
`${props.pendingOrderLabel} ${el.orderNumber} ${ `${props.pendingOrderLabel} ${el.orderNumber} ${pendingText}完成,取消则不提醒?`,
['fastProduction', 'productionScan'].includes(props.fastKey)
? '未生产'
: '未入库'
}完成,取消则不提醒?`,
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -573,13 +754,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => { ...@@ -573,13 +754,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => {
TrackingNumber.value = el.orderNumber TrackingNumber.value = el.orderNumber
await trackCodeInput() await trackCodeInput()
await setData(el.orderNumber) await setData(el.orderNumber)
ElMessage.success( ElMessage.success(successText)
`${
['fastProduction', 'productionScan'].includes(props.fastKey)
? '生产完成'
: '入库完成'
}`,
)
if (len[i + 1]) { if (len[i + 1]) {
confirmQuery(len, i + 1) confirmQuery(len, i + 1)
} }
...@@ -606,18 +781,22 @@ const changeStatus = async () => { ...@@ -606,18 +781,22 @@ const changeStatus = async () => {
if (!detail.value || Object.keys(detail.value).length <= 1) { if (!detail.value || Object.keys(detail.value).length <= 1) {
return ElMessage.warning(props.pleaseScanTip) return ElMessage.warning(props.pleaseScanTip)
} }
showConfirm( const confirmText = (() => {
`确定${ switch (props.fastKey) {
['fastProduction', 'productionScan'].includes(props.fastKey) case 'fastProduction':
? '生产完成' case 'productionScan':
: '入库完成' return '生产完成'
}?`, case 'qualityScan':
{ return '质检通过'
default:
return '入库完成'
}
})()
showConfirm(`确定${confirmText}?`, {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}, }).then(() => {
).then(() => {
setData(historyKeyFromDetail(detail.value)) setData(historyKeyFromDetail(detail.value))
}) })
} }
...@@ -628,6 +807,17 @@ const setData = async ( ...@@ -628,6 +807,17 @@ const setData = async (
if (!detail.value || detail.value?.id === -1) return if (!detail.value || detail.value?.id === -1) return
try { try {
const id = detail.value.id const id = detail.value.id
if (props.fastKey === 'qualityScan') {
const res = await qualityPodOrderOperationApi({
updateParams: [{ id, version: detail.value.version }],
qualityIssues: '',
qualify_problem_type: '',
qualityPassed: true,
source: 1,
})
if (res.code !== 200) return
emit('onSuccess', [{ id, status: true }])
} else {
const res = (await props.completeApi( const res = (await props.completeApi(
[id], [id],
detail.value as unknown as Record<string, unknown>, detail.value as unknown as Record<string, unknown>,
...@@ -640,6 +830,8 @@ const setData = async ( ...@@ -640,6 +830,8 @@ const setData = async (
status?: boolean status?: boolean
}[] }[]
> >
emit('onSuccess', res.data)
}
if (orderNumber) { if (orderNumber) {
const index = historyData.value.findIndex( const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber, (el: HistoryDataItem) => el.orderNumber === orderNumber,
...@@ -653,7 +845,6 @@ const setData = async ( ...@@ -653,7 +845,6 @@ const setData = async (
) )
} }
} }
emit('onSuccess', res.data)
playAudio('weight_success') playAudio('weight_success')
if (trigger === 'auto') { if (trigger === 'auto') {
...@@ -712,6 +903,41 @@ const handleDownload = () => { ...@@ -712,6 +903,41 @@ const handleDownload = () => {
} }
download() download()
} }
const handleQuality = (passed: boolean) => {
if (
!detail.value ||
Object.keys(detail.value).length <= 1 ||
detail.value.id == -1
) {
return ElMessage.warning(props.pleaseScanTip)
}
qualityFailDialogRef.value?.open(
[{ id: detail.value.id, version: detail.value.version }],
passed,
1,
)
}
const handleQualitySuccess = () => {
const orderNumber = historyKeyFromDetail(detail.value)
if (orderNumber) {
const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (index >= 0) {
historyData.value.splice(index, 1)
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
}
detail.value = emptyDetail()
TrackingNumber.value = ''
trackingNumberRef.value && trackingNumberRef.value.focus()
emit('onSuccess', [{ id: 0, status: true }])
}
const download = async () => { const download = async () => {
if (detail.value && detail.value?.id != -1) { if (detail.value && detail.value?.id != -1) {
try { try {
...@@ -776,20 +1002,6 @@ const trackCodeInput = async () => { ...@@ -776,20 +1002,6 @@ const trackCodeInput = async () => {
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
return return
} }
const item = historyData.value.find(
(el: HistoryDataItem) => el.orderNumber === TrackingNumber.value,
)
if (!item) {
// 记录扫单
historyData.value.push({
orderNumber: TrackingNumber.value,
finished: false,
})
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
const orderNumber = TrackingNumber.value const orderNumber = TrackingNumber.value
...@@ -834,10 +1046,6 @@ const trackCodeInput = async () => { ...@@ -834,10 +1046,6 @@ const trackCodeInput = async () => {
} }
} }
if (isDownloadImage.value) {
download()
}
// 工厂订单new 校验库存 生产扫码 // 工厂订单new 校验库存 生产扫码
if (props.fastKey === 'productionScan') { if (props.fastKey === 'productionScan') {
try { try {
...@@ -874,6 +1082,32 @@ const trackCodeInput = async () => { ...@@ -874,6 +1082,32 @@ const trackCodeInput = async () => {
} }
throw inventoryErr throw inventoryErr
} }
}
// 查询成功后再写入缓存
const item = historyData.value.find(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (!item) {
historyData.value.push({
orderNumber,
finished: false,
})
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
if (isDownloadImage.value) {
download()
}
if (props.fastKey === 'qualityScan' && printDevice.value && isPrint.value) {
await getPrintData()
}
if (props.fastKey === 'productionScan') {
await setData(detail.value.id.toString(), 'auto') await setData(detail.value.id.toString(), 'auto')
} }
playAudio('weight_search_success') playAudio('weight_search_success')
...@@ -889,12 +1123,12 @@ const trackCodeInput = async () => { ...@@ -889,12 +1123,12 @@ const trackCodeInput = async () => {
const onOpened = () => { const onOpened = () => {
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
} }
function setProductMark(productMark: string) { // function setProductMark(productMark: string) {
if (!productMark) return '' // if (!productMark) return ''
if (productMark === 'custom_normal') return 'CB' // if (productMark === 'custom_normal') return 'CB'
if (productMark === 'normal') return 'G' // if (productMark === 'normal') return 'G'
return '' // return ''
} // }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.detail-div { .detail-div {
...@@ -913,6 +1147,8 @@ function setProductMark(productMark: string) { ...@@ -913,6 +1147,8 @@ function setProductMark(productMark: string) {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 30px;
padding: 30px 0;
.btn { .btn {
margin: 20px 0; margin: 20px 0;
...@@ -970,6 +1206,27 @@ function setProductMark(productMark: string) { ...@@ -970,6 +1206,27 @@ function setProductMark(productMark: string) {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
&.with-copy {
display: flex;
align-items: center;
min-width: 0;
}
.div-item-value-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.copy-icon {
flex-shrink: 0;
margin-left: 6px;
cursor: pointer;
color: #909399;
}
} }
} }
} }
...@@ -989,7 +1246,6 @@ function setProductMark(productMark: string) { ...@@ -989,7 +1246,6 @@ function setProductMark(productMark: string) {
.input { .input {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 30px 0;
} }
} }
...@@ -1046,12 +1302,15 @@ function setProductMark(productMark: string) { ...@@ -1046,12 +1302,15 @@ function setProductMark(productMark: string) {
.btn { .btn {
position: relative; position: relative;
:deep(.el-button) { .btn-sure,
span { .btn-down {
&:has(.check) {
:deep(.el-button span) {
position: relative; position: relative;
left: -30px; left: -30px;
} }
} }
}
.check { .check {
:deep(.el-checkbox__inner) { :deep(.el-checkbox__inner) {
......
...@@ -68,6 +68,7 @@ const emit = defineEmits<{ ...@@ -68,6 +68,7 @@ const emit = defineEmits<{
const visible = ref(false) const visible = ref(false)
const submitLoading = ref(false) const submitLoading = ref(false)
const qualityPassed = ref(true) const qualityPassed = ref(true)
const source = ref(0) // 0 列表页,1 快捷质检
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const updateParams = ref<{ id: number; version?: number }[]>([]) const updateParams = ref<{ id: number; version?: number }[]>([])
const reasonOptions = ref<QualityTypeItem[]>([]) const reasonOptions = ref<QualityTypeItem[]>([])
...@@ -110,13 +111,17 @@ const handleReasonChange = () => { ...@@ -110,13 +111,17 @@ const handleReasonChange = () => {
formRef.value?.clearValidate('qualify_problem_type') formRef.value?.clearValidate('qualify_problem_type')
} }
/** qualityPassed: true 质检通过,false 质检不通过 */ const open = (
const open = (rows: { id: number; version?: number }[], passed: boolean) => { rows: { id: number; version?: number }[],
passed: boolean,
sourceType: number = 0,
) => {
updateParams.value = rows.map((row) => ({ updateParams.value = rows.map((row) => ({
id: row.id, id: row.id,
version: row.version, version: row.version,
})) }))
qualityPassed.value = passed qualityPassed.value = passed
source.value = sourceType
form.reasonKey = undefined form.reasonKey = undefined
form.qualify_problem_type = '' form.qualify_problem_type = ''
visible.value = true visible.value = true
...@@ -147,10 +152,13 @@ const handleSubmit = async () => { ...@@ -147,10 +152,13 @@ const handleSubmit = async () => {
? form.qualify_problem_type ? form.qualify_problem_type
: (form.reasonKey as number | string), : (form.reasonKey as number | string),
qualityPassed: qualityPassed.value, qualityPassed: qualityPassed.value,
source: source.value,
} }
const res = await qualityPodOrderOperationApi(params) const res = await qualityPodOrderOperationApi(params)
if (res.code !== 200) return if (res.code !== 200) return
if (source.value !== 1) {
ElMessage.success('操作成功') ElMessage.success('操作成功')
}
visible.value = false visible.value = false
emit('success') emit('success')
} catch (e) { } catch (e) {
......
...@@ -638,7 +638,9 @@ ...@@ -638,7 +638,9 @@
> >
</span> </span>
<span v-if="['IN_PRODUCTION'].includes(status)" class="item"> <span v-if="['IN_PRODUCTION'].includes(status)" class="item">
<ElButton type="success" @click="handleQuickProduction()" <ElButton
type="success"
@click="handleQuickProduction('productionScan')"
>快捷生产</ElButton >快捷生产</ElButton
> >
</span> </span>
...@@ -765,7 +767,12 @@ ...@@ -765,7 +767,12 @@
</span> </span>
<!-- 待质检 --> <!-- 待质检 -->
<span v-if="status === 'PENDING_QUALITY'" class="item"> <span v-if="status === 'PENDING_QUALITY'" class="item">
<ElButton type="primary" @click="() => {}"> 快捷质检 </ElButton> <ElButton
type="primary"
@click="handleQuickProduction('qualityScan')"
>
快捷质检
</ElButton>
</span> </span>
<span v-if="status === 'PENDING_QUALITY'" class="item"> <span v-if="status === 'PENDING_QUALITY'" class="item">
<ElButton type="success" @click="handleQuality(true)"> <ElButton type="success" @click="handleQuality(true)">
...@@ -1147,11 +1154,16 @@ ...@@ -1147,11 +1154,16 @@
pending-order-label="操作单号" pending-order-label="操作单号"
please-scan-tip="请扫码操作单号" please-scan-tip="请扫码操作单号"
search-input-audio-tip="请录入操作单号" search-input-audio-tip="请录入操作单号"
history-storage-key="historyFactoryOrderNewData" :history-storage-key="
fastKey === 'qualityScan'
? 'historyFactoryOrderNewQualityData'
: 'historyFactoryOrderNewData'
"
tracking-placeholder="扫描枪输入操作单号" tracking-placeholder="扫描枪输入操作单号"
:query-api="getOperationByNo" :query-api="getOperationByNo"
:complete-api="completeOperationById" :complete-api="completeOperationById"
:download-api="downloadOperationById" :download-api="downloadOperationById"
:print-api="printOperationById"
@on-success="handleFastProductionSuccess" @on-success="handleFastProductionSuccess"
@close="fastClose" @close="fastClose"
/> />
...@@ -1371,6 +1383,7 @@ import { ...@@ -1371,6 +1383,7 @@ import {
completeDeliveryApi, completeDeliveryApi,
productionScanApi, productionScanApi,
getByOperationNoLogApi, getByOperationNoLogApi,
getQualityScanByOperationNoApi,
listByNoPodOrderApi, listByNoPodOrderApi,
orderWeighingPodOrderApi, orderWeighingPodOrderApi,
finishShipmentPodOrderApi, finishShipmentPodOrderApi,
...@@ -2638,7 +2651,6 @@ const suspendDialogRef = ref<InstanceType<typeof SuspendDialog>>() ...@@ -2638,7 +2651,6 @@ const suspendDialogRef = ref<InstanceType<typeof SuspendDialog>>()
const pickCompleteDialogRef = ref<InstanceType<typeof PickCompleteDialog>>() const pickCompleteDialogRef = ref<InstanceType<typeof PickCompleteDialog>>()
const pickFailDialogRef = ref<InstanceType<typeof PickFailDialog>>() const pickFailDialogRef = ref<InstanceType<typeof PickFailDialog>>()
const qualityFailDialogRef = ref<InstanceType<typeof QualityFailDialog>>() const qualityFailDialogRef = ref<InstanceType<typeof QualityFailDialog>>()
const fastQualifyRef = ref<InstanceType<typeof FastQualify>>()
const operateDetailsDialogRef = ref() const operateDetailsDialogRef = ref()
const arrangeDialogRef = ref<InstanceType<typeof ArrangeDialog>>() const arrangeDialogRef = ref<InstanceType<typeof ArrangeDialog>>()
const createLogisticDialogRef = ref() const createLogisticDialogRef = ref()
...@@ -3515,7 +3527,9 @@ const handleReplenishFail = () => { ...@@ -3515,7 +3527,9 @@ const handleReplenishFail = () => {
}) })
} }
const getOperationByNo = (operationNo: string) => const getOperationByNo = (operationNo: string) =>
getByOperationNoLogApi(operationNo) as Promise<{ data?: unknown }> (fastKey.value === 'qualityScan'
? getQualityScanByOperationNoApi(operationNo)
: getByOperationNoLogApi(operationNo)) as Promise<{ data?: unknown }>
const completeOperationById = ( const completeOperationById = (
ids: number[], ids: number[],
detailData?: Record<string, unknown>, detailData?: Record<string, unknown>,
...@@ -3530,8 +3544,13 @@ const completeOperationById = ( ...@@ -3530,8 +3544,13 @@ const completeOperationById = (
const downloadOperationById = (ids: number[]) => const downloadOperationById = (ids: number[]) =>
downloadOperationMaterialApi(ids) downloadOperationMaterialApi(ids)
const printOperationById = (ids: number[]) =>
printNewPodOrderProductionOrderApi(ids) as Promise<{
code?: number
message?: string
}>
const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => { const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => {
if (fastKey.value === 'productionScan') { if (fastKey.value === 'productionScan' || fastKey.value === 'qualityScan') {
ElMessage.success('操作成功') ElMessage.success('操作成功')
return return
} }
...@@ -3584,11 +3603,11 @@ const handleViewDetail = async (item: operateOrderListData) => { ...@@ -3584,11 +3603,11 @@ const handleViewDetail = async (item: operateOrderListData) => {
} }
} }
const isLimitScan = ref(false) const isLimitScan = ref(false)
const handleQuickProduction = () => { const handleQuickProduction = (key: string) => {
detailVisible.value = true fastKey.value = key
fastKey.value = 'productionScan'
isLimitScan.value = true isLimitScan.value = true
detailData.value = {} detailData.value = {}
detailVisible.value = true
} }
const handleSinglePrint = () => { const handleSinglePrint = () => {
podDistributionOrderVisible.value = true podDistributionOrderVisible.value = true
...@@ -3696,12 +3715,9 @@ const handleGetOrderInventoryDetail = async () => { ...@@ -3696,12 +3715,9 @@ const handleGetOrderInventoryDetail = async () => {
const handleQuality = (qualityPassed: boolean) => { const handleQuality = (qualityPassed: boolean) => {
if (!ensureSelection()) return if (!ensureSelection()) return
const rows = isCardLayout.value ? cardSelectList.value : selectedRows.value const rows = isCardLayout.value ? cardSelectList.value : selectedRows.value
qualityFailDialogRef.value?.open(rows, qualityPassed) qualityFailDialogRef.value?.open(rows, qualityPassed, 0)
} }
const handleFastQualify = () => {
fastQualifyRef.value?.open()
}
const isEnableSorting = ref(false) const isEnableSorting = ref(false)
// 获取功能开关 // 获取功能开关
const getFunctionSwitch = async () => { const getFunctionSwitch = async () => {
......
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