Commit 6d3b965d by wuqian

new-pod-cn

parent cc6f038d
......@@ -8,6 +8,7 @@ import {
WarehouseListData,
LogisticsData,
ExportParams,
IconfirmSubmit
} from '@/types/api/podCnOrder'
import { InterceptStateGroupData } from '@/types/api/podUsOrder'
import axios from './axios'
......@@ -32,6 +33,24 @@ export function syncReceiverAddress(data: number[]) {
data,
)
}
export function getPackingCnDataApi(
code: string,
factoryNo: number,
box: number | null,
warehouseId: number | string,
) {
return axios.get<never, BaseRespData<PodMakeOrderData>>(
'/factory/podJomallOrderCn/getPodBoxDetailsBySkuOrNo',
{
params: {
podJomallCnNo: code,
box,
factoryNo,
warehouseId,
},
},
)
}
export function refreshAddressApi(idList: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderCn/syncReceiverAddress',
......@@ -382,10 +401,10 @@ export function replenishmentSuccessApi(data: number[]) {
)
}
//确认生产
export function confirmProductApi(orderIds: (string | number)[]) {
export function confirmProductApi(data:IconfirmSubmit) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/confirmProduct`,
orderIds,
data,
)
}
export function toOutOfStockApi(ids: number[]) {
......@@ -450,6 +469,14 @@ export function batchDownloadRecomposingApi(params: { id: number }) {
},
)
}
export function batchDownloadCnRecomposingApi(params: { id: number }) {
return axios.get<never, BaseRespData<never>>(
`factory/podBatchDownload/reCnComposingDesignImages`,
{
params,
},
)
}
// 生产完成
export function updateToWaitShipmentApi(params: {
cnUpdateParams: Array<{
......@@ -515,7 +542,7 @@ export function updateSelfLogistics(params: {
id?: string
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/updateSelfLogistics',
'factory/podJomallOrderCn/updateSelfLogistics',
params,
)
}
......
import { defineStore } from 'pinia'
import {
OrderData,
PodMakeOrderData,
ProductList,
} from '@/types/api/podMakeOrder'
import { getPodBoxListApi } from '@/api/podCnOrder'
export interface OrderStoreState {
podBoxList?: PodMakeOrderData[]
podBoxIndex?: number | null
socketConnect?: string
}
const useOrderStore = defineStore('order', {
state: () => {
return {
podBoxList: [],
podBoxIndex: null,
socketConnect: '',
} as OrderStoreState
},
actions: {
async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null
factoryNo: number | string
warehouseId: number | string
box?: number
data?: OrderData
}) {
const { factoryNo, warehouseId, boxList, box, data } = content
if (Array.isArray(boxList)) {
this.podBoxList = boxList
} else {
const index = this.podBoxList?.findIndex((item) => item.box === box)
if (index === -1) {
try {
const res = await getPodBoxListApi(factoryNo, warehouseId)
const boxList = res.data.map((item) => {
if (res.data) {
const productList = item?.data?.productList || []
const pickingNumber = productList.reduce(
(prev: number, item1: ProductList) => {
if (item1.count) {
return prev + item1.count
}
return prev
},
0,
)
if (item.data) {
item.data.pickingNumber = pickingNumber
}
}
return item
})
this.podBoxList = boxList
this.podBoxIndex = box
} catch (error) {
console.error(error)
}
} else if (box !== 0 && box !== undefined) {
const arr = this.podBoxList
if (arr) {
arr[box - 1] = {
box,
data: data || boxList || null,
}
}
this.podBoxList = arr
this.podBoxIndex = box
}
}
},
// 清空所有箱子
clearPodBoxList() {
this.podBoxList = []
},
// 设置当前箱子
setPodBox(box: number) {
this.podBoxIndex = box
},
// 清空当前箱子
clearPodBox() {
this.podBoxIndex = null
},
setSocketConnect(connect: string) {
this.socketConnect = connect
},
},
})
export default useOrderStore
......@@ -66,7 +66,6 @@ const useOrderStore = defineStore('order', {
data: data || boxList || null,
}
}
console.log('222arr1111', arr)
this.podBoxList = arr
this.podBoxIndex = box
}
......
......@@ -3,6 +3,11 @@ export interface Tab {
statusName?: string
quantity?: number
}
export interface IconfirmSubmit {
ids: string
warehouseId: number | null
warehouseName: string
}
export interface ExportParams extends SearchForm {
idList?: number[]
exportAll: boolean
......@@ -32,6 +37,8 @@ export interface SearchForm {
batchArrangeNumber?: string
craftCode?: string
thirdStockSku?: string
exceptionHandling?: number | undefined
interceptStatus?: number | string
}
export interface PodCnOrderListData {
id: number
......@@ -122,7 +129,9 @@ export interface ProductList {
isReplenishment?: boolean
thirdSkuCode?: string | null
supplierProductNo?: string | null
userMark?: string | null
replenishmentSumNum?: number | null
interceptStatus?: number | null
batchArrangeNumber?: string | null
}
export interface cardImages {
......
......@@ -45,5 +45,6 @@ export interface ProductList {
power?: boolean
variantImage?: string
podJomallUsNo?: string
podJomallCnNo?: string
previewImgs?: { sort: string | number; title: string; url: string }[]
}
import { getWsUrl } from '../api/axios'
import useOrderStore from '../store/cnOrder'
interface NotificationOptions {
body: string
icon: string
data: string
requireInteraction: boolean
}
export interface WebSocketMessage {
code?: string
content?: string
type?: string
data?: unknown
[key: string]: string | unknown | undefined
}
interface InitOptions {
account: string
factoryNo: string
}
type MessageCallback = (
data: WebSocketMessage,
sendSystemMessage: (msg: string) => void,
) => void
type OpenCallback = () => void
function sendSystemMessage(msg: string): void {
if (window.Notification && Notification.permission === 'granted') {
const notificationOptions: NotificationOptions = {
body: msg,
icon: './favicon.ico',
data: 'I like peas.',
requireInteraction: true,
}
const n = new Notification('消息通知', notificationOptions)
n.onclick = (event: Event) => {
event.preventDefault()
window.open('/home', '_blank')
}
setTimeout(() => {
n.close()
}, 10000)
}
}
const showReconnectingMsg = (): void => {
ElMessageBox.alert('消息服务已断开,正在重新连接,请稍候', {
showClose: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
}
class Im {
private socket: WebSocket | null = null
private _wsUrl: string = ''
// private userId: string = ''
private _onMessageCallback?: MessageCallback
private _onOpenCallback?: OpenCallback
private _heartbeatTimer: number | null = null
private _heartbeatTimeoutTimer: number | null = null
private _reconnectingTimer: number | null = null
private num: number = 0
constructor() {
this._onWsOpen = this._onWsOpen.bind(this)
this._onWsMessage = this._onWsMessage.bind(this)
this._onWsClose = this._onWsClose.bind(this)
this._onWsError = this._onWsError.bind(this)
}
private _onWsOpen(): void {
console.log('服务器连接成功')
localStorage.setItem('socket_connect', 'online')
this._onOpenCallback?.()
this._startHeartbeat()
}
private _onWsMessage(event: MessageEvent): void {
let data: WebSocketMessage = {}
if (typeof event.data === 'string') {
try {
data = JSON.parse(event.data)
} catch (error) {
data = {}
}
}
this._onHeartbeatMessage()
this._onMessageCallback?.(data, sendSystemMessage)
}
private _onWsClose(): void {
console.log('服务器关闭')
this._destroyWebSocket(true)
}
private _onWsError(): void {
console.log('连接出错')
this._destroyWebSocket(true)
}
private _sendHeartbeat(): void {
if (!this.socket) return
this.send({ code: 'HEALTH' })
if (this._heartbeatTimeoutTimer) {
window.clearTimeout(this._heartbeatTimeoutTimer)
}
this._heartbeatTimeoutTimer = window.setTimeout(() => {
this._destroyWebSocket(true)
}, 5 * 1000)
}
private _onHeartbeatMessage(): void {
console.log('心跳')
useOrderStore().setSocketConnect('online')
if (this._heartbeatTimeoutTimer) {
window.clearTimeout(this._heartbeatTimeoutTimer)
}
}
private _startHeartbeat(): void {
this._stopHeartbeat()
this._sendHeartbeat()
this._heartbeatTimer = window.setInterval(
() => this._sendHeartbeat(),
10 * 1000,
)
}
private _stopHeartbeat(): void {
if (this._heartbeatTimer) {
window.clearInterval(this._heartbeatTimer)
}
if (this._heartbeatTimeoutTimer) {
window.clearTimeout(this._heartbeatTimeoutTimer)
}
}
private _scheduleReconnect(): void {
if (!this.num) this.num = 0
this.num++
if (this.num > 5) {
ElMessageBox.alert('尝试重连消息服务失败,请刷新重试')
return
}
showReconnectingMsg()
this._reconnectingTimer = window.setTimeout(() => {
this._createWebSocket()
}, 2000)
}
private _destroyWebSocket(reconnect?: boolean): void {
if (!this.socket) return
this._stopHeartbeat()
if (this._reconnectingTimer) {
window.clearTimeout(this._reconnectingTimer)
}
this.socket.removeEventListener('open', this._onWsOpen)
this.socket.removeEventListener('message', this._onWsMessage)
this.socket.removeEventListener('close', this._onWsClose)
this.socket.removeEventListener('error', this._onWsError)
this.socket.close(1000)
this.socket = null
localStorage.removeItem('socket_connect')
useOrderStore().setSocketConnect('offline')
if (reconnect) this._scheduleReconnect()
}
private _createWebSocket(): void {
if (!this._wsUrl) return
const socket = new WebSocket(this._wsUrl)
socket.addEventListener('open', this._onWsOpen)
socket.addEventListener('message', this._onWsMessage)
socket.addEventListener('close', this._onWsClose)
socket.addEventListener('error', this._onWsError)
this.socket = socket
}
init(
options: InitOptions,
msgfunc?: MessageCallback,
openfunc?: OpenCallback,
): Promise<void> {
return new Promise((resolve, reject) => {
const { account, factoryNo } = options
const socket_connect = localStorage.getItem('socket_connect')
if (socket_connect === 'online') {
resolve()
return
}
if (!window.WebSocket) {
reject(new Error('WebSocket is not supported'))
return
}
this._onMessageCallback = msgfunc
this._onOpenCallback = () => {
openfunc?.()
resolve()
}
this._destroyWebSocket()
this._wsUrl = `${getWsUrl()}/ws/websocket/${factoryNo}/${account}`
this._createWebSocket()
})
}
send(options: WebSocketMessage): void {
this.socket?.send(JSON.stringify(options))
}
close(): void {
this._destroyWebSocket()
}
}
export default new Im()
......@@ -227,17 +227,18 @@ import {
PodMakeOrderData,
ProductList,
} from '@/types/api/podMakeOrder'
import useOrderStore from '@/store/order'
import useOrderStore from '@/store/cnOrder'
import {
getPackingCnDataApi,
clearBoxApi,
clearAllBoxApi,
getPackingDataApi,
getPodBoxListApi,
submitInspectionApi,
} from '@/api/podUsOrder'
} from '@/api/podCnOrder'
import useUserStore from '@/store/user'
import { Check } from '@element-plus/icons-vue'
import socket from '@/utils/websocket'
import socket from '@/utils/cnWebsocket'
import { WarehouseListData } from '@/types/api/podUsOrder'
const { getCLodop } = useLodop()
......@@ -272,7 +273,7 @@ const podOrderDetailsColumns = computed(() => [
},
{
label: '生产单号',
prop: 'podJomallUsNo',
prop: 'podJomallCnNo',
width: 150,
align: 'center',
},
......@@ -326,9 +327,17 @@ watch(visible, async (value: boolean) => {
if (value) {
podOrderDetailsData.value = {}
currentCode = ''
warehouseId.value = props.warehouseList[0].id
_warehouseId.value = props.warehouseList[0].id
// warehouseId.value = props.warehouseList[0].id
// _warehouseId.value = props.warehouseList[0].id
const locaclWarehouseId = sessionStorage.getItem('locaclCnWarehouseId')
// 设置仓库ID,优先使用本地存储的值,否则使用列表中的第一个仓库
warehouseId.value = locaclWarehouseId
? JSON.parse(locaclWarehouseId)
: props.warehouseList[0].id
_warehouseId.value = locaclWarehouseId
? JSON.parse(locaclWarehouseId)
: props.warehouseList[0].id
if (userStore.user?.factory.id) {
try {
await socket.init(
......@@ -367,6 +376,7 @@ watch(boxIndex, (value: number | null) => {
if (value) {
const bool = !boxChange.value
boxChange.value = false
console.log('boxChange', bool, value)
renderItemBox(bool)
}
})
......@@ -440,15 +450,14 @@ const renderItemBox = (bool: boolean) => {
if (currentCode) {
const parts = currentCode.split('_')
currentCode =
parts.length > 3 && parts[3].startsWith('USPSC')
parts.length > 3 && parts[3].startsWith('CNPSC')
? parts[3]
: parts.length > 1
? parts[1]
: parts[0]
for (const product of productList) {
if (product.podJomallUsNo === currentCode) {
if (product.podJomallCnNo === currentCode) {
coverImage.value = product.previewImgs?.[0]?.url || ''
console.log(441, coverImage.value)
nextTick(() => {
tableRef.value?.setCurrentRow(product)
......@@ -460,7 +469,6 @@ const renderItemBox = (bool: boolean) => {
}
podOrderDetailsData.value = data
if (productList.every((item) => item.power)) {
print(data, false, () => {
renderLock = false
......@@ -473,7 +481,7 @@ const messageChange = (data: WebSocketMessage) => {
if (!data) return
const { code, ...more } = data
if (code === 'POD_PRINT_ORDER') {
if (code === 'FACTORY_POD_CN_PRINT_ORDER') {
try {
if (typeof more.txt === 'string') {
console.log(
......@@ -571,7 +579,7 @@ const getPackingData = async (code: string) => {
productionOrder.value = ''
return
}
const res = await getPackingDataApi(
const res = await getPackingCnDataApi(
code,
factoryNo,
boxIndex.value,
......@@ -584,7 +592,6 @@ const getPackingData = async (code: string) => {
return
}
const { box } = res.data
console.log('box', box)
if (box) {
boxIndex.value = box
......@@ -748,6 +755,7 @@ const handleClose = (done: () => void) => {
})
}
const onClose = () => {
// orderStore.clearPodBox()
emit('refresh')
}
// 下一步
......
......@@ -2,7 +2,7 @@
<el-dialog
title="处理结果"
v-model="resultDialog"
width="600px"
width="60%"
:close-on-click-modal="false"
@closed="closedFn"
>
......@@ -128,6 +128,7 @@ const copyAllCode = (field: string) => {
function closedFn() {
if (key === 'stockOut') return
emits('confirm', selectedList.value)
}
// 监听弹窗状态
......
<script setup lang="ts">
import { defineModel } from 'vue'
import { updateAddressApi } from '@/api/podUsOrder.ts'
import {AddressInfo} from '@/types/api/podUsOrder.ts'
import { updateAddressApi } from '@/api/podCnOrder.ts'
import {AddressInfo} from '@/types/api/podCnOrder.ts'
const emits = defineEmits(['success'])
defineProps<{
......
......@@ -8,7 +8,7 @@
v-model="searchForm.warehouseId"
clearable
filterable
placeholder="请输入"
placeholder="请选择"
style="width: 150px"
>
<el-option
......@@ -71,7 +71,7 @@
</ElFormItem>
<ElFormItem label="款号">
<ElInput
v-model="searchForm.supplierProductNo"
v-model.trim="searchForm.supplierProductNo"
placeholder="款号"
clearable
style="width: 150px"
......@@ -79,7 +79,7 @@
</ElFormItem>
<ElFormItem label="批次号">
<ElInput
v-model="searchForm.batchArrangeNumber"
v-model.trim="searchForm.batchArrangeNumber"
placeholder="批次号"
clearable
style="width: 150px"
......@@ -87,7 +87,7 @@
</ElFormItem>
<ElFormItem label="生产单号">
<ElInput
v-model="searchForm.factorySubOrderNumber"
v-model.trim="searchForm.factorySubOrderNumber"
placeholder="生产单号"
clearable
style="width: 150px"
......@@ -95,7 +95,7 @@
</ElFormItem>
<ElFormItem label="店铺单号">
<ElInput
v-model="searchForm.shopNumber"
v-model.trim="searchForm.shopNumber"
placeholder="店铺单号"
clearable
style="width: 150px"
......@@ -306,7 +306,7 @@
转至待确认
</ElButton>
</span>
<span v-if="status === 'CREATE_LOGISTICS'" class="item">
<span v-if="status === 'EXCEPTION_ORDER'&&exceptionStatus === 3" class="item">
<ElButton type="warning" @click="asyncOrderAddress">
同步收货地址
</ElButton>
......@@ -408,8 +408,14 @@
>
</ElDropdownMenu>
</template> -->
<template #dropdown v-if="shipmentArea === 1">
<!-- 代发:0.自有物流 1.工厂物流; 不代发: 0.自提 1.快递-->
<template
v-if="
(status === 'CREATE_LOGISTICS' && shipmentArea === 1) ||
status === 'WAIT_SHIPMENT'
"
#dropdown
>
<ElDropdownMenu>
<ElDropdownItem
:disabled="
......@@ -488,7 +494,7 @@
拦截失败
</ElButton>
</span>
<span
<!-- <span
v-if="
status === 'TO_BE_CONFIRMED' ||
status === 'PICKING' ||
......@@ -501,7 +507,7 @@
<ElButton type="success" @click="refreshMaterial">
刷新素材
</ElButton>
</span>
</span> -->
<span
v-if="
[
......@@ -512,6 +518,7 @@
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
'TO_BE_ARRANGE',
'WAIT_SHIPMENT',
].includes(status)
"
class="item"
......@@ -575,7 +582,10 @@
</template>
</ElDropdown>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<span
v-if="['WAIT_TRACK', 'COMPLETE', 'IN_TRANSIT'].includes(status)"
class="item"
>
<ElButton type="warning" @click="statusPush">状态推送</ElButton>
</span>
<span v-if="status === 'COMPLETE'" class="item">
......@@ -743,13 +753,32 @@
<TableView
ref="tableRef"
:columns="tableColumns"
:serial-numberable="true"
:selectionable="true"
:paginated-data="tableData"
:cell-style="onCellStyle"
:row-style="getRowStyle"
@selection-change="handleSelectionChange"
>
<template #serialNumber="{ row, index }">
<div>
<el-tooltip
v-if="
status !== 'INTERCEPTED' &&
(row.interceptStatus == 0 || row.interceptStatus == 2)
"
effect="light"
:content="
row.interceptStatus == 0
? '订单已提交至生产拦截申请'
: '订单已提交至发货拦截申请'
"
placement="bottom"
>
<el-icon color="#E6A23C"><InfoFilled /></el-icon>
</el-tooltip>
<span class="serial-number">{{ index + 1 }}</span>
</div>
</template>
<template #goods="{ row }">
<div class="goods-info-box">
<div class="goods-list">
......@@ -906,27 +935,33 @@
</div>
<div class="goods-item-info">
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">价格:</span>
<span class="goods-item-info-item-label">价格:</span>
<span class="goods-item-info-item-value">
{{ item.productPrice }}(¥)
{{ item.productPrice }}
</span>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">模板金额:</span>
<span class="goods-item-info-item-label"
>模板金额¥:</span
>
<span class="goods-item-info-item-value">
{{ item.templatePrice }}(¥)
{{ item.templatePrice }}
</span>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">工艺金额:</span>
<span class="goods-item-info-item-label"
>工艺金额¥:</span
>
<span class="goods-item-info-item-value">
{{ item.craftPrice }}(¥)
{{ item.craftPrice }}
</span>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">付款金额:</span>
<span class="goods-item-info-item-label"
>付款金额¥:</span
>
<span class="goods-item-info-item-value">
{{ item.payAmount }}(¥)
{{ item.payAmount }}
</span>
</div>
......@@ -1024,6 +1059,7 @@
</el-icon>
</div>
<div class="order-detail-item">
<!-- 是否代发 0.否 1.是 -->
<span class="order-detail-item-label">是否代发:</span>
<span
style="color: red; font-weight: 500"
......@@ -1038,11 +1074,22 @@
style="color: red; font-weight: 500"
class="order-detail-item-value"
>
{{ ['自有物流', '工厂物流'][row.shipmentType] }}
{{
row.replaceShipment === 1
? ['自有物流', '工厂物流'][row.shipmentType]
: ['自提', '快递'][row.shipmentType]
}}
</span>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">物流跟踪号:</span>
<span class="order-detail-item-label">
<!-- 自提时叫 取货码-->
{{
row.replaceShipment === 0 && row.shipmentType === 0
? '取货码:'
: '物流跟踪号:'
}}</span
>
<span class="order-detail-item-value">
<el-button
type="primary"
......@@ -1065,18 +1112,6 @@
</span>
</div>
<div
v-if="row.status !== 'TO_BE_CONFIRMED'"
class="order-detail-item"
>
<span class="order-detail-item-label">生产端:</span>
<span
class="order-detail-item-value"
:title="row.productionClient"
>
{{ row.productionClient }}
</span>
</div>
<div
v-if="
row.productionClient === 'JOMALL' &&
row.status !== 'TO_BE_CONFIRMED'
......@@ -1136,6 +1171,12 @@
class="order-detail-item-value"
:title="row.lanshouAddress"
>
<!-- {{
row.receiverCountry +
row.receiverProvince +
row.receiverCity +
row.receiverAddress1
}} -->
{{ row.lanshouAddress }}
</span>
</div>
......@@ -1144,9 +1185,9 @@
<template #price="{ row }">
<div class="order-price-box">
<div class="order-price-item">
<span class="order-price-item-label">商品总价:</span>
<span class="order-price-item-label">商品总价</span>
<span class="order-price-item-value">
{{ row.totalAmount }}(¥)
{{ row.totalAmount }}
</span>
</div>
......@@ -1154,9 +1195,9 @@
v-if="row.status !== 'TO_BE_CONFIRMED'"
class="order-price-item"
>
<span class="order-price-item-label">物流运费:</span>
<span class="order-price-item-label">物流运费</span>
<span class="order-price-item-value">
{{ row.payFreight }}(¥)
{{ row.payFreight || 0 }}
</span>
</div>
</div>
......@@ -1306,6 +1347,7 @@
</span> -->
<span
v-if="
row.replaceShipment === 1 &&
row.shipmentType === 0 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status)
"
......@@ -1328,8 +1370,11 @@
</span>
<span
v-if="
row.shipmentType === 0 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status)
(row.replaceShipment === 1 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status)) ||
(row.replaceShipment === 0 &&
row.shipmentType === 1 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status))
"
class="operate-item"
>
......@@ -1367,6 +1412,23 @@
:image-field="'variantImage'"
@contextmenu.prevent="(v: MouseEvent) => rightClick(v)"
>
<template #top_left>
<el-tooltip
v-if="
cardItem.interceptStatus == 0 ||
cardItem.interceptStatus == 2
"
effect="light"
:content="
cardItem.interceptStatus == 0
? '订单已提交至生产拦截申请'
: '订单已提交至发货拦截申请'
"
placement="bottom"
>
<el-icon color="#E6A23C"><InfoFilled /></el-icon>
</el-tooltip>
</template>
<template
#top_right
v-if="['ZPZY', 'CXZY', 'THZY'].includes(cardItem.craftCode as string)"
......@@ -1451,6 +1513,42 @@
/>
</div>
</div>
<div class="flex-row">
<el-tooltip
class="item"
effect="dark"
:content="'用户编码: ' + cardItem?.userMark"
placement="bottom"
>
<span
style="
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
display: inline-block;
"
@click.stop="copy(String(cardItem?.userMark || ''))"
>
{{ cardItem?.userMark }}
</span>
</el-tooltip>
<b
v-if="cardItem"
:style="{
color:
(Number(cardItem.customizedQuantity) || 0) > 1
? 'red'
: '#67C23A',
}"
>
{{
(Number(cardItem.customizedQuantity) || 0) > 1
? '多'
: '单'
}}
</b>
</div>
</div>
</template>
<template #info>
......@@ -1756,6 +1854,40 @@
</template>
</el-dialog>
<el-dialog
v-model="confirmManuShow"
:close-on-click-modal="false"
title="确认生产"
width="40%"
>
<el-form
ref="confirmFormRef"
:model="confirmForm"
label-width="120px"
:rules="confirmRules"
>
<el-form-item label="仓库" prop="warehouseId">
<ElSelect
v-model="confirmForm.warehouseId"
clearable
filterable
placeholder="请选择仓库"
style="width: 80%"
>
<el-option
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</ElSelect>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="confirmManuShow = false">取消</el-button>
<el-button type="primary" @click="confirmSubmit">确定</el-button>
</template>
</el-dialog>
<el-dialog
v-model="logVisible"
title="操作日志"
width="1000px"
......@@ -1776,6 +1908,7 @@
:print-order="printOrder"
:warehouse-list="warehouseList"
@set-printer="handlePrinterChange"
@set-warehouseId="handleWarehouseIdChange"
@refresh="onFastRefresh"
/>
<ElDialog
......@@ -1832,7 +1965,57 @@
:country-list="countryList"
@success="search"
></UpdateAddress>
<el-dialog
v-model="logisticsVisible"
:close-on-click-modal="false"
width="700px"
title="更新物流信息"
>
<el-form
v-if="logisticsVisible"
ref="logisticsFormRef"
label-width="100px"
label-position="left"
:model="logisticsForm"
>
<el-form-item prop="processNumber" label="物流处理号">
<el-input
v-model="logisticsForm.processNumber"
placeholder="请输入物流处理号"
clearable
></el-input>
</el-form-item>
<el-form-item prop="trackingNumber" label="物流跟踪号">
<el-input
v-model="logisticsForm.trackingNumber"
placeholder="请输入物流跟踪号"
clearable
></el-input>
</el-form-item>
<el-form-item
v-if="logisticsForm.trackingNumber"
prop="expressSheetUrl"
label="物流面单"
>
<el-upload accept=".pdf" action="" :before-upload="expressSheetUpload">
<el-button type="primary">点击上传</el-button>
</el-upload>
<div v-if="logisticsForm.expressSheet" class="file">
<span>{{ logisticsForm.expressSheet.name }}</span>
<el-icon
class="expressSheetClose"
@click="logisticsForm.expressSheet = null"
>
<Close></Close>
</el-icon>
</div>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="logisticsVisible = false">取消</el-button>
<el-button type="primary" @click="logisticsSubmit"> 确定</el-button>
</template>
</el-dialog>
<!-- 导出 -->
<ElDialog
v-model="exportVisible"
......@@ -1922,6 +2105,7 @@
import { getUserMarkList } from '@/api/common'
// import { AnyObject } from '@/types/api/warehouse'
import {
InfoFilled,
CaretBottom,
CaretTop,
ArrowDown,
......@@ -1944,7 +2128,6 @@ import {
toBePickingApi,
loadWarehouseListApi,
getLogisticsCalculation,
refreshMaterialApi,
refreshProductInformationApi,
composingDesignImages,
updateLogisticsToArrangeApi,
......@@ -1959,7 +2142,7 @@ import {
batchDownloadApi,
batchDownloadDownloadApi,
batchDownloadDeleteApi,
batchDownloadRecomposingApi,
batchDownloadCnRecomposingApi,
updateToWaitShipmentApi,
exportPodCnInfo,
createLogisticsOrdersApi,
......@@ -1973,6 +2156,8 @@ import {
rejectToApi,
statusPushApi,
completeDeliveryApi,
updateSelfLogistics,
uploadExpressSheet,
} from '@/api/podCnOrder'
import { BaseRespData } from '@/types/api'
......@@ -2098,6 +2283,7 @@ const submitExportForm = async () => {
const updateAddVisible = ref(false)
const initPageSize = ref(50)
const logisticsVisible = ref(false)
const logisticsFormRef = ref()
const logistics = {
processNumber: '',
trackingNumber: '',
......@@ -2666,7 +2852,7 @@ const handleReComposingDesign = async (row: PodCnOrderListData) => {
reComposingLoadingMap[row.id] = true
try {
const res = await batchDownloadRecomposingApi({ id: row.id })
const res = await batchDownloadCnRecomposingApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success(res.message)
search()
......@@ -2751,6 +2937,13 @@ const tableColumns = computed(() => {
}
return [
{
label: '序号',
prop: 'serialNumber',
slot: 'serialNumber',
width: 60,
align: 'center',
},
{
label: '商品',
prop: 'goods',
slot: 'goods',
......@@ -2763,7 +2956,7 @@ const tableColumns = computed(() => {
width: 300,
},
{
label: '单价',
label: '订单金额(¥)',
slot: 'price',
width: 160,
prop: 'price',
......@@ -2855,6 +3048,10 @@ const asyncOrderAddress = async () => {
const changeTab = (item: Tab) => {
status.value = item.status || ''
localStorage.setItem('podCnStatus', item.status as string)
// 如果切换到INTERCEPTED状态,设置默认的exceptionStatus
if (item.status === 'INTERCEPTED' && !interceptCurrent.value) {
interceptCurrent.value = 1
}
selection.value = []
cardSelection.value = []
stockOutSuccessIds.value = []
......@@ -2951,11 +3148,17 @@ const {
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
status: status.value,
status: status.value === 'INTERCEPTED' ? '' : status.value,
shipmentArea:
status.value === 'CREATE_LOGISTICS'
? shipmentArea.value || undefined
: undefined,
exceptionHandling:
status.value === 'EXCEPTION_ORDER'
? exceptionStatus.value || undefined
: undefined,
interceptStatus:
status.value === 'INTERCEPTED' ? interceptStatus.value : '',
},
page,
pageSize,
......@@ -2973,6 +3176,7 @@ const {
? timeRange.value[1]
: null,
status: status.value,
interceptStatus: '',
},
page,
pageSize,
......@@ -3002,50 +3206,66 @@ const handleProductionClientChange = async (v: string) => {
const downloadFacebook = async (row: string) => {
window.open(filePath + row, '_blank')
}
const confirmManuShow = ref(false)
const confirmFormRef = ref()
const confirmForm = reactive({
warehouseId: null,
})
const confirmRules = reactive({
warehouseId: [
{
required: true,
message: '请选择仓库',
trigger: 'change',
},
],
})
//确认生产
async function confirmProduct() {
function confirmProduct() {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
confirmManuShow.value = true
confirmFormRef.value.resetFields()
}
async function confirmSubmit() {
try {
await showConfirm('确定生产吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
const ids = selection.value.map((el) => el.id)
const { code, data } = await confirmProductApi([...ids])
if (code === 200) {
resultInfo.value = data || []
resultInfo.value =
(data as {
id: string | number
status: boolean
factoryOrderNumber?: string
message: string
}[]) || []
if (
Array.isArray(data) &&
(data as { status: boolean }[]).some((item) => !item.status)
) {
resultRefs.value?.showDialog()
} else {
search()
loadTabData()
}
}
ElMessage.success('操作成功')
// search()
// await loadTabData()
await confirmFormRef.value.validate()
} catch {
resultInfo.value = []
return
}
const confirmName =
warehouseList.value.find((item) => item.id == confirmForm.warehouseId)
?.name || '未知仓库'
const ids = selection.value.map((el) => el.id).join(',')
const params = {
ids: ids,
warehouseId: confirmForm.warehouseId,
warehouseName: confirmName,
}
const { code, data } = await confirmProductApi(params)
if (code === 200) {
resultInfo.value = data || []
resultInfo.value =
(data as {
id: string | number
status: boolean
factoryOrderNumber?: string
message: string
}[]) || []
if (
Array.isArray(data) &&
(data as { status: boolean }[]).some((item) => !item.status)
) {
resultRefs.value?.showDialog()
} else {
search()
loadTabData()
}
}
ElMessage.success('操作成功')
confirmManuShow.value = false
}
const handleConfirm = async () => {
if (!productionClientValue.value) {
return ElMessage.warning('请选择生产端')
......@@ -3758,11 +3978,12 @@ const logisticsToPicking = async () => {
}
const sheetPrinter = ref('')
const handlePrinterChange = (value: string) => {
console.log('value', value)
sheetPrinter.value = value
localStorage.setItem('sheetPrinter', JSON.stringify(value))
}
const handleWarehouseIdChange = (value: string) => {
sessionStorage.setItem('locaclCnWarehouseId', JSON.stringify(value))
}
const { getCLodop } = useLodop()
const printOrder = async (
data: OrderData,
......@@ -3982,49 +4203,40 @@ const loadCraftList = async () => {
console.error(e)
}
}
const refreshMaterial = async () => {
if (status.value === 'PICKING' || status.value === 'TO_BE_REPLENISHMENT') {
if (cardSelection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
} else {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
}
const loading = ElLoading.service({
fullscreen: true,
text: '刷新中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await refreshMaterialApi({
orderIds:
status.value !== 'PICKING' && status.value !== 'TO_BE_REPLENISHMENT'
? selection.value.map((item) => item.id).join(',')
: undefined,
productIds:
status.value === 'PICKING' || status.value === 'TO_BE_REPLENISHMENT'
? cardSelection.value.map((item) => item.id).join(',')
: undefined,
})
if (res.code !== 200) return
ElMessage.success('刷新成功')
search()
cardSelection.value = []
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const expressSheetUpload = async (file: File) => {
const fm = new FormData()
fm.append('file', file)
fm.append('trackingNumber', logisticsForm.value.trackingNumber)
const res = await uploadExpressSheet(fm as never)
logisticsForm.value.expressSheetUrl = res.message || ''
logisticsForm.value.expressSheet = file
return false
}
const showLogistics = (item: PodCnOrderListData) => {
currentRow.value = JSON.parse(JSON.stringify(item))
logisticsVisible.value = true
logisticsForm.value = JSON.parse(JSON.stringify(logistics))
}
const logisticsSubmit = () => {
if (!logisticsForm.value.expressSheetUrl) {
return ElMessage.warning('请上传物流面单')
}
logisticsFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
const params = {
trackingNumber: logisticsForm.value.trackingNumber,
expressSheet: logisticsForm.value.expressSheetUrl,
processNumber: logisticsForm.value.processNumber,
id: currentRow.value.id,
}
await updateSelfLogistics(params)
ElMessage.success('操作成功')
logisticsVisible.value = false
search()
}
})
}
watch(
() => status.value,
(val) => {
......@@ -4327,7 +4539,6 @@ useRouter().beforeEach((to, from, next) => {
height: 100%;
overflow-y: auto;
}
.tabs-node_count {
display: inline-block;
min-width: 20px;
......@@ -4362,6 +4573,39 @@ useRouter().beforeEach((to, from, next) => {
.card-list-item {
cursor: pointer;
.flex-between {
display: flex;
justify-content: space-between;
align-items: center;
.images-position {
display: flex;
height: 30px;
gap: 10px;
padding: 10px 6px 0;
.item-image {
width: 30px;
height: 30px;
border: 1px solid #909399;
cursor: pointer;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
b {
margin-right: 5px;
font-size: 15px;
}
}
.flex-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 15px;
}
}
.images-position {
......
......@@ -357,9 +357,17 @@ watch(visible, async (value: boolean) => {
if (value) {
podOrderDetailsData.value = {}
currentCode = ''
warehouseId.value = props.warehouseList[0].id
_warehouseId.value = props.warehouseList[0].id
// warehouseId.value = props.warehouseList[0].id
// _warehouseId.value = props.warehouseList[0].id
const locaclWarehouseId = localStorage.getItem('locaclWarehouseId')
// 设置仓库ID,优先使用本地存储的值,否则使用列表中的第一个仓库
warehouseId.value = locaclWarehouseId
? JSON.parse(locaclWarehouseId)
: props.warehouseList[0].id
_warehouseId.value = locaclWarehouseId
? JSON.parse(locaclWarehouseId)
: props.warehouseList[0].id
if (userStore.user?.factory.id) {
try {
await socket.init(
......@@ -382,9 +390,9 @@ watch(visible, async (value: boolean) => {
initOrderDetailBox()
initPrintDevice()
const locaclPrinter = localStorage.getItem('sheetPrinter')
const locaclWarehouseId = localStorage.getItem('locaclWarehouseId')
// const locaclWarehouseId = localStorage.getItem('locaclWarehouseId')
if (locaclPrinter) sheetPrinter.value = JSON.parse(locaclPrinter)
if (locaclWarehouseId) warehouseId.value = JSON.parse(locaclWarehouseId)
// if (locaclWarehouseId) warehouseId.value = JSON.parse(locaclWarehouseId)
} else {
if (userStore.user?.factory.id) {
socket.send({
......
......@@ -2014,6 +2014,7 @@
v-model="podOrderVisible"
:print-order="printOrder"
:warehouse-list="warehouseList"
:is-cn="false"
@set-printer="handlePrinterChange"
@set-warehouseId="handleWarehouseIdChange"
@refresh="onFastRefresh"
......
......@@ -27,10 +27,10 @@ export default defineConfig({
host: true,
proxy: {
'/api': {
target: 'http://10.168.31.130:8060',
target: 'http://10.168.31.193:8060',
},
'/ws': {
target: 'ws://wkg.local.cn:8066',
target: 'http://10.168.31.193:8060',
ws: true,
changeOrigin: true,
},
......
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