diff --git a/src/api/mes/wm/warehouse/location/index.ts b/src/api/mes/wm/warehouse/location/index.ts index 2a41fd80f..62fc54e20 100644 --- a/src/api/mes/wm/warehouse/location/index.ts +++ b/src/api/mes/wm/warehouse/location/index.ts @@ -45,4 +45,12 @@ export const WmWarehouseLocationApi = { deleteWarehouseLocation: async (id: number) => { return await request.delete({ url: '/mes/wm/warehouse-location/delete?id=' + id }) }, + + // 批量设置库区下所有库位的混放规则 + updateAreaByLocationId: async (locationId: number, allowItemMixing?: boolean, allowBatchMixing?: boolean) => { + return await request.put({ + url: '/mes/wm/warehouse-location/update-by-location-id', + params: { locationId, allowItemMixing, allowBatchMixing } + }) + }, } diff --git a/src/views/mes/wm/warehouse/location/LocationForm.vue b/src/views/mes/wm/warehouse/location/LocationForm.vue index 295a1dc7a..cee1ddbce 100644 --- a/src/views/mes/wm/warehouse/location/LocationForm.vue +++ b/src/views/mes/wm/warehouse/location/LocationForm.vue @@ -65,10 +65,46 @@ + + @@ -99,11 +135,6 @@ const formLoading = ref(false) // 表单的加载中 const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 详情 const isDetail = computed(() => formType.value === 'detail') // 是否详情模式(只读) const warehouseList = ref([]) // 仓库列表 - -/** 生成库区编码 */ -const generateCode = async () => { - formData.value.code = await AutoCodeRecordApi.generateAutoCode(MesAutoCodeRuleCode.WM_LOCATION_CODE) -} const formData = ref({ id: undefined, code: undefined, @@ -122,6 +153,13 @@ const formRules = reactive({ }) const formRef = ref() // 表单 Ref +/** 生成库区编码 */ +const generateCode = async () => { + formData.value.code = await AutoCodeRecordApi.generateAutoCode( + MesAutoCodeRuleCode.WM_LOCATION_CODE + ) +} + /** 打开弹窗 */ const open = async (type: string, id?: number, defaultWarehouseId?: number) => { dialogVisible.value = true @@ -183,4 +221,26 @@ const resetForm = () => { } formRef.value?.resetFields() } + +/** 设置产品混放规则 */ +const setProductMixing = async (allow: boolean) => { + try { + await ElMessageBox.confirm('确认要重置库区下所有库位的产品混放规则吗?', '提示', { + type: 'warning' + }) + await WmWarehouseLocationApi.updateAreaByLocationId(formData.value.id!, allow, undefined) + message.success('设置成功') + } catch {} +} + +/** 设置批次混放规则 */ +const setBatchMixing = async (allow: boolean) => { + try { + await ElMessageBox.confirm('确认要重置库区下所有库位的批次混放规则吗?', '提示', { + type: 'warning' + }) + await WmWarehouseLocationApi.updateAreaByLocationId(formData.value.id!, undefined, allow) + message.success('设置成功') + } catch {} +}