diff --git a/src/api/wms/baseMaterialInfo/types.ts b/src/api/wms/baseMaterialInfo/types.ts
index dd0601c..3bdd2a5 100644
--- a/src/api/wms/baseMaterialInfo/types.ts
+++ b/src/api/wms/baseMaterialInfo/types.ts
@@ -304,6 +304,11 @@ export interface BaseMaterialInfoVO {
*/
isHighValue: string;
+ /**
+ * wms保质期提醒时间
+ */
+ wmsAlarmTime?: number ;
+
}
export interface BaseMaterialInfoForm extends BaseEntity {
@@ -571,6 +576,11 @@ export interface BaseMaterialInfoForm extends BaseEntity {
*/
isHighValue?: string;
+ /**
+ * wms保质期提醒时间
+ */
+ wmsAlarmTime?: number ;
+
}
export interface BaseMaterialInfoQuery extends PageQuery {
@@ -821,6 +831,11 @@ export interface BaseMaterialInfoQuery extends PageQuery {
*/
isHighValue?: string;
+ /**
+ * wms保质期提醒时间
+ */
+ wmsAlarmTime?: number ;
+
/**
* 日期范围参数
diff --git a/src/api/wms/inventory/types.ts b/src/api/wms/inventory/types.ts
index 84a0286..b4cd7ad 100644
--- a/src/api/wms/inventory/types.ts
+++ b/src/api/wms/inventory/types.ts
@@ -58,6 +58,11 @@ export interface InventoryVO {
* 单位:天
*/
maxParkingTime?: number ;
+ /**
+ * 预警时间
+ * 单位:天
+ */
+ wmsAlarmTime?: number ;
}
@@ -126,6 +131,11 @@ export interface InventoryForm extends BaseEntity {
* 单位:天
*/
maxParkingTime?: number ;
+ /**
+ * 预警时间
+ * 单位:天
+ */
+ wmsAlarmTime?: number ;
}
@@ -195,6 +205,11 @@ export interface InventoryQuery extends PageQuery {
* 单位:天
*/
maxParkingTime?: number ;
+ /**
+ * 预警时间
+ * 单位:天
+ */
+ wmsAlarmTime?: number ;
/**
diff --git a/src/views/wms/instockOrderCopy/index.vue b/src/views/wms/instockOrderCopy/index.vue
index 1f83189..caeac1b 100644
--- a/src/views/wms/instockOrderCopy/index.vue
+++ b/src/views/wms/instockOrderCopy/index.vue
@@ -5,11 +5,11 @@
-
+
@@ -172,7 +172,7 @@
-
+
@@ -658,6 +658,21 @@ import { getWmsPurchaseOrderList } from '@/api/wms/wmsPurchaseOrder';
import { useRoute } from 'vue-router';
import { parseTime } from '@/utils/ruoyi';
+// 获取路由实例
+const route = useRoute();// 获取路由实例
+
+// 修复路由参数获取逻辑
+const getRouteParam = (paramName: string): string => {
+ const param = route.query[paramName];
+ if (!param) return '';
+ return Array.isArray(param) ? param[0] : param;
+};
+
+const instockTypeValue = getRouteParam('instockType');
+const instockMethondValue = getRouteParam('instockMethond');
+// ... 现有代码 ...
+
+
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {audit_behave,
wms_barcode_if,
@@ -688,12 +703,19 @@ const childrenTableInfoVisible = ref(false)
// const childrenTableInfoSubmit = ref(false)
const updateDialog = ref(false)
const dialogTitle = ref('添加')
-const dialogForm = ref({ instockType: '', orderNo: '', materialCategoryId: '', warehouseId: '' });
+const dialogForm = ref({
+ instockType: instockTypeValue || '' ,
+ orderNo: '',
+ materialCategoryId: '',
+ warehouseId: '',
+ instockMethond: instockMethondValue || '' ,
+});
const parentTableInfoForm = ref({
materialCategoryId: '',
- instockType: '',
+ instockType: instockTypeValue || '' ,
auditBy: '',
- warehouseCode: ''
+ warehouseCode: '',
+ instockMethond: instockMethondValue || '' ,
})
const parentTableApproveForm = ref({
auditStatus: '',
@@ -710,6 +732,7 @@ const childrenTableInfoForm = ref({
packageMode: 'average',
batchCode: '',
createTime: '',
+
})
@@ -718,22 +741,21 @@ const queryForm = ref({
materialCategoryId: '',
materialCategoryName: '',
warehouseId: '',
- instockType: '',
- instockMethond: '',
+ instockType: instockTypeValue || '' ,
+ instockMethond: instockMethondValue || '' ,
auditStatus: '',
pageNum: 1,
pageSize: 10,
})
-// 获取路由实例
-const route = useRoute();// 获取路由实例
+
// 初始化时获取路由参数并设置到查询表单
let routeInstockMethondValue = '';
if (route.query.instockMethond) {
// 确保值是字符串类型,如果是数组则取第一个元素
- const instockMethondValue = Array.isArray(route.query.instockMethond)
- ? route.query.instockMethond[0]
- : route.query.instockMethond;
+ // const instockMethondValue = Array.isArray(route.query.instockMethond)
+ // ? route.query.instockMethond[0]
+ // : route.query.instockMethond;
queryForm.value.instockMethond = instockMethondValue;
routeInstockMethondValue = instockMethondValue; // 保存路由参数值
}
@@ -741,9 +763,9 @@ if (route.query.instockMethond) {
let routeInstockTypeValue = '';
if (route.query.instockType) {
// 确保值是字符串类型,如果是数组则取第一个元素
- const instockTypeValue = Array.isArray(route.query.instockType)
- ? route.query.instockType[0]
- : route.query.instockType;
+ // const instockTypeValue = Array.isArray(route.query.instockType)
+ // ? route.query.instockType[0]
+ // : route.query.instockType;
queryForm.value.instockType = instockTypeValue;
routeInstockTypeValue = instockTypeValue; // 保存路由参数值
}
@@ -772,7 +794,7 @@ const state = reactive({
productionOrders: [],
selectedPurchaseOrder: null,
selectedProductionOrder: null,
- isPurchaseOrderAssociated: false
+ isPurchaseOrderAssociated: false,
});
// 获取仓库
@@ -980,8 +1002,25 @@ const viewDetails = (e) => {
// 父表格新增
const parentTableAdd = () => {
dialogVisible.value = true;
- dialogForm.value = { instockType: '', orderNo: '', materialCategoryId: '', warehouseId: '' };
+ dialogForm.value = {
+ instockType: instockTypeValue || '',
+ orderNo: '',
+ materialCategoryId: '',
+ warehouseId: '',
+ instockMethond: instockMethondValue || ''
+ };
dialogtable.value = [];
+
+ // 手动触发工单类型变更逻辑,确保采购订单相关组件正确显示
+ if (dialogForm.value.instockType === '1') {
+ state.showPurchaseOrderSelect = true;
+ loadPurchaseOrders();
+ } else if (dialogForm.value.instockType === '2') {
+ state.showProductionOrderSelect = true;
+ loadProductionOrders();
+ }
+
+
// 清空表单验证状态
setTimeout(() => {
if (dialogFormRef.value) {
diff --git a/src/views/wms/inventory/index.vue b/src/views/wms/inventory/index.vue
index 6a54f0d..5fe141c 100644
--- a/src/views/wms/inventory/index.vue
+++ b/src/views/wms/inventory/index.vue
@@ -91,6 +91,12 @@
{{ calculateDaysToExpire(scope.row) }}
+
+
+
+ {{ getExpiryStatusInfo(scope.row).text }}
+
+
@@ -218,7 +224,9 @@ const columns = ref([
{ key: 4, label: `锁定状态`, visible: true },
{ key: 5, label: `库存状态`, visible: true },
{ key: 6, label: `仓库`, visible: true },
- { key: 7, label: `距离过期天数`, visible: true },
+ { key: 7, label: `距离过期天数`, visible: true },
+ { key: 8, label: `保质期天数`, visible: true },
+ { key: 9, label: `保质期状态`, visible: true },
// { key: 11, label: `${comment}`, visible: true },
// { key: 12, label: `${comment}`, visible: true },
// { key: 13, label: `${comment}`, visible: true },
@@ -239,6 +247,7 @@ const initFormData: InventoryForm = {
warehouseName: undefined,
createTime: undefined,
maxParkingTime: undefined,
+ wmsAlarmTime: undefined,
}
const data = reactive>({
form: {...initFormData},
@@ -259,6 +268,7 @@ const data = reactive>({
warehouseName: undefined,
createTime: undefined,
maxParkingTime: undefined,
+ wmsAlarmTime: undefined,
params: {
}
},
@@ -398,13 +408,36 @@ const getMaterialCategorySelect = async () => {
};
const calculateDaysToExpire = (row: InventoryVO) => {
- // 计算距离过期天数:(createTime + maxParkingTime) - 当前日期,若负表示过期
- if (!row.createTime || !row.maxParkingTime) return 'N/A';
+ // 计算距离过期天数:(createTime + shelfLifeDays) - 当前日期
+ // shelfLifeDays 优先使用 row.maxParkingTime;若未提供则默认 30 天后失效
+ if (!row.createTime) return 'N/A';
+ const shelfLifeDays = (row.maxParkingTime ?? 30) as number;
const entryDate = dayjs(row.createTime);
- const expireDate = entryDate.add(row.maxParkingTime, 'day');
+ const expireDate = entryDate.add(shelfLifeDays, 'day');
const today = dayjs();
const days = expireDate.diff(today, 'day');
- return days >= 0 ? days : days; // 显示负数表示过期
+ return days; // 可能为负数,负数表示已过期
+};
+
+const getExpiryStatusInfo = (row: InventoryVO) => {
+ const days = calculateDaysToExpire(row);
+ // 提示阈值:优先使用 row.wmsAlarmTime;若未提供则默认 15 天
+ const warnThreshold = (row.wmsAlarmTime ?? 15) as number;
+ if (days === 'N/A') {
+ return { type: 'info', text: 'N/A' };
+ }
+ if (typeof days !== 'number') {
+ return { type: 'info', text: 'N/A' };
+ }
+ if (days <= 0) {
+ // 到期或已过期
+ return { type: 'danger', text: '已失效' };
+ }
+ if (days <= warnThreshold) {
+ // 距离到期小于等于预警阈值(如 5 天或默认 15 天)
+ return { type: 'warning', text: '即将过期' };
+ }
+ return { type: 'success', text: '正常' };
};