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: 'askGoodsId', 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: basicData.askGoodsCode}, ); // 出库 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', '出库完成'); }); });