master
吴普建 1 year ago
parent aabfd08229
commit c472019cc7

@ -67,6 +67,7 @@
"axios": "1.5.0",
"clipboard": "2.0.11",
"colord": "2.9.3",
"bignumber.js": "^9.1.2",
"crypto-js": "4.1.1",
"dayjs": "1.11.10",
"echarts": "^5.6.0",

@ -10,6 +10,17 @@ export const produce: AuthRoute.Route[] = [
hide: true
}
},
{
name: 'storage_auxiliaryProduceinfo',
path: '/storage/auxiliaryProduceinfo',
component: 'self',
meta: {
title: '单据详情',
singleLayout: 'blank',
icon: 'tdesign:houses',
hide: true
}
},
{
name: 'produce_report',
path: '/produce/report',

@ -7,3 +7,7 @@ export const fetchUserList = async query => {
const { rows, total } = await request.get('/system/user/list', query);
return { rows, total };
};
export const allUserList = params => {
return request.get('/system/user/selectAll', { params });
};

@ -0,0 +1,498 @@
declare namespace wms {
namespace locationRawType {
interface columns {
hasChildren?: boolean;
locationId: string | null; // 库区ID
locationCode: string | null; // 库区编码
locationName: string | null; // 库区名称
warehouseId: string | null; // 仓库ID
area: string | null; // 面积
areaFlag: string | null; // 是否开启库位管理
remark: string | null; // 备注
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy: string | null; // 创建者
createTime: number | null; // 创建时间
updateBy: string | null; // 更新者
updateTime: number | null; // 更新时间
}
}
namespace areaRawType {
interface columns {
areaId: string | null; // 库位ID
areaCode: string | null; // 库位编码
areaName: string | null; // 库位名称
locationId: string | null; // 库区ID
area: string | null; // 面积
maxLoa: string | null; // 最大载重量
positionX: number | null; // 库位位置X
positionY: number | null; // 库位位置y
positionZ: number | null; // 库位位置z
enableFlag: string | undefined; // 是否启用
remark: string | null; // 备注
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy: string | null; // 创建者
createTime: number | null; // 创建时间
updateBy: string | null; // 更新者
updateTime: number | null; // 更新时间
}
}
namespace recptRawType {
interface columns {
quantitySavedTemp?: string | number | null;
workstationId?: string | number | null;
workstageId?: string | number | null;
workstageCode?: string | number | null;
workstationCode?: string | number | null;
workstationName?: string | null;
workstageName?: string | null;
lineList?: recptLineRawType.columns[];
quantitySaved?: string | number | null;
weightSaved?: string | null | number;
quantityRecived?: string | number | null;
weightRecived?: string | number | null;
iqcId?: null | number | string;
iqcCode?: null | number | string;
poCode: null | string;
recptId: string | null; // 入库单ID
recptCode: string | null; // 入库单编号
recptName: string | null; // 入库单名称
vendorId: string | null; // 供应商ID
vendorCode: string | null; // 供应商编码
vendorName: string | null; // 供应商名称
vendorNick?: string | null; // 供应商简称
warehouseId: string | null; // 仓库ID
warehouseCode: string | null; // 仓库编码
warehouseName: string | null; // 仓库名称
locationId: string | null; // 库区ID
locationCode: string | null; // 库区编码
locationName: string | null; // 库区名称
areaId: string | null; // 库位ID
areaCode: string | null; // 库位编码
areaName: string | null; // 库位名称
recptDate: number | null; // 入库日期
status: string | null; // 单据状态
remark: string | null; // 备注
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy?: string | null; // 创建者
createTime?: number | null; // 创建时间
updateBy?: string | null; // 更新者
updateTime?: number | null; // 更新时间
type?: string | null; // 单据类型
fromBillId?: string | null; // 来源单据ID
fromBillCode?: string | null; // 来源单据编码
fromBillName?: string | null; // 来源单据名称
snidCode?: string | null; // 二级节点标识
createByNick?: string | null; // 创建者名称
manageBy?: string | null; // 保管人
manageByNick?: string | null; // 保管人简称
headBy?: string | null; // 负责人
headByNick?: string | null; // 负责人简称
salseDeptId?: string | null; // 业务部门
salseDeptName?: string | null; // 业务部门名称
salseBy?: string | null; // 业务员
salseByNick?: string | null; // 业务员名称
}
}
namespace recptLineRawType {
interface columns {
quantitySavedTemp?: string | null;
weightSavedTemp?: string | null;
// weightSaved?: string | null;
lineId: string | null; // 行ID
recptId: number | string | null; // 入库单ID
itemId: string | null; // 产品物料ID
itemCode: string | null; // 产品物料编码
itemName: string | null; // 产品物料名称
specification: string | null; // 规格型号
unitOfMeasure: string | null; // 单位
quantityRecived: string | null; // 应入数量
quantityChecked: string | null; // 验收数量
quantitySaved: string | null; // 上架数量
batchCode: string | null; // 入库批次号
warehouseId: string | null; // 仓库ID
warehouseCode: string | null; // 仓库编码
warehouseName: string | null; // 仓库名称
locationId: string | null; // 库区ID
locationCode: string | null; // 库区编码
locationName: string | null; // 库区名称
areaId: string | null; // 库位ID
areaCode: string | null; // 库位编码
areaName: string | null; // 库位名称
expireDate: number | null; // 有效期
remark: string | null; // 备注
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy: string | null; // 创建者
createTime: number | null; // 创建时间
updateBy: string | null; // 更新者
updateTime: number | null; // 更新时间
iqcId: string | null; // 来料检验单ID
iqcCode: string | null; // 来料检验单编号
weight: string | number | null; // 净重
weightRecived: number | null; // 应入重量
totalWeight: number | null; // 毛重
weightUnit: string | null; // 重量单位
containerCode: string | null; // 容器码
}
}
namespace issueHeaderRawType {
interface columns {
recordId?: string | null;
issueId: string | null; // 领料单ID
issueCode: string | null; // 领料单编号
issueName: string | null; // 领料单名称
warehouseId: string | null; // 仓库ID
warehouseCode: string | null; // 仓库编码
warehouseName: string | null; // 仓库名称
locationId: string | null; // 库区ID
locationCode: string | null; // 库区编码
locationName: string | null; // 库区名称
areaId: string | null; // 库位ID
areaCode: string | null; // 库位编码
areaName: string | null; // 库位名称
issueDate: number | null; // 出库日期
fromBillId: string | null; // 生产工单id
fromBillCode: string | null; // 来源单据编号
clientId: string | null; // 客户id
clientCode: string | null; // 客户编码
clientName: string | null; // 客户名称
vendorId: string | null; // 供应商id
vendorCode: string | null; // 供应商编码
vendorName: string | null; // 供应商名称
type: string | null; // 单据类型
status: string | null; // 单据状态
remark: string | null; // 备注
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy: string | null; // 创建者
createTime: number | null; // 创建时间
updateBy: string | null; // 更新者
updateTime: number | null; // 更新时间
snidCode: string | null; // 二级节点标识
createByNick: string | null; //
lineList?: [];
pickerUserId: string | null; // 领料人
pickerUserName: string | null; // 领料人名称
saleOrderId: string | null; // 销售订单ID
workstationId: string | null; // 机台id
workstationCode: string | null; // 机台编码
workstationName: string | null; // 机台名称
version: string | null; // 乐观锁
workstageId: string | null; // 工序id
workstageName: string | null; // 工序名称
workstageCode: string | null; // 工序code
}
}
namespace issueLineRawType {
interface columns {
lineId: string | null; // 行ID
issueId: string | null; // 领料单ID
materialStockId: string | null; // 库存ID
itemId: string | null; // 产品物料ID
itemTypeId: string | null; // 产品物料类别ID
itemTypeName: string | null; // 产品物料类别名称
itemCode: string | null; // 产品物料编码
itemName: string | null; // 产品物料名称
specification: string | null; // 规格型号
unitOfMeasure: string | null; // 单位
quantityIssued: string | null; // 已领数量
quantityIssueing: string | null; // 应领数量
quantityOnHand: string | null; // 在库数量
weightOnHand: string | null; // 在库数量
batchCode: string | null; // 领料批次号
containerCode: string | null; // 容器码
warehouseId: string | null; // 仓库ID
warehouseCode: string | null; // 仓库编码
warehouseName: string | null; // 仓库名称
locationId: string | null; // 库区ID
locationCode: string | null; // 库区编码
locationName: string | null; // 库区名称
areaId: string | null; // 库位ID
areaCode: string | null; // 库位编码
areaName: string | null; // 库位名称
remark: string | null; // 备注
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy: string | null; // 创建者
createTime: number | null; // 创建时间
updateBy: string | null; // 更新者
updateTime: number | null; // 更新时间
iqcId: string | null; // 来料检验单ID
iqcCode: string | null; // 来料检验单编号
totalWeight: string | null; // 毛重量
weightUnit: string | null; // 重量单位
weight: string | null; // 净重量
}
}
namespace auxiliaryApplyOrderRawType {
interface columns {
orderId: string | null; // 申请单ID
orderCode: string | null; // 申请单编码
orderName: string | null; // 申请单名称
itemId: string | null; // 物料ID
itemCode: string | null; // 物料编码
itemName: string | null; // 物料名称
specification: string | null; // 规格型号
itemTypeId: string | null; // 物料类别ID
itemTypeName: string | null; // 物料类别
quantitySaved: string | null; // 领用数量
weightSaved: string | null; // 领用重量
unitOfMeasure: string | null; // 单位
weightUnit: string | null; // 重量单位
fromType: string | null; // 类型
applyUserId: string | null; // 领用人id
examineUserId: string | null; // 审核人id
applyUserName: string | null; // 领用人姓名
examineUserName: string | null; // 审核人姓名
examineTime: number | null; // 审核时间
receiveTime: number | null; // 领用时间
status: string | null; // 状态:PREPARE待审核 PASS:确认REJECT:拒绝
remark: string | null; // 备注
rejectResult: string | null; // 拒绝原因
attr1: string | null; // 预留字段1
attr2: string | null; // 预留字段2
attr3: string | null; // 预留字段3
attr4: string | null; // 预留字段4
createBy: string | null; // 创建者
createTime: number | null; // 创建时间
updateBy: string | null; // 更新者
updateTime: number | null; // 更新时间
}
}
}

@ -0,0 +1,38 @@
import { request } from '../../request';
const prefix = `/wms/wms/recpt/`;
// ${functions}列表}
export function selectWmsItemRecptList(data: any) {
return request.get(`${prefix}list`, data);
}
// 查询所有${functions}
export function selectAllWmsItemRecptList(data: any) {
return request.get(`${prefix}selectAll`, data);
}
// 执行入库
export function executeWmsItemRecpt(data: any) {
return request.post(`${prefix}execute`, data);
}
export function exportWmsItemRecpt(data: any) {
return request.get(`${prefix}export`, data);
}
export function getWmsItemRecpt(id: string | number) {
return request.get(`${prefix}${id}`);
}
// 新增
export function addWmsItemRecpt(data: any) {
return request.post(`${prefix}add`, data);
}
// 编辑
export function editWmsItemRecpt(data: any) {
return request.post(`${prefix}edit`, data);
}
// 删除
export function delWmsItemRecpt(ids: string | number) {
return request.post(`${prefix}remove/${ids}`);
}

@ -0,0 +1,33 @@
import { request } from '../../request';
const prefix = `/wms/wms/recptLine/`;
// ${functions}列表}
export function selectWmsItemRecptLineList(data: any) {
return request.get(`${prefix}list`, data);
}
// 查询所有${functions}
export function selectAllWmsItemRecptLineList(data: any) {
return request.get(`${prefix}selectAll`, data);
}
export function exportWmsItemRecptLine(data: any) {
return request.get(`${prefix}export`, data);
}
export function getWmsItemRecptLine(id: string | number) {
return request.get(`${prefix}${id}`);
}
// 新增
export function addWmsItemRecptLine(data: any) {
return request.post(`${prefix}add`, data);
}
// 编辑
export function editWmsItemRecptLine(data: any) {
return request.post(`${prefix}edit`, data);
}
// 删除
export function delWmsItemRecptLine(ids: string | number) {
return request.post(`${prefix}remove/${ids}`);
}

@ -0,0 +1,64 @@
import { request } from '../../request';
/**
*
*/
export async function list(reqBody: any) {
// console.log('reqBody', reqBody);
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/list`, { params: reqBody });
return data;
}
/**
*
*/
export async function getlist(reqBody: any) {
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/getlist`, reqBody);
return data;
}
export async function getWorksstationIds() {
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/getWorksstationIds`, {});
return data;
}
/**
*
*/
export async function add(reqBody: object) {
const data = await request.post<ApiAuth.Token>(`/wms/wms/warehouse`, reqBody);
return data;
}
/**
*
*/
export async function getInfo(warehouseId: number) {
const data = await request.get<ApiAuth.Token>(`/wms/wms/warehouse/${warehouseId}`, {});
return data;
}
/**
*
*/
export async function update(reqBody: object) {
const data = await request.put<ApiAuth.Token>(`/wms/wms/warehouse`, reqBody);
return data;
}
/**
*
*/
export async function deleteInfo(warehouseId: number) {
const data = await request.delete<ApiAuth.Token>(`/wms/wms/warehouse/${warehouseId}`, {});
return data;
}
// 根据仓库id获取库区库位列表
export function getWarehouseAreaList(warehouseId: number) {
return request.get(`/wms/wms/warehouse/getTreeList`, { params: { warehouseId } });
}
// 获取所有的仓库信息
export function getAllWarehouseList() {
return request.get(`/wms/wms/warehouse/getlist`);
}

@ -4,39 +4,39 @@ import { request } from '../../request';
*
*/
export async function fetchMaterialStockList(reqBody: any) {
console.log(reqBody);
const data = await request.get<ApiAuth.Token>(`/wms/mes/wm/wmstock/list`, reqBody);
return data;
console.log(reqBody);
const data = await request.get<ApiAuth.Token>(`/wms/mes/wm/wmstock/list`, reqBody);
return data;
}
/**
*
*/
export async function fetchMaterialStockInfo(materialStockId: number) {
const data = await request.get<ApiAuth.Token>(`/wms/mes/wm/wmstock/${materialStockId}`, {});
return data;
const data = await request.get<ApiAuth.Token>(`/wms/mes/wm/wmstock/${materialStockId}`, {});
return data;
}
/**
*
*/
export async function updateMaterialStock(reqBody: object) {
const data = await request.put<ApiAuth.Token>(`/wms/mes/wm/wmstock`, reqBody);
return data;
const data = await request.put<ApiAuth.Token>(`/wms/mes/wm/wmstock`, reqBody);
return data;
}
/**
*
*/
export async function deleteMaterialStock(materialStockId: number) {
const data = await request.delete<ApiAuth.Token>(`/wms/mes/wm/wmstock/${materialStockId}`, {});
return data;
const data = await request.delete<ApiAuth.Token>(`/wms/mes/wm/wmstock/${materialStockId}`, {});
return data;
}
/**
*
*/
export async function addMaterialStock(reqBody: object) {
const data = await request.post<ApiAuth.Token>(`/wms/mes/wm/wmstock`, reqBody);
return data;
const data = await request.post<ApiAuth.Token>(`/wms/mes/wm/wmstock`, reqBody);
return data;
}

@ -0,0 +1,351 @@
<template>
<my-dialog
v-model:show="modalVisible"
:title="title"
:loading="subDialog"
width="1000px"
@submit="submit"
@cancel="cancel"
>
<template #content>
<div>
<n-form ref="formRef" label-placement="left" :label-width="100" :model="formModel" :rules="rules">
<n-grid :cols="24" :x-gap="18">
<!-- <n-form-item-grid-item :span="8" label="入库单ID" path="recptId">
<n-input v-model:value="formModel.recptId" placeholder="请输入入库单ID" />
</n-form-item-grid-item> -->
<!-- <n-form-item-grid-item :span="8" label="产品物料ID" path="itemId">
<n-input v-model:value="formModel.itemId" placeholder="请输入产品物料ID" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="产品物料编码" path="itemCode">
<n-input v-model:value="formModel.itemCode" placeholder="请输入产品物料编码" />
</n-form-item-grid-item> -->
<n-form-item-grid-item :span="8" label="产品物料名称" path="itemName">
<n-input v-model:value="formModel.itemName" disabled placeholder="请输入产品物料名称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="规格型号" path="specification">
<n-input v-model:value="formModel.specification" placeholder="请输入规格型号" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="单位" path="unitOfMeasure">
<n-input v-model:value="formModel.unitOfMeasure" placeholder="请输入单位" />
</n-form-item-grid-item>
<!-- <n-form-item-grid-item :span="8" label="应入数量" path="quantityRecived">
<n-input v-model:value="formModel.quantityRecived" placeholder="请输入应入数量" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="验收数量" path="quantityChecked">
<n-input v-model:value="formModel.quantityChecked" placeholder="请输入验收数量" />
</n-form-item-grid-item> -->
<n-form-item-grid-item :span="8" label="入库数量" path="quantitySaved">
<n-input v-model:value="formModel.quantitySaved" placeholder="请输入上架数量" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="入库批次号" path="batchCode">
<n-input v-model:value="formModel.batchCode" placeholder="请输入入库批次号" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="仓库名称" path="warehouseName">
<n-input v-model:value="formModel.warehouseName" disabled />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="库区名称" path="locationName">
<n-select v-model:value="formModel.locationId" :options="locationOptions" @update:value="locationSelect">
<template #empty>
<div>
<n-empty v-if="locationOptions.length === 0" description="暂无数据" />
</div>
</template>
</n-select>
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="库位名称" path="locationName">
<n-select v-model:value="formModel.areaId" :options="areaOptions" @update:value="areaSelect">
<template #empty>
<div>
<n-empty v-if="areaOptions.length === 0" description="暂无数据" />
<n-empty v-if="!formModel.locationId && areaOptions.length > 0" description="请选择库区" />
</div>
</template>
</n-select>
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="有效期" path="expireDate">
<n-date-picker v-model:value="formModel.expireDate" type="date" placeholder="请选择有效期" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="备注" path="remark">
<n-input v-model:value="formModel.remark" placeholder="请输入备注" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="来料检验单ID" path="iqcId">
<n-input v-model:value="formModel.iqcId" placeholder="请输入来料检验单ID" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="来料检验单编号" path="iqcCode">
<n-input v-model:value="formModel.iqcCode" placeholder="请输入来料检验单编号" />
</n-form-item-grid-item>
<!-- <n-form-item-grid-item :span="8" label="净重" path="weight">
<n-input-number v-model:value="formModel.weight" placeholder="请输入净重" />
</n-form-item-grid-item> -->
<!-- <n-form-item-grid-item :span="8" label="应入重量" path="weightRecived">
<n-input-number v-model:value="formModel.weightRecived" placeholder="请输入应入重量" />
</n-form-item-grid-item> -->
<n-form-item-grid-item :span="8" label="入库重量" path="totalWeight">
<n-input-number v-model:value="formModel.totalWeight" placeholder="请输入毛重" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="重量单位" path="weightUnit">
<n-input v-model:value="formModel.weightUnit" placeholder="请输入重量单位" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="容器码" path="containerCode">
<n-input v-model:value="formModel.containerCode" placeholder="请输入容器码" />
</n-form-item-grid-item>
</n-grid>
</n-form>
</div>
</template>
</my-dialog>
</template>
<script setup lang="ts">
import { ref, computed, watch } from 'vue';
import { useMessage } from 'naive-ui';
import type { FormInst } from 'naive-ui';
// import { createRequiredFormRule } from '@/utils';
import { editWmsItemRecptLine, addWmsItemRecptLine } from '@/service/api/wms/recptLine';
import { selectAllWmsStorageLocationList } from '@/service/api/wms/location';
import { selectAllWmsStorageAreaList } from '@/service/api/wms/area';
const locationOptions = ref<{ value: string; label: string }[]>([]);
const areaOptions = ref<{ value: string; label: string }[]>([]);
export interface Props {
/** 弹窗可见性 */
visible: boolean;
/**
* 弹窗类型
* add: 新增
* edit: 编辑
*/
type?: 'add' | 'edit';
/** 编辑的表格行数据 */
editData?: any;
getList;
}
export type ModalType = NonNullable<Props['type']>;
const subDialog = ref<boolean>(false);
defineOptions({ name: 'TableActionModal' });
const props = withDefaults(defineProps<Props>(), {
type: 'add',
editData: null
});
interface Emits {
(e: 'update:visible', visible: boolean): void;
}
const emit = defineEmits<Emits>();
const message = useMessage();
const modalVisible = computed({
get() {
return props.visible;
},
set(visible) {
emit('update:visible', visible);
}
});
const cancel = () => {
modalVisible.value = false;
};
const title = computed(() => {
const titles: Record<ModalType, string> = {
add: '添加物料入库单行',
edit: '编辑物料入库单行'
};
return titles[props.type];
});
const formRef = ref<HTMLElement & FormInst>();
const formModel = ref<wms.recptLineRawType.columns>({
lineId: null,
recptId: null,
itemId: null,
itemCode: null,
itemName: null,
specification: null,
unitOfMeasure: null,
quantityRecived: null,
quantityChecked: null,
quantitySaved: null,
batchCode: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
expireDate: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
iqcId: null,
iqcCode: null,
weight: null,
weightRecived: null,
totalWeight: null,
weightUnit: null,
containerCode: null
});
const rules = {};
function handleUpdateFormModelByModalType() {
const handlers: Record<ModalType, () => void> = {
add: () => {
reset();
},
edit: () => {
reset();
if (props.editData) {
Object.assign(formModel.value, props.editData);
init();
}
}
};
handlers[props.type]();
}
async function submit() {
await formRef.value?.validate(vaild => {
if (!vaild) {
if (formModel.value.lineId) {
editWmsItemRecptLine(formModel.value)
.then(res => {
if (res.code === 200) {
message.success('修改成功');
subDialog.value = false;
props.getList();
cancel();
}
})
.catch(() => {
message.success('修改失败');
});
} else {
addWmsItemRecptLine(formModel.value)
.then(res => {
if (res.code === 200) {
message.success('新增成功');
props.getList();
subDialog.value = false;
cancel();
}
})
.catch(() => {
message.success('修改失败');
});
}
}
});
}
function reset() {
formModel.value = {
lineId: null,
recptId: null,
itemId: null,
itemCode: null,
itemName: null,
specification: null,
unitOfMeasure: null,
quantityRecived: null,
quantityChecked: null,
quantitySaved: null,
batchCode: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
expireDate: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
iqcId: null,
iqcCode: null,
weight: null,
weightRecived: null,
totalWeight: null,
weightUnit: null,
containerCode: null
};
}
watch(
() => props.visible,
newValue => {
if (newValue) {
handleUpdateFormModelByModalType();
}
}
);
function locationSelect(_val, item) {
formModel.value.locationId = item.locationId;
formModel.value.locationCode = item.locationCode;
formModel.value.locationName = item.locationName;
// console.log(formModel.value, item, '------');
selectAllWmsStorageAreaList({ locationId: item.locationId }).then(res => {
areaOptions.value = [];
res.data.forEach(listItem => {
areaOptions.value.push({
value: listItem.areaId,
label: listItem.areaName,
...listItem
});
});
});
}
function areaSelect(_val, item) {
formModel.value.areaId = item.areaId;
formModel.value.areaCode = item.areaCode;
formModel.value.areaName = item.areaName;
// console.log(formModel.value, item, '------');
}
function init() {
// console.log(formModel.value, '------');
selectAllWmsStorageLocationList({ warehouseId: formModel.value.warehouseId }).then(res => {
locationOptions.value = [];
res.data.forEach(listItem => {
locationOptions.value.push({
value: listItem.locationId,
label: listItem.locationName,
...listItem
});
});
});
selectAllWmsStorageAreaList({ locationId: formModel.value.locationId }).then(res => {
areaOptions.value = [];
res.data.forEach(listItem => {
areaOptions.value.push({
value: listItem.areaId,
label: listItem.areaName,
...listItem
});
});
});
}
</script>
<style scoped></style>

@ -0,0 +1,691 @@
<template>
<div class="h-full">
<my-card title="订单信息">
<template #right>
<div>
<component :is="useBackBtn()"></component>
<component :is="useBtn(submitInfo, 'lock', 'small', '保存入库', '#646fff')" v-if="!info"></component>
</div>
</template>
<n-descriptions label-width="100px" label-placement="left" :column="3" bordered>
<n-descriptions-item :span="1" label="入库单编号:">
{{ RecptInfo.recptCode }}
</n-descriptions-item>
<n-descriptions-item :span="1" label="单据状态:">
<dict-tag :options="wms_item_recpt_status" :value="RecptInfo.status"></dict-tag>
</n-descriptions-item>
<n-descriptions-item :span="1" label="订单类型:">
采购订单
</n-descriptions-item>
<n-descriptions-item :span="1" label="入库单名称:">
{{ RecptInfo.recptName }}
</n-descriptions-item>
<n-descriptions-item :span="1" label="应入数量:">
{{ RecptInfo.quantityRecived }}
</n-descriptions-item>
<n-descriptions-item :span="1" label="应入重量:">
{{ RecptInfo.weightRecived }}
</n-descriptions-item>
<n-descriptions-item :span="1" label="入库数量:">
{{ num }}
</n-descriptions-item>
<n-descriptions-item :span="1" label="入库重量:">
{{ weight }}
</n-descriptions-item>
<n-descriptions-item :span="1" label="入库仓库:">
<n-select
v-model:value="RecptInfo.warehouseId"
disabled
class="w-210px"
:options="storageOptions"
@update:value="storageSelect"
></n-select>
</n-descriptions-item>
<n-descriptions-item :span="1" label="入库日期:">
<n-date-picker
v-model:value="RecptInfo.recptDate"
:disabled="info"
type="date"
placeholder="请选择入库日期"
/>
</n-descriptions-item>
<n-descriptions-item :span="1" label="保管人:">
<n-select
v-model:value="RecptInfo.manageBy"
:disabled="info"
class="w-210px"
:options="userOptions"
@update:value="manageSelect"
></n-select>
</n-descriptions-item>
<n-descriptions-item :span="1" label="负责人:">
<n-select class="w-210px" :disabled="info" :options="userOptions" @update:value="headSelect"></n-select>
</n-descriptions-item>
<!-- <n-descriptions-item :span="1" label="业务部门:">
<n-tree-select
v-model:value="RecptInfo.salseDeptId"
:options="menuOptions"
label-field="label"
key-field="id"
@update:value="deptSelect"
></n-tree-select>
</n-descriptions-item>
<n-descriptions-item :span="1" label="业务员:">
<n-select
v-model:value="RecptInfo.salseBy"
class="w-210px"
:options="salesOptions"
@update:value="salseSelect"
></n-select>
</n-descriptions-item> -->
<n-descriptions-item :span="1" label="备注:">
<!-- {{ RecptInfo.remark }} -->
<n-input v-model:value="RecptInfo.remark" :disabled="info"></n-input>
</n-descriptions-item>
</n-descriptions>
</my-card>
<!-- <my-card title="搜索条件" search>
<n-form ref="formRef" inline label-width="auto" :model="searchForm" size="medium">
<n-form-item>
<component :is="useSearchBtn(search, reset)"></component>
</n-form-item>
</n-form>
</my-card> -->
<my-card title="产品(物料)信息">
<template #right>
<div class="flex-center">
<component
:is="useDelBtn(delSelect, undefined, '确定要删除所有已选中的数据吗?', Boolean(!selectKeys.length))"
v-hasPermi="['wms:recptLine:remove']"
></component>
<!-- <component :is="useAddBtn(handleAddTable, undefined, '新增')" v-hasPermi="['wms:recptLine:add']"></component> -->
<!-- <component :is="useDownBtn(handleExport)"></component> -->
<n-button size="small" class="mr-5px" type="primary" @click="getWmsItemRecptLineData">
<icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
刷新表格
</n-button>
</div>
</template>
<div>
<n-form ref="dataRef" :model="data" :rules="rules">
<n-data-table
:row-key="row => row.lineId"
:columns="columns"
:data="data"
:loading="loading"
:scroll-x="1600"
@update-checked-row-keys="handleSelect"
/>
</n-form>
<my-pagination v-model:search-form="searchForm" @init="init"></my-pagination>
</div>
<!-- <table-action-modal
v-model:visible="showModal"
:type="modalType"
:edit-data="editData"
:get-list="getWmsItemRecptLineData"
/> -->
</my-card>
</div>
</template>
<script lang="tsx" setup>
import { ref, getCurrentInstance, computed } from 'vue';
import type { Ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useMessage } from 'naive-ui';
import type { DataTableColumns, DataTableRowKey, FormInst } from 'naive-ui';
import { allUserList } from '@/service';
import { BigNumber } from 'bignumber.js';
import { useLoading } from '@/hooks';
import { getWmsItemRecpt, executeWmsItemRecpt } from '@/service/api/wms/recpt';
import { selectWmsItemRecptLineList, delWmsItemRecptLine } from '@/service/api/wms/recptLine';
import { useDelBtn, useBackBtn, useBtn } from '@/hooks/common/useBtn';
import { getlist, getWarehouseAreaList } from '@/service/api/wms/warehouse';
const info = ref<boolean>(false);
const dataRef = ref<FormInst | null>(null);
// import { createRequiredFormRule } from '~/src/utils';
// const formItem = ref<null | FormInst>(null);
const rules: any = {};
const storageOptions = ref<{ value: string; label: string }[]>([]);
const { proxy } = getCurrentInstance() as any;
const { wms_item_recpt_status, wms_item_recpt_type } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
const route = useRoute();
const router = useRouter();
const message = useMessage();
// const delIds = ref();
// const show = ref(false);
const total = ref();
// const page = ref(1);
const searchForm = ref<{
pageNum: number;
pageSize: number;
total: number;
recptId: null | string | number;
}>({
pageNum: 1,
pageSize: 10,
total: 0,
recptId: null
});
// const editData = ref<wms.recptLineRawType.columns>({
// lineId: null,
// recptId: null,
// itemId: null,
// itemCode: null,
// itemName: null,
// specification: null,
// unitOfMeasure: null,
// quantityRecived: null,
// quantityChecked: null,
// quantitySaved: null,
// batchCode: null,
// warehouseId: null,
// warehouseCode: null,
// warehouseName: null,
// locationId: null,
// locationCode: null,
// locationName: null,
// areaId: null,
// areaCode: null,
// areaName: null,
// expireDate: null,
// remark: null,
// attr1: null,
// attr2: null,
// attr3: null,
// attr4: null,
// createBy: null,
// createTime: null,
// updateBy: null,
// updateTime: null,
// iqcId: null,
// iqcCode: null,
// weight: null,
// weightRecived: null,
// totalWeight: null,
// weightUnit: null,
// containerCode: null
// });
const selectKeys = ref<DataTableRowKey[]>([]);
function handleSelect(keys: DataTableRowKey[]) {
selectKeys.value = keys;
}
// const list = ref<{ data: wms.recptLineRawType.columns[] }>({ data: [] });
const data = ref<wms.recptLineRawType.columns[]>([]);
const options = ref<any[]>([]);
// const menuOptions = ref();
const userOptions = ref<any[]>([]);
// const salesOptions = ref<any[]>([]);
// const deptId = ref();
function getUser() {
allUserList({ deptId: null }).then(res => {
// console.log(res.data, '----');
if (!Array.isArray(res.data)) return;
res.data.forEach(item => {
userOptions.value.push({
label: item.nickName,
value: item.userId,
...item
});
});
});
}
// function salesUser(_val) {
// salesOptions.value = [];
// allUserList({ deptId: _val }).then(res => {
// res.data.forEach(item => {
// salesOptions.value.push({
// label: item.nickName,
// value: item.userId
// });
// });
// });
// }
// function getDeptTree() {
// deptTreeSelect().then(response => {
// menuOptions.value = response.data;
// });
// }
const columns: Ref<DataTableColumns<wms.recptLineRawType.columns>> = ref([
{
type: 'selection',
align: 'center',
disabled: _row => {
return info.value;
}
},
{
title: '物料类型',
key: 'itemTypeName',
width: 120,
ellipsis: {
tooltip: true
}
},
{
title: '物料编码',
key: 'itemCode',
width: 120,
ellipsis: {
tooltip: true
}
},
{
title: '物料名称',
key: 'itemName',
width: 120,
ellipsis: {
tooltip: true
}
},
{
title: '规格型号',
key: 'specification',
width: 120
},
// {
// title: '',
// key: 'quantityRecived',
// width: 120
// },
// {
// title: '',
// key: 'quantityChecked',
// width: 120
// },
// {
// title: '',
// key: 'quantitySavedTemp',
// width: 120,
// render: row => {
// return `${row.quantitySavedTemp}`;
// }
// },
// {
// title: '',
// key: 'weightSavedTemp',
// width: 120,
// render: row => {
// return `${row.weightSavedTemp}`;
// }
// },
{
title: '入库数量',
key: 'quantitySaved',
width: 180,
render: row => {
return (
<div class="flex-center">
<sapn class="color-red mr-5px">*</sapn>
<n-form-item path={`quantitySaved${row.recptId}`}>
<n-input disabled={info.value} v-model:value={row.quantitySaved}></n-input>
</n-form-item>
</div>
);
}
},
{
title: '入库重量',
key: 'weight',
width: 180,
render: row => {
return (
<div class="flex-center">
<sapn class="color-red mr-5px">*</sapn>
<n-form-item path={`weight${row.recptId}`}>
<n-input disabled={info.value} v-model:value={row.weight}></n-input>
</n-form-item>
</div>
);
}
},
{
title: '仓库名称',
key: 'warehouseName',
width: 180,
render: row => {
return (
<n-cascader
disabled={info.value}
options={options.value}
label-field="pname"
value-field="id"
children-field="children"
ellipsis-tag-popover-props={true}
v-model:value={row.areaName}
placeholder="请选择仓库"
clearable
check-strategy="child"
cascade={false}
onUpdateValue={(_value, item) => {
// row.warehouseId = value;
row.areaId = item.id;
row.locationId = item.pid;
row.areaName = item.pname;
}}
></n-cascader>
);
}
},
{
title: '入库批次号',
key: 'batchCode',
width: 190,
ellipsis: {
tooltip: true
}
},
// {
// title: '',
// key: 'locationName',
// width: 120
// },
// {
// title: '',
// key: 'areaName',
// width: 120
// },
// {
// title: '',
// key: 'iqcCode',
// width: 130
// },
// {
// title: '',
// key: 'weightRecived',
// width: 120
// },
{
title: '操作',
key: 'action',
fixed: 'right',
width: 220,
align: 'center',
render: (_row, index) => {
return [
info.value
? ''
: // useEditBtn(() => handleEditTable(row.lineId as number)),
useDelBtn(() => {
// delWmsItemRecptLine(row.lineId as number).then(res => {
// if (res.code === 200) {
// window.$message?.success('');
// init();
// }
// });
// console.log(index);
data.value.splice(index, 1);
// console.log(data.value);
})
];
}
}
]) as Ref<DataTableColumns<any>>;
const { loading, startLoading, endLoading } = useLoading(false);
// const { setTrue: openModal } = useBoolean();
// function setModalType(type: ModalType) {
// modalType.value = type;
// }
//
// function reset() {
// searchForm.value.pageNum = 1;
// page.value = 1;
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
// const { pageNum, pageSize, ...rest } = searchForm.value;
// for (const key in rest) {
// if (searchForm.value[key] !== '') {
// searchForm.value[key] = '';
// }
// }
// getWmsItemRecptLineData();
// }
// function search() {
// searchForm.value.pageNum = 1;
// init();
// }
//
// function handleAddTable() {
// setModalType('add');
// openModal();
// }
//
// async function handleEditTable(lineId: number) {
// getWmsItemRecptLine(lineId).then(res => {
// for (const key in res.data) {
// if ((key.includes('Date') || key.includes('Time')) && key !== 'createTime' && key !== 'updateTime') {
// res.data[key] = new Date(res.data[key] as unknown as string).getTime();
// }
// }
// editData.value = deepClone(res.data);
// editData.value.expireDate = new Date(editData.value.expireDate as unknown as string).getTime();
// setModalType('edit');
// openModal();
// });
// }
//
function getWmsItemRecptLineData() {
searchForm.value.recptId = route.query.id as string;
startLoading();
selectWmsItemRecptLineList({ params: searchForm.value }).then(res => {
data.value = res.rows;
if (!Array.isArray(res.rows)) return;
data.value.forEach(item => {
item.quantitySavedTemp = item.quantitySaved;
item.weightSavedTemp = item.weight as string;
// item.quantitySaved = '0';
// item.weight = 0;
//
rules[`quantitySaved${item.recptId}`] = {
trigger: ['input', 'blur'],
validator: (rule, _value, callback) => {
const tempRecptId = rule.field.split('quantitySaved')[1] as string;
if (parseInt(tempRecptId, 10) === item.recptId && (Number(item.weight) || Number(item.quantitySaved))) {
return callback();
}
return callback('数量和重量必须有一个大于0');
}
};
rules[`weight${item.recptId}`] = {
trigger: ['input', 'blur'],
validator: (rule, _value, callback) => {
const tempRecptId = rule.field.split('weight')[1] as string;
if (parseInt(tempRecptId, 10) === item.recptId && (Number(item.weight) || Number(item.quantitySaved))) {
return callback();
}
return callback('数量和重量必须有一个大于0');
}
};
});
// list.value.data = res.rows;
total.value = res.total;
searchForm.value.total = res.total;
if (data.value) {
setTimeout(() => {
endLoading();
}, 200);
}
});
}
//
function delSelect() {
delWmsItemRecptLine(selectKeys.value.join(',') as string).then(() => {
getWmsItemRecptLineData();
message.success('删除成功');
});
}
// function handleExport() {
// show.value = true;
// }
const RecptInfo = ref<wms.recptRawType.columns>({
recptId: null,
recptCode: null,
recptName: null,
iqcId: null,
iqcCode: null,
poCode: null,
vendorId: null,
vendorCode: null,
vendorName: null,
vendorNick: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
recptDate: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
type: null,
fromBillId: null,
fromBillCode: null,
fromBillName: null,
snidCode: null,
createByNick: null,
manageBy: null,
manageByNick: null,
headBy: null,
headByNick: null,
salseDeptId: null,
salseDeptName: null,
salseBy: null,
salseByNick: null
});
const num = computed(() => {
// dataquantitySaved使bigNumber
const val = data.value.reduce((acc, cur) => {
const num1 = new BigNumber(acc);
const num2 = new BigNumber(cur.quantitySaved || 0);
return num1.plus(num2).toNumber();
}, 0);
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
RecptInfo.value.quantitySaved = val;
return val;
});
const weight = computed(() => {
const val = data.value.reduce((acc, cur) => {
const num1 = new BigNumber(acc);
const num2 = new BigNumber(cur.weight || 0);
return num1.plus(num2).toNumber();
}, 0);
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
RecptInfo.value.weightSaved = val;
return val;
});
// function deptSelect(_val, item) {
// // console.log(_val, item, '11');
// salesUser(_val);
// RecptInfo.value.salseDeptName = item.label;
// }
function getRecptInfo() {
getWmsItemRecpt(route.query.id as string).then(res => {
// console.log(res, res.data.salseDeptId, '11');
RecptInfo.value = res.data;
RecptInfo.value.recptDate = new Date(RecptInfo.value.recptDate as unknown as string).getTime();
// salesUser(res.data.salseDeptId);
});
}
function storageSelect(_val, item) {
RecptInfo.value.warehouseId = item.warehouseId;
RecptInfo.value.warehouseCode = item.warehouseCode;
RecptInfo.value.warehouseName = item.warehouseName;
// console.log(formModel.value, item, '------');
// selectAllWmsStorageLocationList({ warehouseId: item.warehouseId }).then(res => {
// locationOptions.value = [];
// res.data.forEach(listItem => {
// locationOptions.value.push({
// value: listItem.locationId,
// label: listItem.locationName,
// ...listItem
// });
// });
// });
}
function manageSelect(_val, item) {
RecptInfo.value.manageBy = item.userId;
RecptInfo.value.manageByNick = item.nickName;
}
function headSelect(_val, item) {
RecptInfo.value.headBy = item.userId;
RecptInfo.value.headByNick = item.nickName;
// console.log(item, '1');
}
// function salseSelect(_val, item) {
// RecptInfo.value.salseBy = item.userId;
// RecptInfo.value.salseByNick = item.nickName;
// }
function getStorage(val) {
if (!val) return;
getWarehouseAreaList(val).then(res => {
options.value = res.data;
});
}
function submitInfo() {
dataRef.value?.validate(err => {
if (!err) {
console.log('校验通过');
RecptInfo.value.lineList = data.value;
executeWmsItemRecpt(RecptInfo.value).then(res => {
// console.log(res);
if (res.code === 200) {
message.success('入库成功');
router.go(-1);
}
});
}
});
// console.log(RecptInfo.value, data.value, '--------');
}
function init() {
info.value = Boolean(route.query.info);
getWmsItemRecptLineData();
getRecptInfo();
getlist({}).then(res => {
if (!Array.isArray(res.data)) return;
res.data.forEach(item => {
storageOptions.value.push({
value: item.warehouseId,
label: item.warehouseName,
...item
});
});
});
getStorage(route.query.warehouseId as string);
getUser();
//
// getDeptTree();
}
init();
</script>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,367 @@
<template>
<my-dialog
v-model:show="modalVisible"
:title="title"
:loading="subDialog"
width="1000px"
@submit="submit"
@cancel="cancel"
>
<template #content>
<div>
<n-form ref="formRef" label-placement="left" :label-width="100" :model="formModel" :rules="rules">
<n-grid :cols="24" :x-gap="18">
<n-form-item-grid-item :span="8" label="入库单名称" path="recptName">
<n-input v-model:value="formModel.recptName" placeholder="请输入入库单名称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="采购订单编号" path="poCode">
<n-input v-model:value="formModel.poCode" placeholder="请输入采购订单编号" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="供应商名称" path="vendorName">
<n-select :options="supperOptions" @update:value="supperSelect"></n-select>
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="仓库名称" path="warehouseName">
<n-select v-moedl:value="formModel.warehouseId" :options="storageOptions" @update:value="storageSelect" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="入库日期" path="recptDate">
<n-date-picker v-model:value="formModel.recptDate" type="date" placeholder="请选择入库日期" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="单据状态" path="status">
<n-select
v-model:value="formModel.status"
disabled
filterable
placeholder="请选择单据状态"
:options="wms_item_recpt_status"
/>
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="备注" path="remark">
<n-input v-model:value="formModel.remark" placeholder="请输入备注" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="单据类型" path="type">
<n-select
v-model:value="formModel.type"
filterable
placeholder="请选择单据类型"
:options="wms_item_recpt_type"
/>
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="来源单据ID" path="fromBillId">
<n-input v-model:value="formModel.fromBillId" placeholder="请输入来源单据ID" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="来源单据编码" path="fromBillCode">
<n-input v-model:value="formModel.fromBillCode" placeholder="请输入来源单据编码" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="来源单据名称" path="fromBillName">
<n-input v-model:value="formModel.fromBillName" placeholder="请输入来源单据名称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="创建者名称" path="createByNick">
<n-input v-model:value="formModel.createByNick" placeholder="请输入创建者名称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="保管人" path="manageBy">
<n-input v-model:value="formModel.manageBy" placeholder="请输入保管人" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="保管人简称" path="manageByNick">
<n-input v-model:value="formModel.manageByNick" placeholder="请输入保管人简称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="负责人" path="headBy">
<n-input v-model:value="formModel.headBy" placeholder="请输入负责人" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="负责人简称" path="headByNick">
<n-input v-model:value="formModel.headByNick" placeholder="请输入负责人简称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="业务部门" path="salseDeptId">
<n-input v-model:value="formModel.salseDeptId" placeholder="请输入业务部门" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="业务部门名称" path="salseDeptName">
<n-input v-model:value="formModel.salseDeptName" placeholder="请输入业务部门名称" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="业务员" path="salseBy">
<n-input v-model:value="formModel.salseBy" placeholder="请输入业务员" />
</n-form-item-grid-item>
<n-form-item-grid-item :span="8" label="业务员名称" path="salseByNick">
<n-input v-model:value="formModel.salseByNick" placeholder="请输入业务员名称" />
</n-form-item-grid-item>
</n-grid>
</n-form>
</div>
</template>
</my-dialog>
</template>
<script setup lang="ts">
import { ref, computed, watch, getCurrentInstance } from 'vue';
import { useMessage } from 'naive-ui';
import type { FormInst } from 'naive-ui';
import { createRequiredFormRule } from '@/utils';
import { editWmsItemRecpt, addWmsItemRecpt } from '@/service/api/wms/recpt';
import { getlist } from '@/service/api/wms/warehouse';
import { getAllSupplier } from '@/service/api/erp/rawProcureList';
const supperOptions = ref<{ value: string; label: string }[]>([]);
const storageOptions = ref<{ value: string; label: string }[]>([]);
const locationOptions = ref<{ value: string; label: string }[]>([]);
const areaOptions = ref<{ value: string; label: string }[]>([]);
const { proxy } = getCurrentInstance() as any;
const { wms_item_recpt_status, wms_item_recpt_type } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
export interface Props {
/** 弹窗可见性 */
visible: boolean;
/**
* 弹窗类型
* add: 新增
* edit: 编辑
*/
type?: 'add' | 'edit';
/** 编辑的表格行数据 */
editData?: any;
getList;
}
export type ModalType = NonNullable<Props['type']>;
const subDialog = ref<boolean>(false);
defineOptions({ name: 'TableActionModal' });
const props = withDefaults(defineProps<Props>(), {
type: 'add',
editData: null
});
interface Emits {
(e: 'update:visible', visible: boolean): void;
}
const emit = defineEmits<Emits>();
const message = useMessage();
const modalVisible = computed({
get() {
return props.visible;
},
set(visible) {
emit('update:visible', visible);
}
});
const cancel = () => {
modalVisible.value = false;
};
const title = computed(() => {
const titles: Record<ModalType, string> = {
add: '添加物料入库单',
edit: '编辑物料入库单'
};
return titles[props.type];
});
const formRef = ref<HTMLElement & FormInst>();
const formModel = ref<WMS.recptRawType.columns>({
recptId: null,
recptCode: null,
recptName: null,
iqcId: null,
iqcCode: null,
poCode: null,
vendorId: null,
vendorCode: null,
vendorName: null,
vendorNick: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
recptDate: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
type: null,
fromBillId: null,
fromBillCode: null,
fromBillName: null,
snidCode: null,
createByNick: null,
manageBy: null,
manageByNick: null,
headBy: null,
headByNick: null,
salseDeptId: null,
salseDeptName: null,
salseBy: null,
salseByNick: null
});
const rules = {
recptCode: createRequiredFormRule('入库单编号不能为空'),
recptName: createRequiredFormRule('入库单名称不能为空')
};
function handleUpdateFormModelByModalType() {
const handlers: Record<ModalType, () => void> = {
add: () => {
reset();
},
edit: () => {
reset();
if (props.editData) {
Object.assign(formModel.value, props.editData);
}
}
};
handlers[props.type]();
}
async function submit() {
await formRef.value?.validate(vaild => {
if (!vaild) {
if (formModel.value.recptId) {
editWmsItemRecpt(formModel.value)
.then(res => {
if (res.code === 200) {
message.success('修改成功');
subDialog.value = false;
props.getList();
cancel();
}
})
.catch(() => {
message.success('修改失败');
});
} else {
addWmsItemRecpt(formModel.value)
.then(res => {
if (res.code === 200) {
message.success('新增成功');
props.getList();
subDialog.value = false;
cancel();
}
})
.catch(() => {
message.success('修改失败');
});
}
}
});
}
function reset() {
formModel.value = {
recptId: null,
recptCode: null,
recptName: null,
iqcId: null,
iqcCode: null,
poCode: null,
vendorId: null,
vendorCode: null,
vendorName: null,
vendorNick: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
recptDate: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
type: null,
fromBillId: null,
fromBillCode: null,
fromBillName: null,
snidCode: null,
createByNick: null,
manageBy: null,
manageByNick: null,
headBy: null,
headByNick: null,
salseDeptId: null,
salseDeptName: null,
salseBy: null,
salseByNick: null
};
}
watch(
() => props.visible,
newValue => {
if (newValue) {
handleUpdateFormModelByModalType();
}
}
);
function supperSelect(_val, item) {
formModel.value.vendorId = item.id;
formModel.value.vendorCode = item.vendorCode;
formModel.value.vendorName = item.vendorName;
// console.log(formModel.value, item, '------');
}
function storageSelect(_val, item) {
formModel.value.warehouseId = item.warehouseId;
formModel.value.warehouseCode = item.warehouseCode;
formModel.value.warehouseName = item.warehouseName;
// console.log(formModel.value, item, '------');
}
function locationSelect(_val, item) {
formModel.value.locationId = item.locationId;
formModel.value.locationCode = item.locationCode;
formModel.value.locationName = item.locationName;
// console.log(formModel.value, item, '------');
}
function areaSelect(_val, item) {
formModel.value.areaId = item.areaId;
formModel.value.areaCode = item.areaCode;
formModel.value.areaName = item.areaName;
// console.log(formModel.value, item, '------');
}
function init() {
getAllSupplier({ attr1: 'FL' }).then(res => {
if (!Array.isArray(res.data)) return;
res.data.forEach(item => {
supperOptions.value.push({
value: item.id,
label: item.vendorName,
...item
});
});
});
getlist({}).then(res => {
console.log(res);
if (!Array.isArray(res.data)) return;
res.data.forEach(item => {
storageOptions.value.push({
value: item.warehouseId,
label: item.warehouseName,
...item
});
});
});
}
init();
</script>
<style scoped></style>

@ -0,0 +1,377 @@
<template>
<div class="h-full">
<my-card title="搜索条件" search>
<n-form ref="formRef" inline label-width="auto" :model="searchForm" size="medium">
<n-form-item label="采购订单编号">
<n-input v-model:value="searchForm.poCode" placeholder="请输入采购订单编号" />
</n-form-item>
<n-form-item label="供应商名称">
<n-input v-model:value="searchForm.vendorName" placeholder="请输入供应商名称" />
</n-form-item>
<n-form-item label="单据状态">
<n-select v-model:value="searchForm.status" class="w-180px" :options="wms_item_recpt_status"></n-select>
<!-- <n-input v-model:value="searchForm.status" placeholder="请选择单据状态" /> -->
</n-form-item>
<n-form-item>
<component :is="useSearchBtn(search, reset)"></component>
</n-form-item>
</n-form>
</my-card>
<my-card title="采购入库列表">
<template #right>
<div class="flex-center">
<component
:is="useDelBtn(delSelect, undefined, '确定要删除所有已选中的数据吗?', Boolean(!selectKeys.length))"
v-hasPermi="['wms:recpt:remove']"
></component>
<!-- <component :is="useAddBtn(handleAddTable, undefined, '新增')" v-hasPermi="['wms:recpt:add']"></component>
<component :is="useDownBtn(handleExport)"></component> -->
<n-button size="small" class="mr-5px" type="primary" @click="getWmsItemRecptData">
<icon-mdi-refresh class="mr-4px text-16px" :class="{ 'animate-spin': loading }" />
刷新表格
</n-button>
</div>
</template>
<div>
<n-data-table
:row-key="row => row.recptId"
:columns="columns"
:data="data"
:loading="loading"
:scroll-x="1000"
@update-checked-row-keys="handleSelect"
/>
<my-pagination v-model:search-form="searchForm" @init="init"></my-pagination>
</div>
<table-action-modal
v-model:visible="showModal"
:type="modalType"
:edit-data="editData"
:get-list="getWmsItemRecptData"
/>
</my-card>
</div>
</template>
<script lang="tsx" setup>
import { ref, getCurrentInstance } from 'vue';
import type { Ref } from 'vue';
import { useRouter } from 'vue-router';
import { useMessage } from 'naive-ui';
import type { DataTableColumns, DataTableRowKey } from 'naive-ui';
import { useLoading, useBoolean } from '@/hooks';
// import { deepClone } from '@/utils';
import { selectWmsItemRecptList, delWmsItemRecpt } from '@/service/api/wms/recpt';
import { useSearchBtn, useDelBtn, useBtn, useEditBtn } from '@/hooks/common/useBtn';
// import { download } from '@/service/request/helpers';
import type { ModalType } from './components/table-action-modal.vue';
import TableActionModal from './components/table-action-modal.vue';
const router = useRouter();
const { proxy } = getCurrentInstance() as any;
const { wms_item_recpt_status } = proxy.useDict('wms_item_recpt_status', 'wms_item_recpt_type');
// const collapseFlag = ref<boolean>(false);
const { bool: showModal } = useBoolean();
const modalType = ref<ModalType>('add');
// const menuOptions = ref();
const message = useMessage();
// const delIds = ref();
// const show = ref(false);
const total = ref();
const page = ref(1);
const searchForm = ref({
pageNum: 1,
pageSize: 10,
total: 0,
poCode: undefined,
vendorName: undefined,
attr1: 'YL',
status: null
});
const editData = ref<wms.recptRawType.columns>({
recptId: null,
recptCode: null,
recptName: null,
iqcId: null,
iqcCode: null,
poCode: null,
vendorId: null,
vendorCode: null,
vendorName: null,
vendorNick: null,
warehouseId: null,
warehouseCode: null,
warehouseName: null,
locationId: null,
locationCode: null,
locationName: null,
areaId: null,
areaCode: null,
areaName: null,
recptDate: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
type: null,
fromBillId: null,
fromBillCode: null,
fromBillName: null,
snidCode: null,
createByNick: null,
manageBy: null,
manageByNick: null,
headBy: null,
headByNick: null,
salseDeptId: null,
salseDeptName: null,
salseBy: null,
salseByNick: null
});
const selectKeys = ref<DataTableRowKey[]>([]);
function handleSelect(keys: DataTableRowKey[]) {
selectKeys.value = keys;
}
const data = ref<wms.recptRawType.columns[]>([]);
const columns: Ref<DataTableColumns<wms.recptRawType.columns>> = ref([
{
type: 'selection',
align: 'center'
},
{
title: '入库单编号',
key: 'recptCode',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '入库单名称',
key: 'recptName',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '采购订单编号',
key: 'poCode',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '供应商名称',
key: 'vendorName',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '仓库名称',
key: 'warehouseName',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
// {
// title: '',
// key: 'locationName',
// align: 'center',
// width: 110
// },
// {
// title: '',
// key: 'areaName',
// align: 'center',
// width: 110
// },
{
title: '入库日期',
key: 'recptDate',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '单据状态',
key: 'status',
align: 'center',
render: row => {
return <dict-tag options={wms_item_recpt_status.value} value={row.status}></dict-tag>;
},
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '来源单据编码',
key: 'fromBillCode',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '负责人简称',
key: 'headByNick',
align: 'center',
width: 110,
ellipsis: {
tooltip: true
}
},
{
title: '操作',
key: 'action',
fixed: 'right',
width: 220,
align: 'center',
render: row => {
console.log(wms_item_recpt_status.value, row.status, '----');
const Btn: JSX.Element[] = [];
if (row.status !== 'FINISHED') {
Btn.push(
useEditBtn(
() => {
router.push({
name: 'storage_auxiliaryProduceinfo',
query: { id: row.recptId, warehouseId: row.warehouseId }
});
},
'tiny',
'执行入库'
)
);
}
// Btn.push(
// useInfoBtn(
// () => {
// router.push({
// name: 'storage_auxiliaryProduceinfo',
// query: { id: row.recptId, warehouseId: row.warehouseId, info: 'true' }
// });
// },
// 'tiny',
// ''
// )
// );
// Btn.push(
// useDelBtn(() => {
// delWmsItemRecpt(row.recptId as number).then(res => {
// if (res.code === 200) {
// window.$message?.success('');
// init();
// }
// });
// }, 'tiny')
// );
return Btn;
}
}
]) as Ref<DataTableColumns<any>>;
const { loading, startLoading, endLoading } = useLoading(false);
// const { setTrue: openModal } = useBoolean();
// function setModalType(type: ModalType) {
// modalType.value = type;
// }
//
function reset() {
searchForm.value.pageNum = 1;
page.value = 1;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { pageNum, pageSize, ...rest } = searchForm.value;
for (const key in rest) {
if (searchForm.value[key] !== '' && searchForm.value[key] !== 'YL') {
searchForm.value[key] = null;
}
}
getWmsItemRecptData();
}
async function handleEditTable(issueId: number) {
console.log("执行部入库操作", issueId)
}
function search() {
searchForm.value.pageNum = 1;
init();
}
//
// function handleAddTable() {
// setModalType('add');
// openModal();
// }
//
// async function handleEditTable(recptId: number) {
// getWmsItemRecpt(recptId).then(res => {
// for (const key in res.data) {
// if ((key.includes('Date') || key.includes('Time')) && key !== 'createTime' && key !== 'updateTime') {
// res.data[key] = new Date(res.data[key] as unknown as string).getTime();
// }
// }
// editData.value = deepClone(res.data);
// editData.value.recptDate = new Date(editData.value.recptDate as unknown as string).getTime();
// setModalType('edit');
// openModal();
// });
// }
//
function getWmsItemRecptData() {
startLoading();
selectWmsItemRecptList({ params: searchForm.value }).then(res => {
data.value = res.rows;
total.value = res.total;
searchForm.value.total = res.total;
if (data.value) {
setTimeout(() => {
endLoading();
}, 200);
}
});
}
//
function delSelect() {
delWmsItemRecpt(selectKeys.value.join(',') as string).then(() => {
getWmsItemRecptData();
message.success('删除成功');
});
}
// function handleExport() {
// show.value = true;
// }
function init() {
getWmsItemRecptData();
//
}
init();
</script>
Loading…
Cancel
Save