| | |
| | | lineId?: number; // 退料单行编号 |
| | | materialStockId?: number; // 库存记录编号 |
| | | itemId?: number; // 物料编号 |
| | | itemName?: string; // 物料名称 |
| | | specification?: string; // 规格型号 |
| | | quantity?: number; // 数量 |
| | | batchId?: number; // 批次编号 |
| | | batchCode?: string; // 批次号 |
| | |
| | | getReturnIssueLine, |
| | | updateReturnIssueLine, |
| | | } from '#/api/mes/wm/returnissue/line'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | materialDisplayName: stock |
| | | ? [stock.itemName, stock.specification].filter(Boolean).join(' | ') |
| | | : undefined, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | }); |
| | |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | component: 'Input', |
| | | dependencies: { triggerFields: [''], show: () => false }, |
| | | }, |
| | | { |
| | | fieldName: 'materialDisplayName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { disabled: true }, |
| | | component: 'Input', |
| | | componentProps: { disabled: true, placeholder: '选择库存后自动带出' }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getReturnIssueLine(data.id); |
| | | await formApi.setValues(formData.value); |
| | | await formApi.setValues({ |
| | | ...formData.value, |
| | | materialDisplayName: [formData.value.itemName, formData.value.specification] |
| | | .filter(Boolean) |
| | | .join(' | '), |
| | | }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | materialDisplayName: stock |
| | | ? [stock.itemName, stock.specification].filter(Boolean).join(' | ') |
| | | : undefined, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | }); |
| | |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialDisplayName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialDisplayName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '选择库存后自动带出', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | 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, |
| | | itemId: stock?.itemId, |
| | | materialDisplayName: stock |
| | | ? [stock.itemName, stock.specification].filter(Boolean).join(' | ') |
| | | : undefined, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | warehouseId: stock?.warehouseId, |
| | | }); |
| | | }, |
| | | virtualFilter: 'only', |
| | |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: '入库仓库', |
| | | label: '上架目标仓库', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | // componentProps: { |
| | | // excludeCodes: ['WIP_VIRTUAL_WAREHOUSE'], |
| | | // }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: '库区', |
| | | label: '上架目标库区', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | disabled: !values.warehouseId, |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: '库位', |
| | | label: '上架目标库位', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | disabled: !values.locationId, |
| | | locationId: values.locationId, |
| | | }), |
| | | }, |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getReturnIssueDetail(data.detailId); |
| | | // 设置到 values |
| | | await formApi.setValues(formData.value); |
| | | // 设置到 values,并构建物料展示名 |
| | | await formApi.setValues({ |
| | | ...formData.value, |
| | | materialDisplayName: [formData.value.itemName, formData.value.specification] |
| | | .filter(Boolean) |
| | | .join(' | '), |
| | | }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getReturnIssueLine(data.id); |
| | | // 设置到 values |
| | | await formApi.setValues(formData.value); |
| | | // 设置到 values,并构建物料展示名 |
| | | await formApi.setValues({ |
| | | ...formData.value, |
| | | materialDisplayName: [formData.value.itemName, formData.value.specification] |
| | | .filter(Boolean) |
| | | .join(' | '), |
| | | }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | |
| | | |
| | | import { computed, ref, useAttrs, watch, watchEffect } from 'vue'; |
| | | |
| | | import { Select, SelectOption, Tag, Tooltip } from 'ant-design-vue'; |
| | | import { Select, SelectOption, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getWarehouseAreaSimpleList } from '#/api/mes/wm/warehouse/area'; |
| | | |
| | |
| | | }, |
| | | ); |
| | | |
| | | /** 库区变更或初始化时重新加载库位列表 */ |
| | | /** 库区变更时清空已选库位并重新加载列表 */ |
| | | watchEffect(async () => { |
| | | if (!props.locationId) { |
| | | allList.value = []; |
| | | return; |
| | | } |
| | | allList.value = await getWarehouseAreaSimpleList(props.locationId); |
| | | if (props.modelValue !== null) { |
| | | selectedItem.value = allList.value.find((o) => o.id === props.modelValue); |
| | | // 库区变更时清空已选的库位 |
| | | if (props.modelValue !== null && props.modelValue !== undefined) { |
| | | const stillExists = allList.value.find((o) => o.id === props.modelValue); |
| | | if (!stillExists) { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | } |
| | | }); |
| | | </script> |
| | |
| | | :disabled="disabled" |
| | | :filter-option="filterOption" |
| | | :placeholder="placeholder" |
| | | :popup-match-select-width="false" |
| | | show-search |
| | | @change="handleChange" |
| | | > |
| | | <SelectOption v-for="item in allList" :key="item.id" :value="item.id"> |
| | | <div class="flex items-center gap-2"> |
| | | <span>{{ item.name }}</span> |
| | | <Tag v-if="item.code" color="blue">编号: {{ item.code }}</Tag> |
| | | </div> |
| | | {{ item.name }} |
| | | </SelectOption> |
| | | </Select> |
| | | </Tooltip> |
| | |
| | | |
| | | import { computed, ref, useAttrs, watch, watchEffect } from 'vue'; |
| | | |
| | | import { Select, SelectOption, Tag, Tooltip } from 'ant-design-vue'; |
| | | import { Select, SelectOption, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getWarehouseLocationSimpleList } from '#/api/mes/wm/warehouse/location'; |
| | | |
| | |
| | | }, |
| | | ); |
| | | |
| | | /** 仓库变更或初始化时重新加载库区列表 */ |
| | | /** 仓库变更时清空已选库区并重新加载列表 */ |
| | | watchEffect(async () => { |
| | | if (!props.warehouseId) { |
| | | allList.value = []; |
| | | return; |
| | | } |
| | | allList.value = await getWarehouseLocationSimpleList(props.warehouseId); |
| | | if (props.modelValue !== null) { |
| | | selectedItem.value = allList.value.find((o) => o.id === props.modelValue); |
| | | // 仓库变更时清空已选的库区 |
| | | if (props.modelValue !== null && props.modelValue !== undefined) { |
| | | const stillExists = allList.value.find((o) => o.id === props.modelValue); |
| | | if (!stillExists) { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | } |
| | | }); |
| | | </script> |
| | |
| | | :disabled="disabled" |
| | | :filter-option="filterOption" |
| | | :placeholder="placeholder" |
| | | :popup-match-select-width="false" |
| | | show-search |
| | | @change="handleChange" |
| | | > |
| | | <SelectOption v-for="item in allList" :key="item.id" :value="item.id"> |
| | | <div class="flex items-center gap-2"> |
| | | <span>{{ item.name }}</span> |
| | | <Tag v-if="item.code" color="blue">编号: {{ item.code }}</Tag> |
| | | </div> |
| | | {{ item.name }} |
| | | </SelectOption> |
| | | </Select> |
| | | </Tooltip> |
| | |
| | | |
| | | import { computed, onMounted, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { Select, SelectOption, Tag, Tooltip } from 'ant-design-vue'; |
| | | import { Select, SelectOption, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; |
| | | |
| | |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | disabled?: boolean; |
| | | excludeCodes?: string[]; |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | disabled: false, |
| | | excludeCodes: undefined, |
| | | modelValue: undefined, |
| | | placeholder: '请选择仓库', |
| | | }, |
| | |
| | | const attrs = useAttrs(); |
| | | const allList = ref<MesWmWarehouseApi.Warehouse[]>([]); |
| | | const selectedItem = ref<MesWmWarehouseApi.Warehouse>(); |
| | | |
| | | /** 按 excludeCodes 过滤后的仓库列表 */ |
| | | const filteredList = computed(() => { |
| | | if (!props.excludeCodes?.length) { |
| | | return allList.value; |
| | | } |
| | | return allList.value.filter((w) => !props.excludeCodes!.includes(w.code ?? '')); |
| | | }); |
| | | |
| | | const selectValue = computed({ |
| | | get: () => props.modelValue, |
| | |
| | | :disabled="disabled" |
| | | :filter-option="filterOption" |
| | | :placeholder="placeholder" |
| | | :popup-match-select-width="false" |
| | | show-search |
| | | @change="handleChange" |
| | | > |
| | | <SelectOption v-for="item in allList" :key="item.id" :value="item.id"> |
| | | <div class="flex items-center gap-2"> |
| | | <span>{{ item.name }}</span> |
| | | <Tag v-if="item.code" color="blue">编号: {{ item.code }}</Tag> |
| | | </div> |
| | | <SelectOption v-for="item in filteredList" :key="item.id" :value="item.id"> |
| | | {{ item.name }} |
| | | </SelectOption> |
| | | </Select> |
| | | </Tooltip> |