Commit c61b0b9e by qinjianhui

feat: 播种墙配货功能开发

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