Kaynağa Gözat

chore: 半成品领料单调整

xyh 3 yıl önce
ebeveyn
işleme
6edda8386c

+ 19 - 2
packages/app/src/models/request/semiManufactures.ts

@@ -96,10 +96,27 @@ export type SemiManufacturesOutParams = {
 /** 产成品/半成品出库物料列表 */
 export type GetSemiManufacturesDrawList = {
   partType: '产成品' | '半成品';
-  /** 要货单id */
-  askGoodsId: string;
   /** 生产订单号 */
   productionCode: string;
   /** 是否出库 */
   type: string;
+  /** 要货单 */
+  askGoodsId: string;
+  /** 物料编号 */
+  materialCode: string;
+  /** 物料名称 */
+  materialName: string;
+  /** 要料部门 code */
+  departmentCode: string;
+  /** 所属公司 code */
+  companyCode: string;
+  /** 分录 */
+  entryNumber: string;
+  /** 移动类型 */
+  moveType: string;
+  /** 来源类型 */
+  sourceType: string;
+  /** 申请时间 */
+  startTime: string;
+  endTime: string;
 } & ListParams;

+ 10 - 0
packages/app/src/models/response/semiManufactures.ts

@@ -108,6 +108,16 @@ export type SemiDrawListData = {
   companyNumber: string;
   /** wbs编号 */
   wbs: string;
+  /** 公司名称 */
+  companyName: string;
+  /** 移动类型 */
+  moveType: string;
+  /** 来源类型 */
+  sourceType: string;
+  /** 分录号 */
+  entryNumber: string;
+  /** 申请日期 */
+  sqrq: string;
 };
 
 /** 半成品出库流水 */

+ 1 - 1
packages/app/src/pages/product-draw/table/index.tsx

@@ -43,7 +43,7 @@ const TableList: FC = function () {
 
   const [{data, count}] = useQueryTableList({
     queryFn: getSemiManufacturesDrawList,
-    params,
+    params: params as any,
     pageContext,
     searchContext,
   });

+ 16 - 1
packages/app/src/pages/semi-draw/context.ts

@@ -1,7 +1,22 @@
 import {createPageContext, createSearchContext, createTableSearchContext} from '@hooks';
+import {GetSemiManufacturesDrawList, OriginalListParams} from '@models';
 
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 
-export const contextState = {code: '', type: ''};
+export const contextState: OriginalListParams<GetSemiManufacturesDrawList> = {
+  partType: '半成品',
+  productionCode: '',
+  type: '',
+  askGoodsId: '',
+  materialCode: '',
+  materialName: '',
+  departmentCode: '',
+  companyCode: '',
+  entryNumber: '',
+  moveType: '',
+  sourceType: '',
+  startTime: '',
+  endTime: '',
+};
 export const context = createTableSearchContext(contextState);

+ 63 - 33
packages/app/src/pages/semi-draw/filter/index.tsx

@@ -1,45 +1,75 @@
-import {FilterField, FilterButtonGroup, FilterSelect, FilterFieldWrapper} from '@components';
 import {Card} from 'antd';
 import {FC} from 'react';
-import {useContextSection, useFilterField, useTableSearchEvent} from '@hooks';
+import {
+  useContextSection,
+  useFilterDB,
+  useFilterField,
+  useRangeDate,
+  useTableSearchToolEvents,
+} from '@hooks';
 import {context, searchContext} from '../context';
-
-const options = [
-  {label: '全部', value: ''},
-  {label: '未出库', value: '0'},
-  {label: '已出库', value: '1'},
-];
+import {FilterSelectorModal, FilterTool} from '@components';
+import {fixedMap, sourceMap} from './state';
 
 const Filter: FC = function () {
-  const [{code, type}, onChange] = useFilterField({code: '', type: ''});
-  const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
-  const onSearch = useTableSearchEvent(context, {code, type});
+  const [fields, {onChange, resetState}] = useFilterField(
+    {
+      partType: '半成品' as const,
+      productionCode: '',
+      type: '',
+      askGoodsId: '',
+      materialCode: '',
+      materialName: '',
+      departmentCode: '',
+      companyCode: '',
+      entryNumber: '',
+      moveType: '',
+      sourceType: '',
+      startTime: '',
+      endTime: '',
+    },
+    true,
+  );
+  const [{dates, start, end}, onDatesChange] = useRangeDate();
+  const {isSearching} = useContextSection(searchContext, state => state[0]);
+  const [visible, {onSearch, onReset, onShowModal, onCloseModal}] = useTableSearchToolEvents(
+    context,
+    {...fields, startTime: start, endTime: end},
+    {
+      resetCallback() {
+        resetState();
+        onDatesChange([null, null]);
+      },
+    },
+  );
+  const [filterList, {set}] = useFilterDB();
 
   return (
-    <Card>
-      <FilterFieldWrapper onSearch={onSearch}>
-        <FilterField
-          name='semiDrawCode'
-          label='生产单号'
-          value={code}
-          onChange={onChange('code')}
-        />
-        <FilterSelect
-          name='semiDrawType'
-          value={type}
-          options={options}
-          onChange={onChange('type')}
-          label='状态'
-        />
-
-        <FilterButtonGroup
-          offset={6}
-          isSearching={isSearching}
+    <>
+      <Card>
+        <FilterTool
           onSearch={onSearch}
-          onRefresh={refetch}
+          onChange={onChange}
+          onReset={onReset}
+          onDatesChange={onDatesChange}
+          filterData={filterList}
+          fields={fields}
+          dates={dates}
+          sourceMap={sourceMap}
+          fixedMap={fixedMap}
+          isSearching={isSearching}
+          onFilter={onShowModal}
         />
-      </FilterFieldWrapper>
-    </Card>
+      </Card>
+
+      <FilterSelectorModal
+        visible={visible}
+        onClose={onCloseModal}
+        source={filterList}
+        filtermap={sourceMap}
+        onConfirm={set}
+      />
+    </>
   );
 };
 

+ 30 - 0
packages/app/src/pages/semi-draw/filter/state.ts

@@ -0,0 +1,30 @@
+import {FilterGroupMap, MapValue} from '@components';
+import {contextState} from '../context';
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {label: '要料部门', type: 'keySelect', selectKey: '部门字典', value: 'departmentCode'}],
+  ['2', {label: '所属公司', type: 'keySelect', selectKey: '公司', value: 'companyCode'}],
+  ['3', {label: '分录号', type: 'field', value: 'entryNumber'}],
+  ['4', {label: '移动类型', type: 'field', value: 'moveType'}],
+  ['5', {label: '来源类型', type: 'field', value: 'sourceType'}],
+  [
+    '6',
+    {
+      label: '状态',
+      type: 'select',
+      value: 'type',
+      options: [
+        {label: '未出库', value: '0'},
+        {label: '已出库', value: '1'},
+      ],
+    },
+  ],
+  ['7', {label: '申请日期', type: 'date', value: 'startTime'}],
+]);
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {label: '要货单编号', type: 'field', value: 'askGoodsId'},
+  {label: '生产订单号', type: 'field', value: 'productionCode'},
+  {label: '物料编号', type: 'field', value: 'materialCode'},
+  {label: '物料名称', type: 'field', value: 'materialName'},
+];

