diff --git a/src/api/wcs/taskQueue/types.ts b/src/api/wcs/taskQueue/types.ts index 54bc7b6..360a30c 100644 --- a/src/api/wcs/taskQueue/types.ts +++ b/src/api/wcs/taskQueue/types.ts @@ -105,8 +105,8 @@ export interface TaskQueueVO { */ updatedTime: string; - /** 实时任务明细列表 */ - details: TaskDetailVO[]; + /** 实时任务明细列表;列表接口不挂载明细,详情接口按需返回。 */ + details?: TaskDetailVO[]; /** 创建人 */ createdBy: string | number; diff --git a/src/views/wcs/locationInfo/index.vue b/src/views/wcs/locationInfo/index.vue index 9860ae2..cfbd492 100644 --- a/src/views/wcs/locationInfo/index.vue +++ b/src/views/wcs/locationInfo/index.vue @@ -15,6 +15,18 @@ + + + 搜索 重置 @@ -68,9 +80,9 @@ - + @@ -190,6 +202,12 @@ import { getMaterialInfoList } from '@/api/wcs/materialInfo'; import { LocationInfoVO, LocationInfoQuery, LocationInfoForm } from '@/api/wcs/locationInfo/types'; import { StoreInfoVO } from '@/api/wcs/storeInfo/types'; import { MaterialInfoVO } from '@/api/wcs/materialInfo/types'; +import { + CREATED_TIME_DISPLAY_FORMAT, + CREATED_TIME_PICKER_FORMAT, + CREATED_TIME_VALUE_FORMAT, + getTodayCreatedTimeRange +} from '../utils/createdTimeRange'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { wcs_location_status, wcs_is_flag } = toRefs(proxy?.useDict('wcs_location_status', 'wcs_is_flag')); @@ -205,6 +223,9 @@ const single = ref(true); const multiple = ref(true); const total = ref(0); +// 创建时间范围筛选,与 SysUser 一致由 addDateRange 注入到 params.beginTime/endTime。 +const dateRange = ref<[string, string]>(getTodayCreatedTimeRange()); + const queryFormRef = ref(); const locationInfoFormRef = ref(); @@ -280,7 +301,8 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listLocationInfo(queryParams.value); + // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 + const res = await listLocationInfo(proxy?.addDateRange(queryParams.value, dateRange.value)); locationInfoList.value = res.rows; total.value = res.total; loading.value = false; @@ -318,6 +340,8 @@ const handleQuery = () => { const resetQuery = () => { queryFormRef.value?.resetFields(); + // 重置后恢复当天完整范围,避免刚新增的数据落在旧结束时间之后。 + dateRange.value = getTodayCreatedTimeRange(); handleQuery(); } @@ -344,14 +368,34 @@ const handleUpdate = async (row?: LocationInfoVO) => { dialog.title = "修改库位信息"; } +const buildSubmitData = (): LocationInfoForm => ({ + objId: form.value.objId, + locationCode: form.value.locationCode, + locationName: form.value.locationName, + locationArea: form.value.locationArea, + storeCode: form.value.storeCode, + locationRows: form.value.locationRows, + locationColumns: form.value.locationColumns, + locationLayers: form.value.locationLayers, + agvPosition: form.value.agvPosition, + materialCode: form.value.materialCode, + palletBarcode: form.value.palletBarcode, + stackCount: form.value.stackCount, + locationStatus: form.value.locationStatus, + isFlag: form.value.isFlag, + remark: form.value.remark +}); + const submitForm = () => { locationInfoFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; - if (form.value.objId) { - await updateLocationInfo(form.value).finally(() => buttonLoading.value = false); + // 仓库名称、物料名称是选择后带出的展示字段,提交时只传真实业务字段。 + const submitData = buildSubmitData(); + if (submitData.objId) { + await updateLocationInfo(submitData).finally(() => buttonLoading.value = false); } else { - await addLocationInfo(form.value).finally(() => buttonLoading.value = false); + await addLocationInfo(submitData).finally(() => buttonLoading.value = false); } proxy?.$modal.msgSuccess("操作成功"); dialog.visible = false; diff --git a/src/views/wcs/pathInfo/index.vue b/src/views/wcs/pathInfo/index.vue index dbe26bc..c2b2b8c 100644 --- a/src/views/wcs/pathInfo/index.vue +++ b/src/views/wcs/pathInfo/index.vue @@ -15,6 +15,18 @@ + + + 搜索 重置 @@ -54,9 +66,9 @@ - + @@ -149,6 +161,12 @@ import { listPathInfo, getPathInfo, delPathInfo, addPathInfo, updatePathInfo } from '@/api/wcs/pathInfo'; import { PathInfoVO, PathInfoQuery, PathInfoForm } from '@/api/wcs/pathInfo/types'; import type { PathDetailsForm } from '@/api/wcs/pathDetails/types'; +import { + CREATED_TIME_DISPLAY_FORMAT, + CREATED_TIME_PICKER_FORMAT, + CREATED_TIME_VALUE_FORMAT, + getTodayCreatedTimeRange +} from '../utils/createdTimeRange'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { wcs_is_flag } = toRefs(proxy?.useDict('wcs_is_flag')); @@ -164,6 +182,9 @@ const single = ref(true); const multiple = ref(true); const total = ref(0); +// 创建时间范围筛选,与 SysUser 一致由 addDateRange 注入到 params.beginTime/endTime。 +const dateRange = ref<[string, string]>(getTodayCreatedTimeRange()); + const queryFormRef = ref(); const pathInfoFormRef = ref(); @@ -200,7 +221,8 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listPathInfo(queryParams.value); + // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 + const res = await listPathInfo(proxy?.addDateRange(queryParams.value, dateRange.value)); pathInfoList.value = res.rows; total.value = res.total; loading.value = false; @@ -225,6 +247,8 @@ const handleQuery = () => { const resetQuery = () => { queryFormRef.value?.resetFields(); + // 重置后恢复当天完整范围,避免刚新增的数据落在旧结束时间之后。 + dateRange.value = getTodayCreatedTimeRange(); handleQuery(); } @@ -267,16 +291,32 @@ const handleDelDetail = (index: number) => { detailList.value.splice(index, 1); } +const buildSubmitData = (): PathInfoForm => ({ + objId: form.value.objId, + pathCode: form.value.pathCode, + pathName: form.value.pathName, + isFlag: form.value.isFlag, + remark: form.value.remark, + // 只提交主子表可编辑业务字段,避免详情接口带回的展示/审计字段被原样回传。 + details: detailList.value.map((item) => ({ + objId: item.objId, + pathCode: form.value.pathCode || '', + startPoint: item.startPoint, + endPoint: item.endPoint, + isFlag: item.isFlag, + remark: item.remark + })) +}); + const submitForm = () => { pathInfoFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; - // 主子表在同一次提交中保存,保证前端入参与后端 Bo.details 契约一致。 - form.value.details = detailList.value; - if (form.value.objId) { - await updatePathInfo(form.value).finally(() => buttonLoading.value = false); + const submitData = buildSubmitData(); + if (submitData.objId) { + await updatePathInfo(submitData).finally(() => buttonLoading.value = false); } else { - await addPathInfo(form.value).finally(() => buttonLoading.value = false); + await addPathInfo(submitData).finally(() => buttonLoading.value = false); } proxy?.$modal.msgSuccess("操作成功"); dialog.visible = false; diff --git a/src/views/wcs/taskDetail/index.vue b/src/views/wcs/taskDetail/index.vue index edd192b..5787f86 100644 --- a/src/views/wcs/taskDetail/index.vue +++ b/src/views/wcs/taskDetail/index.vue @@ -23,6 +23,18 @@ + + + 搜索 重置 @@ -89,9 +101,9 @@ - + @@ -134,7 +146,7 @@ - + @@ -218,6 +230,12 @@ import { getMaterialInfoList } from '@/api/wcs/materialInfo'; import { MaterialInfoVO } from '@/api/wcs/materialInfo/types'; import { getPathInfoList } from '@/api/wcs/pathInfo'; import { PathInfoVO } from '@/api/wcs/pathInfo/types'; +import { + CREATED_TIME_DISPLAY_FORMAT, + CREATED_TIME_PICKER_FORMAT, + CREATED_TIME_VALUE_FORMAT, + getTodayCreatedTimeRange +} from '../utils/createdTimeRange'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { wcs_is_flag, wcs_task_category, wcs_task_type, wcs_task_status } = toRefs( @@ -235,6 +253,9 @@ const single = ref(true); const multiple = ref(true); const total = ref(0); +// 创建时间范围筛选,与 SysUser 一致由 addDateRange 注入到 params.beginTime/endTime。 +const dateRange = ref<[string, string]>(getTodayCreatedTimeRange()); + const queryFormRef = ref(); const taskDetailFormRef = ref(); @@ -293,7 +314,8 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; try { - const res = await listTaskDetail(queryParams.value); + // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 + const res = await listTaskDetail(proxy?.addDateRange(queryParams.value, dateRange.value)); taskDetailList.value = res.rows; total.value = res.total; } finally { @@ -319,8 +341,8 @@ const loadFormOptions = async () => { const handleMaterialChange = (materialCode?: string) => { const material = materialList.value.find(item => item.materialCode === materialCode); - // 物料条码默认跟随主数据回填,保留手工调整入口以适配现场扫码差异。 - form.value.materialBarcode = material?.materialBarcode || form.value.materialBarcode; + // 物料条码来自物料主数据,只能随物料选择同步,避免手工改出编码与条码不一致的数据。 + form.value.materialBarcode = material?.materialBarcode; } const cancel = () => { @@ -340,6 +362,8 @@ const handleQuery = () => { const resetQuery = () => { queryFormRef.value?.resetFields(); + // 重置后恢复当天完整范围,避免刚新增的数据落在旧结束时间之后。 + dateRange.value = getTodayCreatedTimeRange(); handleQuery(); } @@ -366,14 +390,34 @@ const handleUpdate = async (row?: TaskDetailVO) => { dialog.title = "修改实时任务明细"; } +const buildSubmitData = (): TaskDetailForm => ({ + objId: form.value.objId, + taskCode: form.value.taskCode, + materialCode: form.value.materialCode, + palletBarcode: form.value.palletBarcode, + materialBarcode: form.value.materialBarcode, + materialCount: form.value.materialCount, + taskType: form.value.taskType, + taskCategory: form.value.taskCategory, + startPoint: form.value.startPoint, + endPoint: form.value.endPoint, + isValidate: form.value.isValidate, + pathCode: form.value.pathCode, + taskStatus: form.value.taskStatus, + isFlag: form.value.isFlag, + remark: form.value.remark +}); + const submitForm = () => { taskDetailFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; - if (form.value.objId) { - await updateTaskDetail(form.value).finally(() => buttonLoading.value = false); + // 详情接口会带出物料名称、路径名称等展示字段,提交时白名单保留真实业务字段。 + const submitData = buildSubmitData(); + if (submitData.objId) { + await updateTaskDetail(submitData).finally(() => buttonLoading.value = false); } else { - await addTaskDetail(form.value).finally(() => buttonLoading.value = false); + await addTaskDetail(submitData).finally(() => buttonLoading.value = false); } proxy?.$modal.msgSuccess("操作成功"); dialog.visible = false; diff --git a/src/views/wcs/utils/createdTimeRange.ts b/src/views/wcs/utils/createdTimeRange.ts new file mode 100644 index 0000000..7978d47 --- /dev/null +++ b/src/views/wcs/utils/createdTimeRange.ts @@ -0,0 +1,19 @@ +// WCS 任务与库位排查常按秒定位新增/流转记录,前端展示和查询统一保留秒级精度。 +export const CREATED_TIME_DISPLAY_FORMAT = '{y}-{m}-{d} {h}:{i}:{s}'; +export const CREATED_TIME_PICKER_FORMAT = 'YYYY-MM-DD HH:mm:ss'; +export const CREATED_TIME_VALUE_FORMAT = 'YYYY-MM-DD HH:mm:ss'; + +const formatDateTime = (date: Date) => { + const pad = (value: number) => `${value}`.padStart(2, '0'); + return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`; +}; + +export const getTodayCreatedTimeRange = (): [string, string] => { + const now = new Date(); + const startTime = new Date(now); + const endTime = new Date(now); + startTime.setHours(0, 0, 0, 0); + endTime.setHours(23, 59, 59, 999); + // 默认筛今天完整区间,避免页面打开后新增的数据因为超过旧结束时间而查不到。 + return [formatDateTime(startTime), formatDateTime(endTime)]; +};