Browse Source

test: 增加半成品领料管理测试

xyh 2 years ago
parent
commit
42c826e665

+ 161 - 0
cypress/e2e/semiDraw.cy.ts

@@ -0,0 +1,161 @@
+import {
+  beforeSetup,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  selectAllFilters,
+  selectClick,
+  successIntercept,
+  tableBtnClick,
+  validateDelete,
+  validateModalOperation,
+  validatePut,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  id: '56',
+  askGoodsId: 'BCP001',
+  entryNumber: '1',
+  productionCode: 'DD01',
+  storageLocationName: null,
+  userName: null,
+  realName: null,
+  materialId: '00000000000000072550',
+  wbs: '1',
+  measurementId: null,
+  num: '20',
+  outNum: '3',
+  askGoodsCode: 'CODE123',
+  companyNumber: '8130',
+  companyCode: null,
+  sqrq: '2023-04-11',
+  departmentId: null,
+  departmentName: null,
+  department: '柜体组装班组',
+  departmentCode: null,
+  name: null,
+  code: null,
+  sourceType: '8',
+  moveType: '207',
+  materialName: '瑞银;一体式电表;DJZ1226;600A',
+  materialCode: '5TK540010437W87',
+  uniqueCode: null,
+  storageLocationCode: null,
+  supplierId: null,
+  serial: null,
+  type: '0',
+  userId: null,
+  scrq: null,
+  supplierName: null,
+  producDate: null,
+  wllbCode: null,
+  page: 0,
+  limit: 0,
+  askGoodsType: null,
+  startTime: null,
+  endTime: null,
+  process: null,
+  askGoodsApplyType: null,
+  partType: null,
+  attribute: null,
+  deliveryId: null,
+  customerName: null,
+  customerCode: null,
+  warehouseWhere: null,
+  companyName: '青岛特来电智能充电设备有限公司',
+  storageCode: null,
+  accountSleeve: null,
+  inventoryId: null,
+  storageLocationCodeRk: null,
+  accountName: null,
+  requestTypeNumber: null,
+  requestTypeName: null,
+  ifCommodity: null,
+  amount: '0',
+};
+
+describe('半成品领料单管理', function () {
+  beforeEach(function () {
+    beforeSetup();
+    intoMenu('出库管理', '半成品领料单管理');
+  });
+
+  beforeEach(function () {
+    intercept('/askGoods/getGoodsHalf', function ({reply, search}) {
+      generateNetworkResult({
+        search,
+        reply,
+        basicData,
+        title: 'askGoodsCode',
+        skipCondition: name => name === 'partType',
+      });
+    });
+
+    successIntercept([
+      '/askGoods/delAskGoods',
+      '/warehousing/updateInventoryNotice',
+    ]);
+  });
+
+  it('table', function () {
+    selectAllFilters('semi_draw_filter', 11);
+    validateTableList('semi_draw_table');
+    validateTableSearch(
+      'semi_draw_table',
+      [
+        'askGoodsCode',
+        'productionCode',
+        'materialCode',
+        'materialName',
+        {id: 'departmentCode', type: 'select', value: '00029999'},
+        {id: 'companyCode', type: 'select', value: '8130'},
+        'entryNumber',
+        'sourceType',
+        'moveType',
+        {id: 'startTime', type: 'date'},
+        {id: 'type', type: 'select', value: '0'},
+      ],
+      {
+        toolId: 'semi_draw_filter',
+        url: '/askGoods/getGoodsHalf',
+      },
+    );
+  });
+
+  it('operation', function () {
+    const {validateAdd} = validatePut('semi_draw_modal', 'semi_draw_table', {
+      label: '领料单',
+    });
+
+    validateAdd([
+      'requestOrderId',
+      'requestOrderNo',
+      'prodOrderNo',
+      {id: 'materialId', type: 'keySelect'},
+      'requestTypeName',
+      'requestTypeNumber',
+      {id: 'ifCommodity', type: 'select'},
+      {id: 'measUnitId', type: 'keySelect'},
+      {id: 'orderCount', type: 'field', value: '10'},
+      {id: 'companyNo', type: 'keySelect'},
+      {id: 'useDepartment', type: 'keySelect'},
+      'entryNumber',
+      'WBS',
+    ]);
+
+    validateDelete('semi_draw_table', '半成品领料单', {title: 'page-1'});
+
+    // 出库
+    tableBtnClick('semi_draw_table', 0);
+
+    cy.getTestId('semi_draw_modal')
+      .find('h3')
+      .should('have.text', '选择库位信息');
+    cy.getTestId('field_outNum').clear().type('10');
+    selectClick('field_warehouse');
+    selectClick('field_location');
+    validateModalOperation('semi_draw_modal', '出库完成');
+  });
+});

+ 1 - 1
packages/app/src/components/filter-field/Select.tsx

