Commit 932a091f by qinjianhui

Merge branch 'dev' into 'master'

fix: 打单bug修改

See merge request !17
parents 1ad6b613 83881538
......@@ -300,7 +300,6 @@ const boxChange = ref<boolean>(false)
const boxIndex = ref<number | null>(null)
const orderStore = useOrderStore()
const isLock = ref<boolean>(false)
const renderLock = ref<boolean>(false)
const productionOrderRef = ref()
const socketConnect = computed(() => orderStore.socketConnect)
const podBoxList = computed(() => orderStore.podBoxList)
......@@ -372,6 +371,9 @@ watch(
{ deep: true },
)
const podBoxIndex = computed(() => orderStore.podBoxIndex)
let renderLock = false
const renderItemBox = (bool: boolean) => {
if (
!podBoxList.value ||
......@@ -380,13 +382,13 @@ const renderItemBox = (bool: boolean) => {
(bool && boxIndex.value !== podBoxIndex.value)
)
return
if (renderLock.value) return
renderLock.value = true
if (renderLock) return
renderLock = true
let boxItem = podBoxList.value.find((item) => item.box === boxIndex.value)
if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem
if (!data) {
renderLock.value = false
renderLock = false
currentCode = ''
podOrderDetailsData.value = {}
return
......@@ -416,9 +418,12 @@ const renderItemBox = (bool: boolean) => {
}
podOrderDetailsData.value = data
if (productList.every((item) => item.power)) {
print(data)
print(data, false, () => {
renderLock = false
})
} else {
renderLock = false
}
renderLock.value = false
}
const messageChange = (data: WebSocketMessage) => {
if (!data) return
......@@ -443,7 +448,7 @@ const setPodBoxList = (data: WebSocketMessage) => {
const obj = data.txt
if (obj && typeof obj === 'string') {
const parsedData = JSON.parse(obj)
useOrderStore().setPodBoxList(parsedData)
orderStore.setPodBoxList(parsedData)
}
}
const initPrintDevice = () => {
......@@ -657,7 +662,7 @@ const initOrderDetailBox = async () => {
})
}
renderLock.value = false
renderLock = false
productionOrder.value = ''
isLock.value = false
productionOrderRef.value.focus()
......@@ -792,12 +797,13 @@ const handlePrinterChange = (value: string) => {
emit('set-printer', value)
}
const print = (data: OrderData, forcePrint = false) => {
const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
const _boxIndex = boxIndex.value
if (!forcePrint && data.printResult) return
props.printOrder(data, (status: boolean) => {
callback && callback()
const item = podBoxList.value?.find((item) => item.box === _boxIndex)
if (item && item.data) {
if (status) {
......
......@@ -1751,7 +1751,8 @@ const printOrder = async (
return
}
if (data.filePath) {
const strURL = filePath + data.filePath
// const strURL = filePath + data.filePath
const strURL = 'https://factory.jomalls.com/upload/factory' + data.filePath
console.log('strURL', strURL, data)
lodop.ADD_PRINT_PDF(
0,
......
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