+ 19 - 6
packages/app/src/pages/semi-draw/table/hooks.tsx

@@ -2,21 +2,32 @@ import {delProductionRequisition} from '@apis';
 import {ColumnsType} from 'antd/es/table';
 import {SemiDrawListData} from '@models';
 import {Button} from 'antd';
-import {DOUBLE_BTN_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
+import {
+  DOUBLE_BTN_WIDTH,
+  HUGE_TABLE_WIDTH,
+  LARGE_TABLE_WIDTH,
+  MIDDLE_TABLE_WIDTH,
+  NORMAL_TABLE_WIDTH,
+  SMALL_TABLE_WIDTH,
+} from '@utils';
 import {useSupertube, useTableDeleteEvent, useTableModalEvent} from '@hooks';
 
 const tableColumns: ColumnsType<SemiDrawListData> = [
-  {title: '要货单编号', dataIndex: 'askGoodsId', key: 'askGoodsId', width: NORMAL_TABLE_WIDTH},
-  {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: MIDDLE_TABLE_WIDTH},
-  {title: '物料编号', dataIndex: 'materialCode', key: 'materialCode', width: NORMAL_TABLE_WIDTH},
-  {title: '数量', dataIndex: 'num', key: 'num', width: SMALL_TABLE_WIDTH},
+  {title: '要货单编号', dataIndex: 'askGoodsId', key: 'askGoodsId', width: MIDDLE_TABLE_WIDTH},
   {
     title: '生产订单号',
     dataIndex: 'productionCode',
     key: 'productionCode',
-    width: NORMAL_TABLE_WIDTH,
+    width: MIDDLE_TABLE_WIDTH,
   },
+  {title: '物料编号', dataIndex: 'materialCode', key: 'materialCode', width: LARGE_TABLE_WIDTH},
+  {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: HUGE_TABLE_WIDTH},
+  {title: '数量', dataIndex: 'num', key: 'num', width: SMALL_TABLE_WIDTH, align: 'right'},
   {title: '要料部门', dataIndex: 'department', key: 'department', width: NORMAL_TABLE_WIDTH},
+  {title: '所属公司', dataIndex: 'companyName', width: HUGE_TABLE_WIDTH},
+  {title: '分录号', dataIndex: 'entryNumber', width: NORMAL_TABLE_WIDTH},
+  {title: '移动类型', dataIndex: 'moveType', width: NORMAL_TABLE_WIDTH},
+  {title: '来源类型', dataIndex: 'sourceType', width: NORMAL_TABLE_WIDTH},
   {
     title: '状态',
     dataIndex: 'type',
@@ -25,7 +36,9 @@ const tableColumns: ColumnsType<SemiDrawListData> = [
       return type === '0' ? '未出库' : '已出库';
     },
     width: SMALL_TABLE_WIDTH,
+    align: 'center',
   },
+  {title: '申请日期', dataIndex: 'sqrq', width: MIDDLE_TABLE_WIDTH},
 ];
 
 export function useHandle(refetch: () => void) {

+ 1 - 8
packages/app/src/pages/semi-draw/table/index.tsx

@@ -10,14 +10,7 @@ import AddModal from './modal';
 import PutOutModal from './put-out-modal';
 
 const TableList: FC = function () {
-  const params = useContextSection(context, function ([{code, type}]) {
-    return {
-      partType: '半成品' as const,
-      productionCode: code,
-      type,
-      askGoodsId: '',
-    };
-  });
+  const params = useContextSection(context, state => state[0]);
 
   const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getSemiManufacturesDrawList,