Commit bf27a69d by wusiyi

Merge branch 'dev'

parents c1fbf91c c17bd18e
......@@ -33,6 +33,8 @@ export function syncReceiverAddress(data: number[]) {
data,
)
}
// 播种墙配货 扫码放入箱子
export function getPackingCnDataApi(
code: string,
factoryNo: number,
......@@ -51,6 +53,25 @@ export function getPackingCnDataApi(
},
)
}
// 超级播种墙配货 扫码放入箱子
export function getSuperPackingCnDataApi(
code: string,
factoryNo: number,
box: number | null,
) {
return axios.get<never, BaseRespData<PodMakeOrderData>>(
'super/factory/podJomallOrderCn/getPodBoxDetailsBySkuOrNo',
{
params: {
podJomallCnNo: code,
box,
factoryNo,
},
},
)
}
export function refreshAddressApi(idList: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderCn/syncReceiverAddress',
......@@ -237,6 +258,7 @@ export function getPackingDataApi(
},
)
}
// 播种墙配货 获取pod订单拣货箱子详情
export function getPodBoxListApi(
factoryNo: number | string,
warehouseId: number | string,
......@@ -249,6 +271,15 @@ export function getPodBoxListApi(
)
}
// 超级播种墙配货 获取pod订单拣货箱子详情
export function getSuperPodBoxListApi(factoryNo: number | string) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>(
'super/factory/podJomallOrderCn/getPodBoxOrderDetails',
{ params: { factoryNo } },
)
}
// 播种墙配货 打单完成
export function submitInspectionApi(
data: { id: number; version?: number }[],
boxIndex: number | null,
......@@ -261,6 +292,20 @@ export function submitInspectionApi(
},
)
}
// 超级播种墙配货 打单完成
export function submitSuperInspectionApi(
data: { id: number; version?: number }[],
boxIndex: number | null,
) {
return axios.post<never, BaseRespData<never>>(
`super/factory/podJomallOrderCn/podPrintOrderComplete?box=${boxIndex}`,
{
orderParamList: data,
},
)
}
// 播种墙配货 根据箱子删除pod订单拣货箱子详情
export function clearBoxApi(
factoryNo: number,
box: number | null,
......@@ -273,11 +318,28 @@ export function clearBoxApi(
},
)
}
// 超级播种墙配货 根据箱子删除pod订单拣货箱子详情
export function clearSuperBoxApi(factoryNo: number, box: number | null) {
return axios.get<never, BaseRespData<never>>(
'super/factory/podJomallOrderCn/delPodBoxOrderDetailsByBox',
{
params: { factoryNo, box },
},
)
}
// 播种墙配货 删除pod订单拣货箱子详情
export function clearAllBoxApi() {
return axios.get<never, BaseRespData<never>>(
'factory/podJomallOrderCn/delPodBoxOrderDetails',
)
}
// 超级播种墙配货 删除pod订单拣货箱子详情
export function clearSuperAllBoxApi() {
return axios.get<never, BaseRespData<never>>(
'super/factory/podJomallOrderCn/delPodBoxOrderDetails',
)
}
export function updateRemarkApi(id: number, content: string) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderCn/addRemark',
......
import { defineStore } from 'pinia'
import {
OrderData,
PodMakeOrderData,
ProductList,
} from '@/types/api/podMakeOrder'
import { getSuperPodBoxListApi } from '@/api/podCnOrder'
export interface OrderStoreState {
podBoxList?: PodMakeOrderData[]
podBoxIndex?: number | null
socketConnect?: string
}
const useOrderStore = defineStore('cnSuperOrder', {
state: () => {
return {
podBoxList: [],
podBoxIndex: null,
socketConnect: '',
} as OrderStoreState
},
actions: {
async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null
factoryNo: number | string
box?: number
data?: OrderData
}) {
const { factoryNo, 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 getSuperPodBoxListApi(factoryNo)
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
......@@ -37,4 +37,5 @@ export interface Factory {
goodsNumber: number
authorizeNumber: number
status: number
dropShipping?: boolean
}
......@@ -22,6 +22,23 @@ export interface AccountStatementNoteSearchForm {
end_time?: string
}
export interface AccountStatementNoteSearchFormUS {
user_mark?: string
status?: number | string | null
dateRange?: string[]
billNumber?: string
subOrderNumber?: string
shipmentNumber?: string
rec_number?: string
order_number?: string
factory_status?: string
erp_status?: string
startTime?: string
start_time?: string
endTime?: string
end_time?: string
}
export interface AccountStatementNote {
create_time?: string
product_total_amount?: number
......@@ -29,6 +46,7 @@ export interface AccountStatementNote {
pass_num?: number
factory_code?: string
total_amount?: string | number
totalAmount?: string | number
actual_amount?: string | number
num?: number
end_time?: string
......@@ -96,143 +114,143 @@ export interface ItemList {
factory_order_number?: string
}
export interface OrderDetails {
pass_num: number;
num: number;
not_pass_num: number;
erp_order_number: string | null;
product_total_amount: number;
carriage_total_amount: number;
craft_total_price: number;
info_id: number;
template_total_price: number;
id: number;
order_id: string;
factory_order_number: string;
pass_num: number
num: number
not_pass_num: number
erp_order_number: string | null
product_total_amount: number
carriage_total_amount: number
craft_total_price: number
info_id: number
template_total_price: number
id: number
order_id: string
factory_order_number: string
order: {
receiver_post_code: string;
payment_time: string | null;
actual_amount: number;
adjusted_amount: number;
factory_no: number;
factory_online_id: string | null;
total_product_amount: number | null;
process_number: string;
track_status: number;
id: string;
receiver_country: string;
factory_order_number: string;
prepaid_amount: number;
receiver_province: string;
create_time: string;
weight: number;
product_num: number;
version: number;
finish_time: string;
start_stocking_time: string;
payment_type: string | null;
warehouse_name: string;
total_amount: number;
logistics_way_code: string;
third_order_number: string;
shop_number: string;
express_sheet: string;
status: string;
production_client: string;
statusStr: string;
receiver_city: string;
remark: string | null;
exception_reason: string | null;
platform: string;
update_time: string;
receiver_address2: string;
receiver_address1: string;
receiver_name: string;
tracking_number: string;
product_amount: number;
carriage_amount: number | null;
pay_freight: number;
logistics_way_name: string;
factory_code: string;
receiver_district: string | null;
temu_logistics_way_id: string | null;
logistics_way_id: number;
user_mark: string;
namespace: string;
receiver_phone: string;
exception_handling: number;
shipment_type: number;
warehouse_id: number;
};
receiver_post_code: string
payment_time: string | null
actual_amount: number
adjusted_amount: number
factory_no: number
factory_online_id: string | null
total_product_amount: number | null
process_number: string
track_status: number
id: string
receiver_country: string
factory_order_number: string
prepaid_amount: number
receiver_province: string
create_time: string
weight: number
product_num: number
version: number
finish_time: string
start_stocking_time: string
payment_type: string | null
warehouse_name: string
total_amount: number
logistics_way_code: string
third_order_number: string
shop_number: string
express_sheet: string
status: string
production_client: string
statusStr: string
receiver_city: string
remark: string | null
exception_reason: string | null
platform: string
update_time: string
receiver_address2: string
receiver_address1: string
receiver_name: string
tracking_number: string
product_amount: number
carriage_amount: number | null
pay_freight: number
logistics_way_name: string
factory_code: string
receiver_district: string | null
temu_logistics_way_id: string | null
logistics_way_id: number
user_mark: string
namespace: string
receiver_phone: string
exception_handling: number
shipment_type: number
warehouse_id: number
}
}
export interface ProductDetails {
diy_id: string;
diy_bianma: string;
base_sku: string;
sub_order_number: string;
price_update_remark: string | null;
price_status: boolean;
template_item_sku: string | null;
product_id: string;
id: number;
shipment_num: number;
product_item_id: string | null;
template_price: number;
diy_id: string
diy_bianma: string
base_sku: string
sub_order_number: string
price_update_remark: string | null
price_status: boolean
template_item_sku: string | null
product_id: string
id: number
shipment_num: number
product_item_id: string | null
template_price: number
product: {
diy_id: string;
end_product_id: string;
category_name: string;
craft_name: string;
base_sku: string;
num: number;
is_production: boolean;
pick_finish: number;
remark: string | null;
product_price: number;
third_stock_sku: string | null;
customized_quantity: number;
template_price: number;
tag_ids: string | null;
create_time: string;
third_sub_order_number: string;
factory_sub_order_number: string;
variant_image: string;
craft_code: string;
pass_num: number;
factory_code: string;
pay_amount: number;
weight: number;
is_replenishment: number;
image_ary: Array<{ title: string; url: string }>;
diy_id: string
end_product_id: string
category_name: string
craft_name: string
base_sku: string
num: number
is_production: boolean
pick_finish: number
remark: string | null
product_price: number
third_stock_sku: string | null
customized_quantity: number
template_price: number
tag_ids: string | null
create_time: string
third_sub_order_number: string
factory_sub_order_number: string
variant_image: string
craft_code: string
pass_num: number
factory_code: string
pay_amount: number
weight: number
is_replenishment: number
image_ary: Array<{ title: string; url: string }>
design_images: Array<{
imageUrl: string;
fileUrl: string;
id: string;
title: string;
materialId: string;
materialImage: string;
}>;
not_pass_num: number;
version: number;
supplier_product_no: string | null;
pod_jomall_order_us_id: string;
craft_price: number;
customs_value: number;
variant_sku: string;
batch_arrange_number: string;
trim_design_images: string | null;
};
product_item_sku: string | null;
item_id: number;
variant_image: string;
pass_num: number;
not_pass_num: number | null;
craft_price: number;
price_update_time: string | null;
variant_sku: string;
info_id: number;
shop_number: string;
template_item_id: string | null;
order_id: string;
imageUrl: string
fileUrl: string
id: string
title: string
materialId: string
materialImage: string
}>
not_pass_num: number
version: number
supplier_product_no: string | null
pod_jomall_order_us_id: string
craft_price: number
customs_value: number
variant_sku: string
batch_arrange_number: string
trim_design_images: string | null
}
product_item_sku: string | null
item_id: number
variant_image: string
pass_num: number
not_pass_num: number | null
craft_price: number
price_update_time: string | null
variant_sku: string
info_id: number
shop_number: string
template_item_id: string | null
order_id: string
}
export interface ConfirmOrderForm {
......
......@@ -189,55 +189,55 @@ export interface DbFactory {
}
export interface IDetailData {
statusStr?: string;
id: string;
erp_id?: string;
namespace?: string;
dbFactory?: DbFactory | null;
factory?: DbFactory | null;
productList?: Product[];
order_number?: string;
factory_order_number?: string;
erp_order_number?: string;
third_order_number?: string;
shop_number?: string;
product_num?: string | number;
start_stocking_time?: string;
finish_time?: string;
delivery_type?: string;
logistics_way_name?: string;
lanshou_name?: string;
receiver_name?: string;
lanshou_phone?: string;
receiver_phone?: string;
lanshou_region?: string;
receiver_province?: string;
lanshou_address?: string;
receiver_city?: string;
receiver_district?: string;
receiver_address1?: string;
lanshou_post?: string;
receiver_post_code?: string;
user_mark?: string;
statusStr?: string
id: string
erp_id?: string
namespace?: string
dbFactory?: DbFactory | null
factory?: DbFactory | null
productList?: Product[]
order_number?: string
factory_order_number?: string
erp_order_number?: string
third_order_number?: string
shop_number?: string
product_num?: string | number
start_stocking_time?: string
finish_time?: string
delivery_type?: string
logistics_way_name?: string
lanshou_name?: string
receiver_name?: string
lanshou_phone?: string
receiver_phone?: string
lanshou_region?: string
receiver_province?: string
lanshou_address?: string
receiver_city?: string
receiver_district?: string
receiver_address1?: string
lanshou_post?: string
receiver_post_code?: string
user_mark?: string
price?: number
customized_quantityStr?: string
product_price?:string
customized_quantity:number
image_ary?:string | null
[propName: string]: string | number | boolean | undefined | unknown;
product_price?: string
customized_quantity: number
image_ary?: string | null
[propName: string]: string | number | boolean | undefined | unknown
}
export interface PodUsDetailData {
id: number
erp_id?: string;
price?: number;
customized_quantityStr?: string;
product_price?: number;
erp_id?: string
price?: number
customized_quantityStr?: string
product_price?: number
// 其他已有属性...
customized_quantity: number; // 添加缺失属性
image_ary?: string | null; // 添加缺失属性
productList:IDetailData[]
[propName: string]: string | number | boolean | undefined | unknown;
customized_quantity: number // 添加缺失属性
image_ary?: string | null // 添加缺失属性
productList: IDetailData[]
[propName: string]: string | number | boolean | undefined | unknown
}
export interface LogListsData {
id: number
......@@ -276,6 +276,26 @@ export interface DetailForm {
pageSize?: number
infoId?: number
}
export interface DetailFormUS {
shop_number?: string
billNumber?: string
order_number?: string
craft_code?: string
base_sku?: string
shipment_number?: string
process?: string
supplierItemNo?: string
dateRange?: string[]
endTime?: string
startTime?: string
sub_order_number?: string
rows?: number
page?: number
currentPage?: number
pageSize?: number
infoId?: number
}
export interface BillForm {
timeRange: [string, string] | []
}
......
import { getWsUrl } from '../api/axios'
import useOrderStore from '../store/cnSuperOrder'
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()
......@@ -456,6 +456,14 @@
播种墙配货
</ElButton>
</span>
<span
v-if="status === 'WAIT_SHIPMENT' && isSuperFactory"
class="item"
>
<ElButton type="danger" @click="printSuperPodOrder">
超级播种墙配货
</ElButton>
</span>
<span v-if="status === 'CREATE_LOGISTICS'" class="item">
<ElButton type="warning" @click="logisticsToPicking">
转至待排单
......@@ -1992,7 +2000,14 @@
:print-order="printOrder"
:warehouse-list="warehouseList"
@set-printer="handlePrinterChange"
@set-warehouseId="handleWarehouseIdChange"
@set-warehouse-id="handleWarehouseIdChange"
@refresh="onFastRefresh"
/>
<SuperPodMakeOrder
v-model="superPodOrderVisible"
:print-order="printOrder"
:warehouse-list="warehouseList"
@set-printer="handlePrinterChange"
@refresh="onFastRefresh"
/>
<ElDialog
......@@ -2328,6 +2343,7 @@ import { computed, onMounted, ref, nextTick, reactive } from 'vue'
import FastProduction from './FastProduction.vue'
import { filePath } from '@/api/axios'
import PodMakeOrder from './PodMakeOrder.vue'
import SuperPodMakeOrder from './SuperPodMakeOrder.vue'
import { OrderData } from '@/types/api/podMakeOrder'
import useLodop, { LODOPObject } from '@/utils/hooks/useLodop'
import dayjs from 'dayjs'
......@@ -2335,6 +2351,7 @@ import RightClickMenu from '@/components/RightClickMenu.vue'
import ResultInfo from './components/ResultInfo.vue'
import { isArray, isString } from '@/utils/validate'
import platformJson from '../../../json/platform.json'
import useUserStore from '@/store/user'
import BigNumber from 'bignumber.js'
import {
useRouter,
......@@ -2355,6 +2372,11 @@ declare global {
responseBody?: unknown
}
}
const userStore = useUserStore()
const isSuperFactory: boolean = userStore.user?.factory.dropShipping || false
const tabsNav = ref<Tab[]>()
const isAuto = ref(true)
......@@ -4139,6 +4161,15 @@ const printPodOrder = async () => {
podOrderVisible.value = true
}
const superPodOrderVisible = ref(false)
const printSuperPodOrder = async () => {
const lodop = getCLodop(null, null)
if (!lodop) return
sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
superPodOrderVisible.value = true
}
/**
* @description: 创建物流、获取跟踪号、获取打印面单、更改物流、取消物流订单
*/
......
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