productionRequisition.cy.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import {
  2. beforeSetup,
  3. exportIntercept,
  4. generateNetworkResult,
  5. intercept,
  6. intoMenu,
  7. selectAllFilters,
  8. selectClick,
  9. successIntercept,
  10. validateDelete,
  11. validateExport,
  12. validatePut,
  13. validateTableList,
  14. validateTableSearch,
  15. } from './utils';
  16. const basicData = {
  17. id: '57',
  18. askGoodsId: 'LLDID123',
  19. entryNumber: '1234',
  20. productionCode: 'LLDCODE123',
  21. storageLocationName: null,
  22. userName: null,
  23. realName: null,
  24. materialId: '00000000000000012522',
  25. wbs: '111',
  26. measurementId: null,
  27. num: '2',
  28. outNum: '0',
  29. askGoodsCode: 'LLDCODE123',
  30. companyNumber: '8130',
  31. companyCode: null,
  32. sqrq: '2023-04-13',
  33. departmentId: null,
  34. departmentName: '采购中心(公共) ',
  35. department: null,
  36. departmentCode: null,
  37. name: null,
  38. code: null,
  39. sourceType: '8',
  40. moveType: '207',
  41. materialName: '加强筋;8T.K42.600.0210',
  42. materialCode: '8TK426000210',
  43. uniqueCode: null,
  44. storageLocationCode: null,
  45. supplierId: null,
  46. serial: null,
  47. type: null,
  48. userId: null,
  49. scrq: null,
  50. supplierName: null,
  51. producDate: null,
  52. wllbCode: null,
  53. page: 0,
  54. limit: 0,
  55. askGoodsType: null,
  56. startTime: null,
  57. endTime: null,
  58. process: null,
  59. askGoodsApplyType: null,
  60. partType: null,
  61. attribute: null,
  62. deliveryId: null,
  63. customerName: null,
  64. customerCode: null,
  65. warehouseWhere: null,
  66. companyName: '青岛特来电智能设备有限公司',
  67. storageCode: null,
  68. accountSleeve: null,
  69. inventoryId: null,
  70. storageLocationCodeRk: null,
  71. accountName: null,
  72. requestTypeNumber: null,
  73. requestTypeName: null,
  74. ifCommodity: null,
  75. amount: '0',
  76. };
  77. describe('生产领料明细', function () {
  78. beforeEach(function () {
  79. beforeSetup();
  80. intoMenu('出库管理', '生产领料明细');
  81. });
  82. beforeEach(function () {
  83. intercept('/queryList/getAskGoods', function ({reply, search}) {
  84. generateNetworkResult({
  85. search,
  86. reply,
  87. basicData,
  88. title: 'askGoodsCode',
  89. skipCondition: name => name === 'type',
  90. });
  91. });
  92. intercept('/queryList/getInvite', function ({reply, search}) {
  93. generateNetworkResult({
  94. search,
  95. reply,
  96. basicData,
  97. title: 'askGoodsCode',
  98. skipCondition: name => name === 'type',
  99. });
  100. });
  101. successIntercept(['/askGoods/delAskGoods', '/invite/delAskGoods']);
  102. exportIntercept([
  103. '/queryList/getAskGoodsExcel',
  104. '/queryList/getInviteExcel',
  105. ]);
  106. });
  107. function validateTable(label?: string, callback?: () => void) {
  108. selectAllFilters('production_requisition_filter', 11);
  109. validateTableList('production_requisition_table');
  110. validateTableSearch(
  111. 'production_requisition_table',
  112. [
  113. 'askGoodsCode',
  114. 'productionCode',
  115. 'materialCode',
  116. 'materialName',
  117. {id: 'companyCode', type: 'select', value: '8130'},
  118. {id: 'departmentCode', type: 'select', value: '00029999'},
  119. 'moveType',
  120. 'sourceType',
  121. 'entryNumber',
  122. 'wbs',
  123. ],
  124. {
  125. toolId: 'production_requisition_filter',
  126. url: '/queryList/getAskGoods',
  127. },
  128. );
  129. // eslint-disable-next-line callback-return
  130. callback?.();
  131. validateExport('production_requisition_table');
  132. const {validateAdd} = validatePut(
  133. 'production_requisition_modal',
  134. 'production_requisition_table',
  135. {label: label ?? '生产领料单'},
  136. );
  137. validateAdd([
  138. 'requestOrderId',
  139. 'requestOrderNo',
  140. 'prodOrderNo',
  141. 'requestTypeName',
  142. 'requestTypeNumber',
  143. {id: 'materialId', type: 'keySelect'},
  144. {id: 'measUnitId', type: 'keySelect'},
  145. {id: 'orderCount', type: 'field', value: '10'},
  146. {id: 'companyNo', type: 'keySelect'},
  147. {id: 'ifCommodity', type: 'select'},
  148. {id: 'useDepartment', type: 'select'},
  149. 'entryNumber',
  150. 'WBS',
  151. ]);
  152. validateDelete('production_requisition_table', label ?? '生产领料单', {
  153. eq: 0,
  154. title: 'page-1',
  155. });
  156. }
  157. it('table', () => validateTable());
  158. it('non-standard table', function () {
  159. selectClick('filter_type', 1);
  160. cy.getTestId('search_btn').click();
  161. validateTable('非生产领料单', function () {
  162. selectClick('filter_type', 1);
  163. cy.getTestId('search_btn').click();
  164. });
  165. });
  166. });