Commit 63b7899c by wusiyi

feat: 备货计划页面1000860

parent 681244f3
...@@ -11,7 +11,8 @@ import { ...@@ -11,7 +11,8 @@ import {
InterProductList, InterProductList,
ExportInWarehouseInfo, ExportInWarehouseInfo,
stockingPlanSearchForm, stockingPlanSearchForm,
InterStackingPlanDetail InterStackingPlanDetail,
InterWarehouseBase
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
export interface LogListData { export interface LogListData {
createTime: string createTime: string
...@@ -683,11 +684,36 @@ export function deleteStackingPlanApi(ids: string) { ...@@ -683,11 +684,36 @@ export function deleteStackingPlanApi(ids: string) {
}, },
) )
} }
// 备货计划 更新物流单号
// 备货计划 审核 export function updateShipmentNumberApi(data: InterWarehouseBase[]) {
export function auditStackingPlanApi(data: WarehouseParams) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factoryStockingPlanRecord/audit', 'factoryStockingPlanRecord/update_shipmentNumber',
{ data }, { stockingPlanRecordParamList: data },
)
}
// 备货计划 导出
export function stackingPlanRecordExport(data: ExportInWarehouseInfo) {
return axios.post<never, BasePaginationData<never>>(
'factoryStockingPlanRecord/export',
data,
{
responseType: 'blob',
},
)
}
// 备货计划 盘点
export function scanBoxCodeApi(boxCode: string) {
return axios.get<never, BaseRespData<never>>(
'factoryStockingPlanRecord/scan_box_code',
{
params: { boxCode },
},
)
}
// 备货计划 打印箱贴
export function printBarcodeApi(data: { id: number, dataVersion: number }[]) {
return axios.post<never, BaseRespData<never[]>>(
'factoryStockingPlanRecord/print_barcode',
data,
) )
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ export interface InterProductList { ...@@ -21,6 +21,7 @@ export interface InterProductList {
productNo?: string | null //custom的货号 productNo?: string | null //custom的货号
buyStored?: number | null //入库数量 buyStored?: number | null //入库数量
outCount?: number | null //出库数量 outCount?: number | null //出库数量
stockUpStored?: number | null //备货数量
remark?: string | null remark?: string | null
skuImage?: string skuImage?: string
skuName?: string skuName?: string
...@@ -80,6 +81,7 @@ export interface InterProductList { ...@@ -80,6 +81,7 @@ export interface InterProductList {
productNo?: string | null //货号 productNo?: string | null //货号
buyStored?: number | null //入库数量 buyStored?: number | null //入库数量
outCount?: number | null //出库数量 outCount?: number | null //出库数量
stockUpStored?: number | null //备货数量
usableInventory?: number | null //可用库存数量 usableInventory?: number | null //可用库存数量
remark?: string | null remark?: string | null
skuImage?: string skuImage?: string
...@@ -127,8 +129,11 @@ export interface stockingPlanSearchForm extends InterWarehouseBase { ...@@ -127,8 +129,11 @@ export interface stockingPlanSearchForm extends InterWarehouseBase {
warehouseSku?: string warehouseSku?: string
} }
// 备货计划 新增编辑 // 备货计划
export interface InterStackingPlanDetail extends InterWarehouseDetail { export interface InterStackingPlanDetail extends InterWarehouseDetail {
boxSum?: number boxSum?: number
checkBoxSum?: number checkBoxSum?: number
box?: number | string
} }
...@@ -109,8 +109,8 @@ ...@@ -109,8 +109,8 @@
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>
<el-button type="success" @click="handleExport"> <el-button type="success" @click="handleExport">
导出</el-button 导出
> </el-button>
</ElFormItem> </ElFormItem>
<ElFormItem v-if="nodeCode === 'PENDING_SUBMIT'"> <ElFormItem v-if="nodeCode === 'PENDING_SUBMIT'">
<el-button type="primary" @click="addDialog(1, null)"> <el-button type="primary" @click="addDialog(1, null)">
...@@ -118,8 +118,12 @@ ...@@ -118,8 +118,12 @@
</el-button> </el-button>
</ElFormItem> </ElFormItem>
<ElFormItem v-if="nodeCode === 'PENDING_AUDIT'"> <ElFormItem
<el-button type="danger" @click="rejectedInRecord"> v-if="
nodeCode === 'PENDING_AUDIT' || nodeCode === 'WAIT_SHIPMENT'
"
>
<el-button type="danger" @click="rejectedInRecord('record')">
驳回 驳回
</el-button> </el-button>
</ElFormItem> </ElFormItem>
...@@ -133,19 +137,39 @@ ...@@ -133,19 +137,39 @@
提交审核 提交审核
</el-button> </el-button>
</ElFormItem> </ElFormItem>
<ElFormItem v-if="nodeCode === 'WAIT_SHIPMENT'">
<ElFormItem> <el-button type="success" @click="printProductTag">
<el-button type="primary" @click="printProductTag"> 打印箱贴
打印库存SKU标签
</el-button> </el-button>
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem v-if="nodeCode === 'IN_TRANSIT'">
<el-button
type="primary"
@click="openUpdateShipmentNumberDialog"
>
更新物流单号
</el-button>
</ElFormItem>
<ElFormItem v-if="nodeCode === 'IN_TRANSIT'">
<el-button
type="warning"
@click="auditOrder('toWaitLoadedCabinets')"
>
转至待卸柜
</el-button>
</ElFormItem>
<ElFormItem v-if="nodeCode === 'WAIT_UNLOADED_CABINETS'">
<ElButton type="warning" @click="openScanDialog">
盘点
</ElButton>
</ElFormItem>
<ElFormItem v-if="nodeCode === 'WAIT_INBOUND'">
<el-button <el-button
v-if="nodeCode === 'COMPLETED'"
type="success" type="success"
@click="auditOrder('archiving')" @click="auditOrder('toWaitInbound')"
> >
归档 转至待上架
</el-button> </el-button>
</ElFormItem> </ElFormItem>
</ElForm> </ElForm>
...@@ -229,7 +253,7 @@ ...@@ -229,7 +253,7 @@
<ElTableColumn <ElTableColumn
label="总金额" label="总金额"
show-overflow-tooltip show-overflow-tooltip
width="120" width="100"
prop="totalPrice" prop="totalPrice"
header-align="center" header-align="center"
align="center" align="center"
...@@ -238,7 +262,7 @@ ...@@ -238,7 +262,7 @@
label="箱数" label="箱数"
header-align="center" header-align="center"
prop="boxSum" prop="boxSum"
width="90" width="60"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
...@@ -246,7 +270,7 @@ ...@@ -246,7 +270,7 @@
label="盘点箱数" label="盘点箱数"
header-align="center" header-align="center"
prop="checkBoxSum" prop="checkBoxSum"
width="90" width="80"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
...@@ -285,7 +309,7 @@ ...@@ -285,7 +309,7 @@
<ElTableColumn <ElTableColumn
label="发货时间" label="发货时间"
header-align="center" header-align="center"
prop="shipmentTime" prop="deliveryTime"
width="130" width="130"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
...@@ -293,7 +317,7 @@ ...@@ -293,7 +317,7 @@
<ElTableColumn <ElTableColumn
label="入库时间" label="入库时间"
header-align="center" header-align="center"
prop="deliveryTime" prop="warehouseTime"
width="130" width="130"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
...@@ -301,8 +325,9 @@ ...@@ -301,8 +325,9 @@
<ElTableColumn <ElTableColumn
label="驳回原因" label="驳回原因"
show-overflow-tooltip show-overflow-tooltip
prop="rejectReason" prop="rejectCause"
header-align="center" header-align="center"
width="130"
align="center" align="center"
/> />
<ElTableColumn <ElTableColumn
...@@ -325,14 +350,24 @@ ...@@ -325,14 +350,24 @@
type="primary" type="primary"
link link
@click="addDialog(2, row)" @click="addDialog(2, row)"
>编辑 >
编辑
</ElButton> </ElButton>
<ElButton <ElButton
v-if="nodeCode === 'PENDING_AUDIT'" v-if="nodeCode === 'PENDING_AUDIT'"
type="warning" type="warning"
link link
@click="addDialog(3, row)" @click="addDialog(3, row)"
>审核 >
审核
</ElButton>
<ElButton
v-if="nodeCode === 'WAIT_SHIPMENT'"
type="success"
link
@click="addDialog(4, row)"
>
完成发货
</ElButton> </ElButton>
</template> </template>
</ElTableColumn> </ElTableColumn>
...@@ -433,13 +468,6 @@ ...@@ -433,13 +468,6 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
width="240"
label="备注"
prop="remark"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="创建时间" label="创建时间"
width="130" width="130"
prop="createTime" prop="createTime"
...@@ -447,9 +475,9 @@ ...@@ -447,9 +475,9 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="更新时间" width="240"
width="130" label="备注"
prop="updateTime" prop="remark"
/> />
</ElTable> </ElTable>
</div> </div>
...@@ -485,7 +513,7 @@ ...@@ -485,7 +513,7 @@
</div> </div>
<ElDialog <ElDialog
v-model="importDialogVisible" v-model="importDialogVisible"
title="导入入库单" title="导入备货单"
width="500px" width="500px"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
...@@ -494,8 +522,8 @@ ...@@ -494,8 +522,8 @@
<UploadExcel <UploadExcel
v-model="importedFileUrl" v-model="importedFileUrl"
:import-type="'localAndXlsx'" :import-type="'localAndXlsx'"
:import-name="'入库单'" :import-name="'备货单'"
:import-url="'/files/warehousingEntry.xlsx'" :import-url="'/files/stockingPlan.xlsx'"
@imported="handleLocalImport" @imported="handleLocalImport"
/> />
</div> </div>
...@@ -503,7 +531,7 @@ ...@@ -503,7 +531,7 @@
</ElDialog> </ElDialog>
<ElDialog <ElDialog
v-model="newDialogVisible" v-model="newDialogVisible"
:title="actionMap[currentAction - 1].label + '备货计划'" :title="actionMap[currentAction - 1].label"
width="80%" width="80%"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
...@@ -542,7 +570,7 @@ ...@@ -542,7 +570,7 @@
<ElInput <ElInput
v-model.trim="editForm.boxSum" v-model.trim="editForm.boxSum"
placeholder="请输入箱数" placeholder="请输入箱数"
:disabled="currentAction === 3" :disabled="currentAction === 3 || currentAction === 4"
style="width: 160px" style="width: 160px"
clearable clearable
/> />
...@@ -550,7 +578,7 @@ ...@@ -550,7 +578,7 @@
<ElFormItem label="备注" prop="remark"> <ElFormItem label="备注" prop="remark">
<ElInput <ElInput
v-model.trim="editForm.remark" v-model.trim="editForm.remark"
:disabled="currentAction === 3" :disabled="currentAction === 3 || currentAction === 4"
placeholder="请输入备注" placeholder="请输入备注"
style="width: 160px" style="width: 160px"
clearable clearable
...@@ -611,7 +639,7 @@ ...@@ -611,7 +639,7 @@
<template #default="{ row }"> <template #default="{ row }">
<el-input <el-input
v-model.number="row.stockUpStored" v-model.number="row.stockUpStored"
:disabled="currentAction === 3" :disabled="currentAction === 3 || currentAction === 4"
placeholder="备货数量" placeholder="备货数量"
style="width: 120px" style="width: 120px"
clearable clearable
...@@ -645,7 +673,7 @@ ...@@ -645,7 +673,7 @@
v-model="row.locationId" v-model="row.locationId"
clearable clearable
placeholder="请输入库位" placeholder="请输入库位"
:disabled="currentAction === 3" :disabled="currentAction === 3 || currentAction === 4"
style="width: 120px" style="width: 120px"
filterable filterable
@change="handleLocationChange(row.locationId, row)" @change="handleLocationChange(row.locationId, row)"
...@@ -671,7 +699,7 @@ ...@@ -671,7 +699,7 @@
v-model.trim="row.remark" v-model.trim="row.remark"
clearable clearable
size="small" size="small"
:disabled="currentAction === 3" :disabled="currentAction === 3 || currentAction === 4"
/> />
</template> </template>
</ElTableColumn> </ElTableColumn>
...@@ -679,14 +707,14 @@ ...@@ -679,14 +707,14 @@
</div> </div>
<template #footer> <template #footer>
<div class="product-dialog-footer"> <div class="product-dialog-footer">
<div v-if="currentAction !== 3"> <div v-if="currentAction !== 3 && currentAction !== 4">
<el-input <el-input
v-model.trim="selectSku" v-model.trim="selectSku"
placeholder="库存SKU" placeholder="库存SKU"
style="width: 200px; margin: 0 10px" style="width: 200px; margin: 0 10px"
clearable clearable
size="small" size="small"
></el-input> />
<el-popover placement="top-start" width="1000" trigger="click"> <el-popover placement="top-start" width="1000" trigger="click">
<div v-if="skuData.length > 0" style="height: 50vh"> <div v-if="skuData.length > 0" style="height: 50vh">
<ElTable size="small" :data="filterSkuData" height="100%" border> <ElTable size="small" :data="filterSkuData" height="100%" border>
...@@ -799,24 +827,24 @@ ...@@ -799,24 +827,24 @@
导入 导入
</el-button> </el-button>
</div> </div>
<div :style="{ margin: currentAction === 3 ? '0 auto' : '' }"> <div
:style="{
margin: currentAction === 3 || currentAction === 4 ? '0 auto' : '',
}"
>
<el-button size="small" @click="newDialogVisible = false"> <el-button size="small" @click="newDialogVisible = false">
取消 取消
</el-button> </el-button>
<el-button <el-button
v-if="currentAction === 3" v-if="currentAction === 3 || currentAction === 4"
type="danger" type="danger"
size="small" size="small"
@click="rejectInAudit" @click="rejectedInRecord('audit')"
> >
驳回 驳回
</el-button> </el-button>
<el-button <el-button type="primary" size="small" @click="addOtherCurrency">
type="primary" 确认
size="small"
@click="currentAction === 2 ? addOtherCurrency : handleOudit"
>
保存
</el-button> </el-button>
</div> </div>
</div> </div>
...@@ -849,32 +877,11 @@ ...@@ -849,32 +877,11 @@
</ElDialog> </ElDialog>
<el-dialog v-model="showPrintDialog" title="打印参数设置"> <el-dialog v-model="showPrintDialog" title="打印参数设置">
<el-table height="400px" :data="printData" border> <el-table height="400px" :data="printData" border>
<el-table-column <el-table-column width="60" align="center" type="index" label="序号" />
width="60" <el-table-column align="center" prop="skuName" label="商品名称" />
align="center" <el-table-column align="center" prop="warehouseSku" label="库存SKU" />
type="index" <el-table-column align="center" prop="locationName" label="库位编码" />
label="序号" <el-table-column align="center" prop="supplierItemNo" label="款号" />
></el-table-column>
<el-table-column
align="center"
prop="skuName"
label="商品名称"
></el-table-column>
<el-table-column
align="center"
prop="warehouseSku"
label="库存SKU"
></el-table-column>
<el-table-column
align="center"
prop="locationName"
label="库位编码"
></el-table-column>
<el-table-column
align="center"
prop="supplierItemNo"
label="款号"
></el-table-column>
<el-table-column align="center" prop="number" label="打印数量"> <el-table-column align="center" prop="number" label="打印数量">
<template #default="{ row }"> <template #default="{ row }">
<el-input <el-input
...@@ -918,6 +925,60 @@ ...@@ -918,6 +925,60 @@
</span> </span>
</template> </template>
</ElDialog> </ElDialog>
<ElDialog
v-model="updateShipmentNumberVisible"
title="更新物流单号"
width="500px"
>
<ElTable :data="updateShipmentNumberForm" border>
<ElTableColumn prop="inNo" label="备货单号" />
<ElTableColumn prop="shipmentNumber" label="物流单号">
<template #default="{ row }">
<el-input
v-model="row.shipmentNumber"
clearable
placeholder="请输入物流单号"
/>
</template>
</ElTableColumn>
</ElTable>
<template #footer>
<el-button @click="updateShipmentNumberVisible = false">取消</el-button>
<el-button type="primary" @click="updateShipmentNumber"> 确认 </el-button>
</template>
</ElDialog>
<ElDialog v-model="scanDialogVisible" width="800px" title="盘点">
<el-input
v-model="scanInput"
placeholder="请输入备货单号"
style="width: 90%"
clearable
@keyup.enter="scan"
/>
<el-button type="primary" style="margin-left: 10px" @click="scan">
查询
</el-button>
<el-descriptions style="margin-top: 50px">
<el-descriptions-item label="备货仓库">
{{ scanData.warehouseName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="备货单号">
{{ scanData.inNo || '-' }}
</el-descriptions-item>
<el-descriptions-item label="物流单号">
{{ scanData.shipmentNumber || '-' }}
</el-descriptions-item>
<el-descriptions-item label="当前箱子">
{{ scanData.box || '-' }}
</el-descriptions-item>
<el-descriptions-item label="箱数">
{{ scanData.boxSum || '-' }}
</el-descriptions-item>
<el-descriptions-item label="盘点箱数">
{{ scanData.checkBoxSum || '-' }}
</el-descriptions-item>
</el-descriptions>
</ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
...@@ -943,10 +1004,11 @@ import { ...@@ -943,10 +1004,11 @@ import {
rejectStackingPlanApi, rejectStackingPlanApi,
LogListData, LogListData,
warehouseInfo, warehouseInfo,
InRecordBatchCheckPrintApi, printBarcodeApi,
factoryWarehouseInventoryPrint, factoryWarehouseInventoryPrint,
warehouseInRecordExport, stackingPlanRecordExport,
auditStackingPlanApi, updateShipmentNumberApi,
scanBoxCodeApi,
} from '@/api/warehouse' } from '@/api/warehouse'
import { filePath } from '@/api/axios.ts' import { filePath } from '@/api/axios.ts'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
...@@ -960,6 +1022,7 @@ import { ...@@ -960,6 +1022,7 @@ import {
InterskuList, InterskuList,
ILocation, ILocation,
InterStackingPlanDetail, InterStackingPlanDetail,
InterWarehouseBase,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import UploadExcel from '@/components/UploadExcel.vue' import UploadExcel from '@/components/UploadExcel.vue'
...@@ -1087,7 +1150,9 @@ function getStartTime() { ...@@ -1087,7 +1150,9 @@ function getStartTime() {
} }
const selectSku = ref('') const selectSku = ref('')
const treeData = ref<InterWarehouseTree[]>() const treeData = ref<InterWarehouseTree[]>()
const [searchForm, resetSearchForm] = useValue<stockingPlanSearchForm>({}) const [searchForm, resetSearchForm] = useValue<stockingPlanSearchForm>({
dateStr: 'createTime',
})
const tradingTime = ref<string[]>([]) const tradingTime = ref<string[]>([])
const selections = ref<InterWarehousePage[]>([]) const selections = ref<InterWarehousePage[]>([])
...@@ -1122,7 +1187,7 @@ const { ...@@ -1122,7 +1187,7 @@ const {
getStackingPlanListPage( getStackingPlanListPage(
{ {
...searchForm.value, ...searchForm.value,
billStatus: nodeCode.value == 'all' ? 'all' : nodeCode.value, billStatus: nodeCode.value == 'all' ? '' : nodeCode.value,
startDate: tradingTime.value && tradingTime.value[0], startDate: tradingTime.value && tradingTime.value[0],
endDate: tradingTime.value && tradingTime.value[1], endDate: tradingTime.value && tradingTime.value[1],
}, },
...@@ -1137,9 +1202,11 @@ const setCostPrice = (item: InterProductList) => { ...@@ -1137,9 +1202,11 @@ const setCostPrice = (item: InterProductList) => {
return return
} }
if (item) { if (item) {
const buyStored = item.buyStored ?? 0 const stockUpStored = item.stockUpStored ?? 0
const costPrice = item.costPrice ?? 0 const costPrice = item.costPrice ?? 0
const amount = new BigNumber(buyStored).multipliedBy(costPrice).toFixed(2) const amount = new BigNumber(stockUpStored)
.multipliedBy(costPrice)
.toFixed(2)
item.totalPrice = Number(amount) item.totalPrice = Number(amount)
} }
} }
...@@ -1157,22 +1224,37 @@ const getTreeNum = async () => { ...@@ -1157,22 +1224,37 @@ const getTreeNum = async () => {
} }
const showPrintDialog = ref(false) const showPrintDialog = ref(false)
const printData = ref([]) const printData = ref([])
// const printProductTag = async () => {
// if (!selections.value.length) {
// return ElMessage.warning('请选择要操作的数据')
// }
// const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
// try {
// const res = await printBarcodeApi(str)
// if (res.code === 200) {
// printData.value = res.data
// showPrintDialog.value = true
// } else {
// ElMessage.error(res.message)
// }
// } catch (e) {
// console.error(e)
// }
// }
const printProductTag = async () => { const printProductTag = async () => {
if (!selections.value.length) { if (!selections.value.length) {
return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
} }
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',') const str: { id: number; dataVersion: number }[] = selections.value.map(
try { (el: InterWarehousePage) => ({
const res = await InRecordBatchCheckPrintApi(str) id: el.id ?? 0,
if (res.code === 200) { dataVersion: el.dataVersion ?? 0,
printData.value = res.data }),
showPrintDialog.value = true )
} else { const res = await printBarcodeApi(str)
ElMessage.error(res.message) showPrintDialog.value = false
} window.open(filePath + res.message, '_blank')
} catch (e) {
console.error(e)
}
} }
async function handlePrintProductTag() { async function handlePrintProductTag() {
...@@ -1291,6 +1373,7 @@ const handleLocalImport = async ({ ...@@ -1291,6 +1373,7 @@ const handleLocalImport = async ({
return obj return obj
}) })
.filter((item) => item.warehouseSku) .filter((item) => item.warehouseSku)
// console.log('@', importedData, data) // console.log('@', importedData, data)
if (importedData.length === 0) { if (importedData.length === 0) {
ElMessage.warning('导入数据中没有有效的商品SKU') ElMessage.warning('导入数据中没有有效的商品SKU')
...@@ -1321,16 +1404,17 @@ const handleLocalImport = async ({ ...@@ -1321,16 +1404,17 @@ const handleLocalImport = async ({
warehouseSku: skuItem.sku, warehouseSku: skuItem.sku,
skuName: skuItem.skuName, skuName: skuItem.skuName,
productNo: skuItem.productNo, productNo: skuItem.productNo,
locationCode: target?.locationCode ?? '', locationCode: importedItem?.locationCode ?? null,
locationId: target?.locationId, locationId: target?.locationId,
costPrice: skuItem.factoryPrice, costPrice: skuItem.factoryPrice,
buyStored: importedItem?.buyStored ?? null, buyStored: importedItem?.buyStored ?? null,
totalPrice: new BigNumber( totalPrice: new BigNumber(
(importedItem?.buyStored ?? 0) as number | string, (importedItem?.stockUpStored ?? 0) as number | string,
) )
.multipliedBy(skuItem.factoryPrice ?? 0) .multipliedBy(skuItem.factoryPrice ?? 0)
.toNumber(), .toNumber(),
usableInventory: skuItem.usableInventory, usableInventory: skuItem.usableInventory,
stockUpStored: importedItem?.stockUpStored ?? null,
remark: importedItem?.remark ?? null, remark: importedItem?.remark ?? null,
} as InterProductList // 明确类型 } as InterProductList // 明确类型
}) })
...@@ -1366,23 +1450,31 @@ const submitExportForm = async () => { ...@@ -1366,23 +1450,31 @@ const submitExportForm = async () => {
} else if (resourceType === 2) { } else if (resourceType === 2) {
purchaseIds = '' purchaseIds = ''
exportTotal = total.value exportTotal = total.value
params.billStatus = nodeCode.value == 'all' ? 'all' : nodeCode.value params.billStatus = nodeCode.value == 'all' ? '' : nodeCode.value
} }
params.idList = purchaseIds params.idList = purchaseIds
if (exportTotal !== undefined) { if (exportTotal !== undefined) {
params.total = exportTotal params.total = exportTotal
} }
try { stackingPlanRecordExport({
const res = await warehouseInRecordExport({ showDetail: exportForm.value.delivery,
showDetail: exportForm.value.delivery, ...params,
...params, ...searchForm.value,
...searchForm.value, })
.then((res) => {
const blob = new Blob([res as unknown as BlobPart], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
})
const filename = `备货计划_${new Date().getTime()}.xlsx`
const link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = filename
link.click()
window.URL.revokeObjectURL(link.href)
})
.finally(() => {
exportVisible.value = false
}) })
window.open(filePath + res.message, '_blank')
exportVisible.value = false
} catch (e) {
exportVisible.value = false
}
} }
const getWarehouseList = async () => { const getWarehouseList = async () => {
try { try {
...@@ -1487,19 +1579,19 @@ const editFormRef = ref() ...@@ -1487,19 +1579,19 @@ const editFormRef = ref()
const editForm2 = ref({}) const editForm2 = ref({})
const formId = ref<number | undefined>(undefined) const formId = ref<number | undefined>(undefined)
const actionMap = [ const actionMap = [
{ label: '新增', value: 1 }, { label: '新增备货计划', value: 1 },
{ label: '编辑', value: 2 }, { label: '编辑备货计划', value: 2 },
{ label: '审核', value: 3 }, { label: '备货计划审核', value: 3 },
{ label: '完成发货', value: 4 },
] ]
const currentAction = ref<number>(1) const currentAction = ref<number>(1)
const otherPurchaseData = ref<InterProductList[]>([]) const otherPurchaseData = ref<InterProductList[]>([])
const addDialog = async (i: number, v: InterWarehousePage | null) => { const addDialog = async (i: number, v: InterWarehousePage | null) => {
currentAction.value = i currentAction.value = i
if (i === 2 || i === 3) { if (i !== 1) {
if (v) formId.value = v.id if (v) formId.value = v.id
if (v) getProduct(v.id) if (v) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录') if (!formId.value) return ElMessage('请勾选至少一条记录')
// editForm.value = JSON.parse(JSON.stringify(v))
} else { } else {
await nextTick() await nextTick()
editForm.value = JSON.parse(JSON.stringify(editForm2.value)) editForm.value = JSON.parse(JSON.stringify(editForm2.value))
...@@ -1528,6 +1620,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1528,6 +1620,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
selectSku.value = '' selectSku.value = ''
newDialogVisible.value = true newDialogVisible.value = true
} }
const getProduct = async (id: number | undefined) => { const getProduct = async (id: number | undefined) => {
try { try {
const res = await getStackingPlanDetailApi(id) const res = await getStackingPlanDetailApi(id)
...@@ -1544,27 +1637,32 @@ const otherWarehouseSelection = ref<InterProductList[]>([]) ...@@ -1544,27 +1637,32 @@ const otherWarehouseSelection = ref<InterProductList[]>([])
const productSelectionChange = (v: InterProductList[]) => { const productSelectionChange = (v: InterProductList[]) => {
otherWarehouseSelection.value = v otherWarehouseSelection.value = v
} }
const auditOrder = (key: string) => { const auditOrder = async (key: string) => {
if (selections.value.length === 0) { if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
} }
let url = '' let url = ''
let text = '' let text = ''
switch (key) { switch (key) {
case 'archiving':
url = 'factory/warehouseInRecord/archive'
text = '归档'
break
case 'submitAudit': case 'submitAudit':
url = 'factoryStockingPlanRecord/submit_audit' url = 'factoryStockingPlanRecord/submit_audit'
text = '提交审核' text = '提交审核'
break break
case 'toWaitLoadedCabinets':
url = 'factoryStockingPlanRecord/to_wait_unloaded_cabinets'
text = '转至待卸柜'
break
case 'toWaitInbound':
url = 'factoryStockingPlanRecord/to_wait_inbound'
text = '转至待上架'
break
} }
const confimText = `确定对选中的信息进行${text}?` const confimText = `确定对选中的信息进行${text}?`
ElMessageBox.confirm(confimText, '重要提示', { await ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'warning', type: 'warning',
}).then(async () => { })
try {
const data = selections.value.map( const data = selections.value.map(
({ id, dataVersion }: InterWarehousePage) => ({ ({ id, dataVersion }: InterWarehousePage) => ({
id, id,
...@@ -1575,49 +1673,18 @@ const auditOrder = (key: string) => { ...@@ -1575,49 +1673,18 @@ const auditOrder = (key: string) => {
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
await getTreeNum() await getTreeNum()
}) } catch (e) {
} console.error(e)
}
const handleOudit = async () => {
await auditStackingPlanApi({
id: currentRow.value?.id,
dataVersion: currentRow.value?.dataVersion,
})
ElMessage.success('操作成功')
search()
await getTreeNum()
} }
const rejectInAudit = () => { const rejectedInRecord = (type: 'audit' | 'record') => {
ElMessageBox.prompt('请输入驳回原因', '提示', { if (type === 'record') {
confirmButtonText: '确定', if (selections.value.length === 0) {
cancelButtonText: '取消', return ElMessage.warning('请选择要操作的数据')
type: 'warning',
inputPattern: /.+/,
customClass: 'reject',
inputErrorMessage: '请输入驳回原因',
inputPlaceholder: '驳回原因',
}).then(async ({ value }: { value: string }) => {
const data = [currentRow.value as InterProductList]
try {
await rejectStackingPlanApi({
list: data,
rejectReason: value,
status: nodeCode.value,
})
ElMessage.success('操作成功')
newDialogVisible.value = false
search()
await getTreeNum()
} catch (e) {
console.error(e)
} }
})
}
const rejectedInRecord = () => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
} }
ElMessageBox.prompt('请输入驳回原因', '提示', { ElMessageBox.prompt('请输入驳回原因', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -1697,10 +1764,39 @@ const addOtherCurrency = async () => { ...@@ -1697,10 +1764,39 @@ const addOtherCurrency = async () => {
arr[i].locationCode = found ? found?.locationCode : '' arr[i].locationCode = found ? found?.locationCode : ''
} }
} }
if (!formId.value) {
addSection() let url = ''
} else { switch (nodeCode.value) {
upSection() // 新增
case 'PENDING_SUBMIT':
if (!formId.value) {
addSection()
} else {
upSection()
}
return
// 审核
case 'PENDING_AUDIT':
url = 'factoryStockingPlanRecord/audit'
break
// 完成发货
case 'WAIT_SHIPMENT':
url = 'factoryStockingPlanRecord/complete_shipment'
break
}
try {
console.log(currentRow.value)
const data = [
{ id: currentRow.value?.id, dataVersion: currentRow.value?.dataVersion },
] as InterWarehousePage[]
await auditOrderApi(url, data)
newDialogVisible.value = false
ElMessage.success('操作成功')
search()
await getTreeNum()
} catch (e) {
console.error(e)
} }
} }
...@@ -1737,7 +1833,7 @@ const upSection = async () => { ...@@ -1737,7 +1833,7 @@ const upSection = async () => {
) )
try { try {
await updateStackingPlanApi(result as InterStackingPlanDetail) await updateStackingPlanApi(result as unknown as InterStackingPlanDetail)
newDialogVisible.value = false newDialogVisible.value = false
ElMessage.success('修改成功') ElMessage.success('修改成功')
search() search()
...@@ -1890,6 +1986,81 @@ const handleWarehouseChange = (val: number | string | undefined) => { ...@@ -1890,6 +1986,81 @@ const handleWarehouseChange = (val: number | string | undefined) => {
editForm.value.warehouseName = found ? found.name : '' editForm.value.warehouseName = found ? found.name : ''
} }
// 更新物流单号
const updateShipmentNumberVisible = ref(false)
const updateShipmentNumberForm = ref<InterWarehouseBase[]>([
{
inNo: '',
shipmentNumber: '',
warehouseId: '',
id: 0,
},
])
// 打开更新物流单号弹窗
const openUpdateShipmentNumberDialog = () => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
updateShipmentNumberForm.value = selections.value.map(
(item: InterWarehousePage) => {
return {
inNo: item.inNo,
shipmentNumber: item.shipmentNumber,
warehouseId: item.warehouseId,
id: item.id,
}
},
)
updateShipmentNumberVisible.value = true
}
// 更新物流单号
const updateShipmentNumber = async () => {
try {
await updateShipmentNumberApi(
updateShipmentNumberForm.value as InterWarehouseBase[],
)
updateShipmentNumberVisible.value = false
ElMessage.success('更新成功')
search()
await getTreeNum()
} catch (e) {
console.error(e)
}
}
// 盘点
const scanDialogVisible = ref(false)
const scanInput = ref('')
const scanData = ref<InterStackingPlanDetail>({} as InterStackingPlanDetail)
const openScanDialog = () => {
scanInput.value = ''
scanData.value = {} as InterStackingPlanDetail
scanDialogVisible.value = true
}
// 扫码盘点
const scan = async () => {
if (!scanInput.value) {
return ElMessage.warning('请输入备货单号')
}
const loading = ElLoading.service({
lock: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.7)',
})
try {
const res = await scanBoxCodeApi(scanInput.value)
if (res.code === 200) {
scanData.value = res.data
} else {
ElMessage.error(res.message)
}
} catch (e) {
console.error(e)
} finally {
loading.close()
scanInput.value = ''
}
}
/** /**
* @description: 页面添加回车监听 * @description: 页面添加回车监听
*/ */
......
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