Commit c61b0b9e by qinjianhui

feat: 播种墙配货功能开发

parent ec604b00
......@@ -179,10 +179,7 @@ export function productionQueryApi(id: number, podJomallOrderUsId: number) {
)
}
export function printProductionOrderApi(url: string, orderIds: number[]) {
return axios.post<never, BaseRespData<string>>(
url,
orderIds,
)
return axios.post<never, BaseRespData<string>>(url, orderIds)
}
export function printNormalProductionOrderApi(orderIds: number[]) {
return axios.post<never, BaseRespData<string>>(
......@@ -232,66 +229,59 @@ export function getOrderDetailById(id: number) {
)
}
export function getPackingDataApi(
code: string,
factoryNo: number,
box: number | null,
warehouseId: number | string,
url: string,
params: {
podJomallUsNo?: string
box?: number | null
factoryNo?: number
warehouseId?: number | string
},
) {
return axios.get<never, BaseRespData<PodMakeOrderData>>(
'/factory/podJomallOrderUs/local/putPackingSafe',
{
params: {
podJomallUsNo: code,
box,
factoryNo,
warehouseId,
},
},
)
return axios.get<never, BaseRespData<PodMakeOrderData>>(url, {
params,
})
}
export function getPodBoxListApi(
url: string,
factoryNo: number | string | undefined,
warehouseId: number | string,
) {
return axios.get<never, BaseRespData<PodMakeOrderData[]>>(
'factory/podJomallOrderUs/local/getPodBoxOrderDetails',
{
params: { factoryNo, warehouseId },
},
)
return axios.get<never, BaseRespData<PodMakeOrderData[]>>(url, {
params: { factoryNo, warehouseId },
})
}
export function submitInspectionApi(
orderId: number | undefined,
url: string,
params: {
orderId?: number | undefined
},
boxIndex: number | null,
warehouseId: number | string,
) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/podPrintOrderComplete?box=${boxIndex}&warehouseId=${warehouseId}`,
{
orderId,
},
`${url}?box=${boxIndex}&warehouseId=${warehouseId}`,
params,
)
}
export function clearBoxApi(
url: string,
factoryNo: number,
box: number | null,
warehouseId: number | string,
) {
return axios.get<never, BaseRespData<never>>(
'factory/podJomallOrderUs/local/delPodBoxOrderDetailsByBox',
{
params: { factoryNo, box, warehouseId },
},
)
return axios.get<never, BaseRespData<never>>(url, {
params: { factoryNo, box, warehouseId },
})
}
export function clearAllBoxApi(warehouseId: string | number, factoryNo: string | number | undefined) {
return axios.get<never, BaseRespData<never>>(
'factory/podJomallOrderUs/local/delPodBoxOrderDetails',
{
params: { warehouseId, factoryNo },
},
)
export function clearAllBoxApi(
url: string,
warehouseId: string | number,
factoryNo: string | number | undefined,
) {
return axios.get<never, BaseRespData<never>>(url, {
params: { warehouseId, factoryNo },
})
}
export function updateRemarkApi(id: number, content: string) {
return axios.post<never, BaseRespData<never>>(
......
......@@ -381,6 +381,7 @@ const coverImage = ref<string>('')
let currentCode = ''
const tableRef = ref()
watch(visible, async (value: boolean) => {
console.log('visible', value)
if (value) {
podOrderDetailsData.value = {}
currentCode = ''
......
......@@ -850,6 +850,7 @@
v-model="podOrderVisible"
:print-order="printOrder"
:warehouse-list="warehouseList"
:is-new-order="true"
@set-printer="handlePrinterChange"
@set-warehouse-id="handleWarehouseIdChange"
@refresh="() => refreshCurrentView({ isRefreshTree: true })"
......@@ -1498,15 +1499,15 @@ const handlePrinterChange = (value: string) => {
localStorage.setItem('sheetPrinter', JSON.stringify(value))
}
const handleWarehouseIdChange = (value: string) => {
localStorage.setItem('locaclWarehouseId', JSON.stringify(value))
localStorage.setItem('localNewWarehouseId', JSON.stringify(value))
}
const { getCLodop } = useLodop()
const handleSeedingWall = () => {
const lodop = getCLodop(null, null)
if (!lodop) return
sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
podOrderVisible.value = true
}
const { getCLodop } = useLodop()
const printOrder = async (
data: OrderData,
......@@ -1631,7 +1632,9 @@ const handleProductionComplete = async () => {
confirmText: '确定生产完成吗?',
refreshTree: true,
onSuccess: (res) => {
const data = Array.isArray(res.data) ? (res.data as ResultInfoDataItem[]) : []
const data = Array.isArray(res.data)
? (res.data as ResultInfoDataItem[])
: []
const hasFailed = data.some((item) => !item.status)
if (hasFailed) {
resultInfo.value = data.filter((item) => !item.status)
......
......@@ -155,14 +155,23 @@
<span class="box-top-item-box-index-text">号箱</span>
<span style="font-size: 30px">放入第</span>
<div class="box-top-item-box-index-number" :style="{color:podOrderDetailsData?.pickingNumber ===
podOrderDetailsData?.purchaseNumber ? 'rgb(0, 255, 0)' : ''}">
<div
class="box-top-item-box-index-number"
:style="{
color:
podOrderDetailsData?.pickingNumber ===
podOrderDetailsData?.purchaseNumber
? 'rgb(0, 255, 0)'
: '',
}"
>
{{ podOrderDetailsData?.pickingNumber }}
</div>
<span style="font-size: 30px">件商品</span>
</div>
<div v-else class="box-top-item-box-index-text">
单件商品<span style="color: rgb(0, 255, 0)">(配齐)</span>,不占用播种墙
单件商品<span style="color: rgb(0, 255, 0)">(配齐)</span
>,不占用播种墙
</div>
<div class="box-top-item-status">
<span
......@@ -190,7 +199,12 @@
<ElButton type="success" @click="handlePrintFinish"
>打单完成</ElButton
>
<ElButton :disabled="boxIndex === 0" type="danger" @click="handleClearBox">清空箱子</ElButton>
<ElButton
:disabled="boxIndex === 0"
type="danger"
@click="handleClearBox"
>清空箱子</ElButton
>
</div>
<div
v-if="
......@@ -273,11 +287,15 @@ import { ElButton, ElIcon } from 'element-plus'
const { getCLodop } = useLodop()
const props = defineProps<{
modelValue: boolean
printOrder: (data: OrderData, callback: (status: boolean) => void) => void
warehouseList: WarehouseListData[]
}>()
const props = withDefaults(
defineProps<{
modelValue: boolean
printOrder: (data: OrderData, callback: (status: boolean) => void) => void
warehouseList: WarehouseListData[]
isNewOrder: boolean
}>(),
{ isNewOrder: false },
)
const emit = defineEmits([
'update:modelValue',
'set-printer',
......@@ -369,7 +387,9 @@ watch(visible, async (value: boolean) => {
if (value) {
podOrderDetailsData.value = {}
currentCode = ''
const localRaw = localStorage.getItem('locaclWarehouseId')
const localRaw = props.isNewOrder
? localStorage.getItem('localNewWarehouseId')
: localStorage.getItem('locaclWarehouseId')
const localId = localRaw ? JSON.parse(localRaw) : ''
/* 先找一次,确认本地值是否存在于列表 */
const hit = props.warehouseList.find((w) => w.id == localId)
......@@ -394,7 +414,6 @@ watch(visible, async (value: boolean) => {
console.error(error)
}
}
initOrderDetailBox()
initPrintDevice()
const locaclPrinter = localStorage.getItem('sheetPrinter')
......@@ -658,15 +677,29 @@ const getPackingData = async (code: string) => {
productionOrder.value = ''
return
}
if(!warehouseId.value){
if (!warehouseId.value) {
return ElMessage.warning('请选择仓库')
}
const res = await getPackingDataApi(
code,
factoryNo,
boxIndex.value,
warehouseId.value,
)
const url = props.isNewOrder
? 'factory/podOrderPacking/local/putPackingSafe'
: 'factory/podJomallOrderUs/local/putPackingSafe'
let params = {}
if (props.isNewOrder) {
params = {
podOperationNo: code,
box: boxIndex.value,
factoryNo,
warehouseId: warehouseId.value,
}
} else {
params = {
podJomallUsNo: code,
box: boxIndex.value,
factoryNo,
warehouseId: warehouseId.value,
}
}
const res = await getPackingDataApi(url, params)
if (res.code !== 200) {
ElMessage.warning(res.message)
isLock.value = false
......@@ -718,8 +751,22 @@ const submitInspection = async (callback: () => void) => {
return
}
try {
const url = props.isNewOrder
? 'factory/podOrderPacking/podPrintOrderComplete'
: 'factory/podJomallOrderUs/podPrintOrderComplete'
let params = {}
if (props.isNewOrder) {
params = {
orderParamList: [{ id: podOrderDetailsData.value?.id }],
}
} else {
params = {
orderId: podOrderDetailsData.value?.id,
}
}
const res = await submitInspectionApi(
podOrderDetailsData.value?.id,
url,
params,
boxIndex.value,
warehouseId.value,
)
......@@ -749,7 +796,10 @@ const initOrderDetailBox = async () => {
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await getPodBoxListApi(factoryNo, warehouseId.value)
const url = props.isNewOrder
? 'factory/podOrderPacking/local/getPodBoxOrderDetails'
: 'factory/podJomallOrderUs/local/getPodBoxOrderDetails'
const res = await getPodBoxListApi(url, factoryNo, warehouseId.value)
if (res.code !== 200) {
ElMessage.warning(res.message)
return
......@@ -910,7 +960,7 @@ const handleBoxClick = (item: PodMakeOrderData) => {
}
const handleClearBox = async () => {
try {
if(!boxIndex.value){
if (!boxIndex.value) {
ElMessage.warning('请选择箱子')
return
}
......@@ -927,7 +977,11 @@ const handleClearBox = async () => {
}
try {
const url = props.isNewOrder
? 'factory/podOrderPacking/local/delPodBoxOrderDetailsByBox'
: 'factory/podJomallOrderUs/local/delPodBoxOrderDetailsByBox'
const res = await clearBoxApi(
url,
factoryNo,
boxIndex.value || null,
warehouseId.value,
......@@ -937,12 +991,6 @@ const handleClearBox = async () => {
return
}
ElMessage.success('清空成功')
// orderStore.setPodBoxList({
// boxList: null,
// factoryNo,
// box: boxIndex.value || undefined,
// warehouseId: warehouseId.value,
// })
boxIndex.value = null
podOrderDetailsData.value = {}
coverImage.value = ''
......@@ -1043,7 +1091,11 @@ const clearAllBox = async () => {
return
}
try {
const url = props.isNewOrder
? 'factory/podOrderPacking/local/delPodBoxOrderDetails'
: 'factory/podJomallOrderUs/local/delPodBoxOrderDetails'
const res = await clearAllBoxApi(
url,
warehouseId.value,
userStore.user?.factory.id,
)
......
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