Commit 20b5f95f by qinjianhui

Merge branch 'dev_new_order_intercept' into 'dev'

Dev new order intercept

See merge request !209
parents 7bb0575c ba2110e0
...@@ -2,6 +2,7 @@ import axios from './axios' ...@@ -2,6 +2,7 @@ import axios from './axios'
import type { BasePaginationData, BaseRespData } from '@/types/api' import type { BasePaginationData, BaseRespData } from '@/types/api'
import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess' import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess'
import type { operateOrderListData } from '@/types/api/factoryOrderNew' import type { operateOrderListData } from '@/types/api/factoryOrderNew'
import { InterskuList } from '@/types/api/warehouse'
function normalizePodOrderQueryPayload( function normalizePodOrderQueryPayload(
data: Record<string, unknown>, data: Record<string, unknown>,
...@@ -20,7 +21,7 @@ function normalizePodOrderQueryPayload( ...@@ -20,7 +21,7 @@ function normalizePodOrderQueryPayload(
export function getCancelOrderProcessStateGroupMapApi() { export function getCancelOrderProcessStateGroupMapApi() {
return axios.get<never, BaseRespData<CancelOrderProcessStateGroupMap>>( return axios.get<never, BaseRespData<CancelOrderProcessStateGroupMap>>(
'factory/podOrderOperationForReclaim/findStateGroupMap', 'factory/podOrderOperation/find-state-group-map',
) )
} }
...@@ -32,13 +33,13 @@ export function getCancelOrderProcessListApi( ...@@ -32,13 +33,13 @@ export function getCancelOrderProcessListApi(
) { ) {
const body = normalizePodOrderQueryPayload({ ...data }) const body = normalizePodOrderQueryPayload({ ...data })
return axios.post<never, BasePaginationData<operateOrderListData>>( return axios.post<never, BasePaginationData<operateOrderListData>>(
'factory/podOrderOperationForReclaim/list_page', 'factory/podOrderOperation/list-page',
{ ...body, currentPage, pageSize, alreadyInStock }, { ...body, currentPage, pageSize, alreadyInStock },
) )
} }
export function getOperationInfoByNoApi(operationNo: string) { export function getOperationInfoByNoApi(operationNo: string) {
return axios.get<never, BaseRespData<operateOrderListData>>( return axios.get<never, BaseRespData<operateOrderListData>>(
`factory/podOrderOperationForReclaim/getByOperationNo?operationNo=${operationNo}`, `factory/podOrderOperation/get-by-operation-no?operationNo=${operationNo}`,
) )
} }
export function completeDeliveryByCancelOrderProcessApi(data: { export function completeDeliveryByCancelOrderProcessApi(data: {
...@@ -47,7 +48,14 @@ export function completeDeliveryByCancelOrderProcessApi(data: { ...@@ -47,7 +48,14 @@ export function completeDeliveryByCancelOrderProcessApi(data: {
warehouseId: number warehouseId: number
}) { }) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/podOrderOperationForReclaim/storeAfterScan', 'factory/podOrderOperation/store-after-scan',
data, data,
) )
} }
export function getBySkuAndUserMarkAndInboundTypeApi(operationNo: string[]) {
return axios.post<never, BaseRespData<InterskuList[]>>(
'factory/podOrderOperation/get-product-by-operation-no',
operationNo,
)
}
...@@ -394,7 +394,7 @@ export function rejectInRecordApi({ ...@@ -394,7 +394,7 @@ export function rejectInRecordApi({
) )
} }
export function addInRecordApi(form: InterWarehouseDetail) { export function addInRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<unknown>>(
'factory/warehouseInRecord/add', 'factory/warehouseInRecord/add',
{ {
...form, ...form,
......
...@@ -151,11 +151,11 @@ const menu: MenuItem[] = [ ...@@ -151,11 +151,11 @@ const menu: MenuItem[] = [
id: 12, id: 12,
label: '工厂订单(NEW)', label: '工厂订单(NEW)',
}, },
// { {
// index: '/order/cancel-order-process', index: '/order/cancel-order-process',
// id: 13, id: 13,
// label: '取消后订单处理', label: '取消后订单处理',
// }, },
], ],
}, },
{ {
......
...@@ -123,6 +123,8 @@ export interface InterskuList { ...@@ -123,6 +123,8 @@ export interface InterskuList {
remark?: string | null remark?: string | null
currencyName?: string | null currencyName?: string | null
currencyCode?: string | null currencyCode?: string | null
buyStored?: number | null
totalPrice?: number | null
} }
export interface ILocation { export interface ILocation {
id?: number id?: number
......
...@@ -327,6 +327,7 @@ ...@@ -327,6 +327,7 @@
</div> </div>
<FastProduction <FastProduction
v-model:detail-visible="detailVisible" v-model:detail-visible="detailVisible"
:dialog-title="dialogTitle"
:is-new-order="true" :is-new-order="true"
:detail-data="detailData" :detail-data="detailData"
:fast-key="fastKey" :fast-key="fastKey"
...@@ -385,6 +386,7 @@ import { ...@@ -385,6 +386,7 @@ import {
getCancelOrderProcessStateGroupMapApi, getCancelOrderProcessStateGroupMapApi,
getOperationInfoByNoApi, getOperationInfoByNoApi,
completeDeliveryByCancelOrderProcessApi, completeDeliveryByCancelOrderProcessApi,
getBySkuAndUserMarkAndInboundTypeApi,
} from '@/api/cancelOrderProcess' } from '@/api/cancelOrderProcess'
import type { CardLayoutListFetcher } from '@/types/api/factoryOrderNew' import type { CardLayoutListFetcher } from '@/types/api/factoryOrderNew'
import LogisticsWaySelect from '@/views/logistics/components/LogisticsWaySelect' import LogisticsWaySelect from '@/views/logistics/components/LogisticsWaySelect'
...@@ -393,7 +395,6 @@ import ProductTypeFilter from '../factoryOrderNew/component/ProductTypeFilter.vu ...@@ -393,7 +395,6 @@ import ProductTypeFilter from '../factoryOrderNew/component/ProductTypeFilter.vu
import { CaretBottom, CaretTop } from '@element-plus/icons-vue' import { CaretBottom, CaretTop } from '@element-plus/icons-vue'
import { normalizeProductMarkListForQuery } from '../factoryOrderNew/utils/productMarkQuery' import { normalizeProductMarkListForQuery } from '../factoryOrderNew/utils/productMarkQuery'
import FastProduction from '../components/FastProduction.vue' import FastProduction from '../components/FastProduction.vue'
import { ResultInfoDataItem } from '@/types/api/order/common'
import { ElButton } from 'element-plus' import { ElButton } from 'element-plus'
import ReceiptProductDialog from '@/views/warehouse/components/ReceiptProductDialog.vue' import ReceiptProductDialog from '@/views/warehouse/components/ReceiptProductDialog.vue'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
...@@ -412,6 +413,7 @@ import { ...@@ -412,6 +413,7 @@ import {
warehouseInfoGetAll, warehouseInfoGetAll,
} from '@/api/warehouse' } from '@/api/warehouse'
import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess' import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess'
import BigNumber from 'bignumber.js'
const cardLayoutRef = ref() const cardLayoutRef = ref()
...@@ -545,23 +547,14 @@ const completeOperationById = (_: number[], detail: Record<string, unknown>) => ...@@ -545,23 +547,14 @@ const completeOperationById = (_: number[], detail: Record<string, unknown>) =>
warehouseId: detail.warehouseId as number, warehouseId: detail.warehouseId as number,
inboundType: fastInboundType.value, inboundType: fastInboundType.value,
}) })
const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => { const handleFastProductionSuccess = () => {
const result = data[0] ElMessage.success('入库成功')
if (!result.status) {
ElMessageBox.alert(
`操作单号 ${result.factoryOrderNumber} ${result.message}`,
'提示',
{
type: 'error',
},
)
return
}
} }
const fastClose = () => { const fastClose = () => {
detailVisible.value = false detailVisible.value = false
if (fastKey.value === 'detail') return if (fastKey.value === 'detail') return
search() search()
loadOrderStatusCounts()
} }
const { const {
userMarkList, userMarkList,
...@@ -614,7 +607,10 @@ const { skuData, setCostPrice, filterSkuData } = useReceiptProductDialog({ ...@@ -614,7 +607,10 @@ const { skuData, setCostPrice, filterSkuData } = useReceiptProductDialog({
selectSku: receiptSelectSku, selectSku: receiptSelectSku,
userMarkList: receiptUserMarkList, userMarkList: receiptUserMarkList,
}) })
function mapInterskuToProduct(val: InterskuList): InterProductList { function mapInterskuToProduct(
val: InterskuList,
type: 'completeProduction' | 'embryoInStock',
): InterProductList {
const warehouseSku = val.warehouseSku || val.sku || '' const warehouseSku = val.warehouseSku || val.sku || ''
const skuNameVal = val.skuName || val.productName || '' const skuNameVal = val.skuName || val.productName || ''
let customerId: number | null = null let customerId: number | null = null
...@@ -622,6 +618,16 @@ function mapInterskuToProduct(val: InterskuList): InterProductList { ...@@ -622,6 +618,16 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
const n = Number(val.customerId) const n = Number(val.customerId)
if (!Number.isNaN(n)) customerId = n if (!Number.isNaN(n)) customerId = n
} }
if (type === 'embryoInStock') {
const operationList = cardSelectList.value.filter(
(r) => r.thirdSkuCode === val.warehouseSku,
)
val.buyStored = operationList ? operationList.length : 0
}
const amount = new BigNumber(val.buyStored ?? 0)
.multipliedBy(val.costPrice ?? 0)
.toFixed(2)
val.totalPrice = Number(amount) as number
return { return {
skuImage: val.skuImage || val.image || '', skuImage: val.skuImage || val.image || '',
warehouseSku, warehouseSku,
...@@ -630,8 +636,8 @@ function mapInterskuToProduct(val: InterskuList): InterProductList { ...@@ -630,8 +636,8 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
locationCode: val.locationCode ?? '', locationCode: val.locationCode ?? '',
locationId: val.locationId ?? null, locationId: val.locationId ?? null,
costPrice: val.costPrice ?? null, costPrice: val.costPrice ?? null,
buyStored: null, buyStored: val.buyStored ?? null,
totalPrice: null, totalPrice: val.totalPrice ?? null,
currencyName: val.currencyName ?? null, currencyName: val.currencyName ?? null,
currencyCode: val.currencyCode ?? null, currencyCode: val.currencyCode ?? null,
customerId, customerId,
...@@ -641,20 +647,40 @@ function mapInterskuToProduct(val: InterskuList): InterProductList { ...@@ -641,20 +647,40 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
} }
const handleEmbryoInStock = async () => { const handleEmbryoInStock = async () => {
if (cardSelectList.value.length !== 0) { if (cardSelectList.value.length !== 0) {
handleEmbryoInStockByCard() handleEmbryoInStockByCard('embryoInStock')
} else { } else {
handleEmbryoInFastStock(0) handleEmbryoInFastStock(0)
} }
} }
const dialogTitle = computed(() => {
return fastKey.value === 'fastReceipt'
? fastInboundType.value === 1
? '生产完成-快捷入库'
: '胚衣-快捷入库'
: '查看详情'
})
const handleEmbryoInFastStock = (inboundType: number) => { const handleEmbryoInFastStock = (inboundType: number) => {
fastInboundType.value = inboundType fastInboundType.value = inboundType
fastKey.value = 'fastReceipt' fastKey.value = 'fastReceipt'
detailVisible.value = true detailVisible.value = true
detailData.value = {} detailData.value = {}
} }
const handleEmbryoInStockByCard = async () => { const handleEmbryoInStockByCard = async (
const firstWid = cardSelectList.value[0].warehouseId type: 'completeProduction' | 'embryoInStock',
if (cardSelectList.value.some((r) => r.warehouseId !== firstWid)) { ) => {
let operationList
if (type === 'completeProduction') {
operationList = cardSelectList.value.filter((r) => r.inboundType !== 2)
if (operationList.length === 0) {
ElMessage.error('客户定制商品,不能入库!')
return
}
} else {
operationList = cardSelectList.value
}
fastInboundType.value = type === 'completeProduction' ? 1 : 0
const firstWid = operationList[0].warehouseId
if (operationList.some((r) => r.warehouseId !== firstWid)) {
return ElMessage.error('请选择相同仓库的库存SKU!') return ElMessage.error('请选择相同仓库的库存SKU!')
} }
resetReceiptEditForm() resetReceiptEditForm()
...@@ -674,8 +700,7 @@ const handleEmbryoInStockByCard = async () => { ...@@ -674,8 +700,7 @@ const handleEmbryoInStockByCard = async () => {
} }
} }
receiptEditForm.value.warehouseId = firstWid receiptEditForm.value.warehouseId = firstWid
receiptEditForm.value.warehouseName = cardSelectList.value[0] receiptEditForm.value.warehouseName = operationList[0].warehouseName as string
.warehouseName as string
const wh = warehouseList.value.find((w) => w.id == firstWid) const wh = warehouseList.value.find((w) => w.id == firstWid)
if (wh) { if (wh) {
receiptEditForm.value.warehouseName = wh.name receiptEditForm.value.warehouseName = wh.name
...@@ -685,11 +710,16 @@ const handleEmbryoInStockByCard = async () => { ...@@ -685,11 +710,16 @@ const handleEmbryoInStockByCard = async () => {
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
const skus = cardSelectList.value.map((r) => r.thirdSkuCode as string) const skus = operationList.map((r) => r.thirdSkuCode as string)
const res = await getBySkuAndUserMarkApi(firstWid, skus.join(','), null) const res =
type === 'embryoInStock'
? await getBySkuAndUserMarkApi(firstWid, skus.join(','), null)
: await getBySkuAndUserMarkAndInboundTypeApi(
operationList.map((r) => r.operationNo as string),
)
if (res.code !== 200) return if (res.code !== 200) return
otherPurchaseData.value = res.data.map((item: InterskuList) => otherPurchaseData.value = res.data.map((item: InterskuList) =>
mapInterskuToProduct(item), mapInterskuToProduct(item, type),
) )
await fetchReceiptLocationList('') await fetchReceiptLocationList('')
const listRes = await warehouseInfoGetAll() const listRes = await warehouseInfoGetAll()
...@@ -758,7 +788,17 @@ const handleReceiptSave = async () => { ...@@ -758,7 +788,17 @@ const handleReceiptSave = async () => {
} catch { } catch {
return return
} }
const arr = otherPurchaseData.value const arr = otherPurchaseData.value.map((item) => {
const operationForReclaimList = cardSelectList.value.filter((r) =>
fastInboundType.value === 1
? `${r.userMark}${r.variantSku}` === item.warehouseSku
: r.thirdSkuCode === item.warehouseSku,
)
return {
...item,
operationForReclaimList: operationForReclaimList,
}
})
if (arr.length === 0) { if (arr.length === 0) {
ElMessage.error('请至少选择一条数据') ElMessage.error('请至少选择一条数据')
return return
...@@ -780,17 +820,31 @@ const handleReceiptSave = async () => { ...@@ -780,17 +820,31 @@ const handleReceiptSave = async () => {
} }
} }
const params = { const params = {
forNewProduct: fastInboundType.value === 1,
...receiptEditForm.value, ...receiptEditForm.value,
productList: otherPurchaseData.value, productList: arr,
} }
const loading = ElLoading.service({ const loading = ElLoading.service({
text: '保存中...', text: '保存中...',
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
await addInRecordApi(params) const res = await addInRecordApi(params)
ElMessage.success('保存成功') if (res.code !== 200) return
if (res.data && Array.isArray(res.data) && res.data.length > 0) {
ElMessageBox.alert(
`操作单号: ${res.data.map((e: number) => e).join(',')}入库失败`,
'提示',
{
type: 'error',
},
)
} else {
ElMessage.success('保存成功')
}
receiptDialogVisible.value = false receiptDialogVisible.value = false
search()
loadOrderStatusCounts()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally { } finally {
...@@ -800,11 +854,7 @@ const handleReceiptSave = async () => { ...@@ -800,11 +854,7 @@ const handleReceiptSave = async () => {
const handleProductionCompleteInStock = () => { const handleProductionCompleteInStock = () => {
// 客户定制的单子不能操作生产完成入库,提示:客户定制商品,不能入库! // 客户定制的单子不能操作生产完成入库,提示:客户定制商品,不能入库!
if (cardSelectList.value.length !== 0) { if (cardSelectList.value.length !== 0) {
if (cardSelectList.value.some((r) => r.inboundType === 2)) { handleEmbryoInStockByCard('completeProduction')
ElMessage.error('客户定制商品,不能入库!')
return
}
handleEmbryoInStockByCard()
} else { } else {
handleEmbryoInFastStock(1) handleEmbryoInFastStock(1)
} }
......
...@@ -323,7 +323,7 @@ const title = computed(() => { ...@@ -323,7 +323,7 @@ const title = computed(() => {
if (props.fastKey === 'fastProduction') { if (props.fastKey === 'fastProduction') {
return '快捷生产' return '快捷生产'
} else if (props.fastKey === 'fastReceipt') { } else if (props.fastKey === 'fastReceipt') {
return '快捷入库' return props.dialogTitle
} else { } else {
return '查看详情' return '查看详情'
} }
...@@ -388,18 +388,13 @@ const props = withDefaults( ...@@ -388,18 +388,13 @@ const props = withDefaults(
downloadApi?: ( downloadApi?: (
ids: number[], ids: number[],
) => Promise<{ code?: number; message?: string }> ) => Promise<{ code?: number; message?: string }>
/** 打开弹框时「自动完成上一单」的初始勾选;默认 false,与原有 podCN 快捷生产一致 */
defaultAutoSure?: boolean defaultAutoSure?: boolean
/** 为 true 时展示「操作单号」一行,数据字段为 `operationNo`(不影响 podCN 默认) */
showOperationNoRow?: boolean showOperationNoRow?: boolean
/** 查询无数据时的提示 */
notFoundMessage?: string notFoundMessage?: string
/** 未生产完成提醒里对单号的称呼,如「生产单号」「操作单号」 */
pendingOrderLabel?: string pendingOrderLabel?: string
/** 未扫码时的提示 */
pleaseScanTip?: string pleaseScanTip?: string
/** 扫码输入为空时音频/提示文案 */
searchInputAudioTip?: string searchInputAudioTip?: string
dialogTitle?: string
}>(), }>(),
{ {
type: 0, type: 0,
...@@ -420,6 +415,7 @@ const props = withDefaults( ...@@ -420,6 +415,7 @@ 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),
dialogTitle: '',
}, },
) )
const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess']) const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess'])
...@@ -553,7 +549,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => { ...@@ -553,7 +549,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(`${props.fastKey === 'fastProduction' ? '生产完成' : '入库完成'}`)
if (len[i + 1]) { if (len[i + 1]) {
confirmQuery(len, i + 1) confirmQuery(len, i + 1)
} }
...@@ -580,7 +576,7 @@ const changeStatus = async () => { ...@@ -580,7 +576,7 @@ 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('确定生产完成?', { showConfirm(`确定${props.fastKey === 'fastProduction' ? '生产完成' : '入库完成'}?`, {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
......
...@@ -1796,13 +1796,13 @@ const operationOrderColumns = [ ...@@ -1796,13 +1796,13 @@ const operationOrderColumns = [
key: 'imageAry', key: 'imageAry',
prop: 'imageAry', prop: 'imageAry',
label: '商品图片', label: '商品图片',
minWidth: 100, minWidth: 180,
align: 'center', align: 'center',
render: (row: operateOrderListData) => { render: (row: operateOrderListData) => {
const list = parseOperationOrderImageAry(row.imageAry) const list = parseOperationOrderImageAry(row.imageAry)
if (!list.length) { if (!list.length) {
return ( return (
<div> <div style="display:flex;gap:4px;">
<el-image <el-image
src={row.variantImage} src={row.variantImage}
style="width:50px;height:50px" style="width:50px;height:50px"
......
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