Переглянути джерело

fix: 仓库恢复是否产成品

xyh 2 роки тому
батько
коміт
3bba102253

+ 2 - 0
packages/app/src/models/request/storage.ts

@@ -12,6 +12,8 @@ export type GetStorageListParams = {
   isNotDisable: string;
   /** 所属仓库 */
   warehouseWhere: string;
+  /** 是否是产成品库位 */
+  isProduct: string;
 } & ListParams;
 
 /** 新增库位 */

+ 1 - 0
packages/app/src/pages/storage/context.ts

@@ -7,6 +7,7 @@ export const contextState: OriginalListParams<GetStorageListParams> = {
   storageLocationType: '',
   isNotDisable: '',
   warehouseWhere: '',
+  isProduct: '',
 };
 
 export const context = createTableSearchContext(contextState);

+ 12 - 0
packages/app/src/pages/storage/filter/state.ts

@@ -19,6 +19,18 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
       ],
     },
   ],
+  [
+    '4',
+    {
+      label: '产成品库位',
+      type: 'select',
+      value: 'isProduct',
+      options: [
+        {label: '是', value: '1'},
+        {label: '否', value: '0'},
+      ],
+    },
+  ],
 ]);
 
 export const fixedMap: MapValue<typeof contextState>[] = [

+ 9 - 0
packages/app/src/pages/storage/table/hooks.tsx

@@ -39,6 +39,15 @@ const tableColumns: ColumnsType<StorageListData> = [
     },
     width: NORMAL_TABLE_WIDTH,
   },
+  {
+    title: '是否是产成品库位',
+    dataIndex: 'isProduct',
+    key: 'isProduct',
+    render(_, {isProduct}) {
+      return isProduct === '1' ? '是' : '否';
+    },
+    width: NORMAL_TABLE_WIDTH,
+  },
   {title: '修改人', dataIndex: 'modifyUser', key: 'modifyUser', width: NORMAL_TABLE_WIDTH},
   {title: '修改时间', dataIndex: 'modifyTime', key: 'modifyTime', width: MIDDLE_TABLE_WIDTH},
   {

+ 6 - 0
packages/app/src/pages/storage/table/modal/Info.tsx

@@ -39,6 +39,12 @@ const StoreModalInfo: FC<Props> = function ({id}) {
         control={control}
         data={stateOptions}
       />
+      <ModalSelect
+        name='storageIsProduct'
+        label='产成品库位'
+        control={control}
+        data={stateOptions}
+      />
       <ModalSelect
         name='storageMaterialType'
         label='物料类型'

+ 6 - 0
packages/app/src/pages/storage/table/modal/hooks.ts

@@ -12,6 +12,7 @@ type FormState = {
   storageIsNotDisable: string;
   storageWarehouse: string;
   storageMaterialType: string[];
+  storageIsProduct: string;
 };
 
 const validate = object({
@@ -19,6 +20,7 @@ const validate = object({
   storageLocationName: string().required('请输入库位名称'),
   storageIsNotDisable: string().required('请选择是否是混合库位'),
   storageWarehouse: string().required('请选择所在仓库'),
+  storageIsProduct: string().required('请选择是否是产成品库位'),
 });
 
 export function useFormState({
@@ -39,6 +41,7 @@ export function useFormState({
       storageIsNotDisable: '0',
       storageWarehouse: '',
       storageMaterialType: [],
+      storageIsProduct: '',
     },
     resolver: yupResolver(validate),
   });
@@ -65,6 +68,7 @@ export function useFormState({
     storageIsNotDisable,
     storageWarehouse,
     storageMaterialType,
+    storageIsProduct,
   }) {
     const params: AddStorageParams = {
       storageLocationName,
@@ -72,6 +76,7 @@ export function useFormState({
       isNotDisable: storageIsNotDisable,
       warehouseWhere: storageWarehouse,
       storageLocationType: storageMaterialType.join(','),
+      isProduct: storageIsProduct,
     };
 
     id ? editMutate({...params, id}) : addMutate(params);
@@ -102,6 +107,7 @@ export function useFormInfoValue(id: string) {
       setValue('storageIsNotDisable', data?.isNotDisable ?? '0');
       setValue('storageWarehouse', data?.warehouseWhere ?? '');
       setValue('storageMaterialType', data?.storageLocationType?.split(',').filter(Boolean) ?? []);
+      setValue('storageIsProduct', data?.isProduct ?? '');
     },
     [data, setValue],
   );