@@ -41,7 +41,7 @@ const Select: FC<Props> = function ({
           className={classNames('width-full')}
           id={`filter_${name}`}
           data-testid={`filter_${name}`}
-          placeholder={placeholder ?? '请输入'}
+          placeholder={placeholder ?? '请选择'}
           value={value?.length ? value : void 0}
           options={filterOptions}
           onChange={onChange}

+ 1 - 1
packages/app/src/models/request/semiManufactures.ts

@@ -101,7 +101,7 @@ export type GetSemiManufacturesDrawList = {
   /** 是否出库 */
   type: string;
   /** 要货单 */
-  askGoodsId: string;
+  askGoodsCode: string;
   /** 物料编号 */
   materialCode: string;
   /** 物料名称 */

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

@@ -96,6 +96,7 @@ export type SemiInStreamListData = {
 /** 半成品领料单列表 */
 export type SemiDrawListData = {
   id: string;
+  askGoodsCode: string;
   /** 物料名称 */
   materialName: string;
   /** 数量 */

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

@@ -12,7 +12,7 @@ export const contextState: OriginalListParams<GetSemiManufacturesDrawList> = {
   partType: '产成品',
   productionCode: '',
   type: '',
-  askGoodsId: '',
+  askGoodsCode: '',
   materialCode: '',
   materialName: '',
   departmentCode: '',

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

@@ -16,7 +16,7 @@ const Filter: FC = function () {
       partType: '产成品' as const,
       productionCode: '',
       type: '',
-      askGoodsId: '',
+      askGoodsCode: '',
       materialCode: '',
       materialName: '',
       departmentCode: '',

+ 1 - 1
packages/app/src/pages/product-draw/filter/state.ts

@@ -39,7 +39,7 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
 ]);
 
 export const fixedMap: MapValue<typeof contextState>[] = [
-  {label: '要货单编号', type: 'field', value: 'askGoodsId'},
+  {label: '领料单编号', type: 'field', value: 'askGoodsCode'},
   {label: '生产订单号', type: 'field', value: 'productionCode'},
   {label: '物料编号', type: 'field', value: 'materialCode'},
   {label: '物料名称', type: 'field', value: 'materialName'},

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

@@ -12,7 +12,7 @@ export const contextState: OriginalListParams<GetSemiManufacturesDrawList> = {
   partType: '半成品',
   productionCode: '',
   type: '',
-  askGoodsId: '',
+  askGoodsCode: '',
   materialCode: '',
   materialName: '',
   departmentCode: '',

+ 2 - 1
packages/app/src/pages/semi-draw/filter/index.tsx

@@ -16,7 +16,7 @@ const Filter: FC = function () {
       partType: '半成品' as const,
       productionCode: '',
       type: '',
-      askGoodsId: '',
+      askGoodsCode: '',
       materialCode: '',
       materialName: '',
       departmentCode: '',
@@ -58,6 +58,7 @@ const Filter: FC = function () {
         fixedMap={fixedMap}
         isSearching={isSearching}
         onFilter={onShowModal}
+        testId='semi_draw_filter'
       />
 
       <FilterSelectorModal

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

@@ -39,7 +39,7 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
 ]);
 
 export const fixedMap: MapValue<typeof contextState>[] = [
-  {label: '要货单编号', type: 'field', value: 'askGoodsId'},
+  {label: '领料单编号', type: 'field', value: 'askGoodsCode'},
   {label: '生产订单号', type: 'field', value: 'productionCode'},
   {label: '物料编号', type: 'field', value: 'materialCode'},
   {label: '物料名称', type: 'field', value: 'materialName'},

+ 4 - 5
packages/app/src/pages/semi-draw/table/hooks.tsx

@@ -14,9 +14,8 @@ import {useSupertube, useTableDeleteEvent, useTableModalEvent} from '@hooks';
 
 const tableColumns: ColumnsType<SemiDrawListData> = [
   {
-    title: '要货单编号',
-    dataIndex: 'askGoodsId',
-    key: 'askGoodsId',
+    title: '领料单编号',
+    dataIndex: 'askGoodsCode',
     width: MIDDLE_TABLE_WIDTH,
   },
   {
@@ -100,7 +99,7 @@ export function useHandle(refetch: () => void) {
       key: 'id',
       fixed: 'right',
       width: DOUBLE_BTN_WIDTH,
-      render(_, {id, type}) {
+      render(_, {id, type, askGoodsCode}) {
         return (
           <>
             <Button
@@ -116,7 +115,7 @@ export function useHandle(refetch: () => void) {
                 type='text'
                 danger
                 loading={deleteId === id}
-                onClick={onDelete(id)}
+                onClick={onDelete(id, askGoodsCode)}
               >
                 删除
               </Button>

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

@@ -35,6 +35,7 @@ const AddModal: FC<Props> = function (props) {
       isLoading={isLoading}
       title='新增领料单'
       onSubmit={onSubmit}
+      testId='semi_draw_modal'
     >
       <ModalField control={control} label='领料单ID' name='requestOrderId' />
       <ModalField control={control} label='领料单编号' name='requestOrderNo' />

+ 1 - 0
packages/app/src/pages/semi-draw/table/put-out-modal/index.tsx

@@ -35,6 +35,7 @@ const PutOutModal: FC<Props> = function (props) {
       title='选择库位信息'
       onSubmit={onSubmit}
       isLoading={isLoading}
+      testId='semi_draw_modal'
     >
       <ModalField
         label='出库数量'

+ 1 - 1
packages/app/src/utils/constants.ts

@@ -28,7 +28,7 @@ export const MODAL_PAGE_SIZE_LIST = ['5', ...PAGE_SIZE_LIST];
 /** 请求域名 */
 export const NETWORK_URL =
   process.env.NODE_ENV === 'development'
-    ? 'http://192.168.0.108:9560'
+    ? 'http://192.168.0.147:9560'
     : 'http://10.2.111.91:9560';
 export const E2E_NETWORK_URL = 'http://e2e.test.cn';
 /** 导出错误提示 */