incentory.cy.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. import {
  2. beforeSetup,
  3. exportIntercept,
  4. generateNetworkResult,
  5. intercept,
  6. intoMenu,
  7. successIntercept,
  8. tableBtnClick,
  9. validateExport,
  10. validateTableList,
  11. validateTableSearch,
  12. } from './utils';
  13. const basicData = {
  14. id: '10',
  15. storageLocationCode: null,
  16. accountSleeve: null,
  17. storageLocationName: null,
  18. amount: null,
  19. gsAmount: null,
  20. plateAmount: null,
  21. name: null,
  22. total: null,
  23. wllbCode: null,
  24. materialId: null,
  25. scrq: '2023-04-11 17:08:43',
  26. plateId: null,
  27. supplierId: null,
  28. serial: null,
  29. attribute: null,
  30. uuid: '400807081608876032',
  31. title: '2023',
  32. producBatch: null,
  33. wllbCodes: null,
  34. storageLocationCodes: null,
  35. accountSleeves: null,
  36. accountName: null,
  37. startTime: null,
  38. endTime: null,
  39. userId: '3',
  40. userName: 'admin',
  41. page: 0,
  42. limit: 0,
  43. modifyUser: null,
  44. modifyTime: null,
  45. },
  46. basicData2 = {
  47. id: '9430',
  48. storageLocationCode: null,
  49. accountSleeve: '8130',
  50. storageLocationName: null,
  51. amount: '0',
  52. gsAmount: '54.00000000',
  53. plateAmount: null,
  54. name: '分体式直流充电机;240kW;六路;偏矩阵;200-1000V;EC风机;交流电表;B型',
  55. total: null,
  56. wllbCode: '3907060140030264',
  57. materialId: '00000000000000070387',
  58. scrq: null,
  59. plateId: null,
  60. supplierId: null,
  61. serial: null,
  62. attribute: null,
  63. uuid: '400807081608876032',
  64. title: null,
  65. producBatch: null,
  66. wllbCodes: null,
  67. storageLocationCodes: null,
  68. accountSleeves: null,
  69. accountName: '青岛特来电智能设备有限公司',
  70. startTime: null,
  71. endTime: null,
  72. userId: null,
  73. userName: null,
  74. page: 0,
  75. limit: 0,
  76. modifyUser: null,
  77. modifyTime: null,
  78. },
  79. basicData3 = {
  80. id: '58',
  81. storageLocationCode: 'B3-10-4',
  82. accountSleeve: '8130',
  83. storageLocationName: 'B3-10-4',
  84. amount: '6.00',
  85. gsAmount: null,
  86. plateAmount: null,
  87. name: '六角螺母\\\\M16;4;彩锌;粗;GB/T41-2000\\\\',
  88. total: '2.00',
  89. wllbCode: '3415100010390008',
  90. materialId: null,
  91. scrq: '2023-04-11 17:43:17',
  92. plateId: '10',
  93. supplierId: 'EC00276',
  94. serial: null,
  95. attribute: null,
  96. uuid: '400807081608876032',
  97. title: null,
  98. producBatch: null,
  99. wllbCodes: null,
  100. storageLocationCodes: null,
  101. accountSleeves: null,
  102. accountName: null,
  103. startTime: null,
  104. endTime: null,
  105. userId: null,
  106. userName: null,
  107. page: 0,
  108. limit: 0,
  109. modifyUser: null,
  110. modifyTime: null,
  111. };
  112. describe('盘点明细', function () {
  113. beforeEach(function () {
  114. beforeSetup();
  115. intoMenu('库内管理', '盘点明细');
  116. });
  117. beforeEach(function () {
  118. intercept('/inventory/getInventoryDataList', function ({search, reply}) {
  119. generateNetworkResult({search, reply, basicData, title: 'title'});
  120. });
  121. intercept('/inventory/getInventoryPlates', function ({search, reply}) {
  122. generateNetworkResult({
  123. search,
  124. reply,
  125. basicData: basicData2,
  126. title: 'wllbCode',
  127. skipCondition: name => name === 'uuid',
  128. });
  129. });
  130. successIntercept('/inventory/addInventoryPlate');
  131. exportIntercept(['/inventory/export', '/inventory/exportEntering']);
  132. });
  133. it('table', function () {
  134. validateTableList('inventory_table');
  135. validateTableSearch(
  136. 'inventory_table',
  137. ['inventory', 'userName', {id: 'inventoryDates', type: 'date'}],
  138. {
  139. toolId: 'inventory_filter',
  140. url: '/inventory/getInventoryDataList',
  141. },
  142. );
  143. });
  144. it('detail table', function () {
  145. tableBtnClick('inventory_table', 0);
  146. validateTableList('inventory_detail_table');
  147. validateTableSearch(
  148. 'inventory_detail_table',
  149. [
  150. 'wllbCode',
  151. 'name',
  152. {type: 'select', id: 'accountSleeves', value: '8130'},
  153. ],
  154. {
  155. toolId: 'inventory_detail_filter',
  156. url: '/inventory/getInventoryPlates',
  157. },
  158. );
  159. validateExport('inventory_detail_table');
  160. });
  161. it('log table', function () {
  162. // 会影响到其他的路由
  163. intercept('/inventory/getInventory', function ({search, reply}) {
  164. generateNetworkResult({
  165. search,
  166. reply,
  167. basicData: basicData3,
  168. title: 'wllbCode',
  169. skipCondition: name => name === 'uuid',
  170. });
  171. });
  172. tableBtnClick('inventory_table', 1);
  173. validateTableList('inventory_log_table');
  174. validateTableSearch(
  175. 'inventory_log_table',
  176. ['wllbCodes', 'name', 'storageLocationCodes', 'storageLocationName'],
  177. {
  178. toolId: 'inventory_log_filter',
  179. url: '/inventory/getInventory',
  180. },
  181. );
  182. validateExport('inventory_log_table');
  183. });
  184. });