diff --git a/apps/web-antd/src/api/mes/pro/workorder/index.ts b/apps/web-antd/src/api/mes/pro/workorder/index.ts index fcc22b79e..24de7d057 100644 --- a/apps/web-antd/src/api/mes/pro/workorder/index.ts +++ b/apps/web-antd/src/api/mes/pro/workorder/index.ts @@ -21,6 +21,8 @@ export namespace MesProWorkOrderApi { routeName?: string; clientId?: number; clientName?: string; + vendorId?: number; // 供应商编号 + vendorName?: string; // 供应商名称 planStartTime?: number | string; planEndTime?: number | string; actualStartTime?: number | string; diff --git a/apps/web-antd/src/api/mes/wm/itemreceipt/index.ts b/apps/web-antd/src/api/mes/wm/itemreceipt/index.ts index d7086de99..c1a77cd98 100644 --- a/apps/web-antd/src/api/mes/wm/itemreceipt/index.ts +++ b/apps/web-antd/src/api/mes/wm/itemreceipt/index.ts @@ -1,3 +1,5 @@ +import type { PageParam, PageResult } from '@vben/request'; + import { requestClient } from '#/api/request'; export namespace MesWmItemReceiptApi { @@ -19,16 +21,66 @@ export namespace MesWmItemReceiptApi { locationName?: string; // 库区名称 areaId?: number; // 库位编号 areaName?: string; // 库位名称 - receiptDate?: Date | number | string; // 入库日期 + receiptDate?: number; // 入库日期 status?: number; // 状态 remark?: string; // 备注 createTime?: Date; // 创建时间 } } +/** 查询采购入库单分页 */ +export function getItemReceiptPage(params: PageParam) { + return requestClient.get>( + '/mes/wm/item-receipt/page', + { params }, + ); +} + /** 查询采购入库单详情 */ export function getItemReceipt(id: number) { return requestClient.get( `/mes/wm/item-receipt/get?id=${id}`, ); } + +/** 新增采购入库单 */ +export function createItemReceipt(data: MesWmItemReceiptApi.ItemReceipt) { + return requestClient.post('/mes/wm/item-receipt/create', data); +} + +/** 修改采购入库单 */ +export function updateItemReceipt(data: MesWmItemReceiptApi.ItemReceipt) { + return requestClient.put('/mes/wm/item-receipt/update', data); +} + +/** 删除采购入库单 */ +export function deleteItemReceipt(id: number) { + return requestClient.delete(`/mes/wm/item-receipt/delete?id=${id}`); +} + +/** 提交采购入库单 */ +export function submitItemReceipt(id: number) { + return requestClient.put(`/mes/wm/item-receipt/submit?id=${id}`); +} + +/** 执行上架 */ +export function stockItemReceipt(id: number) { + return requestClient.put(`/mes/wm/item-receipt/stock?id=${id}`); +} + +/** 执行入库 */ +export function finishItemReceipt(id: number) { + return requestClient.put(`/mes/wm/item-receipt/finish?id=${id}`); +} + +/** 取消采购入库单 */ +export function cancelItemReceipt(id: number) { + return requestClient.put(`/mes/wm/item-receipt/cancel?id=${id}`); +} + +/** 导出采购入库单 */ +export function exportItemReceipt(params: any) { + return requestClient.download('/mes/wm/item-receipt/export-excel', { + params, + }); +} diff --git a/apps/web-antd/src/api/mes/wm/itemreceipt/line/index.ts b/apps/web-antd/src/api/mes/wm/itemreceipt/line/index.ts index 55562e84c..8ce7236c1 100644 --- a/apps/web-antd/src/api/mes/wm/itemreceipt/line/index.ts +++ b/apps/web-antd/src/api/mes/wm/itemreceipt/line/index.ts @@ -3,11 +3,12 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; export namespace MesWmItemReceiptLineApi { - /** MES 物料接收单行 */ + /** MES 采购入库单行 */ export interface ItemReceiptLine { id?: number; // 行编号 receiptId?: number; // 入库单编号 receiptCode?: string; // 入库单编码 + arrivalNoticeLineId?: number; // 到货通知单行编号 purchaseOrderCode?: string; // 采购订单号 itemId?: number; // 物料编号 itemCode?: string; // 物料编码 @@ -15,14 +16,48 @@ export namespace MesWmItemReceiptLineApi { specification?: string; // 规格型号 unitMeasureName?: string; // 单位 receivedQuantity?: number; // 入库数量 + batchId?: number; // 批次编号 batchCode?: string; // 批次号 + productionDate?: number; // 生产日期 + expireDate?: number; // 有效期 + lotNumber?: string; // 生产批号 + iqcCheckFlag?: boolean; // 是否检验 + iqcId?: number; // 来料检验单编号 + iqcCode?: string; // 来料检验单编码 + remark?: string; // 备注 } } -/** 查询物料接收单行分页 */ +/** 查询采购入库单行分页 */ export function getItemReceiptLinePage(params: PageParam) { return requestClient.get>( '/mes/wm/item-receipt-line/page', { params }, ); } + +/** 查询采购入库单行详情 */ +export function getItemReceiptLine(id: number) { + return requestClient.get( + `/mes/wm/item-receipt-line/get?id=${id}`, + ); +} + +/** 新增采购入库单行 */ +export function createItemReceiptLine( + data: MesWmItemReceiptLineApi.ItemReceiptLine, +) { + return requestClient.post('/mes/wm/item-receipt-line/create', data); +} + +/** 修改采购入库单行 */ +export function updateItemReceiptLine( + data: MesWmItemReceiptLineApi.ItemReceiptLine, +) { + return requestClient.put('/mes/wm/item-receipt-line/update', data); +} + +/** 删除采购入库单行 */ +export function deleteItemReceiptLine(id: number) { + return requestClient.delete(`/mes/wm/item-receipt-line/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/wm/outsourceissue/detail/index.ts b/apps/web-antd/src/api/mes/wm/outsourceissue/detail/index.ts new file mode 100644 index 000000000..15b50b6a6 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/outsourceissue/detail/index.ts @@ -0,0 +1,60 @@ +import { requestClient } from '#/api/request'; + +export namespace MesWmOutsourceIssueDetailApi { + /** MES 外协发料单明细 */ + export interface OutsourceIssueDetail { + id?: number; // 明细编号 + lineId?: number; // 行编号 + issueId?: number; // 发料单编号 + itemId?: number; // 物料编号 + itemCode?: string; // 物料编码 + itemName?: string; // 物料名称 + specification?: string; // 规格型号 + unitMeasureName?: string; // 计量单位名称 + quantity?: number; // 数量 + materialStockId?: number; // 库存编号 + batchId?: number; // 批次编号 + batchCode?: string; // 批次编码 + warehouseId?: number; // 仓库编号 + warehouseName?: string; // 仓库名称 + locationId?: number; // 库区编号 + locationName?: string; // 库区名称 + areaId?: number; // 库位编号 + areaName?: string; // 库位名称 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询外协发料单明细列表 */ +export function getOutsourceIssueDetailListByLineId(lineId: number) { + return requestClient.get< + MesWmOutsourceIssueDetailApi.OutsourceIssueDetail[] + >('/mes/wm/outsource-issue-detail/list-by-line', { params: { lineId } }); +} + +/** 查询外协发料单明细详情 */ +export function getOutsourceIssueDetail(id: number) { + return requestClient.get( + `/mes/wm/outsource-issue-detail/get?id=${id}`, + ); +} + +/** 新增外协发料单明细 */ +export function createOutsourceIssueDetail( + data: MesWmOutsourceIssueDetailApi.OutsourceIssueDetail, +) { + return requestClient.post('/mes/wm/outsource-issue-detail/create', data); +} + +/** 修改外协发料单明细 */ +export function updateOutsourceIssueDetail( + data: MesWmOutsourceIssueDetailApi.OutsourceIssueDetail, +) { + return requestClient.put('/mes/wm/outsource-issue-detail/update', data); +} + +/** 删除外协发料单明细 */ +export function deleteOutsourceIssueDetail(id: number) { + return requestClient.delete(`/mes/wm/outsource-issue-detail/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/wm/outsourceissue/index.ts b/apps/web-antd/src/api/mes/wm/outsourceissue/index.ts new file mode 100644 index 000000000..8b3b94b75 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/outsourceissue/index.ts @@ -0,0 +1,90 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmOutsourceIssueApi { + /** MES 外协发料单 */ + export interface OutsourceIssue { + id?: number; // 发料单编号 + code?: string; // 发料单编号 + name?: string; // 发料单名称 + vendorId?: number; // 供应商编号 + vendorCode?: string; // 供应商编码 + vendorName?: string; // 供应商名称 + workOrderId?: number; // 生产工单编号 + workOrderCode?: string; // 生产工单编码 + workOrderName?: string; // 生产工单名称 + issueDate?: number; // 发料日期 + status?: number; // 单据状态 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询外协发料单分页 */ +export function getOutsourceIssuePage(params: PageParam) { + return requestClient.get>( + '/mes/wm/outsource-issue/page', + { params }, + ); +} + +/** 查询外协发料单详情 */ +export function getOutsourceIssue(id: number) { + return requestClient.get( + `/mes/wm/outsource-issue/get?id=${id}`, + ); +} + +/** 新增外协发料单 */ +export function createOutsourceIssue( + data: MesWmOutsourceIssueApi.OutsourceIssue, +) { + return requestClient.post('/mes/wm/outsource-issue/create', data); +} + +/** 修改外协发料单 */ +export function updateOutsourceIssue( + data: MesWmOutsourceIssueApi.OutsourceIssue, +) { + return requestClient.put('/mes/wm/outsource-issue/update', data); +} + +/** 删除外协发料单 */ +export function deleteOutsourceIssue(id: number) { + return requestClient.delete(`/mes/wm/outsource-issue/delete?id=${id}`); +} + +/** 提交外协发料单 */ +export function submitOutsourceIssue(id: number) { + return requestClient.put(`/mes/wm/outsource-issue/submit?id=${id}`); +} + +/** 执行拣货 */ +export function stockOutsourceIssue(id: number) { + return requestClient.put(`/mes/wm/outsource-issue/stock?id=${id}`); +} + +/** 执行领出 */ +export function finishOutsourceIssue(id: number) { + return requestClient.put(`/mes/wm/outsource-issue/finish?id=${id}`); +} + +/** 取消外协发料单 */ +export function cancelOutsourceIssue(id: number) { + return requestClient.put(`/mes/wm/outsource-issue/cancel?id=${id}`); +} + +/** 校验外协发料单拣货数量是否与发料数量一致 */ +export function checkOutsourceIssueQuantity(id: number) { + return requestClient.get( + `/mes/wm/outsource-issue/check-quantity?id=${id}`, + ); +} + +/** 导出外协发料单 */ +export function exportOutsourceIssue(params: any) { + return requestClient.download('/mes/wm/outsource-issue/export-excel', { + params, + }); +} diff --git a/apps/web-antd/src/api/mes/wm/outsourceissue/line/index.ts b/apps/web-antd/src/api/mes/wm/outsourceissue/line/index.ts new file mode 100644 index 000000000..68fae8f95 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/outsourceissue/line/index.ts @@ -0,0 +1,55 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmOutsourceIssueLineApi { + /** MES 外协发料单行 */ + export interface OutsourceIssueLine { + id?: number; // 行编号 + issueId?: number; // 发料单编号 + itemId?: number; // 物料编号 + itemCode?: string; // 物料编码 + itemName?: string; // 物料名称 + specification?: string; // 规格型号 + unitMeasureName?: string; // 计量单位名称 + quantity?: number; // 发料数量 + materialStockId?: number; // 库存编号 + batchId?: number; // 批次编号 + batchCode?: string; // 批次编码 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询外协发料单行分页 */ +export function getOutsourceIssueLinePage(params: PageParam) { + return requestClient.get< + PageResult + >('/mes/wm/outsource-issue-line/page', { params }); +} + +/** 查询外协发料单行详情 */ +export function getOutsourceIssueLine(id: number) { + return requestClient.get( + `/mes/wm/outsource-issue-line/get?id=${id}`, + ); +} + +/** 新增外协发料单行 */ +export function createOutsourceIssueLine( + data: MesWmOutsourceIssueLineApi.OutsourceIssueLine, +) { + return requestClient.post('/mes/wm/outsource-issue-line/create', data); +} + +/** 修改外协发料单行 */ +export function updateOutsourceIssueLine( + data: MesWmOutsourceIssueLineApi.OutsourceIssueLine, +) { + return requestClient.put('/mes/wm/outsource-issue-line/update', data); +} + +/** 删除外协发料单行 */ +export function deleteOutsourceIssueLine(id: number) { + return requestClient.delete(`/mes/wm/outsource-issue-line/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/wm/outsourcereceipt/detail/index.ts b/apps/web-antd/src/api/mes/wm/outsourcereceipt/detail/index.ts new file mode 100644 index 000000000..645fa7ad3 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/outsourcereceipt/detail/index.ts @@ -0,0 +1,61 @@ +import { requestClient } from '#/api/request'; + +export namespace MesWmOutsourceReceiptDetailApi { + /** MES 外协入库单明细 */ + export interface OutsourceReceiptDetail { + id?: number; // 明细编号 + lineId?: number; // 行编号 + receiptId?: number; // 入库单编号 + itemId?: number; // 物料编号 + itemCode?: string; // 物料编码 + itemName?: string; // 物料名称 + specification?: string; // 规格型号 + unitMeasureName?: string; // 计量单位名称 + quantity?: number; // 上架数量 + batchId?: number; // 批次编号 + batchCode?: string; // 批次编码 + warehouseId?: number; // 仓库编号 + warehouseName?: string; // 仓库名称 + locationId?: number; // 库区编号 + locationName?: string; // 库区名称 + areaId?: number; // 库位编号 + areaName?: string; // 库位名称 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询外协入库单明细列表 */ +export function getOutsourceReceiptDetailListByLineId(lineId: number) { + return requestClient.get< + MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail[] + >('/mes/wm/outsource-receipt-detail/list-by-line', { params: { lineId } }); +} + +/** 查询外协入库单明细详情 */ +export function getOutsourceReceiptDetail(id: number) { + return requestClient.get( + `/mes/wm/outsource-receipt-detail/get?id=${id}`, + ); +} + +/** 新增外协入库单明细 */ +export function createOutsourceReceiptDetail( + data: MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail, +) { + return requestClient.post('/mes/wm/outsource-receipt-detail/create', data); +} + +/** 修改外协入库单明细 */ +export function updateOutsourceReceiptDetail( + data: MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail, +) { + return requestClient.put('/mes/wm/outsource-receipt-detail/update', data); +} + +/** 删除外协入库单明细 */ +export function deleteOutsourceReceiptDetail(id: number) { + return requestClient.delete( + `/mes/wm/outsource-receipt-detail/delete?id=${id}`, + ); +} diff --git a/apps/web-antd/src/api/mes/wm/outsourcereceipt/index.ts b/apps/web-antd/src/api/mes/wm/outsourcereceipt/index.ts new file mode 100644 index 000000000..730b2f8b9 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/outsourcereceipt/index.ts @@ -0,0 +1,81 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmOutsourceReceiptApi { + /** MES 外协入库单 */ + export interface OutsourceReceipt { + id?: number; // 入库单编号 + code?: string; // 入库单编码 + name?: string; // 入库单名称 + workOrderId?: number; // 外协工单编号 + workOrderCode?: string; // 外协工单编码 + vendorId?: number; // 供应商编号 + vendorName?: string; // 供应商名称 + receiptDate?: number; // 入库日期 + status?: number; // 单据状态 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询外协入库单分页 */ +export function getOutsourceReceiptPage(params: PageParam) { + return requestClient.get>( + '/mes/wm/outsource-receipt/page', + { params }, + ); +} + +/** 查询外协入库单详情 */ +export function getOutsourceReceipt(id: number) { + return requestClient.get( + `/mes/wm/outsource-receipt/get?id=${id}`, + ); +} + +/** 新增外协入库单 */ +export function createOutsourceReceipt( + data: MesWmOutsourceReceiptApi.OutsourceReceipt, +) { + return requestClient.post('/mes/wm/outsource-receipt/create', data); +} + +/** 修改外协入库单 */ +export function updateOutsourceReceipt( + data: MesWmOutsourceReceiptApi.OutsourceReceipt, +) { + return requestClient.put('/mes/wm/outsource-receipt/update', data); +} + +/** 删除外协入库单 */ +export function deleteOutsourceReceipt(id: number) { + return requestClient.delete(`/mes/wm/outsource-receipt/delete?id=${id}`); +} + +/** 提交外协入库单 */ +export function submitOutsourceReceipt(id: number) { + return requestClient.put(`/mes/wm/outsource-receipt/submit?id=${id}`); +} + +/** 执行上架 */ +export function stockOutsourceReceipt(id: number) { + return requestClient.put(`/mes/wm/outsource-receipt/stock?id=${id}`); +} + +/** 完成入库 */ +export function finishOutsourceReceipt(id: number) { + return requestClient.put(`/mes/wm/outsource-receipt/finish?id=${id}`); +} + +/** 取消外协入库单 */ +export function cancelOutsourceReceipt(id: number) { + return requestClient.put(`/mes/wm/outsource-receipt/cancel?id=${id}`); +} + +/** 导出外协入库单 */ +export function exportOutsourceReceipt(params: any) { + return requestClient.download('/mes/wm/outsource-receipt/export-excel', { + params, + }); +} diff --git a/apps/web-antd/src/api/mes/wm/outsourcereceipt/line/index.ts b/apps/web-antd/src/api/mes/wm/outsourcereceipt/line/index.ts new file mode 100644 index 000000000..fd5c0ce46 --- /dev/null +++ b/apps/web-antd/src/api/mes/wm/outsourcereceipt/line/index.ts @@ -0,0 +1,58 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MesWmOutsourceReceiptLineApi { + /** MES 外协入库单行 */ + export interface OutsourceReceiptLine { + id?: number; // 行编号 + receiptId?: number; // 入库单编号 + itemId?: number; // 物料编号 + itemCode?: string; // 物料编码 + itemName?: string; // 物料名称 + specification?: string; // 规格型号 + unitMeasureName?: string; // 计量单位名称 + quantity?: number; // 入库数量 + batchId?: number; // 批次编号 + batchCode?: string; // 批次编码 + productionDate?: number; // 生产日期 + expireDate?: number; // 有效期 + lotNumber?: string; // 生产批号 + iqcCheckFlag?: boolean; // 是否需要质检 + remark?: string; // 备注 + createTime?: Date; // 创建时间 + } +} + +/** 查询外协入库单行分页 */ +export function getOutsourceReceiptLinePage(params: PageParam) { + return requestClient.get< + PageResult + >('/mes/wm/outsource-receipt-line/page', { params }); +} + +/** 查询外协入库单行详情 */ +export function getOutsourceReceiptLine(id: number) { + return requestClient.get( + `/mes/wm/outsource-receipt-line/get?id=${id}`, + ); +} + +/** 新增外协入库单行 */ +export function createOutsourceReceiptLine( + data: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine, +) { + return requestClient.post('/mes/wm/outsource-receipt-line/create', data); +} + +/** 修改外协入库单行 */ +export function updateOutsourceReceiptLine( + data: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine, +) { + return requestClient.put('/mes/wm/outsource-receipt-line/update', data); +} + +/** 删除外协入库单行 */ +export function deleteOutsourceReceiptLine(id: number) { + return requestClient.delete(`/mes/wm/outsource-receipt-line/delete?id=${id}`); +} diff --git a/apps/web-antd/src/api/mes/wm/productsales/index.ts b/apps/web-antd/src/api/mes/wm/productsales/index.ts index aa00d4556..b0fddcfe4 100644 --- a/apps/web-antd/src/api/mes/wm/productsales/index.ts +++ b/apps/web-antd/src/api/mes/wm/productsales/index.ts @@ -5,12 +5,24 @@ import { requestClient } from '#/api/request'; export namespace MesWmProductSalesApi { /** MES 销售出库单 */ export interface ProductSales { - id?: number; // 销售出库单编号 + id?: number; // 出库单编号 code?: string; // 出库单编号 name?: string; // 出库单名称 + noticeId?: number; // 发货通知单编号 + noticeCode?: string; // 发货通知单编码 + clientId?: number; // 客户编号 + clientCode?: string; // 客户编码 + clientName?: string; // 客户名称 salesOrderCode?: string; // 销售订单编号 - salesDate?: Date; // 出库日期 + salesDate?: number; // 出库日期 + contactName?: string; // 收货人 + contactTelephone?: string; // 联系方式 + contactAddress?: string; // 收货地址 + carrier?: string; // 承运商 + shippingNumber?: string; // 运输单号 status?: number; // 单据状态 + remark?: string; // 备注 + createTime?: Date; // 创建时间 } } @@ -21,3 +33,64 @@ export function getProductSalesPage(params: PageParam) { { params }, ); } + +/** 查询销售出库单详情 */ +export function getProductSales(id: number) { + return requestClient.get( + `/mes/wm/product-sales/get?id=${id}`, + ); +} + +/** 新增销售出库单 */ +export function createProductSales(data: MesWmProductSalesApi.ProductSales) { + return requestClient.post('/mes/wm/product-sales/create', data); +} + +/** 修改销售出库单 */ +export function updateProductSales(data: MesWmProductSalesApi.ProductSales) { + return requestClient.put('/mes/wm/product-sales/update', data); +} + +/** 删除销售出库单 */ +export function deleteProductSales(id: number) { + return requestClient.delete(`/mes/wm/product-sales/delete?id=${id}`); +} + +/** 提交销售出库单 */ +export function submitProductSales(id: number) { + return requestClient.put(`/mes/wm/product-sales/submit?id=${id}`); +} + +/** 执行拣货 */ +export function stockProductSales(id: number) { + return requestClient.put(`/mes/wm/product-sales/stock?id=${id}`); +} + +/** 填写运单 */ +export function shippingProductSales(data: MesWmProductSalesApi.ProductSales) { + return requestClient.put('/mes/wm/product-sales/shipping', data); +} + +/** 执行出库 */ +export function finishProductSales(id: number) { + return requestClient.put(`/mes/wm/product-sales/finish?id=${id}`); +} + +/** 取消销售出库单 */ +export function cancelProductSales(id: number) { + return requestClient.put(`/mes/wm/product-sales/cancel?id=${id}`); +} + +/** 校验销售出库单拣货数量是否与出库数量一致 */ +export function checkProductSalesQuantity(id: number) { + return requestClient.get( + `/mes/wm/product-sales/check-quantity?id=${id}`, + ); +} + +/** 导出销售出库单 */ +export function exportProductSales(params: any) { + return requestClient.download('/mes/wm/product-sales/export-excel', { + params, + }); +} diff --git a/apps/web-antd/src/api/mes/wm/productsales/line/index.ts b/apps/web-antd/src/api/mes/wm/productsales/line/index.ts index b66ef6ba7..f1d4ff57b 100644 --- a/apps/web-antd/src/api/mes/wm/productsales/line/index.ts +++ b/apps/web-antd/src/api/mes/wm/productsales/line/index.ts @@ -6,13 +6,19 @@ export namespace MesWmProductSalesLineApi { /** MES 销售出库单行 */ export interface ProductSalesLine { id?: number; // 行编号 + salesId?: number; // 出库单编号 + noticeLineId?: number; // 发货通知单行编号 itemId?: number; // 物料编号 itemCode?: string; // 物料编码 itemName?: string; // 物料名称 specification?: string; // 规格型号 unitMeasureName?: string; // 单位 quantity?: number; // 出库数量 + pickedQuantity?: number; // 已拣货数量 + batchId?: number; // 批次编号 batchCode?: string; // 批次号 + oqcCheckFlag?: boolean; // 是否检验 + remark?: string; // 备注 } } @@ -22,3 +28,29 @@ export function getProductSalesLinePage(params: PageParam) { PageResult >('/mes/wm/product-sales-line/page', { params }); } + +/** 查询销售出库单行详情 */ +export function getProductSalesLine(id: number) { + return requestClient.get( + `/mes/wm/product-sales-line/get?id=${id}`, + ); +} + +/** 新增销售出库单行 */ +export function createProductSalesLine( + data: MesWmProductSalesLineApi.ProductSalesLine, +) { + return requestClient.post('/mes/wm/product-sales-line/create', data); +} + +/** 修改销售出库单行 */ +export function updateProductSalesLine( + data: MesWmProductSalesLineApi.ProductSalesLine, +) { + return requestClient.put('/mes/wm/product-sales-line/update', data); +} + +/** 删除销售出库单行 */ +export function deleteProductSalesLine(id: number) { + return requestClient.delete(`/mes/wm/product-sales-line/delete?id=${id}`); +} diff --git a/apps/web-antd/src/views/mes/pro/card/components/index.ts b/apps/web-antd/src/views/mes/pro/card/components/index.ts new file mode 100644 index 000000000..8092d6cb7 --- /dev/null +++ b/apps/web-antd/src/views/mes/pro/card/components/index.ts @@ -0,0 +1,2 @@ +export { default as ProCardSelectDialog } from './pro-card-select-dialog.vue'; +export { default as ProCardSelect } from './pro-card-select.vue'; diff --git a/apps/web-antd/src/views/mes/pro/card/components/pro-card-select-dialog.vue b/apps/web-antd/src/views/mes/pro/card/components/pro-card-select-dialog.vue new file mode 100644 index 000000000..d6836f2dd --- /dev/null +++ b/apps/web-antd/src/views/mes/pro/card/components/pro-card-select-dialog.vue @@ -0,0 +1,198 @@ + + + diff --git a/apps/web-antd/src/views/mes/pro/card/components/pro-card-select.vue b/apps/web-antd/src/views/mes/pro/card/components/pro-card-select.vue new file mode 100644 index 000000000..46c5a8804 --- /dev/null +++ b/apps/web-antd/src/views/mes/pro/card/components/pro-card-select.vue @@ -0,0 +1,133 @@ + + + diff --git a/apps/web-antd/src/views/mes/pro/card/data.ts b/apps/web-antd/src/views/mes/pro/card/data.ts new file mode 100644 index 000000000..e4e0d6f9a --- /dev/null +++ b/apps/web-antd/src/views/mes/pro/card/data.ts @@ -0,0 +1,100 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesProCardApi } from '#/api/mes/pro/card'; + +import { markRaw } from 'vue'; + +import { MdItemSelect } from '#/views/mes/md/item/components'; +import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; + +/** 流转卡选择弹窗的搜索表单 */ +export function useCardSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '流转卡编号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入流转卡编号', + }, + }, + { + fieldName: 'workOrderId', + label: '生产工单', + component: markRaw(ProWorkOrderSelect), + componentProps: { + placeholder: '请选择生产工单', + }, + }, + { + fieldName: 'itemId', + label: '产品物料', + component: markRaw(MdItemSelect), + componentProps: { + placeholder: '请选择产品物料', + }, + }, + { + fieldName: 'batchCode', + label: '批次号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入批次号', + }, + }, + ]; +} + +/** 流转卡选择弹窗的字段 */ +export function useCardSelectGridColumns( + multiple = false, +): VxeTableGridOptions['columns'] { + return [ + { + type: multiple ? 'checkbox' : 'radio', + width: 50, + }, + { + field: 'code', + title: '流转卡编号', + width: 160, + }, + { + field: 'workOrderCode', + title: '生产工单编号', + width: 160, + }, + { + field: 'itemCode', + title: '产品物料编码', + width: 140, + }, + { + field: 'batchCode', + title: '批次号', + width: 120, + }, + { + field: 'itemName', + title: '产品物料名称', + minWidth: 150, + }, + { + field: 'specification', + title: '规格型号', + width: 120, + }, + { + field: 'unitMeasureName', + title: '单位', + width: 80, + }, + { + field: 'transferedQuantity', + title: '流转数量', + width: 100, + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/utils/constants.ts b/apps/web-antd/src/views/mes/utils/constants.ts index 5c1360124..19315fc41 100644 --- a/apps/web-antd/src/views/mes/utils/constants.ts +++ b/apps/web-antd/src/views/mes/utils/constants.ts @@ -151,11 +151,22 @@ export const MesAutoCodeRuleCode = { TM_TOOL_CODE: 'TM_TOOL_CODE', WM_AREA_CODE: 'WM_AREA_CODE', WM_LOCATION_CODE: 'WM_LOCATION_CODE', + WM_ARRIVAL_NOTICE_CODE: 'WM_ARRIVAL_NOTICE_CODE', + WM_ITEM_RECEIPT_CODE: 'WM_ITEM_RECEIPT_CODE', + WM_RETURN_VENDOR_CODE: 'WM_RETURN_VENDOR_CODE', + WM_SALES_NOTICE_CODE: 'WM_SALES_NOTICE_CODE', + WM_RETURN_SALES_CODE: 'WM_RETURN_SALES_CODE', + WM_RETURN_ISSUE_CODE: 'WM_RETURN_ISSUE_CODE', + WM_PRODUCT_ISSUE_CODE: 'WM_PRODUCT_ISSUE_CODE', + WM_PRODUCT_SALES_CODE: 'WM_PRODUCT_SALES_CODE', + PRODUCTRECPT_CODE: 'PRODUCTRECPT_CODE', WM_MISC_ISSUE_CODE: 'WM_MISC_ISSUE_CODE', WM_MISC_RECEIPT_CODE: 'WM_MISC_RECEIPT_CODE', WM_OUTSOURCE_ISSUE_CODE: 'WM_OUTSOURCE_ISSUE_CODE', WM_OUTSOURCE_RECEIPT_CODE: 'WM_OUTSOURCE_RECEIPT_CODE', WM_PACKAGE_CODE: 'WM_PACKAGE_CODE', + WM_STOCK_TAKING_CODE: 'WM_STOCK_TAKING_CODE', + WM_STOCK_TAKING_PLAN_CODE: 'WM_STOCK_TAKING_PLAN_CODE', WM_WAREHOUSE_CODE: 'WM_WAREHOUSE_CODE', } as const; @@ -165,6 +176,38 @@ export const MesWmPackageStatusEnum = { FINISHED: MesOrderStatusConstants.FINISHED, } as const; +/** MES 盘点类型枚举 */ +export const MesWmStockTakingTypeEnum = { + STATIC: 1, + DYNAMIC: 2, +} as const; + +/** MES 盘点任务状态枚举 */ +export const MesWmStockTakingTaskStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + APPROVING: MesOrderStatusConstants.APPROVING, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 盘点任务行状态枚举 */ +export const MesWmStockTakingTaskLineStatusEnum = { + UNCOUNTED: 0, + NORMAL: 1, + GAIN: 2, + LOSS: 3, +} as const; + +/** MES 盘点方案参数类型枚举 */ +export const MesWmStockTakingParamTypeEnum = { + WAREHOUSE: 102, + LOCATION: 103, + AREA: 104, + BATCH: 107, + ITEM: 600, + QUALITY_STATUS: 900, +} as const; + /** MES 生产工单状态枚举 */ export const MesProWorkOrderStatusEnum = { PREPARE: MesOrderStatusConstants.DRAFT, @@ -263,6 +306,87 @@ export const MesWmOutsourceReceiptStatusEnum = { CANCELED: MesOrderStatusConstants.CANCELLED, } as const; +/** MES 到货通知单状态枚举 */ +export const MesWmArrivalNoticeStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + PENDING_QC: MesOrderStatusConstants.APPROVING, + PENDING_RECEIPT: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, +} as const; + +/** MES 采购入库单状态枚举 */ +export const MesWmItemReceiptStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + APPROVING: MesOrderStatusConstants.APPROVING, + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 供应商退货单状态枚举 */ +export const MesWmReturnVendorStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + APPROVING: MesOrderStatusConstants.APPROVING, + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 发货通知单状态枚举 */ +export const MesWmSalesNoticeStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + APPROVED: MesOrderStatusConstants.APPROVED, +} as const; + +/** MES 销售退货单状态枚举 */ +export const MesWmReturnSalesStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + CONFIRMED: MesOrderStatusConstants.CONFIRMED, + APPROVING: MesOrderStatusConstants.APPROVING, + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 生产退料单状态枚举 */ +export const MesWmReturnIssueStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + CONFIRMED: MesOrderStatusConstants.CONFIRMED, + APPROVING: MesOrderStatusConstants.APPROVING, + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 领料出库单状态枚举 */ +export const MesWmProductIssueStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + APPROVING: MesOrderStatusConstants.APPROVING, + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 产品入库单状态枚举 */ +export const MesWmProductReceiptStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + APPROVING: MesOrderStatusConstants.APPROVING, + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + +/** MES 销售出库单状态枚举 */ +export const MesWmProductSalesStatusEnum = { + PREPARE: MesOrderStatusConstants.DRAFT, + CONFIRMED: MesOrderStatusConstants.CONFIRMED, + APPROVING: MesOrderStatusConstants.APPROVING, + SHIPPING: 10, // 待填写运单 + APPROVED: MesOrderStatusConstants.APPROVED, + FINISHED: MesOrderStatusConstants.FINISHED, + CANCELED: MesOrderStatusConstants.CANCELLED, +} as const; + /** MES 质检结果值类型枚举 */ export const MesQcResultValueType = { FLOAT: 1, diff --git a/apps/web-antd/src/views/mes/wm/barcode/data.ts b/apps/web-antd/src/views/mes/wm/barcode/data.ts index 2d1671e23..3c57d300b 100644 --- a/apps/web-antd/src/views/mes/wm/barcode/data.ts +++ b/apps/web-antd/src/views/mes/wm/barcode/data.ts @@ -19,9 +19,12 @@ import MdItemSelect from '#/views/mes/md/item/components/md-item-select.vue'; import MdVendorSelect from '#/views/mes/md/vendor/components/md-vendor-select.vue'; import MdWorkshopSelect from '#/views/mes/md/workstation/components/md-workshop-select.vue'; import MdWorkstationSelect from '#/views/mes/md/workstation/components/md-workstation-select.vue'; +import { ProCardSelect } from '#/views/mes/pro/card/components'; import ProWorkOrderSelect from '#/views/mes/pro/workorder/components/pro-work-order-select.vue'; import TmToolSelect from '#/views/mes/tm/tool/components/tm-tool-select.vue'; import { BarcodeBizTypeEnum } from '#/views/mes/utils/constants'; +import { WmBatchSelect } from '#/views/mes/wm/batch/components'; +import { UserSelect } from '#/views/system/user/components'; import WmMaterialStockSelect from './../materialstock/components/wm-material-stock-select.vue'; import { WmPackageSelect } from './../packages/components'; @@ -51,15 +54,31 @@ async function syncBizDetail( } let bizCode: string | undefined; let bizName: string | undefined; - if (bizType === BarcodeBizTypeEnum.STOCK) { - bizCode = item.itemCode; - bizName = item.itemName; - } else if (bizType === BarcodeBizTypeEnum.PACKAGE) { - bizCode = item.code; - bizName = item.clientName || item.code; - } else { - bizCode = item.code || item.username; - bizName = item.name || item.nickname; + switch (bizType) { + case BarcodeBizTypeEnum.BATCH: { + bizCode = item.code; + bizName = item.itemName || item.code; + break; + } + case BarcodeBizTypeEnum.PACKAGE: { + bizCode = item.code; + bizName = item.clientName || item.code; + break; + } + case BarcodeBizTypeEnum.PROCARD: { + bizCode = item.code; + bizName = item.workOrderName || item.code; + break; + } + case BarcodeBizTypeEnum.STOCK: { + bizCode = item.itemCode; + bizName = item.itemName; + break; + } + default: { + bizCode = item.code || item.username; + bizName = item.name || item.nickname; + } } // 先回填业务编码、名称并清空旧条码内容 await formApi.setValues({ bizCode, bizName, content: undefined }); @@ -328,6 +347,45 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { }, rules: 'required', }, + { + fieldName: 'bizId', + label: '批次', + component: markRaw(WmBatchSelect), + componentProps: { + onChange: (item: any) => syncBizDetail(formApi, item), + }, + dependencies: { + triggerFields: ['bizType'], + show: (values) => values.bizType === BarcodeBizTypeEnum.BATCH, + }, + rules: 'required', + }, + { + fieldName: 'bizId', + label: '流转卡', + component: markRaw(ProCardSelect), + componentProps: { + onChange: (item: any) => syncBizDetail(formApi, item), + }, + dependencies: { + triggerFields: ['bizType'], + show: (values) => values.bizType === BarcodeBizTypeEnum.PROCARD, + }, + rules: 'required', + }, + { + fieldName: 'bizId', + label: '人员', + component: markRaw(UserSelect), + componentProps: { + onChange: (item: any) => syncBizDetail(formApi, item), + }, + dependencies: { + triggerFields: ['bizType'], + show: (values) => values.bizType === BarcodeBizTypeEnum.USER, + }, + rules: 'required', + }, { fieldName: 'bizId', label: '业务编号', @@ -343,13 +401,16 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { values.bizType !== undefined && ![ BarcodeBizTypeEnum.AREA, + BarcodeBizTypeEnum.BATCH, BarcodeBizTypeEnum.CLIENT, BarcodeBizTypeEnum.ITEM, BarcodeBizTypeEnum.LOCATION, BarcodeBizTypeEnum.MACHINERY, BarcodeBizTypeEnum.PACKAGE, + BarcodeBizTypeEnum.PROCARD, BarcodeBizTypeEnum.STOCK, BarcodeBizTypeEnum.TOOL, + BarcodeBizTypeEnum.USER, BarcodeBizTypeEnum.VENDOR, BarcodeBizTypeEnum.WAREHOUSE, BarcodeBizTypeEnum.WORKORDER, diff --git a/apps/web-antd/src/views/mes/wm/batch/components/index.ts b/apps/web-antd/src/views/mes/wm/batch/components/index.ts new file mode 100644 index 000000000..6d4a5d756 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/batch/components/index.ts @@ -0,0 +1,2 @@ +export { default as WmBatchSelectDialog } from './wm-batch-select-dialog.vue'; +export { default as WmBatchSelect } from './wm-batch-select.vue'; diff --git a/apps/web-antd/src/views/mes/wm/batch/components/wm-batch-select-dialog.vue b/apps/web-antd/src/views/mes/wm/batch/components/wm-batch-select-dialog.vue new file mode 100644 index 000000000..9d19931ab --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/batch/components/wm-batch-select-dialog.vue @@ -0,0 +1,248 @@ + + + diff --git a/apps/web-antd/src/views/mes/wm/batch/components/wm-batch-select.vue b/apps/web-antd/src/views/mes/wm/batch/components/wm-batch-select.vue new file mode 100644 index 000000000..7464a6639 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/batch/components/wm-batch-select.vue @@ -0,0 +1,147 @@ + + + diff --git a/apps/web-antd/src/views/mes/wm/batch/data.ts b/apps/web-antd/src/views/mes/wm/batch/data.ts new file mode 100644 index 000000000..74b0e3776 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/batch/data.ts @@ -0,0 +1,234 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesWmBatchApi } from '#/api/mes/wm/batch'; + +import { markRaw } from 'vue'; + +import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + +import MdClientSelect from '#/views/mes/md/client/components/md-client-select.vue'; +import MdItemSelect from '#/views/mes/md/item/components/md-item-select.vue'; +import MdVendorSelect from '#/views/mes/md/vendor/components/md-vendor-select.vue'; +import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; +import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; +import { TmToolSelect } from '#/views/mes/tm/tool/components'; + +/** 批次选择弹窗的搜索表单 */ +export function useBatchSelectGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '批次编号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入批次编号', + }, + }, + { + fieldName: 'itemId', + label: '产品物料', + component: markRaw(MdItemSelect), + componentProps: { + placeholder: '请选择产品物料', + }, + }, + { + fieldName: 'vendorId', + label: '供应商', + component: markRaw(MdVendorSelect), + componentProps: { + placeholder: '请选择供应商', + }, + }, + { + fieldName: 'clientId', + label: '客户', + component: markRaw(MdClientSelect), + componentProps: { + placeholder: '请选择客户', + }, + }, + { + fieldName: 'workOrderId', + label: '生产工单', + component: markRaw(ProWorkOrderSelect), + componentProps: { + placeholder: '请选择生产工单', + }, + }, + { + fieldName: 'workstationId', + label: '工作站', + component: markRaw(MdWorkstationSelect), + componentProps: { + placeholder: '请选择工作站', + }, + }, + { + fieldName: 'toolId', + label: '工具', + component: markRaw(TmToolSelect), + componentProps: { + placeholder: '请选择工具', + }, + }, + { + fieldName: 'salesOrderCode', + label: '销售订单编号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入销售订单编号', + }, + }, + { + fieldName: 'purchaseOrderCode', + label: '采购订单编号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入采购订单编号', + }, + }, + { + fieldName: 'lotNumber', + label: '生产批号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入生产批号', + }, + }, + { + fieldName: 'qualityStatus', + label: '质量状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS, 'number'), + placeholder: '请选择质量状态', + }, + }, + ]; +} + +/** 批次选择弹窗的字段 */ +export function useBatchSelectGridColumns( + multiple = false, +): VxeTableGridOptions['columns'] { + return [ + { + type: multiple ? 'checkbox' : 'radio', + width: 50, + }, + { + field: 'code', + title: '批次编号', + width: 150, + }, + { + field: 'itemCode', + title: '物料编码', + width: 150, + }, + { + field: 'itemName', + title: '物料名称', + minWidth: 140, + }, + { + field: 'itemSpecification', + title: '规格型号', + width: 120, + }, + { + field: 'unitName', + title: '单位', + width: 80, + }, + { + field: 'vendorCode', + title: '供应商编码', + width: 120, + }, + { + field: 'vendorName', + title: '供应商名称', + width: 120, + }, + { + field: 'clientCode', + title: '客户编码', + width: 110, + }, + { + field: 'clientName', + title: '客户名称', + width: 110, + }, + { + field: 'salesOrderCode', + title: '销售订单编号', + width: 140, + }, + { + field: 'purchaseOrderCode', + title: '采购订单编号', + width: 140, + }, + { + field: 'workOrderCode', + title: '工单编码', + width: 140, + }, + { + field: 'workstationCode', + title: '工作站编码', + width: 120, + }, + { + field: 'taskCode', + title: '生产任务编号', + width: 140, + }, + { + field: 'toolCode', + title: '工具编号', + width: 120, + }, + { + field: 'lotNumber', + title: '生产批号', + width: 120, + }, + { + field: 'qualityStatus', + title: '质量状态', + width: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_WM_QUALITY_STATUS }, + }, + }, + { + field: 'produceDate', + title: '生产日期', + width: 120, + formatter: 'formatDate', + }, + { + field: 'expireDate', + title: '有效期', + width: 120, + formatter: 'formatDate', + }, + { + field: 'receiptDate', + title: '入库日期', + width: 120, + formatter: 'formatDate', + }, + ]; +} diff --git a/apps/web-antd/src/views/mes/wm/outsourceissue/data.ts b/apps/web-antd/src/views/mes/wm/outsourceissue/data.ts new file mode 100644 index 000000000..70da52788 --- /dev/null +++ b/apps/web-antd/src/views/mes/wm/outsourceissue/data.ts @@ -0,0 +1,488 @@ +import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; +import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; +import type { MesWmOutsourceIssueApi } from '#/api/mes/wm/outsourceissue'; +import type { MesWmOutsourceIssueDetailApi } from '#/api/mes/wm/outsourceissue/detail'; +import type { MesWmOutsourceIssueLineApi } from '#/api/mes/wm/outsourceissue/line'; + +import { h, markRaw } from 'vue'; + +import { DICT_TYPE } from '@vben/constants'; + +import { Button } from 'ant-design-vue'; + +import { generateAutoCode } from '#/api/mes/md/autocode/record'; +import { getRangePickerDefaultProps } from '#/utils'; +import MdItemSelect from '#/views/mes/md/item/components/md-item-select.vue'; +import MdVendorSelect from '#/views/mes/md/vendor/components/md-vendor-select.vue'; +import ProWorkOrderSelect from '#/views/mes/pro/workorder/components/pro-work-order-select.vue'; +import { + MesAutoCodeRuleCode, + MesProWorkOrderStatusEnum, + MesProWorkOrderTypeEnum, +} from '#/views/mes/utils/constants'; +import { WmMaterialStockSelect } from '#/views/mes/wm/materialstock/components'; +import { + WmWarehouseAreaSelect, + WmWarehouseLocationSelect, + WmWarehouseSelect, +} from '#/views/mes/wm/warehouse/components'; + +/** 表单类型 */ +export type FormType = 'create' | 'detail' | 'finish' | 'stock' | 'update'; + +/** 表单头部是否只读(拣货、详情、领出态) */ +function isHeaderReadonly(formType: FormType): boolean { + return ( + formType === 'detail' || formType === 'finish' || formType === 'stock' + ); +} + +/** 新增/修改的表单 */ +export function useFormSchema( + formType: FormType, + formApi?: VbenFormApi, +): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'status', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'code', + label: '发料单编号', + component: 'Input', + componentProps: { + placeholder: '请输入发料单编号', + }, + rules: 'required', + suffix: isHeaderReadonly(formType) + ? undefined + : () => + h( + Button, + { + type: 'default', + onClick: async () => { + const code = await generateAutoCode( + MesAutoCodeRuleCode.WM_OUTSOURCE_ISSUE_CODE, + ); + await formApi?.setFieldValue('code', code); + }, + }, + { default: () => '生成' }, + ), + }, + { + fieldName: 'name', + label: '发料单名称', + component: 'Input', + componentProps: { + placeholder: '请输入发料单名称', + }, + rules: 'required', + }, + { + fieldName: 'issueDate', + label: '发料日期', + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + placeholder: '请选择发料日期', + valueFormat: 'x', + }, + }, + { + fieldName: 'workOrderId', + label: '外协工单', + component: markRaw(ProWorkOrderSelect), + componentProps: { + // 选择外协工单后,自动回填供应商 + onChange: async (workOrder?: MesProWorkOrderApi.WorkOrder) => { + await formApi?.setFieldValue('vendorId', workOrder?.vendorId); + }, + status: MesProWorkOrderStatusEnum.CONFIRMED, + type: MesProWorkOrderTypeEnum.OUTSOURCE, + }, + rules: 'selectRequired', + }, + { + fieldName: 'vendorId', + label: '供应商', + component: markRaw(MdVendorSelect), + componentProps: { + placeholder: '请选择供应商', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'code', + label: '发料单编号', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入发料单编号', + }, + }, + { + fieldName: 'name', + label: '发料单名称', + component: 'Input', + componentProps: { + allowClear: true, + placeholder: '请输入发料单名称', + }, + }, + { + fieldName: 'vendorId', + label: '供应商', + component: markRaw(MdVendorSelect), + componentProps: { + placeholder: '请选择供应商', + }, + }, + { + fieldName: 'issueDate', + label: '发料日期', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'code', + title: '发料单编号', + minWidth: 160, + slots: { default: 'code' }, + }, + { + field: 'name', + title: '发料单名称', + minWidth: 150, + }, + { + field: 'workOrderCode', + title: '生产工单号', + minWidth: 140, + }, + { + field: 'vendorName', + title: '供应商名称', + minWidth: 120, + }, + { + field: 'issueDate', + title: '发料日期', + width: 180, + formatter: 'formatDate', + }, + { + field: 'status', + title: '单据状态', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.MES_WM_OUTSOURCE_ISSUE_STATUS }, + }, + }, + { + title: '操作', + width: 240, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 发料单行子表的字段 */ +export function useLineGridColumns( + editable: boolean, + stockable: boolean, +): VxeTableGridOptions['columns'] { + return [ + { + type: 'expand', + width: 48, + slots: { content: 'detail' }, + }, + { + field: 'itemCode', + title: '物料编码', + minWidth: 120, + }, + { + field: 'itemName', + title: '物料名称', + minWidth: 140, + }, + { + field: 'specification', + title: '规格型号', + minWidth: 120, + }, + { + field: 'unitMeasureName', + title: '单位', + width: 80, + }, + { + field: 'quantity', + title: '领料数量', + width: 100, + }, + { + field: 'batchCode', + title: '批次号', + minWidth: 120, + }, + { + field: 'remark', + title: '备注', + minWidth: 150, + }, + ...(editable || stockable + ? [ + { + title: '操作', + width: 160, + fixed: 'right', + slots: { default: 'actions' }, + } as const, + ] + : []), + ]; +} + +/** 发料单行新增/修改的表单 */ +export function useLineFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'itemId', + label: '物料', + component: markRaw(MdItemSelect), + componentProps: { + placeholder: '请选择物料', + }, + rules: 'selectRequired', + }, + { + fieldName: 'quantity', + label: '发料数量', + component: 'InputNumber', + componentProps: { + class: '!w-full', + min: 0, + placeholder: '请输入发料数量', + precision: 2, + }, + rules: 'required', + }, + { + fieldName: 'batchCode', + label: '批次号', + component: 'Input', + componentProps: { + placeholder: '请输入批次号', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + formItemClass: 'col-span-3', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 发料明细子表的字段 */ +export function useDetailGridColumns( + stockable: boolean, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'warehouseName', + title: '仓库名称', + minWidth: 100, + }, + { + field: 'locationName', + title: '库区名称', + minWidth: 100, + }, + { + field: 'areaName', + title: '库位名称', + minWidth: 100, + }, + { + field: 'quantity', + title: '数量', + width: 100, + }, + ...(stockable + ? [ + { + title: '操作', + width: 120, + fixed: 'right', + slots: { default: 'actions' }, + } as const, + ] + : []), + ]; +} + +/** 发料明细新增/修改的表单 */ +export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { + return [ + { + fieldName: 'quantityMax', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'materialStockId', + label: '库存记录', + component: markRaw(WmMaterialStockSelect), + componentProps: { + // 选择库存记录后,自动回填仓库/库区/库位/批次/数量 + onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { + await formApi?.setValues({ + areaId: stock?.areaId, + batchCode: stock?.batchCode, + batchId: stock?.batchId, + locationId: stock?.locationId, + quantity: stock?.quantity, + quantityMax: stock?.quantity, + warehouseId: stock?.warehouseId, + }); + }, + }, + rules: 'selectRequired', + dependencies: { + triggerFields: ['itemId'], + componentProps: (values) => ({ + itemId: values.itemId, + }), + }, + }, + { + fieldName: 'itemId', + label: '物料', + component: markRaw(MdItemSelect), + componentProps: { + disabled: true, + }, + }, + { + fieldName: 'quantity', + label: '数量', + component: 'InputNumber', + componentProps: { + class: '!w-full', + min: 0, + placeholder: '请输入数量', + precision: 2, + }, + rules: 'required', + dependencies: { + triggerFields: ['quantityMax'], + componentProps: (values) => ({ + class: '!w-full', + max: values.quantityMax, + min: 0, + placeholder: '请输入数量', + precision: 2, + }), + }, + }, + { + fieldName: 'warehouseId', + label: '发料仓库', + component: markRaw(WmWarehouseSelect), + componentProps: { + disabled: true, + }, + }, + { + fieldName: 'locationId', + label: '库区', + component: markRaw(WmWarehouseLocationSelect), + componentProps: { + disabled: true, + }, + dependencies: { + triggerFields: ['warehouseId'], + componentProps: (values) => ({ + disabled: true, + warehouseId: values.warehouseId, + }), + }, + }, + { + fieldName: 'areaId', + label: '库位', + component: markRaw(WmWarehouseAreaSelect), + componentProps: { + disabled: true, + }, + dependencies: { + triggerFields: ['locationId'], + componentProps: (values) => ({ + disabled: true, + locationId: values.locationId, + }), + }, + }, + { + fieldName: 'batchCode', + label: '批次号', + component: 'Input', + componentProps: { + disabled: true, + }, + }, + ]; +} diff --git a/apps/web-antd/src/views/system/dept/components/index.ts b/apps/web-antd/src/views/system/dept/components/index.ts index 04d2b6145..5bd391a52 100644 --- a/apps/web-antd/src/views/system/dept/components/index.ts +++ b/apps/web-antd/src/views/system/dept/components/index.ts @@ -1 +1,2 @@ export { default as DeptSelectModal } from './select-modal.vue'; +export { default as DeptTreeSelect } from './tree-select.vue'; diff --git a/apps/web-antd/src/views/system/user/modules/dept-tree.vue b/apps/web-antd/src/views/system/dept/components/tree-select.vue similarity index 75% rename from apps/web-antd/src/views/system/user/modules/dept-tree.vue rename to apps/web-antd/src/views/system/dept/components/tree-select.vue index d1b7fb0ec..423316014 100644 --- a/apps/web-antd/src/views/system/user/modules/dept-tree.vue +++ b/apps/web-antd/src/views/system/dept/components/tree-select.vue @@ -10,10 +10,16 @@ import { Input, Spin, Tree } from 'ant-design-vue'; import { getSimpleDeptList } from '#/api/system/dept'; -const emit = defineEmits(['select']); +defineOptions({ name: 'DeptTreeSelect' }); + +const emit = defineEmits<{ + select: [dept?: SystemDeptApi.Dept]; +}>(); + const deptList = ref([]); // 部门列表 const deptTree = ref([]); // 部门树 const expandedKeys = ref([]); // 展开的节点 +const selectedKeys = ref([]); // 选中的节点 const loading = ref(false); // 加载状态 const searchValue = ref(''); // 搜索值 @@ -31,11 +37,21 @@ function handleSearch(e: any) { expandedKeys.value = deptTree.value.map((node) => node.id!); } -/** 选中部门 */ +/** 选中部门:点击已选中的节点时取消选中 */ function handleSelect(_selectedKeys: any[], info: any) { - emit('select', info.node.dataRef); + emit('select', info.selected ? info.node.dataRef : undefined); } +/** 重置选中状态(供外部重置按钮调用) */ +function reset() { + searchValue.value = ''; + selectedKeys.value = []; + deptTree.value = handleTree(deptList.value); + emit('select', undefined); +} + +defineExpose({ reset }); + /** 初始化 */ onMounted(async () => { try { @@ -43,8 +59,6 @@ onMounted(async () => { const data = await getSimpleDeptList(); deptList.value = data; deptTree.value = handleTree(data); - } catch (error) { - console.error('获取部门数据失败', error); } finally { loading.value = false; } @@ -54,24 +68,25 @@ onMounted(async () => {