Commit 888af742 by qinjianhui

Merge branch 'dev' into 'master'

Dev

See merge request !212
parents acdec884 3bbd5f32
......@@ -54,7 +54,6 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
......
......@@ -2,6 +2,7 @@ import axios from './axios'
import type { BasePaginationData, BaseRespData } from '@/types/api'
import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess'
import type { operateOrderListData } from '@/types/api/factoryOrderNew'
import { InterskuList } from '@/types/api/warehouse'
function normalizePodOrderQueryPayload(
data: Record<string, unknown>,
......@@ -20,7 +21,7 @@ function normalizePodOrderQueryPayload(
export function getCancelOrderProcessStateGroupMapApi() {
return axios.get<never, BaseRespData<CancelOrderProcessStateGroupMap>>(
'factory/podOrderOperationForReclaim/findStateGroupMap',
'factory/podOrderOperation/find-state-group-map',
)
}
......@@ -32,13 +33,13 @@ export function getCancelOrderProcessListApi(
) {
const body = normalizePodOrderQueryPayload({ ...data })
return axios.post<never, BasePaginationData<operateOrderListData>>(
'factory/podOrderOperationForReclaim/list_page',
'factory/podOrderOperation/list-page',
{ ...body, currentPage, pageSize, alreadyInStock },
)
}
export function getOperationInfoByNoApi(operationNo: string) {
return axios.get<never, BaseRespData<operateOrderListData>>(
`factory/podOrderOperationForReclaim/getByOperationNo?operationNo=${operationNo}`,
`factory/podOrderOperation/get-by-operation-no?operationNo=${operationNo}`,
)
}
export function completeDeliveryByCancelOrderProcessApi(data: {
......@@ -47,7 +48,14 @@ export function completeDeliveryByCancelOrderProcessApi(data: {
warehouseId: number
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrderOperationForReclaim/storeAfterScan',
'factory/podOrderOperation/store-after-scan',
data,
)
}
export function getBySkuAndUserMarkAndInboundTypeApi(operationNo: string[]) {
return axios.post<never, BaseRespData<InterskuList[]>>(
'factory/podOrderOperation/get-product-by-operation-no',
operationNo,
)
}
......@@ -535,6 +535,14 @@ export function completeDeliveryApi(ids: (number | string)[]) {
)
}
// 生产扫码
export function productionScanApi(id: number | string, status: string) {
return axios.get<never, BaseRespData<never>>(
'factory/podOrderOperation/scan-produce',
{ params: { id, status } },
)
}
export function applyForProductByIdApi(id: string, url: string) {
return axios.get<never, BaseRespData<operateOrderListData[]>>(url, {
params: { podProductId: id },
......@@ -550,6 +558,13 @@ export function getByOperationNoLogApi(operationNo: string) {
)
}
// 校验库存
export function checkInventoryApi(id: number | string, status: string) {
return axios.get<never, BaseRespData<never>>(
'factory/podOrderOperation/check-inventory',
{ params: { id, status } },
)
}
export function listByNoPodOrderApi(params: {
type: string
no: string
......
......@@ -394,7 +394,7 @@ export function rejectInRecordApi({
)
}
export function addInRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>(
return axios.post<never, BaseRespData<unknown>>(
'factory/warehouseInRecord/add',
{
...form,
......
......@@ -151,11 +151,11 @@ const menu: MenuItem[] = [
id: 12,
label: '工厂订单(NEW)',
},
// {
// index: '/order/cancel-order-process',
// id: 13,
// label: '取消后订单处理',
// },
{
index: '/order/cancel-order-process',
id: 13,
label: '取消后订单处理',
},
],
},
{
......
......@@ -123,6 +123,8 @@ export interface InterskuList {
remark?: string | null
currencyName?: string | null
currencyCode?: string | null
buyStored?: number | null
totalPrice?: number | null
}
export interface ILocation {
id?: number
......
......@@ -327,6 +327,7 @@
</div>
<FastProduction
v-model:detail-visible="detailVisible"
:dialog-title="dialogTitle"
:is-new-order="true"
:detail-data="detailData"
:fast-key="fastKey"
......@@ -385,6 +386,7 @@ import {
getCancelOrderProcessStateGroupMapApi,
getOperationInfoByNoApi,
completeDeliveryByCancelOrderProcessApi,
getBySkuAndUserMarkAndInboundTypeApi,
} from '@/api/cancelOrderProcess'
import type { CardLayoutListFetcher } from '@/types/api/factoryOrderNew'
import LogisticsWaySelect from '@/views/logistics/components/LogisticsWaySelect'
......@@ -393,7 +395,6 @@ import ProductTypeFilter from '../factoryOrderNew/component/ProductTypeFilter.vu
import { CaretBottom, CaretTop } from '@element-plus/icons-vue'
import { normalizeProductMarkListForQuery } from '../factoryOrderNew/utils/productMarkQuery'
import FastProduction from '../components/FastProduction.vue'
import { ResultInfoDataItem } from '@/types/api/order/common'
import { ElButton } from 'element-plus'
import ReceiptProductDialog from '@/views/warehouse/components/ReceiptProductDialog.vue'
import { useValue } from '@/utils/hooks/useValue'
......@@ -412,6 +413,7 @@ import {
warehouseInfoGetAll,
} from '@/api/warehouse'
import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess'
import BigNumber from 'bignumber.js'
const cardLayoutRef = ref()
......@@ -545,23 +547,14 @@ const completeOperationById = (_: number[], detail: Record<string, unknown>) =>
warehouseId: detail.warehouseId as number,
inboundType: fastInboundType.value,
})
const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => {
const result = data[0]
if (!result.status) {
ElMessageBox.alert(
`操作单号 ${result.factoryOrderNumber} ${result.message}`,
'提示',
{
type: 'error',
},
)
return
}
const handleFastProductionSuccess = () => {
ElMessage.success('入库成功')
}
const fastClose = () => {
detailVisible.value = false
if (fastKey.value === 'detail') return
search()
loadOrderStatusCounts()
}
const {
userMarkList,
......@@ -614,7 +607,10 @@ const { skuData, setCostPrice, filterSkuData } = useReceiptProductDialog({
selectSku: receiptSelectSku,
userMarkList: receiptUserMarkList,
})
function mapInterskuToProduct(val: InterskuList): InterProductList {
function mapInterskuToProduct(
val: InterskuList,
type: 'completeProduction' | 'embryoInStock',
): InterProductList {
const warehouseSku = val.warehouseSku || val.sku || ''
const skuNameVal = val.skuName || val.productName || ''
let customerId: number | null = null
......@@ -622,6 +618,16 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
const n = Number(val.customerId)
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 {
skuImage: val.skuImage || val.image || '',
warehouseSku,
......@@ -630,8 +636,8 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
locationCode: val.locationCode ?? '',
locationId: val.locationId ?? null,
costPrice: val.costPrice ?? null,
buyStored: null,
totalPrice: null,
buyStored: val.buyStored ?? null,
totalPrice: val.totalPrice ?? null,
currencyName: val.currencyName ?? null,
currencyCode: val.currencyCode ?? null,
customerId,
......@@ -641,20 +647,40 @@ function mapInterskuToProduct(val: InterskuList): InterProductList {
}
const handleEmbryoInStock = async () => {
if (cardSelectList.value.length !== 0) {
handleEmbryoInStockByCard()
handleEmbryoInStockByCard('embryoInStock')
} else {
handleEmbryoInFastStock(0)
}
}
const dialogTitle = computed(() => {
return fastKey.value === 'fastReceipt'
? fastInboundType.value === 1
? '生产完成-快捷入库'
: '胚衣-快捷入库'
: '查看详情'
})
const handleEmbryoInFastStock = (inboundType: number) => {
fastInboundType.value = inboundType
fastKey.value = 'fastReceipt'
detailVisible.value = true
detailData.value = {}
}
const handleEmbryoInStockByCard = async () => {
const firstWid = cardSelectList.value[0].warehouseId
if (cardSelectList.value.some((r) => r.warehouseId !== firstWid)) {
const handleEmbryoInStockByCard = async (
type: 'completeProduction' | 'embryoInStock',
) => {
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!')
}
resetReceiptEditForm()
......@@ -674,8 +700,7 @@ const handleEmbryoInStockByCard = async () => {
}
}
receiptEditForm.value.warehouseId = firstWid
receiptEditForm.value.warehouseName = cardSelectList.value[0]
.warehouseName as string
receiptEditForm.value.warehouseName = operationList[0].warehouseName as string
const wh = warehouseList.value.find((w) => w.id == firstWid)
if (wh) {
receiptEditForm.value.warehouseName = wh.name
......@@ -685,11 +710,16 @@ const handleEmbryoInStockByCard = async () => {
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const skus = cardSelectList.value.map((r) => r.thirdSkuCode as string)
const res = await getBySkuAndUserMarkApi(firstWid, skus.join(','), null)
const skus = operationList.map((r) => r.thirdSkuCode as string)
const res =
type === 'embryoInStock'
? await getBySkuAndUserMarkApi(firstWid, skus.join(','), null)
: await getBySkuAndUserMarkAndInboundTypeApi(
operationList.map((r) => r.operationNo as string),
)
if (res.code !== 200) return
otherPurchaseData.value = res.data.map((item: InterskuList) =>
mapInterskuToProduct(item),
mapInterskuToProduct(item, type),
)
await fetchReceiptLocationList('')
const listRes = await warehouseInfoGetAll()
......@@ -758,7 +788,17 @@ const handleReceiptSave = async () => {
} catch {
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) {
ElMessage.error('请至少选择一条数据')
return
......@@ -780,17 +820,31 @@ const handleReceiptSave = async () => {
}
}
const params = {
forNewProduct: fastInboundType.value === 1,
...receiptEditForm.value,
productList: otherPurchaseData.value,
productList: arr,
}
const loading = ElLoading.service({
text: '保存中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
await addInRecordApi(params)
ElMessage.success('保存成功')
const res = await addInRecordApi(params)
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
search()
loadOrderStatusCounts()
} catch (e) {
console.error(e)
} finally {
......@@ -800,11 +854,7 @@ const handleReceiptSave = async () => {
const handleProductionCompleteInStock = () => {
// 客户定制的单子不能操作生产完成入库,提示:客户定制商品,不能入库!
if (cardSelectList.value.length !== 0) {
if (cardSelectList.value.some((r) => r.inboundType === 2)) {
ElMessage.error('客户定制商品,不能入库!')
return
}
handleEmbryoInStockByCard()
handleEmbryoInStockByCard('completeProduction')
} else {
handleEmbryoInFastStock(1)
}
......
......@@ -13,7 +13,7 @@
>
<template #header>
<div class="title">
<span>播种墙配货</span>
<span>{{ isNewOrder ? '配货打单' : '播种墙配货' }}</span>
<span v-if="socketConnect === 'online'" class="online">[在线]</span>
<span v-else class="offline">[离线]</span>
<ElButton
......@@ -169,7 +169,17 @@
>
{{ podOrderDetailsData?.pickingNumber }}
</div>
<span style="font-size: 30px">件商品</span>
<span
v-if="
podOrderDetailsData?.pickingNumber != null &&
podOrderDetailsData?.purchaseNumber != null &&
podOrderDetailsData.pickingNumber ===
podOrderDetailsData.purchaseNumber
"
style="font-size: 30px"
>件已配齐</span
>
<span v-else style="font-size: 30px">件商品</span>
</div>
<div v-else class="box-top-item-box-index-text">
单件商品<span style="color: rgb(0, 255, 0)">(配齐)</span
......@@ -288,6 +298,7 @@ import socket from '@/utils/websocket'
import { WarehouseListData } from '@/types/index'
import { filePath } from '@/api/axios.ts'
import { ElButton, ElIcon, ElTag } from 'element-plus'
import { BaseRespData } from '@/types/api'
const { getCLodop } = useLodop()
......@@ -793,6 +804,7 @@ const getPackingData = async (code: string) => {
}
}
const res = await getPackingDataApi(url, params)
if (res.code !== 200) {
ElMessage.warning(res.message)
isLock.value = false
......@@ -829,7 +841,24 @@ const getPackingData = async (code: string) => {
// }
} catch (error) {
console.log(error)
const err = error as BaseRespData<{
inventory: number
producingQuantity: number
availableInventory: number
thirdSkuCode?: string
}>
if (props.isNewOrder && err?.code === 301) {
loading.close()
await ElMessageBox.alert(
`${err.data?.thirdSkuCode}库存不足,无法进入生产!请联系仓库管理人员核对库存。<br/>
库存数量:${err.data?.inventory},生产中的数量:${err.data?.producingQuantity}<span style="color: red">可调配库存:${err.data?.availableInventory}</span>`,
'提示',
{
type: 'warning',
dangerouslyUseHTMLString: true,
},
)
}
} finally {
isLock.value = false
productionOrder.value = ''
......@@ -1394,7 +1423,7 @@ const reconnectWebSocket = async () => {
font-size: 60px;
color: red;
text-align: center;
width: 120px;
width: 80px;
font-weight: 600;
}
.box-top-item-box-index-text {
......@@ -1406,7 +1435,7 @@ const reconnectWebSocket = async () => {
color: red;
display: inline-block;
text-align: center;
width: 90px;
width: 80px;
font-weight: 600;
}
.box-top-item-status {
......
......@@ -7,13 +7,6 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
import compression from 'vite-plugin-compression'
export default defineConfig({
base: '/',
server:{
proxy: {
'/api/': {
target: 'http://172.16.17.244:8060',
},
},
},
plugins: [
vue(),
......
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