Commit bc2d1dc3 by qinjianhui

feat: 质检

parent 8b7564ca
......@@ -49,6 +49,10 @@ img {
.flex-1 {
flex: 1;
}
.font-bold {
font-weight: bold;
}
.margin-top-10 {
margin-top: 10px;
}
......
......@@ -58,6 +58,7 @@ export interface OrderData {
shipmentList?: string
sourceType?: string
moreable?: boolean
}
export interface ProductList {
id: number
......@@ -81,6 +82,8 @@ export interface ProductList {
createTime?: string
updateTime?: string
version?: string | number
passNum?: number
notPassNum?: number
}
export interface MemoList {
......@@ -156,6 +159,8 @@ export interface DetailList {
notShipmentNum?: number
productName?: string
facotoryNo?: string
notPassNum?: number
passNum?: number
}
export interface LogListData {
......
......@@ -44,13 +44,16 @@
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">发货状态:</span>
<span
v-if="item.shipmentNum === item.num"
v-if="(item.shipmentNum || 0) - (item.notPassNum || 0) === item.num"
class="order-list-expand_item_value"
>
<el-tag effect="dark" type="success"> 已发货 </el-tag>
</span>
<span
v-if="item.num !== item.shipmentNum && item.shipmentNum !== 0"
v-if="
item.num !== (item.shipmentNum || 0) - (item.notPassNum || 0) &&
(item.shipmentNum || 0) > 0
"
class="order-list-expand_item_value"
>
<el-tag effect="dark"> 部分发货 </el-tag>
......@@ -72,18 +75,36 @@
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">购买数:</span>
<span class="order-list-expand_item_value">{{ item.num || '--' }}</span>
<span class="order-list-expand_item_value">{{ item.num || 0 }}</span>
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">已发数:</span>
<span class="order-list-expand_item_value">{{
item.shipmentNum || '--'
item.shipmentNum || 0
}}</span>
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">未发数:</span>
<span class="order-list-expand_item_value">{{
(item.num || 0) - (item.shipmentNum || 0)
(item.num || 0) - ((item.shipmentNum || 0) - (item.notPassNum || 0))
}}</span>
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">待质检:</span>
<span class="order-list-expand_item_value">{{
(item.shipmentNum || 0) - ((item.passNum || 0) + (item.notPassNum || 0))
}}</span>
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">质检(通过):</span>
<span class="order-list-expand_item_value">{{
item.passNum || 0
}}</span>
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">质检(不通过):</span>
<span class="order-list-expand_item_value">{{
item.notPassNum || 0
}}</span>
</div>
<div class="order-list-expand_item_info_title">
......
......@@ -18,7 +18,11 @@
:key="i"
class="send-order-prop-list"
>
<div v-for="pi in p" :key="pi.key" class="send-order-prop-item">
<div
v-for="(pi, index) in p"
:key="index"
class="send-order-prop-item"
>
{{ pi.label }}{{ val(od, pi.key) }}
</div>
</div>
......@@ -42,7 +46,7 @@
<script lang="ts" setup>
import { val } from '@/utils'
import type { SendOrderData } from '@/types/api/order'
import type { DetailList, SendOrderData } from '@/types/api/order'
import type { PropType } from 'vue'
defineProps({
......@@ -60,12 +64,23 @@ const productProps = [
],
[
{ label: '生产单号', key: 'subOrderNumber' },
{ label: '工厂', key: 'facotoryNo' },
],
[
{ label: '生产数', key: 'productionNum' },
{ label: '发货数', key: 'shipmentNum' },
{ label: '未发数', key: 'notShipmentNum' },
{
label: '未发数',
key: (data: DetailList) =>
(data.productionNum || 0) -
((data.shipmentNum || 0) - (data.notPassNum || 0)),
},
{
label: '待质检',
key: (data: DetailList) =>
(data.shipmentNum || 0) - ((data.passNum || 0) + (data.notPassNum || 0)),
},
{ label: '质检(通过)', key: 'passNum' },
{ label: '质检(不通过)', key: 'notPassNum' },
],
]
......
<template>
<div v-if="orderList.length" class="shipment-info" >
<div v-for="o in orderList" :key="o.id" class="shipment-info-item">
<div class="shipment-info-item-header">
<div class="shipment-info-item-header--title">
<span class="shipment-info-item-header__label">主单号:</span>
<span class="shipment-info-item-header__value">{{
o.orderNumber || '--'
}}</span>
</div>
<div class="shipment-info-item-header--title">
<span class="shipment-info-item-header__label">订单类型:</span>
<span class="shipment-info-item-header__value">{{
o.sourceType || '--'
}}</span>
</div>
<div class="shipment-info-item-header--title">
<span class="shipment-info-item-header__label">收货人:</span>
<span class="shipment-info-item-header__value">{{
o.lanshouName || '--'
}}</span>
</div>
</div>
<div class="shipment-info-item-content">
<div
v-for="item in o.productList"
:key="item.id"
:class="{ 'active-row': item.subOrderNumber === orderNumber }"
class="shipment-info-item-content-item"
>
<div class="image">
<img :src="item.variantImage" />
</div>
<div class="shipment-info-item-content-item--info">
<span class="label">SKU:</span>
<span class="value">{{ item.baseSku || '--' }}</span>
<div v-if="orderList.length" class="shipment-order">
<div ref="shipmentOrderRef" class="shipment-info">
<div v-for="o in orderList" :key="o.id" class="shipment-info-item">
<div class="shipment-info-item-header">
<div class="shipment-info-item-header--title">
<span class="shipment-info-item-header__label">主单号:</span>
<span class="shipment-info-item-header__value">{{
o.orderNumber || '--'
}}</span>
</div>
<div class="shipment-info-item-content-item--info">
<span class="label">生产单号:</span>
<span class="value">{{ item.subOrderNumber || '--' }}</span>
<div class="shipment-info-item-header--title">
<span class="shipment-info-item-header__label">订单类型:</span>
<span class="shipment-info-item-header__value">{{
o.sourceType || '--'
}}</span>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
>
<span class="label">购买数:</span>
<span class="value">{{ item.num || '--' }}</span>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
>
<span class="label">已发数:</span>
<span class="value">{{ item.shipmentNum || '--' }}</span>
<div class="shipment-info-item-header--title">
<span class="shipment-info-item-header__label">收货人:</span>
<span class="shipment-info-item-header__value">{{
o.lanshouName || '--'
}}</span>
</div>
</div>
<div class="shipment-info-item-content">
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
v-for="item in o.productList"
:key="item.id"
:data-id="item.id"
:class="{
'active-row': item.subOrderNumber === currentRow.subOrderNumber,
}"
class="shipment-info-item-content-item"
@click="onRowClick(item)"
>
<span class="label">未发数:</span>
<span class="value">{{ (item.num || 0) - (item.shipmentNum || 0) }}</span>
<div class="image">
<img :src="item.variantImage" />
</div>
<div class="shipment-info-item-content-item--info">
<span class="label">SKU:</span>
<span class="value">{{ item.baseSku || '--' }}</span>
</div>
<div class="shipment-info-item-content-item--info">
<span class="label">生产单号:</span>
<span class="value">{{ item.subOrderNumber || '--' }}</span>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
>
<span class="label">购买数:</span>
<span class="value">{{ item.num || 0 }}</span>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
>
<span class="label">已发数:</span>
<span class="value">{{ item.shipmentNum || 0 }}</span>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
>
<span class="label">未发数:</span>
<span class="value">{{
(item.num || 0) -
((item.shipmentNum || 0) - (item.notPassNum || 0))
}}</span>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
>
<span class="label">拣货数:</span>
<span class="value">{{ item.count }}</span>
</div>
</div>
<div
class="shipment-info-item-content-item--info"
style="width: 90px; flex: none"
</div>
</div>
</div>
<div class="shipment-order-detail_info">
<div class="shipment-order-detail_info_image">
<img :src="currentRow.variantImage" style="width: 100%" />
</div>
<div class="shipment-order-detail_info_other">
<div class="order-norm">
<span class="order-norm-label" style="margin-right: 6px">
规格:
</span>
<span class="order-norm-value" :title="currentRow.variantSku">
{{ currentRow.variantSku }}
</span>
</div>
<div class="order-count" style="line-height: 26px">
<span class="order-count-label" style="margin-right: 6px">
拣货数:
</span>
<span
class="order-count-value"
style="font-size: 16px; font-weight: bold; color: red"
>
<span class="label">拣货数:</span>
<span class="value">{{ item.count }}</span>
</div>
{{ currentRow.count }}
</span>
</div>
</div>
</div>
</div>
<ElEmpty v-else class="shipment-info"></ElEmpty>
<ElEmpty v-else class="shipment-order"></ElEmpty>
</template>
<script setup lang="ts">
import { OrderData } from '@/types/api/order';
import { PropType } from 'vue';
import { OrderData, ProductList } from '@/types/api/order'
import { PropType } from 'vue'
import useShipment from './hook/useShipment'
const emit = defineEmits<{
(e: 'changeCurrentRow', v: ProductList): void
}>()
defineProps({
orderList: {
type: Array as PropType<OrderData[]>,
default: () => [],
},
orderNumber: {
type: String,
default: () => '',
currentRow: {
type: Object as PropType<ProductList>,
default: () => {},
},
})
const { shipmentOrderRef } = useShipment()
const onRowClick = (item: ProductList) => {
emit('changeCurrentRow', item)
}
</script>
<style lang="scss" scoped>
.shipment-info {
height: 600px;
.shipment-order {
overflow: hidden;
margin-top: 20px;
height: 600px;
display: flex;
gap: 10px;
}
.shipment-info {
width: 50%;
border: 1px solid #eee;
overflow: auto;
font-size: 13px;
}
.shipment-order-detail_info {
width: 50%;
display: flex;
gap: 6px;
}
.shipment-order-detail_info_image {
flex: 1;
overflow: hidden;
border: 1px solid #eee;
}
.shipment-order-detail_info_other {
width: 200px;
}
.image {
......@@ -114,7 +180,6 @@ defineProps({
padding: 10px;
}
.shipment-info-item-content-item {
display: flex;
justify-content: space-between;
......
import { getOrderBySubOrderNumber, saveOrder } from '@/api/order'
import { OrderData, ShipmentForm, ShipmentOrderRes } from '@/types/api/order'
import {
OrderData,
ProductList,
ShipmentForm,
ShipmentOrderRes,
} from '@/types/api/order'
import { useValue } from '@/utils/hooks/useValue'
import { showError } from '@/utils/ui'
import { ref } from 'vue'
......@@ -17,8 +22,9 @@ export default function useShipment(callback?: () => void) {
const shipmentVisible = ref(false)
const isLock = ref(false)
const inputRef = ref()
const orderNumber = ref('')
const currentRow = ref<ProductList>()
const shipmentLoading = ref(false)
const shipmentOrderRef = ref()
const searchShipmentByOrderNumber = async () => {
const code = productionOrderNumber.value
shipmentVisible.value = true
......@@ -37,12 +43,19 @@ export default function useShipment(callback?: () => void) {
if (rowData) break
}
if (rowData) {
orderNumber.value = code
const unShipmentNum = (rowData.num || 0) - (rowData.shipmentNum || 0)
currentRow.value = rowData
const unShipmentNum =
(rowData.num || 0) -
(rowData.shipmentNum || 0) +
(rowData.notPassNum || 0)
if (unShipmentNum > (rowData.count || 0)) {
rowData.count || rowData.count === 0
? (rowData.count += 1)
: (rowData.count = 0)
rowData.count = unShipmentNum
if (+rowData.count > 1) {
ElMessageBox.confirm(`该产品未发数为${rowData.count}件`, '重要提示', {
confirmButtonText: '确定',
type: 'warning',
}).catch(() => {})
}
} else {
ElMessage({
message: '拣货数不能大于未发数',
......@@ -50,9 +63,18 @@ export default function useShipment(callback?: () => void) {
offset: window.innerHeight / 2,
})
}
inputRef.value.focus()
productionOrderNumber.value = ''
isLock.value = false
inputRef.value.focus()
if (shipmentOrderRef.value) {
const rowEl = shipmentOrderRef.value.querySelector(
`div[data-id="${rowData.id}"]`,
)
if (!rowEl) return
rowEl.scrollIntoView()
}
} else {
getPackingData(code)
}
......@@ -63,13 +85,30 @@ export default function useShipment(callback?: () => void) {
const res = await getOrderBySubOrderNumber(code)
if (res.data) {
for (const item of res.data.productList || []) {
if (item.num) {
item.count = 0
}
item.count = 0
if (item.subOrderNumber === code) {
item.count || item.count === 0
? (item.count += 1)
: (item.count = 0)
item.count =
(item.num || 0) -
((item.shipmentNum || 0) - (item.notPassNum || 0))
if (+item.count > 1) {
ElMessageBox.confirm(
`该产品未发数为${item.count}件`,
'重要提示',
{
confirmButtonText: '确定',
type: 'warning',
},
).catch(() => {})
}
currentRow.value = item
if (shipmentOrderRef.value) {
const rowEl = shipmentOrderRef.value.querySelector(
`div[data-id="${item.id}"]`,
)
if (!rowEl) return
rowEl.scrollIntoView()
}
}
}
const index = orderList.value.findIndex(
......@@ -79,10 +118,9 @@ export default function useShipment(callback?: () => void) {
orderList.value.unshift(res.data)
}
}
orderNumber.value = code
inputRef.value.focus()
productionOrderNumber.value = ''
isLock.value = false
inputRef.value.focus()
} catch (e) {
productionOrderNumber.value = ''
isLock.value = false
......@@ -105,7 +143,7 @@ export default function useShipment(callback?: () => void) {
} catch {
return
}
const isEqual = orderList.value.some(
(item) => item.namespace === orderList.value[0].namespace,
)
......@@ -127,7 +165,7 @@ export default function useShipment(callback?: () => void) {
erpSubOrderNumber: jj.erpSubOrderNumber,
subOrderNumber: jj.subOrderNumber,
sendOutQuantity: jj.count,
version: jj.version
version: jj.version,
}
order.push(subOrder)
}
......@@ -156,16 +194,17 @@ export default function useShipment(callback?: () => void) {
}
return {
shipmentFormRef,
shipmentOrderRef,
productionOrderNumber,
shipmentVisible,
inputRef,
shipmentForm,
orderNumber,
currentRow,
shipmentLoading,
orderList,
searchShipmentByOrderNumber,
saveShipment,
confirmDelivery,
onShipmentDialogOpened
onShipmentDialogOpened,
}
}
......@@ -43,10 +43,10 @@
style="width: 160px"
></ElInput>
</ElFormItem>
<ElFormItem label="内部便签">
<ElFormItem label="内部签">
<ElInput
v-model="searchForm.internalMemo"
placeholder="内部便签"
placeholder="内部签"
clearable
style="width: 160px"
></ElInput>
......@@ -80,24 +80,25 @@
<span v-if="statusCode === 2" class="item">
<ElButton type="success" @click="confirmProduce">确认生产</ElButton>
</span>
<span v-if="statusCode === 3 || statusCode === 4" class="item">
<ElButton type="success" @click="confirmDelivery">发货</ElButton>
</span>
<span class="item">
<span v-if="statusCode === 2 || statusCode === 3" class="item">
<ElButton type="warning" is-dark @click="downloadManuscript"
>下载稿件</ElButton
>
</span>
<span class="item">
<span v-if="statusCode === 2 || statusCode === 3" class="item">
<ElButton type="primary" dark @click="printManuscript"
>打印生产单</ElButton
>
</span>
<span class="item">
<ElButton type="success" @click="addInternalTag"
<ElButton type="warning" @click="addInternalTag"
>添加内部标签</ElButton
>
</span>
<span v-if="statusCode === 3 || statusCode === 4" class="item">
<ElButton type="success" @click="confirmDelivery">发货</ElButton>
</span>
</div>
<div
ref="tableWrapperRef"
......@@ -227,7 +228,7 @@
>
</div>
<div
v-if="statusCode == 4 || statusCode == 5"
v-if="statusCode !== 2 && statusCode !== 3"
class="order-list-expand_item_info_title"
>
<ElButton
......@@ -300,7 +301,7 @@
header-align="center"
></ElTableColumn>
<ElTableColumn
label="内部便签"
label="内部签"
width="350"
header-align="center"
></ElTableColumn>
......@@ -330,7 +331,8 @@
v-model="shipmentVisible"
title="发货"
:close-on-click-modal="false"
width="1300px"
width="1600px"
top="6vh"
@opened="onShipmentDialogOpened"
>
<div class="header-search">
......@@ -339,7 +341,7 @@
v-model="productionOrderNumber"
clearable
size="large"
placeholder="这里是扫码输入框"
placeholder="请输入生产单号"
@keyup.enter="searchShipmentByOrderNumber"
/>
<el-button
......@@ -352,7 +354,8 @@
<Shipment
v-loading="shipmentLoading"
:order-list="orderList"
:order-number="orderNumber"
:current-row="currentRow"
@change-current-row="onChangeCurrentRow"
/>
<div class="shipment-logistics-info margin-top-20">
<ElForm ref="shipmentFormRef" :model="shipmentForm" :rules="rules">
......@@ -459,6 +462,7 @@ import type {
LogisticsData,
SendOrderData,
LogListData,
ProductList,
} from '@/types/api/order'
import { onMounted, reactive, ref } from 'vue'
import useElTableColumnWidth from '@/utils/hooks/useElTableColumnWidth'
......@@ -492,7 +496,7 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({
shopNumber: '',
internalMemo: '',
erpOrderNumber: '',
subOrderNumber: ''
subOrderNumber: '',
})
const tabsNav = ref<Tab[]>([])
......@@ -554,7 +558,7 @@ const {
shipmentVisible,
inputRef,
shipmentForm,
orderNumber,
currentRow,
shipmentLoading,
orderList,
searchShipmentByOrderNumber,
......@@ -771,6 +775,10 @@ const cancelOrder = async (id: number) => {
showError(e)
}
}
const onChangeCurrentRow = (item: ProductList) => {
currentRow.value = item
}
</script>
<style lang="scss" scoped>
.header-filter-form {
......@@ -780,7 +788,7 @@ const cancelOrder = async (id: number) => {
}
}
.header-filter-tab {
margin-top: 20px;
margin-top: 10px;
}
.tabs {
......@@ -810,11 +818,11 @@ const cancelOrder = async (id: number) => {
}
.order-content {
margin-top: 20px;
margin-top: 10px;
}
.order-list {
margin-top: 20px;
margin-top: 10px;
flex: 1;
:deep(.el-table__expand-icon > .el-icon) {
display: none;
......
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