Commit ab0d0dfd by zhuzhequan

Merge branch 'dev' into 'master'

Dev

See merge request !123
parents 3eb20eca 87593839
......@@ -86,20 +86,15 @@ export function getCardOrderList(
)
}
export function uploadPRNFile(
id: number,
data: FormData,
) {
export function uploadPRNFile(id: number, data: FormData) {
return axios.post<never, BaseRespData<string>>(
`/factory/podBatchDownload/uploadPRNFile?id=${id}`,
data
data,
)
}
export function updatePRNDownloadStatus(
id: number
) {
export function updatePRNDownloadStatus(id: number) {
return axios.get<never, BaseRespData<string>>(
`/factory/podBatchDownload/updatePRNDownloadStatus?id=${id}`
`/factory/podBatchDownload/updatePRNDownloadStatus?id=${id}`,
)
}
export function confirmOrderApi(
......@@ -242,7 +237,7 @@ export function getPackingDataApi(
warehouseId: number | string,
) {
return axios.get<never, BaseRespData<PodMakeOrderData>>(
'/factory/podJomallOrderUs/getPodBoxDetailsBySkuOrNo',
'/factory/podJomallOrderUs/putPackingSafe',
{
params: {
podJomallUsNo: code,
......@@ -254,7 +249,7 @@ export function getPackingDataApi(
)
}
export function getPodBoxListApi(
factoryNo: number | string,
factoryNo: number | string | undefined,
warehouseId: number | string,
) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>(
......@@ -289,9 +284,12 @@ export function clearBoxApi(
},
)
}
export function clearAllBoxApi() {
export function clearAllBoxApi(warehouseId: string | number,factoryNo: string | number | undefined) {
return axios.get<never, BaseRespData<never>>(
'factory/podJomallOrderUs/delPodBoxOrderDetails',
{
params: { warehouseId,factoryNo },
},
)
}
export function updateRemarkApi(id: number, content: string) {
......@@ -483,7 +481,11 @@ export function getListCraftApi() {
}
// 批量下载 列表
export function batchDownloadApi(params: SearchForm, currentPage: number, pageSize: number) {
export function batchDownloadApi(
params: SearchForm,
currentPage: number,
pageSize: number,
) {
return axios.post<never, BaseRespData<never>>(
`factory/podBatchDownload/us/list_page`,
{
......@@ -581,10 +583,10 @@ export function changeToFinished(ids: string) {
}
export function reissueOrderApi(data: {
ids:string
reissueType:number
trackingNumber?:string
expressSheet:string
ids: string
reissueType: number
trackingNumber?: string
expressSheet: string
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/reissueOrder`,
......
......@@ -20,7 +20,7 @@ const useOrderStore = defineStore('order', {
},
actions: {
async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null
boxList: PodMakeOrderData[] | OrderData | null | undefined,
factoryNo: number | string
warehouseId: number | string
box?: number
......
......@@ -20,7 +20,7 @@ const useOrderStore = defineStore('cnSuperOrder', {
},
actions: {
async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null
boxList: PodMakeOrderData[] | OrderData | null | undefined,
factoryNo: number | string
box?: number
data?: OrderData
......
......@@ -21,13 +21,18 @@ const useOrderStore = defineStore('order', {
actions: {
async setPodBoxList(content: {
boxList: PodMakeOrderData[] | OrderData | null
factoryNo: number | string
factoryNo: number | string | undefined
fromUser: number
warehouseId: number | string
box?: number
data?: OrderData
}) {
const { factoryNo, warehouseId, boxList, box, data } = content
console.log(content,'content')
const { factoryNo, warehouseId, boxList, box, data,fromUser } = content
if (Array.isArray(boxList)) {
boxList.forEach(item => {
item.fromUser = fromUser
})
this.podBoxList = boxList
} else {
const index = this.podBoxList?.findIndex((item) => item.box === box)
......@@ -35,6 +40,7 @@ const useOrderStore = defineStore('order', {
try {
const res = await getPodBoxListApi(factoryNo, warehouseId)
const boxList = res.data.map((item) => {
item.fromUser = fromUser
if (res.data) {
const productList = item?.data?.productList || []
const pickingNumber = productList.reduce(
......@@ -62,6 +68,7 @@ const useOrderStore = defineStore('order', {
const arr = this.podBoxList
if (arr) {
arr[box - 1] = {
fromUser: fromUser,
box,
data: data || boxList || null,
}
......
export interface PodMakeOrderData {
data: OrderData | null
data?: OrderData | null
warehouseId?: number
fromUser?: number | string
box?: number
addDate?: string
}
......@@ -12,6 +13,7 @@ export interface OrderData {
logisticsWayName?: string | null
company?: string | null
orderStatus?: number
fromUser?: string | number
salesPlatform?: string
logisticsCompanyId?: number
blocked?: boolean
......@@ -52,6 +54,7 @@ export interface ProductList {
variantImage?: string
podJomallUsNo?: string
podJomallCnNo?: string
thirdSkuCode?: string
previewImgs?: { sort?: string | number; title?: string; url: string }[]
}
......
......@@ -10,6 +10,7 @@ interface NotificationOptions {
export interface WebSocketMessage {
code?: string
fromUser?: number
content?: string
type?: string
data?: unknown
......
......@@ -463,7 +463,18 @@ watch(
(val) => {
if (val && val.productList?.length)
val.productList.forEach((el) => {
if (!el.previewImgs) el.previewImgs = JSON.parse(el.imageAry || '[]')
if (!el.previewImgs) {
if (
el.productMark === 'custom_normal' ||
el.productMark === 'normal'
) {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = el.imageAry
? JSON.parse(el.imageAry)
: [{ url: el.variantImage }]
}
}
})
},
{ deep: true },
......@@ -492,7 +503,13 @@ const renderItemBox = (bool: boolean) => {
if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem
data?.productList?.forEach((el) => {
if (!el.previewImgs) el.previewImgs = JSON.parse(el.imageAry || '[]')
if (!el.previewImgs || !el.previewImgs.length) {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = JSON.parse(el.imageAry || '[]')
}
}
})
if (!data) {
renderLock = false
......@@ -513,15 +530,23 @@ const renderItemBox = (bool: boolean) => {
}
}
if (currentCode) {
const parts = currentCode.split('_')
currentCode =
parts.length > 3 && parts[3].startsWith('CNPSC')
? parts[3]
: parts.length > 1
? parts[1]
: parts[0]
if (!currentCode.startsWith('JM')) {
const parts = currentCode.split('_')
currentCode =
parts.length > 3 && parts[3].startsWith('CNPSC')
? parts[3]
: parts.length > 1
? parts[1]
: parts[0]
}
console.log(540, currentCode)
for (const product of productList) {
if (product.podJomallCnNo === currentCode) {
if (
product.podJomallCnNo === currentCode ||
product.thirdSkuCode === currentCode
) {
coverImage.value = product.previewImgs?.[0]?.url || ''
nextTick(() => {
tableRef.value?.setCurrentRow(product)
......
......@@ -138,10 +138,11 @@
</div>
<div class="middle-content">
<div class="box-top">
<div class="box-top-item">
<div class="box-top-item" v-if="boxIndex !== 0">
<span class="box-top-item-box-index">
{{ boxIndex }}
</span>
<span class="box-top-item-box-index-text">号箱</span>
<span style="font-size: 30px">放入第</span>
......@@ -150,6 +151,9 @@
</div>
<span style="font-size: 30px">件商品</span>
</div>
<div v-else class="box-top-item-box-index-text">
单件商品订单,不占用播种墙
</div>
<div class="box-top-item-status">
<span
v-if="
......@@ -207,8 +211,9 @@
<span style="font-weight: bold" :title="index + 1 + '号箱'">
{{ index + 1 }}
</span>
<span v-if="item.data" class="number">
{{ item.data.pickingNumber }}/{{ item.data.purchaseNumber }}
<span v-if="item.data?.pickingNumber" class="number">
{{ item.data?.pickingNumber }}/{{ item.data.purchaseNumber }}
</span>
<div
v-if="
......@@ -343,7 +348,9 @@ const orderStore = useOrderStore()
const isLock = ref<boolean>(false)
const productionOrderRef = ref()
const socketConnect = computed(() => orderStore.socketConnect)
const podBoxList = computed(() => orderStore.podBoxList)
const podBoxList = computed(() => {
return orderStore.podBoxList
})
const coverImage = ref<string>('')
let currentCode = ''
const tableRef = ref()
......@@ -354,9 +361,9 @@ watch(visible, async (value: boolean) => {
const localRaw = localStorage.getItem('locaclWarehouseId')
const localId = localRaw ? JSON.parse(localRaw) : ''
/* 先找一次,确认本地值是否存在于列表 */
const hit = props.warehouseList.find((w) => w.id === localId)
warehouseId.value = hit ? localId : props.warehouseList[0].id
_warehouseId.value = hit ? localId : props.warehouseList[0].id
const hit = props.warehouseList.find((w) => w.id == localId)
warehouseId.value = hit ? localId : props.warehouseList[0]?.id
_warehouseId.value = hit ? localId : props.warehouseList[0]?.id
if (userStore.user?.factory.id) {
try {
......@@ -394,15 +401,19 @@ watch(visible, async (value: boolean) => {
}
})
watch(boxIndex, (value: number | null) => {
if (value) {
const bool = !boxChange.value
boxChange.value = false
renderItemBox(bool)
}
// if (value) {
console.log('boxIndex11111', value)
const bool = !boxChange.value
boxChange.value = false
renderItemBox(bool)
// }
})
watch(
podBoxList,
(value) => {
console.log('podBoxIndex1111', podBoxIndex.value)
if (value) {
const item = value.find((item) => item.box === podBoxIndex.value)
console.log('podBoxList', value, podBoxIndex.value, item)
......@@ -424,7 +435,10 @@ watch(
if (val && val.productList?.length)
val.productList.forEach((el) => {
if (!el.previewImgs) {
if (el.productMark === 'custom_normal') {
if (
el.productMark === 'custom_normal' ||
el.productMark === 'normal'
) {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = el.imageAry
......@@ -451,16 +465,17 @@ const renderItemBox = (bool: boolean) => {
return
if (renderLock) return
renderLock = true
let boxItem = podBoxList.value.find((item) => item.box === boxIndex.value)
let boxItem = podBoxList.value?.find((item) => item.box === boxIndex.value)
console.log(boxItem,'boxItem')
if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem
data?.productList?.forEach((el) => {
if (!el.previewImgs) {
if (!el.previewImgs || !el.previewImgs.length) {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = JSON.parse(el.imageAry)
el.previewImgs = JSON.parse(el.imageAry || '[]')
}
}
})
......@@ -483,15 +498,21 @@ const renderItemBox = (bool: boolean) => {
}
}
if (currentCode) {
const parts = currentCode.split('_')
currentCode =
parts.length > 3 && parts[3].startsWith('USPSC')
? parts[3]
: parts.length > 1
? parts[1]
: parts[0]
if (!currentCode.startsWith('JM')) {
const parts = currentCode.split('_')
currentCode =
parts.length > 3 && parts[3].startsWith('USPSC')
? parts[3]
: parts.length > 1
? parts[1]
: parts[0]
}
console.log(540, currentCode)
for (const product of productList) {
if (product.podJomallUsNo === currentCode) {
if (
product.podJomallUsNo === currentCode ||
product.thirdSkuCode === currentCode
) {
coverImage.value = product.previewImgs?.[0]?.url || ''
console.log(441, coverImage.value)
......@@ -505,8 +526,10 @@ const renderItemBox = (bool: boolean) => {
}
podOrderDetailsData.value = data
console.log(408, data)
if (productList.every((item) => item.power)) {
if(userStore.user?.id!==boxItem.fromUser) return
print(data, false, () => {
renderLock = false
})
......@@ -530,13 +553,19 @@ const messageChange = (data: WebSocketMessage) => {
} catch (e) {
console.error(e)
}
console.log('WebSocketMessage', more)
setPodBoxList(more)
} else if (code === 'POD_BOX_FLUSH') {
initOrderDetailBox()
}
}
const setPodBoxList = (data: WebSocketMessage) => {
console.log(data,'datatatata')
const obj = data.txt
if (obj && typeof obj === 'string') {
const parsedData = JSON.parse(obj)
parsedData.fromUser = data.fromUser
orderStore.setPodBoxList(parsedData)
}
}
......@@ -556,6 +585,7 @@ const initPrintDevice = () => {
sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
printDeviceList.value = arr
}
// const handleProduct = (val: OrderData) => {
// if (val && val.productList && val.productList.length > 0) {
// return val.productList?.some((item) => {
......@@ -628,12 +658,35 @@ const getPackingData = async (code: string) => {
productionOrder.value = ''
return
}
const { box } = res.data
const { box, data } = res.data
console.log('box', box)
if (box) {
boxIndex.value = box
// if (box) {
boxIndex.value = box as number
// }
if (boxIndex.value == 0) {
podOrderDetailsData.value = data as OrderData
podOrderDetailsData.value.fromUser = userStore.user?.id
if (podOrderDetailsData.value.productList?.length) {
const list = podOrderDetailsData.value.productList
for (const product of list) {
if (product.count === product.purchaseNumber) {
product.power = true
print(data as OrderData, false, () => {
renderLock = false
})
}
}
nextTick(() => {
tableRef.value?.setCurrentRow(list[0])
})
}
}
// renderItemBox(true)
console.log('podBoxList', podBoxList.value)
// }
} catch (error) {
console.log(error)
} finally {
......@@ -696,6 +749,7 @@ const initOrderDetailBox = async () => {
}
orderStore.setPodBoxList({
boxList: res.data,
fromUser: userStore.user?userStore.user.id : 0,
factoryNo,
warehouseId: warehouseId.value,
})
......@@ -835,6 +889,7 @@ const nextStep = async (callback: () => void) => {
}
const handleBoxClick = (item: PodMakeOrderData) => {
const { box, data } = item
if (box == 0) return
isBillLading.value = !data?.filePath
nextStep(() => {
if (!data) {
......@@ -870,12 +925,12 @@ const handleClearBox = async () => {
return
}
ElMessage.success('清空成功')
orderStore.setPodBoxList({
boxList: null,
factoryNo,
box: boxIndex.value || undefined,
warehouseId: warehouseId.value,
})
// orderStore.setPodBoxList({
// boxList: null,
// factoryNo,
// box: boxIndex.value || undefined,
// warehouseId: warehouseId.value,
// })
boxIndex.value = null
podOrderDetailsData.value = {}
coverImage.value = ''
......@@ -947,10 +1002,18 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
item.data.printResult = 'printFail'
}
}
if (_boxIndex == 0) {
if (status) {
;(podOrderDetailsData.value as OrderData).printResult = 'printSuccess'
} else {
;(podOrderDetailsData.value as OrderData).printResult = 'printFail'
}
}
const factoryNo = userStore.user?.factory.id
if (!factoryNo) return
orderStore.setPodBoxList({
boxList: item ? item.data : null,
fromUser:userStore.user?userStore.user.id:0,
boxList: item ? (item.data as PodMakeOrderData[]) : null,
factoryNo,
box: _boxIndex || undefined,
warehouseId: warehouseId.value,
......@@ -968,13 +1031,13 @@ const clearAllBox = async () => {
return
}
try {
const res = await clearAllBoxApi()
const res = await clearAllBoxApi(warehouseId.value,userStore.user?.factory.id)
if (res.code !== 200) return
orderStore.setPodBoxList({
boxList: res.data,
factoryNo: userStore.user?.factory.id || '',
warehouseId: warehouseId.value,
})
// orderStore.setPodBoxList({
// boxList: res.data,
// factoryNo: userStore.user?.factory.id || '',
// warehouseId: warehouseId.value,
// })
productionOrderRef.value.focus()
podOrderDetailsData.value = {}
coverImage.value = ''
......@@ -1229,6 +1292,9 @@ const printNormal = async () => {
background-color: red;
}
}
.fontStyle {
font-size: 12px;
}
</style>
<style lang="scss">
.pod-make-order-dialog {
......
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