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