t-erp-auto-test.json 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976
  1. {
  2. "info": {
  3. "_postman_id": "5b90b987-503f-484c-b8d7-a0974674e95d",
  4. "name": "t-erp-auto-test",
  5. "description": "T系列ERP自动化测试集合\\[for Jenkins\\]",
  6. "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
  7. "_exporter_id": "3170378",
  8. "_collection_link": "https://go.postman.co/collection/3170378-5b90b987-503f-484c-b8d7-a0974674e95d?source=collection_link"
  9. },
  10. "item": [
  11. {
  12. "name": "登录",
  13. "item": [
  14. {
  15. "name": "登录",
  16. "event": [
  17. {
  18. "listen": "test",
  19. "script": {
  20. "exec": [
  21. "// 登录测试脚本",
  22. "// ===================== status:状态码 =====================",
  23. "pm.test(\"✅ 状态码 200\", () => pm.response.to.have.status(200));",
  24. "// =========================================================",
  25. "",
  26. "var jsonData = pm.response.json();",
  27. "// ===================== console:按需打印 =====================",
  28. "// 1. 单个关键值打印(按需选择)",
  29. "console.log(`📋 登录接口返回CompNo:${jsonData.CompNo}`);",
  30. "console.log(`📋 登录接口返回UserNo:${jsonData.UserNo}`);",
  31. "console.log(`📋 生成的登录令牌LoginId:${jsonData.LoginId}`);",
  32. "console.log(`📋 令牌有效期LoginIdExpiry:${jsonData.LoginIdExpiry} 秒`);",
  33. "",
  34. "// 2. 批量打印多个核心值(推荐,日志更集中,少占行数)",
  35. "console.log(\"📋 登录接口核心返回值汇总:\", {",
  36. " LoginId: jsonData.LoginId,",
  37. " CompNo: jsonData.CompNo,",
  38. " UserNo: jsonData.UserNo,",
  39. " LoginIdExpiry: jsonData.LoginIdExpiry,",
  40. " ClientType: jsonData.ClientType",
  41. "});",
  42. "",
  43. "// 3. 打印刚设置的环境变量(验证是否保存成功,可选)",
  44. "console.info(`🔧 环境变量已设置t-erp-api-login-id:${pm.environment.get(\"t-erp-api-login-id\")}`);",
  45. "// ======================================================================",
  46. "",
  47. "// ===================== test:按需验证 =====================",
  48. "pm.test(\"✅ 必需字段存在\", () => {",
  49. " pm.expect(jsonData).to.include.all.keys(",
  50. " 'LoginId', 'CompNo', 'UserNo', 'LoginIdExpiry'",
  51. " );",
  52. "});",
  53. "pm.test(\"✅ 登录信息正确\", () => {",
  54. " pm.expect(jsonData.CompNo).to.equal('TAPI');",
  55. " pm.expect(jsonData.UserNo).to.equal('API');",
  56. " pm.expect(jsonData.ClientType).to.equal('JksAutoTestApi');",
  57. " pm.expect(jsonData.LoginIdExpiry).to.equal(604800);",
  58. "});",
  59. "pm.test(\"✅ 保存登录令牌成功\", () => {",
  60. " pm.expect(jsonData.LoginId).to.be.a('string').and.not.empty;",
  61. " pm.environment.set(\"t-erp-api-login-id\", jsonData.LoginId);",
  62. "});",
  63. "// ======================================================================"
  64. ],
  65. "type": "text/javascript",
  66. "packages": {},
  67. "requests": {}
  68. }
  69. }
  70. ],
  71. "request": {
  72. "auth": {
  73. "type": "noauth"
  74. },
  75. "method": "POST",
  76. "header": [
  77. {
  78. "key": "LanguageId",
  79. "value": "{{t-erp-api-language}}",
  80. "description": "0:简体;1:繁体;2:英文"
  81. },
  82. {
  83. "key": "Authorization",
  84. "value": "{{t-erp-api-authorization}}",
  85. "description": "服务:237;账套:TAPI;用户:API"
  86. },
  87. {
  88. "key": "ClientType",
  89. "value": "{{t-erp-api-client-type}}",
  90. "description": "JksAutoTestApi"
  91. },
  92. {
  93. "key": "Content-Type",
  94. "value": "{{t-erp-api-content-type}}",
  95. "description": "application/json"
  96. },
  97. {
  98. "key": "X-Tiansi-Auth-Bypass",
  99. "value": "{{t-erp-api-x-tiansi-bypass}}",
  100. "description": "跳过接口注册检验",
  101. "type": "text"
  102. },
  103. {
  104. "key": "sn",
  105. "value": "{{t-erp-api-sn}}",
  106. "description": "用于Linker定位ERP服务",
  107. "type": "text"
  108. }
  109. ],
  110. "url": {
  111. "raw": "{{t-erp-api-url}}/User/login",
  112. "host": [
  113. "{{t-erp-api-url}}"
  114. ],
  115. "path": [
  116. "User",
  117. "login"
  118. ]
  119. },
  120. "description": "登录系统"
  121. },
  122. "response": []
  123. }
  124. ],
  125. "description": "登录"
  126. },
  127. {
  128. "name": "部门资料",
  129. "item": [
  130. {
  131. "name": "新增部门",
  132. "event": [
  133. {
  134. "listen": "test",
  135. "script": {
  136. "exec": [
  137. "// 完整可用的部门接口测试脚本\r",
  138. "pm.test(\"✅ 状态码 200\", () => pm.response.to.have.status(200));\r",
  139. "\r",
  140. "var requestData = JSON.parse(pm.request.body.raw);\r",
  141. "var responseData = pm.response.json();\r",
  142. "\r",
  143. "// 1. 验证响应结构\r",
  144. "pm.test(\"📋 响应结构验证\", () => {\r",
  145. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  146. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  147. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  148. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  149. "});\r",
  150. "\r",
  151. "// 2. 验证请求数据(修正后的正确写法)\r",
  152. "pm.test(\"✅ 请求部门数据验证\", () => {\r",
  153. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  154. " \r",
  155. " requestData.forEach((dept, idx) => {\r",
  156. " const deptNum = idx + 1;\r",
  157. " \r",
  158. " // 验证必填字段存在\r",
  159. " pm.expect(dept, `部门${deptNum}`).to.include.keys('DEP', 'NAME');\r",
  160. " \r",
  161. " // 验证字段类型和值\r",
  162. " pm.expect(dept.DEP, `部门${deptNum}的部门代码`).to.be.a('string').that.is.not.empty;\r",
  163. " pm.expect(dept.NAME, `部门${deptNum}的部门名称`).to.be.a('string').that.is.not.empty;\r",
  164. " \r",
  165. " // 可选字段验证\r",
  166. " if (dept.ENG_NAME !== undefined) {\r",
  167. " pm.expect(dept.ENG_NAME).to.be.a('string');\r",
  168. " }\r",
  169. " \r",
  170. " if (dept.UP !== undefined) {\r",
  171. " pm.expect(dept.UP).to.be.a('string');\r",
  172. " }\r",
  173. " });\r",
  174. "});\r",
  175. "\r",
  176. "// 3. 验证业务结果\r",
  177. "pm.test(\"📊 操作结果验证\", () => {\r",
  178. " const total = requestData.length;\r",
  179. " \r",
  180. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  181. " \r",
  182. " if (responseData.ErrorCount === 0) {\r",
  183. " pm.expect(responseData.OkCount).to.equal(total);\r",
  184. " pm.expect(responseData.ErrorData).to.eql([]);\r",
  185. " console.log(`✅ 成功处理 ${responseData.OkCount} 个部门`);\r",
  186. " } else {\r",
  187. " console.log(`⚠️ 部分失败: ${responseData.OkCount} 成功, ${responseData.ErrorCount} 失败`);\r",
  188. " \r",
  189. " // 验证错误数据\r",
  190. " responseData.ErrorData.forEach(error => {\r",
  191. " pm.expect(error).to.include.keys('Index', 'DEP', 'ErrorMessage');\r",
  192. " pm.expect(error.Index).to.be.within(0, total - 1);\r",
  193. " });\r",
  194. " }\r",
  195. "});"
  196. ],
  197. "type": "text/javascript",
  198. "packages": {},
  199. "requests": {}
  200. }
  201. }
  202. ],
  203. "request": {
  204. "method": "POST",
  205. "header": [
  206. {
  207. "key": "LoginId",
  208. "value": "{{t-erp-api-login-id}}",
  209. "type": "text"
  210. },
  211. {
  212. "key": "sn",
  213. "value": "{{t-erp-api-sn}}",
  214. "type": "text"
  215. }
  216. ],
  217. "body": {
  218. "mode": "raw",
  219. "raw": "[\r\n {\r\n \"DEP\": \"0001\", // 必须,部门代号,该部门代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"0001部门\", // 必须,部门名称\r\n \"ENG_NAME\": \"0001Dep\", // 非必须,英文名称\r\n \"UP\": \"0000\" // 非必须,上层部门代号\r\n },\r\n {\r\n \"DEP\": \"0002\", // 必须,部门代号,该部门代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"0002部门\", // 必须,部门名称\r\n \"ENG_NAME\": \"0002Dep\", // 非必须,英文名称\r\n \"UP\": \"0001\" // 非必须,上层部门代号\r\n },\r\n {\r\n \"DEP\": \"0003\", // 必须,部门代号,该部门代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"0003部门\", // 必须,部门名称\r\n \"ENG_NAME\": \"0003Dep\", // 非必须,英文名称\r\n \"UP\": \"0002\" // 非必须,上层部门代号\r\n }\r\n]",
  220. "options": {
  221. "raw": {
  222. "language": "json"
  223. }
  224. }
  225. },
  226. "url": {
  227. "raw": "{{t-erp-api-url}}/Dept/AppendToDept",
  228. "host": [
  229. "{{t-erp-api-url}}"
  230. ],
  231. "path": [
  232. "Dept",
  233. "AppendToDept"
  234. ]
  235. },
  236. "description": "新增部门资料"
  237. },
  238. "response": []
  239. },
  240. {
  241. "name": "删除部门",
  242. "event": [
  243. {
  244. "listen": "test",
  245. "script": {
  246. "exec": [
  247. "// 简化版删除部门测试脚本\r",
  248. "pm.test(\"✅ 状态码 200\", () => pm.response.to.have.status(200));\r",
  249. "\r",
  250. "var requestData = JSON.parse(pm.request.body.raw);\r",
  251. "var responseData = pm.response.json();\r",
  252. "\r",
  253. "// 基础验证\r",
  254. "pm.test(\"✅ 响应结构验证\", () => {\r",
  255. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  256. "});\r",
  257. "\r",
  258. "// 请求数据验证\r",
  259. "pm.test(\"✅ 删除请求数据验证\", () => {\r",
  260. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  261. " \r",
  262. " requestData.forEach((item, index) => {\r",
  263. " pm.expect(item).to.have.property('DEP');\r",
  264. " pm.expect(item.DEP).to.be.a('string').and.not.empty;\r",
  265. " });\r",
  266. " \r",
  267. " console.log(`🗑️ 请求删除 ${requestData.length} 个部门`);\r",
  268. "});\r",
  269. "\r",
  270. "// 业务结果验证\r",
  271. "pm.test(\"📊 删除结果验证\", () => {\r",
  272. " const total = requestData.length;\r",
  273. " \r",
  274. " // 验证计数逻辑\r",
  275. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  276. " \r",
  277. " // 根据成功示例验证\r",
  278. " pm.expect(responseData.ErrorCount).to.equal(0);\r",
  279. " pm.expect(responseData.OkCount).to.equal(total);\r",
  280. " pm.expect(responseData.ErrorData).to.eql([]);\r",
  281. " \r",
  282. " console.log(`✅ 成功删除 ${responseData.OkCount} 个部门`);\r",
  283. "});"
  284. ],
  285. "type": "text/javascript",
  286. "packages": {},
  287. "requests": {}
  288. }
  289. }
  290. ],
  291. "request": {
  292. "method": "POST",
  293. "header": [
  294. {
  295. "key": "LoginId",
  296. "value": "{{t-erp-api-login-id}}",
  297. "type": "text"
  298. },
  299. {
  300. "key": "sn",
  301. "value": "{{t-erp-api-sn}}",
  302. "type": "text"
  303. }
  304. ],
  305. "body": {
  306. "mode": "raw",
  307. "raw": "[\r\n {\r\n \"DEP\": \"0003\" // 必须,部门代号,删除该笔部门资料\r\n }\r\n]",
  308. "options": {
  309. "raw": {
  310. "language": "json"
  311. }
  312. }
  313. },
  314. "url": {
  315. "raw": "{{t-erp-api-url}}/Dept/DeleteForDept",
  316. "host": [
  317. "{{t-erp-api-url}}"
  318. ],
  319. "path": [
  320. "Dept",
  321. "DeleteForDept"
  322. ]
  323. },
  324. "description": "删除部门资料"
  325. },
  326. "response": []
  327. }
  328. ],
  329. "description": "部门资料"
  330. },
  331. {
  332. "name": "员工资料",
  333. "item": [
  334. {
  335. "name": "新增员工",
  336. "event": [
  337. {
  338. "listen": "test",
  339. "script": {
  340. "exec": [
  341. "// 1. 基础响应验证\r",
  342. "pm.test(\"✅ 状态码 200\", function() {\r",
  343. " pm.response.to.have.status(200);\r",
  344. "});\r",
  345. "\r",
  346. "// 2. 获取数据\r",
  347. "var requestData = JSON.parse(pm.request.body.raw);\r",
  348. "var responseData = pm.response.json();\r",
  349. "\r",
  350. "// 3. 响应结构验证\r",
  351. "pm.test(\"📋 响应结构验证\", function() {\r",
  352. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  353. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  354. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  355. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  356. "});\r",
  357. "\r",
  358. "// 4. 请求数据验证\r",
  359. "pm.test(\"✅ 员工数据验证\", function() {\r",
  360. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  361. " \r",
  362. " requestData.forEach((employee, index) => {\r",
  363. " const empNum = index + 1;\r",
  364. " \r",
  365. " // 必填字段验证\r",
  366. " pm.expect(employee, `员工${empNum}`).to.include.keys('SAL_NO', 'NAME', 'DEP');\r",
  367. " pm.expect(employee.SAL_NO, `员工${empNum}工号`).to.be.a('string').and.not.empty;\r",
  368. " pm.expect(employee.NAME, `员工${empNum}姓名`).to.be.a('string').and.not.empty;\r",
  369. " pm.expect(employee.DEP, `员工${empNum}部门`).to.be.a('string').and.not.empty;\r",
  370. " \r",
  371. " // 可选字段类型验证(如果存在)\r",
  372. " if (employee.POS !== undefined) {\r",
  373. " pm.expect(employee.POS).to.be.a('string');\r",
  374. " }\r",
  375. " if (employee.UP_SAL_NO !== undefined) {\r",
  376. " pm.expect(employee.UP_SAL_NO).to.be.a('string');\r",
  377. " }\r",
  378. " if (employee.TOPSWD !== undefined) {\r",
  379. " pm.expect(employee.TOPSWD).to.be.a('string');\r",
  380. " }\r",
  381. " if (employee.REM !== undefined) {\r",
  382. " pm.expect(employee.REM).to.be.a('string');\r",
  383. " }\r",
  384. " });\r",
  385. " \r",
  386. " console.log(`✅ 已验证 ${requestData.length} 个员工数据`);\r",
  387. "});\r",
  388. "\r",
  389. "// 5. 业务结果验证\r",
  390. "pm.test(\"📊 操作结果验证\", function() {\r",
  391. " const total = requestData.length;\r",
  392. " \r",
  393. " // 验证计数逻辑\r",
  394. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  395. " \r",
  396. " // 根据成功示例验证\r",
  397. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  398. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  399. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  400. " \r",
  401. " console.log(`✅ 成功处理 ${responseData.OkCount}/${total} 个员工`);\r",
  402. "});"
  403. ],
  404. "type": "text/javascript",
  405. "packages": {},
  406. "requests": {}
  407. }
  408. }
  409. ],
  410. "request": {
  411. "method": "POST",
  412. "header": [
  413. {
  414. "key": "LoginId",
  415. "value": "{{t-erp-api-login-id}}",
  416. "type": "text"
  417. },
  418. {
  419. "key": "sn",
  420. "value": "{{t-erp-api-sn}}",
  421. "type": "text"
  422. }
  423. ],
  424. "body": {
  425. "mode": "raw",
  426. "raw": "[\r\n {\r\n \"SAL_NO\": \"ZS\", // 必须,员工代号,该员工代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"张三\", // 必须,员工名称 \r\n \"POS\": \"机床操作主管\", // 非必须,职称\r\n \"DEP\": \"0001\", // 部门代号\r\n \"TOPSWD\": \"T\", // 非必须,同步到登录用户\r\n \"REM\": \"机床操作主管\" // 非必须,摘要\r\n },\r\n {\r\n \"SAL_NO\": \"LS\", // 必须,员工代号,该员工代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"李四\", // 必须,员工名称 \r\n \"POS\": \"机床操作工\", // 非必须,职称\r\n \"DEP\": \"0001\", // 部门代号\r\n \"UP_SAL_NO\": \"ZS\", // 上级主管\r\n \"TOPSWD\": \"T\", // 非必须,同步到登录用户\r\n \"REM\": \"机床操作工\" // 非必须,摘要\r\n },\r\n {\r\n \"SAL_NO\": \"WW\", // 必须,员工代号,该员工代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"王五\", // 必须,员工名称 \r\n \"POS\": \"机床操作工\", // 非必须,职称\r\n \"DEP\": \"0001\", // 部门代号\r\n \"REM\": \"机床操作工\" // 非必须,摘要\r\n }\r\n]",
  427. "options": {
  428. "raw": {
  429. "language": "json"
  430. }
  431. }
  432. },
  433. "url": {
  434. "raw": "{{t-erp-api-url}}/Salm/AppendToSalm",
  435. "host": [
  436. "{{t-erp-api-url}}"
  437. ],
  438. "path": [
  439. "Salm",
  440. "AppendToSalm"
  441. ]
  442. },
  443. "description": "新增员工资料"
  444. },
  445. "response": []
  446. },
  447. {
  448. "name": "删除员工",
  449. "event": [
  450. {
  451. "listen": "test",
  452. "script": {
  453. "exec": [
  454. "// 1. 基础响应验证\r",
  455. "pm.test(\"✅ 状态码 200\", function() {\r",
  456. " pm.response.to.have.status(200);\r",
  457. "});\r",
  458. "\r",
  459. "// 2. 获取数据\r",
  460. "var requestData = JSON.parse(pm.request.body.raw);\r",
  461. "var responseData = pm.response.json();\r",
  462. "\r",
  463. "// 3. 响应结构验证\r",
  464. "pm.test(\"📋 响应结构验证\", function() {\r",
  465. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  466. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  467. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  468. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  469. "});\r",
  470. "\r",
  471. "// 4. 请求数据验证\r",
  472. "pm.test(\"✅ 删除请求验证\", function() {\r",
  473. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  474. " \r",
  475. " requestData.forEach((item, index) => {\r",
  476. " const itemNum = index + 1;\r",
  477. " \r",
  478. " // 必填字段验证\r",
  479. " pm.expect(item, `删除项${itemNum}`).to.have.property('SAL_NO');\r",
  480. " pm.expect(item.SAL_NO, `员工${itemNum}工号`).to.be.a('string').and.not.empty;\r",
  481. " });\r",
  482. " \r",
  483. " console.log(`🗑️ 请求删除 ${requestData.length} 个员工`);\r",
  484. "});\r",
  485. "\r",
  486. "// 5. 业务结果验证\r",
  487. "pm.test(\"📊 删除结果验证\", function() {\r",
  488. " const total = requestData.length;\r",
  489. " \r",
  490. " // 验证计数逻辑\r",
  491. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  492. " \r",
  493. " // 根据成功示例验证\r",
  494. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  495. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  496. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  497. " \r",
  498. " console.log(`✅ 成功删除 ${responseData.OkCount}/${total} 个员工`);\r",
  499. "});"
  500. ],
  501. "type": "text/javascript",
  502. "packages": {},
  503. "requests": {}
  504. }
  505. }
  506. ],
  507. "request": {
  508. "method": "POST",
  509. "header": [
  510. {
  511. "key": "LoginId",
  512. "value": "{{t-erp-api-login-id}}",
  513. "type": "text"
  514. },
  515. {
  516. "key": "sn",
  517. "value": "{{t-erp-api-sn}}",
  518. "type": "text"
  519. }
  520. ],
  521. "body": {
  522. "mode": "raw",
  523. "raw": "[\r\n {\r\n \"SAL_NO\": \"WW\" // 必须,员工代号,删除该笔员工资料\r\n }\r\n]",
  524. "options": {
  525. "raw": {
  526. "language": "json"
  527. }
  528. }
  529. },
  530. "url": {
  531. "raw": "{{t-erp-api-url}}/Salm/DeleteForSalm",
  532. "host": [
  533. "{{t-erp-api-url}}"
  534. ],
  535. "path": [
  536. "Salm",
  537. "DeleteForSalm"
  538. ]
  539. },
  540. "description": "删除员工资料"
  541. },
  542. "response": []
  543. }
  544. ],
  545. "description": "员工资料"
  546. },
  547. {
  548. "name": "仓库资料",
  549. "item": [
  550. {
  551. "name": "新增仓库",
  552. "event": [
  553. {
  554. "listen": "test",
  555. "script": {
  556. "exec": [
  557. "// 1. 基础响应验证\r",
  558. "pm.test(\"✅ 状态码 200\", function() {\r",
  559. " pm.response.to.have.status(200);\r",
  560. "});\r",
  561. "\r",
  562. "// 2. 获取数据\r",
  563. "var requestData = JSON.parse(pm.request.body.raw);\r",
  564. "var responseData = pm.response.json();\r",
  565. "\r",
  566. "// 3. 响应结构验证\r",
  567. "pm.test(\"📋 响应结构验证\", function() {\r",
  568. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  569. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  570. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  571. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  572. "});\r",
  573. "\r",
  574. "// 4. 请求数据验证\r",
  575. "pm.test(\"✅ 仓库数据验证\", function() {\r",
  576. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  577. " \r",
  578. " requestData.forEach((warehouse, index) => {\r",
  579. " const whNum = index + 1;\r",
  580. " \r",
  581. " // 必填字段验证\r",
  582. " pm.expect(warehouse, `仓库${whNum}`).to.include.keys('WH', 'NAME');\r",
  583. " pm.expect(warehouse.WH, `仓库${whNum}代号`).to.be.a('string').and.not.empty;\r",
  584. " pm.expect(warehouse.NAME, `仓库${whNum}名称`).to.be.a('string').and.not.empty;\r",
  585. " \r",
  586. " // 可选字段类型验证(如果存在)\r",
  587. " const optionalFields = ['ATTRIB', 'UP_WH', 'INVALID', 'VMIVALID', 'LOC_ID', 'OUT_ID'];\r",
  588. " optionalFields.forEach(field => {\r",
  589. " if (warehouse[field] !== undefined) {\r",
  590. " pm.expect(warehouse[field]).to.be.a('string');\r",
  591. " }\r",
  592. " });\r",
  593. " });\r",
  594. " \r",
  595. " console.log(`✅ 已验证 ${requestData.length} 个仓库数据`);\r",
  596. "});\r",
  597. "\r",
  598. "// 5. 业务结果验证\r",
  599. "pm.test(\"📊 操作结果验证\", function() {\r",
  600. " const total = requestData.length;\r",
  601. " \r",
  602. " // 验证计数逻辑\r",
  603. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  604. " \r",
  605. " // 根据成功示例验证\r",
  606. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  607. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  608. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  609. " \r",
  610. " console.log(`✅ 成功处理 ${responseData.OkCount}/${total} 个仓库`);\r",
  611. "});"
  612. ],
  613. "type": "text/javascript",
  614. "packages": {},
  615. "requests": {}
  616. }
  617. }
  618. ],
  619. "request": {
  620. "method": "POST",
  621. "header": [
  622. {
  623. "key": "LoginId",
  624. "value": "{{t-erp-api-login-id}}",
  625. "type": "text"
  626. },
  627. {
  628. "key": "sn",
  629. "value": "{{t-erp-api-sn}}",
  630. "type": "text"
  631. }
  632. ],
  633. "body": {
  634. "mode": "raw",
  635. "raw": "[\r\n {\r\n \"WH\": \"0001\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"原料仓\", // 必须,仓库名称 \r\n \"ATTRIB\": \"2\", // 非必须,属性\r\n \"UP_WH\": \"0000\" // 非必须,上层仓库\r\n },\r\n {\r\n \"WH\": \"0002\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"半成品仓\", // 必须,仓库名称 \r\n \"ATTRIB\": \"3\", // 非必须,属性\r\n \"UP_WH\": \"0001\" // 非必须,上层仓库\r\n },\r\n {\r\n \"WH\": \"0003\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"制成品仓\", // 必须,仓库名称 \r\n \"ATTRIB\": \"5\", // 非必须,属性\r\n \"UP_WH\": \"0002\" // 非必须,上层仓库\r\n },\r\n {\r\n \"WH\": \"0004\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"废品仓\", // 必须,仓库名称\r\n \"INVALID\": \"T\", // 是否勾选废品仓\r\n \"UP_WH\": \"0000\" // 非必须,上层仓库\r\n },\r\n {\r\n \"WH\": \"0005\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"寄售仓\", // 必须,仓库名称\r\n \"VMIVALID\": \"T\", // 是否勾选寄售仓\r\n \"UP_WH\": \"0000\" // 非必须,上层仓库\r\n },\r\n {\r\n \"WH\": \"0006\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"储位仓\", // 必须,仓库名称\r\n \"LOC_ID\": \"T\", // 是否勾选寄售仓\r\n \"OUT_ID\": \"1\", // 出库规则\r\n \"UP_WH\": \"0000\" // 非必须,上层仓库\r\n },\r\n {\r\n \"WH\": \"0007\", // 必须,仓库代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"原料仓2\", // 必须,仓库名称 \r\n \"ATTRIB\": \"2\", // 非必须,属性\r\n \"UP_WH\": \"0000\" // 非必须,上层仓库\r\n }\r\n]",
  636. "options": {
  637. "raw": {
  638. "language": "json"
  639. }
  640. }
  641. },
  642. "url": {
  643. "raw": "{{t-erp-api-url}}/Wh/AppendToWh",
  644. "host": [
  645. "{{t-erp-api-url}}"
  646. ],
  647. "path": [
  648. "Wh",
  649. "AppendToWh"
  650. ]
  651. },
  652. "description": "新增仓库资料"
  653. },
  654. "response": []
  655. }
  656. ],
  657. "description": "仓库资料"
  658. },
  659. {
  660. "name": "货品资料",
  661. "item": [
  662. {
  663. "name": "新增货品",
  664. "event": [
  665. {
  666. "listen": "test",
  667. "script": {
  668. "exec": [
  669. "// 1. 基础响应验证\r",
  670. "pm.test(\"✅ 状态码 200\", function() {\r",
  671. " pm.response.to.have.status(200);\r",
  672. "});\r",
  673. "\r",
  674. "// 2. 获取数据\r",
  675. "var requestData = JSON.parse(pm.request.body.raw);\r",
  676. "var responseData = pm.response.json();\r",
  677. "\r",
  678. "// 3. 响应结构验证\r",
  679. "pm.test(\"📋 响应结构验证\", function() {\r",
  680. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  681. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  682. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  683. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  684. "});\r",
  685. "\r",
  686. "// 4. 请求数据验证\r",
  687. "pm.test(\"✅ 货品数据验证\", function() {\r",
  688. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  689. " \r",
  690. " requestData.forEach((product, index) => {\r",
  691. " const prodNum = index + 1;\r",
  692. " \r",
  693. " // 必填字段验证\r",
  694. " pm.expect(product, `货品${prodNum}`).to.include.keys('PRD_NO', 'NAME', 'UT');\r",
  695. " pm.expect(product.PRD_NO, `货品${prodNum}代号`).to.be.a('string').and.not.empty;\r",
  696. " pm.expect(product.NAME, `货品${prodNum}名称`).to.be.a('string').and.not.empty;\r",
  697. " pm.expect(product.UT, `货品${prodNum}单位`).to.be.a('string').and.not.empty;\r",
  698. " \r",
  699. " // 可选字段类型验证(如果存在)\r",
  700. " const optionalFields = ['WH', 'REM', 'CHK_BAT', 'CHK_MARK'];\r",
  701. " optionalFields.forEach(field => {\r",
  702. " if (product[field] !== undefined) {\r",
  703. " pm.expect(product[field]).to.be.a('string');\r",
  704. " }\r",
  705. " });\r",
  706. " });\r",
  707. " \r",
  708. " console.log(`✅ 已验证 ${requestData.length} 个货品数据`);\r",
  709. "});\r",
  710. "\r",
  711. "// 5. 业务结果验证\r",
  712. "pm.test(\"📊 操作结果验证\", function() {\r",
  713. " const total = requestData.length;\r",
  714. " \r",
  715. " // 验证计数逻辑\r",
  716. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  717. " \r",
  718. " // 根据成功示例验证\r",
  719. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  720. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  721. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  722. " \r",
  723. " console.log(`✅ 成功处理 ${responseData.OkCount}/${total} 个货品`);\r",
  724. "});"
  725. ],
  726. "type": "text/javascript",
  727. "packages": {},
  728. "requests": {}
  729. }
  730. }
  731. ],
  732. "request": {
  733. "method": "POST",
  734. "header": [
  735. {
  736. "key": "LoginId",
  737. "value": "{{t-erp-api-login-id}}",
  738. "type": "text"
  739. },
  740. {
  741. "key": "sn",
  742. "value": "{{t-erp-api-sn}}",
  743. "type": "text"
  744. }
  745. ],
  746. "body": {
  747. "mode": "raw",
  748. "raw": "[\r\n {\r\n \"PRD_NO\": \"YL0001\", // 必须,货品代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"原料0001\", // 必须,货品名称\r\n \"UT\": \"个\", // 必须,主单位\r\n \"WH\": \"0001\", // 非必须,预入仓库\r\n \"REM\": \"原料0001摘要,API测试\" // 非必须,摘要\r\n },\r\n {\r\n \"PRD_NO\": \"YL0002\", // 必须,货品代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"原料0002\", // 必须,货品名称\r\n \"UT\": \"个\", // 必须,主单位\r\n \"WH\": \"0001\", // 非必须,预入仓库\r\n \"REM\": \"原料0002摘要,API测试\" // 非必须,摘要\r\n },\r\n {\r\n \"PRD_NO\": \"BCP0001\", // 必须,货品代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"半成品0001\", // 必须,货品名称\r\n \"UT\": \"KG\", // 必须,主单位\r\n \"WH\": \"0002\", // 非必须,预入仓库\r\n \"CHK_BAT\": \"T\", // 批号管制\r\n \"REM\": \"半成品0001摘要,API测试\" // 非必须,摘要\r\n },\r\n {\r\n \"PRD_NO\": \"ZCP0001\", // 必须,货品代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"制成品0001\", // 必须,货品名称\r\n \"UT\": \"KG\", // 必须,主单位\r\n \"WH\": \"0003\", // 非必须,预入仓库\r\n \"CHK_MARK\": \"T\", // 特征管制\r\n \"REM\": \"制成品0001摘要,API测试\" // 非必须,摘要\r\n },\r\n {\r\n \"PRD_NO\": \"ZCP0002\", // 必须,货品代号,该货品代号在资料中存在即为修改原数据,不存在为新增\r\n \"NAME\": \"制成品0002\", // 必须,货品名称\r\n \"UT\": \"KG\", // 必须,主单位\r\n \"WH\": \"0003\", // 非必须,预入仓库\r\n \"CHK_BAT\": \"T\", // 批号管制\r\n \"CHK_MARK\": \"T\", // 特征管制\r\n \"REM\": \"制成品0002摘要,API测试\" // 非必须,摘要\r\n }\r\n]",
  749. "options": {
  750. "raw": {
  751. "language": "json"
  752. }
  753. }
  754. },
  755. "url": {
  756. "raw": "{{t-erp-api-url}}/Prdt/AppendToPrdt",
  757. "host": [
  758. "{{t-erp-api-url}}"
  759. ],
  760. "path": [
  761. "Prdt",
  762. "AppendToPrdt"
  763. ]
  764. },
  765. "description": "新增货品"
  766. },
  767. "response": []
  768. },
  769. {
  770. "name": "删除货品",
  771. "event": [
  772. {
  773. "listen": "test",
  774. "script": {
  775. "exec": [
  776. "// 1. 基础响应验证\r",
  777. "pm.test(\"✅ 状态码 200\", function() {\r",
  778. " pm.response.to.have.status(200);\r",
  779. "});\r",
  780. "\r",
  781. "// 2. 获取数据\r",
  782. "var requestData = JSON.parse(pm.request.body.raw);\r",
  783. "var responseData = pm.response.json();\r",
  784. "\r",
  785. "// 3. 响应结构验证\r",
  786. "pm.test(\"📋 响应结构验证\", function() {\r",
  787. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  788. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  789. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  790. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  791. "});\r",
  792. "\r",
  793. "// 4. 请求数据验证\r",
  794. "pm.test(\"✅ 删除请求验证\", function() {\r",
  795. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  796. " \r",
  797. " requestData.forEach((item, index) => {\r",
  798. " const itemNum = index + 1;\r",
  799. " \r",
  800. " // 必填字段验证\r",
  801. " pm.expect(item, `删除项${itemNum}`).to.have.property('PRD_NO');\r",
  802. " pm.expect(item.PRD_NO, `货品${itemNum}代号`).to.be.a('string').and.not.empty;\r",
  803. " });\r",
  804. " \r",
  805. " console.log(`🗑️ 请求删除 ${requestData.length} 个货品`);\r",
  806. "});\r",
  807. "\r",
  808. "// 5. 业务结果验证\r",
  809. "pm.test(\"📊 删除结果验证\", function() {\r",
  810. " const total = requestData.length;\r",
  811. " \r",
  812. " // 验证计数逻辑\r",
  813. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  814. " \r",
  815. " // 根据成功示例验证\r",
  816. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  817. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  818. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  819. " \r",
  820. " console.log(`✅ 成功删除 ${responseData.OkCount}/${total} 个货品`);\r",
  821. "});"
  822. ],
  823. "type": "text/javascript",
  824. "packages": {},
  825. "requests": {}
  826. }
  827. }
  828. ],
  829. "request": {
  830. "method": "POST",
  831. "header": [
  832. {
  833. "key": "LoginId",
  834. "value": "{{t-erp-api-login-id}}",
  835. "type": "text"
  836. },
  837. {
  838. "key": "sn",
  839. "value": "{{t-erp-api-sn}}",
  840. "type": "text"
  841. }
  842. ],
  843. "body": {
  844. "mode": "raw",
  845. "raw": "[\r\n {\r\n \"PRD_NO\": \"YL0002\" // 必须,货品代号,删除该笔货品资料\r\n }\r\n]",
  846. "options": {
  847. "raw": {
  848. "language": "json"
  849. }
  850. }
  851. },
  852. "url": {
  853. "raw": "{{t-erp-api-url}}/Prdt/DeleteForPrdt",
  854. "host": [
  855. "{{t-erp-api-url}}"
  856. ],
  857. "path": [
  858. "Prdt",
  859. "DeleteForPrdt"
  860. ]
  861. },
  862. "description": "删除货品资料"
  863. },
  864. "response": []
  865. }
  866. ],
  867. "description": "货品资料"
  868. },
  869. {
  870. "name": "客户厂商资料",
  871. "item": [
  872. {
  873. "name": "新增客户",
  874. "event": [
  875. {
  876. "listen": "test",
  877. "script": {
  878. "exec": [
  879. "// 1. 基础响应验证\r",
  880. "pm.test(\"✅ 状态码 200\", function() {\r",
  881. " pm.response.to.have.status(200);\r",
  882. "});\r",
  883. "\r",
  884. "// 2. 获取数据\r",
  885. "var requestData = JSON.parse(pm.request.body.raw);\r",
  886. "var responseData = pm.response.json();\r",
  887. "\r",
  888. "// 3. 响应结构验证\r",
  889. "pm.test(\"📋 响应结构验证\", function() {\r",
  890. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  891. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  892. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  893. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  894. "});\r",
  895. "\r",
  896. "// 4. 请求数据验证\r",
  897. "pm.test(\"✅ 客户数据验证\", function() {\r",
  898. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  899. " \r",
  900. " requestData.forEach((customer, index) => {\r",
  901. " const custNum = index + 1;\r",
  902. " \r",
  903. " // 必填字段验证\r",
  904. " pm.expect(customer, `客户${custNum}`).to.include.keys('CUS_NO', 'OBJ_ID', 'NAME');\r",
  905. " pm.expect(customer.CUS_NO, `客户${custNum}代号`).to.be.a('string').and.not.empty;\r",
  906. " pm.expect(customer.NAME, `客户${custNum}名称`).to.be.a('string').and.not.empty;\r",
  907. " pm.expect(customer.OBJ_ID, `客户${custNum}对象别`).to.be.a('string');\r",
  908. " \r",
  909. " // 验证OBJ_ID取值范围\r",
  910. " const validObjIds = ['1', '2', '3'];\r",
  911. " if (customer.OBJ_ID && customer.OBJ_ID !== '') {\r",
  912. " pm.expect(validObjIds).to.include(\r",
  913. " customer.OBJ_ID,\r",
  914. " `客户${custNum}的OBJ_ID应为1、2或3,当前值为:${customer.OBJ_ID}`\r",
  915. " );\r",
  916. " }\r",
  917. " \r",
  918. " // 可选字段类型验证(如果存在)\r",
  919. " const optionalFields = ['SAL', 'ID1_TAX', 'MAS_CUS', 'REM'];\r",
  920. " optionalFields.forEach(field => {\r",
  921. " if (customer[field] !== undefined) {\r",
  922. " pm.expect(customer[field]).to.be.a('string');\r",
  923. " }\r",
  924. " });\r",
  925. " });\r",
  926. " \r",
  927. " console.log(`✅ 已验证 ${requestData.length} 个客户数据`);\r",
  928. "});\r",
  929. "\r",
  930. "// 5. 业务结果验证\r",
  931. "pm.test(\"📊 操作结果验证\", function() {\r",
  932. " const total = requestData.length;\r",
  933. " \r",
  934. " // 验证计数逻辑\r",
  935. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  936. " \r",
  937. " // 根据成功示例验证\r",
  938. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  939. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  940. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  941. " \r",
  942. " console.log(`✅ 成功处理 ${responseData.OkCount}/${total} 个客户`);\r",
  943. "});"
  944. ],
  945. "type": "text/javascript",
  946. "packages": {},
  947. "requests": {}
  948. }
  949. }
  950. ],
  951. "request": {
  952. "method": "POST",
  953. "header": [
  954. {
  955. "key": "LoginId",
  956. "value": "{{t-erp-api-login-id}}",
  957. "type": "text"
  958. },
  959. {
  960. "key": "sn",
  961. "value": "{{t-erp-api-sn}}",
  962. "type": "text"
  963. }
  964. ],
  965. "body": {
  966. "mode": "raw",
  967. "raw": "[\r\n {\r\n \"CUS_NO\": \"KH0001\", // 必须,客户厂商代号,该客户厂商代号在资料中存在即为修改原数据,不存在为新增\r\n \"OBJ_ID\": \"1\", // 必须,对象别,1:客户,2:厂商,3 :客户厂商;为空时默认取3\r\n \"NAME\": \"客户A\", // 必须,全称\r\n \"SAL\": \"ZS\", // 非必须,责任业务\r\n \"ID1_TAX\": \"2\", // 非必须,扣税类别\r\n \"REM\": \"这是客户A备注\" // 非必须,备注\r\n },\r\n {\r\n \"CUS_NO\": \"KH0002\", // 必须,客户厂商代号,该客户厂商代号在资料中存在即为修改原数据,不存在为新增\r\n \"OBJ_ID\": \"3\", // 必须,对象别,1:客户,2:厂商,3 :客户厂商;为空时默认取3\r\n \"NAME\": \"客户B\", // 必须,全称\r\n \"SAL\": \"ZS\", // 非必须,责任业务\r\n \"ID1_TAX\": \"2\", // 非必须,扣税类别\r\n \"MAS_CUS\": \"KH0001\", // 非必须,归属客户\r\n \"REM\": \"这是客户B备注\" // 非必须,备注\r\n },\r\n {\r\n \"CUS_NO\": \"KH0003\", // 必须,客户厂商代号,该客户厂商代号在资料中存在即为修改原数据,不存在为新增\r\n \"OBJ_ID\": \"1\", // 必须,对象别,1:客户,2:厂商,3 :客户厂商;为空时默认取3\r\n \"NAME\": \"客户C\", // 必须,全称\r\n \"SAL\": \"ZS\", // 非必须,责任业务\r\n \"ID1_TAX\": \"2\", // 非必须,扣税类别\r\n \"REM\": \"这是客户C备注\" // 非必须,备注\r\n }\r\n]",
  968. "options": {
  969. "raw": {
  970. "language": "json"
  971. }
  972. }
  973. },
  974. "url": {
  975. "raw": "{{t-erp-api-url}}/Cust/AppendToCust",
  976. "host": [
  977. "{{t-erp-api-url}}"
  978. ],
  979. "path": [
  980. "Cust",
  981. "AppendToCust"
  982. ]
  983. },
  984. "description": "新增客户资料"
  985. },
  986. "response": []
  987. },
  988. {
  989. "name": "删除客户",
  990. "event": [
  991. {
  992. "listen": "test",
  993. "script": {
  994. "exec": [
  995. "// 1. 基础响应验证\r",
  996. "pm.test(\"✅ 状态码 200\", function() {\r",
  997. " pm.response.to.have.status(200);\r",
  998. "});\r",
  999. "\r",
  1000. "// 2. 获取数据\r",
  1001. "var requestData = JSON.parse(pm.request.body.raw);\r",
  1002. "var responseData = pm.response.json();\r",
  1003. "\r",
  1004. "// 3. 响应结构验证\r",
  1005. "pm.test(\"📋 响应结构验证\", function() {\r",
  1006. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  1007. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  1008. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  1009. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  1010. "});\r",
  1011. "\r",
  1012. "// 4. 请求数据验证\r",
  1013. "pm.test(\"✅ 删除请求验证\", function() {\r",
  1014. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  1015. " \r",
  1016. " requestData.forEach((item, index) => {\r",
  1017. " const itemNum = index + 1;\r",
  1018. " \r",
  1019. " // 必填字段验证\r",
  1020. " pm.expect(item, `删除项${itemNum}`).to.have.property('CUS_NO');\r",
  1021. " pm.expect(item.CUS_NO, `客户${itemNum}代号`).to.be.a('string').and.not.empty;\r",
  1022. " });\r",
  1023. " \r",
  1024. " console.log(`🗑️ 请求删除 ${requestData.length} 个客户`);\r",
  1025. "});\r",
  1026. "\r",
  1027. "// 5. 业务结果验证\r",
  1028. "pm.test(\"📊 删除结果验证\", function() {\r",
  1029. " const total = requestData.length;\r",
  1030. " \r",
  1031. " // 验证计数逻辑\r",
  1032. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  1033. " \r",
  1034. " // 根据成功示例验证\r",
  1035. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  1036. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  1037. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  1038. " \r",
  1039. " console.log(`✅ 成功删除 ${responseData.OkCount}/${total} 个客户`);\r",
  1040. "});"
  1041. ],
  1042. "type": "text/javascript",
  1043. "packages": {},
  1044. "requests": {}
  1045. }
  1046. }
  1047. ],
  1048. "request": {
  1049. "method": "POST",
  1050. "header": [
  1051. {
  1052. "key": "LoginId",
  1053. "value": "{{t-erp-api-login-id}}",
  1054. "type": "text"
  1055. },
  1056. {
  1057. "key": "sn",
  1058. "value": "{{t-erp-api-sn}}",
  1059. "type": "text"
  1060. }
  1061. ],
  1062. "body": {
  1063. "mode": "raw",
  1064. "raw": "[\r\n {\r\n \"CUS_NO\": \"KH0003\" // 必须,客户厂商代号,删除该笔客户厂商资料\r\n }\r\n]",
  1065. "options": {
  1066. "raw": {
  1067. "language": "json"
  1068. }
  1069. }
  1070. },
  1071. "url": {
  1072. "raw": "{{t-erp-api-url}}/Cust/DeleteForCust",
  1073. "host": [
  1074. "{{t-erp-api-url}}"
  1075. ],
  1076. "path": [
  1077. "Cust",
  1078. "DeleteForCust"
  1079. ]
  1080. },
  1081. "description": "删除客户资料"
  1082. },
  1083. "response": []
  1084. },
  1085. {
  1086. "name": "新增厂商",
  1087. "event": [
  1088. {
  1089. "listen": "test",
  1090. "script": {
  1091. "exec": [
  1092. "// 1. 基础响应验证\r",
  1093. "pm.test(\"✅ 状态码 200\", function() {\r",
  1094. " pm.response.to.have.status(200);\r",
  1095. "});\r",
  1096. "\r",
  1097. "// 2. 获取数据\r",
  1098. "var requestData = JSON.parse(pm.request.body.raw);\r",
  1099. "var responseData = pm.response.json();\r",
  1100. "\r",
  1101. "// 3. 响应结构验证\r",
  1102. "pm.test(\"📋 响应结构验证\", function() {\r",
  1103. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  1104. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  1105. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  1106. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  1107. "});\r",
  1108. "\r",
  1109. "// 4. 请求数据验证\r",
  1110. "pm.test(\"✅ 厂商数据验证\", function() {\r",
  1111. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  1112. " \r",
  1113. " requestData.forEach((supplier, index) => {\r",
  1114. " const supNum = index + 1;\r",
  1115. " \r",
  1116. " // 必填字段验证\r",
  1117. " pm.expect(supplier, `厂商${supNum}`).to.include.keys('CUS_NO', 'OBJ_ID', 'NAME');\r",
  1118. " pm.expect(supplier.CUS_NO, `厂商${supNum}代号`).to.be.a('string').and.not.empty;\r",
  1119. " pm.expect(supplier.NAME, `厂商${supNum}名称`).to.be.a('string').and.not.empty;\r",
  1120. " pm.expect(supplier.OBJ_ID, `厂商${supNum}对象别`).to.be.a('string');\r",
  1121. " \r",
  1122. " // 验证OBJ_ID取值范围(这里厂商应该是2或3,但根据接口说明,1、2、3都允许)\r",
  1123. " const validObjIds = ['1', '2', '3'];\r",
  1124. " if (supplier.OBJ_ID && supplier.OBJ_ID !== '') {\r",
  1125. " pm.expect(validObjIds).to.include(\r",
  1126. " supplier.OBJ_ID,\r",
  1127. " `厂商${supNum}的OBJ_ID应为1、2或3,当前值为:${supplier.OBJ_ID}`\r",
  1128. " );\r",
  1129. " }\r",
  1130. " \r",
  1131. " // 可选字段类型验证(如果存在)\r",
  1132. " const optionalFields = ['SAL', 'ID1_TAX', 'MAS_CUS', 'REM'];\r",
  1133. " optionalFields.forEach(field => {\r",
  1134. " if (supplier[field] !== undefined) {\r",
  1135. " pm.expect(supplier[field]).to.be.a('string');\r",
  1136. " }\r",
  1137. " });\r",
  1138. " });\r",
  1139. " \r",
  1140. " console.log(`✅ 已验证 ${requestData.length} 个厂商数据`);\r",
  1141. "});\r",
  1142. "\r",
  1143. "// 5. 业务结果验证\r",
  1144. "pm.test(\"📊 操作结果验证\", function() {\r",
  1145. " const total = requestData.length;\r",
  1146. " \r",
  1147. " // 验证计数逻辑\r",
  1148. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  1149. " \r",
  1150. " // 根据成功示例验证\r",
  1151. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  1152. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  1153. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  1154. " \r",
  1155. " console.log(`✅ 成功处理 ${responseData.OkCount}/${total} 个厂商`);\r",
  1156. "});"
  1157. ],
  1158. "type": "text/javascript",
  1159. "packages": {},
  1160. "requests": {}
  1161. }
  1162. }
  1163. ],
  1164. "request": {
  1165. "method": "POST",
  1166. "header": [
  1167. {
  1168. "key": "LoginId",
  1169. "value": "{{t-erp-api-login-id}}",
  1170. "type": "text"
  1171. },
  1172. {
  1173. "key": "sn",
  1174. "value": "{{t-erp-api-sn}}",
  1175. "type": "text"
  1176. }
  1177. ],
  1178. "body": {
  1179. "mode": "raw",
  1180. "raw": "[\r\n {\r\n \"CUS_NO\": \"CS0001\", // 必须,客户厂商代号,该客户厂商代号在资料中存在即为修改原数据,不存在为新增\r\n \"OBJ_ID\": \"2\", // 必须,对象别,1:客户,2:厂商,3 :客户厂商;为空时默认取3\r\n \"NAME\": \"厂商A\", // 必须,全称\r\n \"SAL\": \"ZS\", // 非必须,责任业务\r\n \"ID1_TAX\": \"2\", // 非必须,扣税类别\r\n \"REM\": \"这是厂商A备注\" // 非必须,备注\r\n },\r\n {\r\n \"CUS_NO\": \"CS0002\", // 必须,客户厂商代号,该客户厂商代号在资料中存在即为修改原数据,不存在为新增\r\n \"OBJ_ID\": \"3\", // 必须,对象别,1:客户,2:厂商,3 :客户厂商;为空时默认取3\r\n \"NAME\": \"厂商B\", // 必须,全称\r\n \"SAL\": \"ZS\", // 非必须,责任业务\r\n \"ID1_TAX\": \"2\", // 非必须,扣税类别\r\n \"MAS_CUS\": \"CS0001\", // 非必须,归属厂商\r\n \"REM\": \"这是厂商B备注\" // 非必须,备注\r\n },\r\n {\r\n \"CUS_NO\": \"CS0003\", // 必须,客户厂商代号,该客户厂商代号在资料中存在即为修改原数据,不存在为新增\r\n \"OBJ_ID\": \"2\", // 必须,对象别,1:客户,2:厂商,3 :客户厂商;为空时默认取3\r\n \"NAME\": \"厂商C\", // 必须,全称\r\n \"SAL\": \"ZS\", // 非必须,责任业务\r\n \"ID1_TAX\": \"2\", // 非必须,扣税类别\r\n \"REM\": \"这是厂商C备注\" // 非必须,备注\r\n }\r\n]",
  1181. "options": {
  1182. "raw": {
  1183. "language": "json"
  1184. }
  1185. }
  1186. },
  1187. "url": {
  1188. "raw": "{{t-erp-api-url}}/Cust/AppendToCust",
  1189. "host": [
  1190. "{{t-erp-api-url}}"
  1191. ],
  1192. "path": [
  1193. "Cust",
  1194. "AppendToCust"
  1195. ]
  1196. },
  1197. "description": "新增厂商资料"
  1198. },
  1199. "response": []
  1200. },
  1201. {
  1202. "name": "删除厂商",
  1203. "event": [
  1204. {
  1205. "listen": "test",
  1206. "script": {
  1207. "exec": [
  1208. "// 1. 基础响应验证\r",
  1209. "pm.test(\"✅ 状态码 200\", function() {\r",
  1210. " pm.response.to.have.status(200);\r",
  1211. "});\r",
  1212. "\r",
  1213. "// 2. 获取数据\r",
  1214. "var requestData = JSON.parse(pm.request.body.raw);\r",
  1215. "var responseData = pm.response.json();\r",
  1216. "\r",
  1217. "// 3. 响应结构验证\r",
  1218. "pm.test(\"📋 响应结构验证\", function() {\r",
  1219. " pm.expect(responseData).to.have.all.keys('OkCount', 'ErrorCount', 'ErrorData');\r",
  1220. " pm.expect(responseData.OkCount).to.be.a('number');\r",
  1221. " pm.expect(responseData.ErrorCount).to.be.a('number');\r",
  1222. " pm.expect(responseData.ErrorData).to.be.an('array');\r",
  1223. "});\r",
  1224. "\r",
  1225. "// 4. 请求数据验证\r",
  1226. "pm.test(\"✅ 删除请求验证\", function() {\r",
  1227. " pm.expect(requestData).to.be.an('array').that.is.not.empty;\r",
  1228. " \r",
  1229. " requestData.forEach((item, index) => {\r",
  1230. " const itemNum = index + 1;\r",
  1231. " \r",
  1232. " // 必填字段验证\r",
  1233. " pm.expect(item, `删除项${itemNum}`).to.have.property('CUS_NO');\r",
  1234. " pm.expect(item.CUS_NO, `厂商${itemNum}代号`).to.be.a('string').and.not.empty;\r",
  1235. " });\r",
  1236. " \r",
  1237. " console.log(`🗑️ 请求删除 ${requestData.length} 个厂商`);\r",
  1238. "});\r",
  1239. "\r",
  1240. "// 5. 业务结果验证\r",
  1241. "pm.test(\"📊 删除结果验证\", function() {\r",
  1242. " const total = requestData.length;\r",
  1243. " \r",
  1244. " // 验证计数逻辑\r",
  1245. " pm.expect(responseData.OkCount + responseData.ErrorCount).to.equal(total);\r",
  1246. " \r",
  1247. " // 根据成功示例验证\r",
  1248. " pm.expect(responseData.ErrorCount, \"失败数量\").to.equal(0);\r",
  1249. " pm.expect(responseData.OkCount, \"成功数量\").to.equal(total);\r",
  1250. " pm.expect(responseData.ErrorData, \"错误数据\").to.eql([]);\r",
  1251. " \r",
  1252. " console.log(`✅ 成功删除 ${responseData.OkCount}/${total} 个厂商`);\r",
  1253. "});"
  1254. ],
  1255. "type": "text/javascript",
  1256. "packages": {},
  1257. "requests": {}
  1258. }
  1259. }
  1260. ],
  1261. "request": {
  1262. "method": "POST",
  1263. "header": [
  1264. {
  1265. "key": "LoginId",
  1266. "value": "{{t-erp-api-login-id}}",
  1267. "type": "text"
  1268. },
  1269. {
  1270. "key": "sn",
  1271. "value": "{{t-erp-api-sn}}",
  1272. "type": "text"
  1273. }
  1274. ],
  1275. "body": {
  1276. "mode": "raw",
  1277. "raw": "[\r\n {\r\n \"CUS_NO\": \"CS0003\" // 必须,客户厂商代号,删除该笔客户厂商资料\r\n }\r\n]",
  1278. "options": {
  1279. "raw": {
  1280. "language": "json"
  1281. }
  1282. }
  1283. },
  1284. "url": {
  1285. "raw": "{{t-erp-api-url}}/Cust/DeleteForCust",
  1286. "host": [
  1287. "{{t-erp-api-url}}"
  1288. ],
  1289. "path": [
  1290. "Cust",
  1291. "DeleteForCust"
  1292. ]
  1293. },
  1294. "description": "删除厂商资料"
  1295. },
  1296. "response": []
  1297. }
  1298. ],
  1299. "description": "客户/厂商资料"
  1300. },
  1301. {
  1302. "name": "示例业务:采购订单-采购入库-销售订单-销售出库",
  1303. "item": [
  1304. {
  1305. "name": "新增采购订单",
  1306. "event": [
  1307. {
  1308. "listen": "prerequest",
  1309. "script": {
  1310. "exec": [
  1311. "// 设置当天日期为集合变量,格式:YYYY-MM-DD\r",
  1312. "// 1. 定义补0函数:日/月不足2位时自动补0(核心)\r",
  1313. "function addZero(num) {\r",
  1314. " return num < 10 ? '0' + num : num;\r",
  1315. "}\r",
  1316. "\r",
  1317. "// 2. 获取当前本地时间\r",
  1318. "const now = new Date();\r",
  1319. "\r",
  1320. "// 3. 解析年、月、日(月份+1,日/月调用补0函数)\r",
  1321. "const year = now.getFullYear(); // 年:4位数字(如2026)\r",
  1322. "const month = addZero(now.getMonth() + 1); // 月:补0后(如01/12)\r",
  1323. "const day = addZero(now.getDate()); // 日:补0后(如05/30)\r",
  1324. "\r",
  1325. "// 4. 拼接成YYYY-MM-DD格式\r",
  1326. "const currentDate = `${year}-${month}-${day}`;\r",
  1327. "\r",
  1328. "// 5. 设置为【环境变量】\r",
  1329. "pm.environment.set(\"t-erp-api-current-date\", currentDate);\r",
  1330. "\r",
  1331. "// 可选:打印日志,验证日期是否正确(Postman控制台/Jenkins日志可看)\r",
  1332. "console.log(`✅ 环境变量设置成功:t-erp-api-current-date = ${currentDate}`);"
  1333. ],
  1334. "type": "text/javascript",
  1335. "packages": {},
  1336. "requests": {}
  1337. }
  1338. },
  1339. {
  1340. "listen": "test",
  1341. "script": {
  1342. "exec": [
  1343. "// 1. 解析接口顶层的JSON响应(获取包含Data的原始对象)\r",
  1344. "var resJson = pm.response.json();\r",
  1345. "console.log(\"✅ 接口顶层JSON解析成功\");\r",
  1346. "\r",
  1347. "// 2. 提取Data字段的原始字符串,同时做非空判断\r",
  1348. "var dataRawStr = resJson.Data;\r",
  1349. "if (!dataRawStr) {\r",
  1350. " console.error(\"❌ Data字段为空/不存在,无法解析\");\r",
  1351. " pm.test(\"Data字段非空\", () => pm.expect(dataRawStr).to.not.be.empty);\r",
  1352. " return; // 终止后续脚本\r",
  1353. "}\r",
  1354. "\r",
  1355. "// 3. 核心:解析Data为JSON对象(含异常捕获+清理\\r\\n换行符)\r",
  1356. "var dataJson; // 用于存储解析后的Data JSON对象\r",
  1357. "try {\r",
  1358. " // 清理Data中的\\r\\n(全局替换),可选:可顺带去掉多余空格/\\t\r",
  1359. " var dataCleanStr = dataRawStr.replace(/\\r\\n/g, \"\").replace(/\\s+/g, \" \");\r",
  1360. " // 将清理后的字符串转为JSON对象(核心步骤)\r",
  1361. " dataJson = JSON.parse(dataCleanStr);\r",
  1362. " console.log(\"✅ Data字段成功转为JSON对象\", dataJson);\r",
  1363. "} catch (e) {\r",
  1364. " // 解析失败时打印错误日志+原始Data字符串,方便调试\r",
  1365. " console.error(\"❌ Data解析为JSON失败:\", e.message);\r",
  1366. " console.error(\"❌ Data原始字符串:\", dataRawStr);\r",
  1367. " pm.test(\"Data字段可正常解析为JSON\", () => pm.expect.fail(\"Data格式错误,解析失败\"));\r",
  1368. " return;\r",
  1369. "}\r",
  1370. "\r",
  1371. "// 4. 解析成功后:直接获取Data里的任意字段(按需使用)\r",
  1372. "// 示例:获取你Data中的TF_TABNAME、BIL_NO、BIL_ID等字段\r",
  1373. "var tfTabName = dataJson.TF_TABNAME;\r",
  1374. "var bilNo = dataJson.BIL_NO;\r",
  1375. "var bilId = dataJson.BIL_ID;\r",
  1376. "console.log(`📌 从Data中提取:TF_TABNAME=${tfTabName},BIL_NO=${bilNo},BIL_ID=${bilId}`);\r",
  1377. "\r",
  1378. "// 5. 可选:将解析后的Data JSON对象设置为环境/集合变量,供后续接口使用\r",
  1379. "pm.environment.set(\"t-erp-api-po-bill-no\", bilNo); // 单独存储常用字段(推荐)\r",
  1380. "console.log(\"✅ 解析后的Data字段已存入环境变量\");\r",
  1381. "\r",
  1382. "// 可选:添加测试断言,验证Data中的字段(按需添加)\r",
  1383. "pm.test(\"✅ Data中TF_TABNAME字段存在且正确\", () => {\r",
  1384. " pm.expect(dataJson).to.have.property(\"TF_TABNAME\", \"TF_POS\");\r",
  1385. "});"
  1386. ],
  1387. "type": "text/javascript",
  1388. "packages": {},
  1389. "requests": {}
  1390. }
  1391. }
  1392. ],
  1393. "request": {
  1394. "method": "POST",
  1395. "header": [
  1396. {
  1397. "key": "LoginId",
  1398. "value": "{{t-erp-api-login-id}}",
  1399. "type": "text"
  1400. },
  1401. {
  1402. "key": "sn",
  1403. "value": "{{t-erp-api-sn}}",
  1404. "type": "text"
  1405. }
  1406. ],
  1407. "body": {
  1408. "mode": "raw",
  1409. "raw": "{\n \"HeadData\": { //必须,表头数据\n \"CallId\": \"PO\", //必须,调用的单据识别号,\"PO\":表示采购订单\n \"CusNo\": \"CS0001\", //必须,厂商代号,有来源单或修改时非必须\n \"DepNo\": \"0001\", //非必须,部门代号\n \"SalNo\": \"ZS\", //非必须,业务员代号\n \"EstDate\": \"{{t-erp-api-current-date}}\", //非必须,预交日,单据属性控制是否必填,默认必填\n \"Rem\": \"这是采购订单表头备注\" //非必须,备注\n },\n \"BodyData\": [ //必须,表身数据\n {\n \"PrdNo\": \"YL0001\", //必须,货品代号,有来源单或修改时非必须\n \"WhNo\": \"0001\", //非必须,仓库代号\n \"Qty\": 100, //必须,主数量,有来源单或修改时非必须\n \"Up\": 10, //非必须,主单价\n \"Rem\": \"这是采购订单表身摘要\" //非必须,摘要\n }\n ]\n}",
  1410. "options": {
  1411. "raw": {
  1412. "language": "json"
  1413. }
  1414. }
  1415. },
  1416. "url": {
  1417. "raw": "{{t-erp-api-url}}/Bill/SaveBill",
  1418. "host": [
  1419. "{{t-erp-api-url}}"
  1420. ],
  1421. "path": [
  1422. "Bill",
  1423. "SaveBill"
  1424. ]
  1425. },
  1426. "description": "新增采购订单"
  1427. },
  1428. "response": []
  1429. },
  1430. {
  1431. "name": "新增采购入库单",
  1432. "event": [
  1433. {
  1434. "listen": "prerequest",
  1435. "script": {
  1436. "exec": [
  1437. "// 【集合级前置脚本】设置当天日期为集合变量,格式:YYYY-MM-DD\r",
  1438. "// 1. 定义补0函数:日/月不足2位时自动补0(核心)\r",
  1439. "function addZero(num) {\r",
  1440. " return num < 10 ? '0' + num : num;\r",
  1441. "}\r",
  1442. "\r",
  1443. "// 2. 获取当前本地时间\r",
  1444. "const now = new Date();\r",
  1445. "\r",
  1446. "// 3. 解析年、月、日(月份+1,日/月调用补0函数)\r",
  1447. "const year = now.getFullYear(); // 年:4位数字(如2026)\r",
  1448. "const month = addZero(now.getMonth() + 1); // 月:补0后(如01/12)\r",
  1449. "const day = addZero(now.getDate()); // 日:补0后(如05/30)\r",
  1450. "\r",
  1451. "// 4. 拼接成YYYY-MM-DD格式\r",
  1452. "const currentDate = `${year}-${month}-${day}`;\r",
  1453. "\r",
  1454. "// 5. 设置为【环境变量】\r",
  1455. "pm.environment.set(\"t-erp-api-current-date\", currentDate);\r",
  1456. "\r",
  1457. "// 可选:打印日志,验证日期是否正确(Postman控制台/Jenkins日志可看)\r",
  1458. "console.log(`✅ 环境变量设置成功:t-erp-api-current-date = ${currentDate}`);"
  1459. ],
  1460. "type": "text/javascript",
  1461. "packages": {},
  1462. "requests": {}
  1463. }
  1464. },
  1465. {
  1466. "listen": "test",
  1467. "script": {
  1468. "exec": [
  1469. "// 1. 解析接口顶层的JSON响应(获取包含Data的原始对象)\r",
  1470. "var resJson = pm.response.json();\r",
  1471. "console.log(\"✅ 接口顶层JSON解析成功\");\r",
  1472. "\r",
  1473. "// 2. 提取Data字段的原始字符串,同时做非空判断\r",
  1474. "var dataRawStr = resJson.Data;\r",
  1475. "if (!dataRawStr) {\r",
  1476. " console.error(\"❌ Data字段为空/不存在,无法解析\");\r",
  1477. " pm.test(\"Data字段非空\", () => pm.expect(dataRawStr).to.not.be.empty);\r",
  1478. " return; // 终止后续脚本\r",
  1479. "}\r",
  1480. "\r",
  1481. "// 3. 核心:解析Data为JSON对象(含异常捕获+清理\\r\\n换行符)\r",
  1482. "var dataJson; // 用于存储解析后的Data JSON对象\r",
  1483. "try {\r",
  1484. " // 清理Data中的\\r\\n(全局替换),可选:可顺带去掉多余空格/\\t\r",
  1485. " var dataCleanStr = dataRawStr.replace(/\\r\\n/g, \"\").replace(/\\s+/g, \" \");\r",
  1486. " // 将清理后的字符串转为JSON对象(核心步骤)\r",
  1487. " dataJson = JSON.parse(dataCleanStr);\r",
  1488. " console.log(\"✅ Data字段成功转为JSON对象\", dataJson);\r",
  1489. "} catch (e) {\r",
  1490. " // 解析失败时打印错误日志+原始Data字符串,方便调试\r",
  1491. " console.error(\"❌ Data解析为JSON失败:\", e.message);\r",
  1492. " console.error(\"❌ Data原始字符串:\", dataRawStr);\r",
  1493. " pm.test(\"Data字段可正常解析为JSON\", () => pm.expect.fail(\"Data格式错误,解析失败\"));\r",
  1494. " return;\r",
  1495. "}\r",
  1496. "\r",
  1497. "// 4. 解析成功后:直接获取Data里的任意字段(按需使用)\r",
  1498. "// 示例:获取你Data中的TF_TABNAME、BIL_NO、BIL_ID等字段\r",
  1499. "var tfTabName = dataJson.TF_TABNAME;\r",
  1500. "var bilNo = dataJson.BIL_NO;\r",
  1501. "var bilId = dataJson.BIL_ID;\r",
  1502. "console.log(`📌 从Data中提取:TF_TABNAME=${tfTabName},BIL_NO=${bilNo},BIL_ID=${bilId}`);\r",
  1503. "\r",
  1504. "// 5. 可选:将解析后的Data JSON对象设置为环境/集合变量,供后续接口使用\r",
  1505. "pm.environment.set(\"t-erp-api-pc-bill-no\", bilNo); // 单独存储常用字段(推荐)\r",
  1506. "console.log(\"✅ 解析后的Data字段已存入环境变量\");\r",
  1507. "\r",
  1508. "// 可选:添加测试断言,验证Data中的字段(按需添加)\r",
  1509. "pm.test(\"✅ Data中TF_TABNAME字段存在且正确\", () => {\r",
  1510. " pm.expect(dataJson).to.have.property(\"TF_TABNAME\", \"TF_PSS\");\r",
  1511. "});"
  1512. ],
  1513. "type": "text/javascript",
  1514. "packages": {},
  1515. "requests": {}
  1516. }
  1517. }
  1518. ],
  1519. "request": {
  1520. "method": "POST",
  1521. "header": [
  1522. {
  1523. "key": "LoginId",
  1524. "value": "{{t-erp-api-login-id}}",
  1525. "type": "text"
  1526. },
  1527. {
  1528. "key": "sn",
  1529. "value": "{{t-erp-api-sn}}",
  1530. "type": "text"
  1531. }
  1532. ],
  1533. "body": {
  1534. "mode": "raw",
  1535. "raw": "{\n \"HeadData\": { //必须,表头数据\n \"CallId\": \"PC\", //必须,调用的单据识别号,\"PC\":表示采购入库单\n \"SalNo\": \"ZS\", //非必须,业务员代号\n \"DepNo\": \"0001\" //非必须,部门代号\n },\n \"BodyData\": [ //必须,表身数据\n {\n \"BilId\": \"PO\", //必须,转入来源单识别号,\"PO\":表示采购订单\n \"BilNo\": \"{{t-erp-api-po-bill-no}}\", //必须,转入来源单单号\n \"BilItm\": 1 //必须,转入来源单项次\n }\n ]\n}",
  1536. "options": {
  1537. "raw": {
  1538. "language": "json"
  1539. }
  1540. }
  1541. },
  1542. "url": {
  1543. "raw": "{{t-erp-api-url}}/Bill/SaveBill",
  1544. "host": [
  1545. "{{t-erp-api-url}}"
  1546. ],
  1547. "path": [
  1548. "Bill",
  1549. "SaveBill"
  1550. ]
  1551. },
  1552. "description": "新增采购入库单"
  1553. },
  1554. "response": []
  1555. },
  1556. {
  1557. "name": "货品库存查询(报表)",
  1558. "request": {
  1559. "method": "GET",
  1560. "header": [
  1561. {
  1562. "key": "LoginId",
  1563. "value": "{{t-erp-api-login-id}}",
  1564. "type": "text"
  1565. },
  1566. {
  1567. "key": "PRD_NO",
  1568. "value": "YL0001",
  1569. "type": "text"
  1570. },
  1571. {
  1572. "key": "WH",
  1573. "value": "",
  1574. "type": "text"
  1575. },
  1576. {
  1577. "key": "PRD_LOC",
  1578. "value": "",
  1579. "type": "text"
  1580. },
  1581. {
  1582. "key": "BAT_NO",
  1583. "value": "",
  1584. "type": "text"
  1585. },
  1586. {
  1587. "key": "PRD_MARK",
  1588. "value": "",
  1589. "type": "text"
  1590. },
  1591. {
  1592. "key": "ISGROUPBYWH",
  1593. "value": "T",
  1594. "type": "text"
  1595. },
  1596. {
  1597. "key": "ISGROUPBYPRD_MARK",
  1598. "value": "",
  1599. "type": "text"
  1600. },
  1601. {
  1602. "key": "ISGROUPBYBAT_NO",
  1603. "value": "",
  1604. "type": "text"
  1605. },
  1606. {
  1607. "key": "ISGROUPBYPRD_LOC",
  1608. "value": "",
  1609. "type": "text"
  1610. }
  1611. ],
  1612. "url": {
  1613. "raw": "{{t-erp-api-url}}/TbrECC/GetPrdStockData",
  1614. "host": [
  1615. "{{t-erp-api-url}}"
  1616. ],
  1617. "path": [
  1618. "TbrECC",
  1619. "GetPrdStockData"
  1620. ]
  1621. },
  1622. "description": "货品库存查询(报表)"
  1623. },
  1624. "response": []
  1625. },
  1626. {
  1627. "name": "新增销售订单",
  1628. "event": [
  1629. {
  1630. "listen": "prerequest",
  1631. "script": {
  1632. "exec": [
  1633. "// 【集合级前置脚本】设置当天日期为集合变量,格式:YYYY-MM-DD\r",
  1634. "// 1. 定义补0函数:日/月不足2位时自动补0(核心)\r",
  1635. "function addZero(num) {\r",
  1636. " return num < 10 ? '0' + num : num;\r",
  1637. "}\r",
  1638. "\r",
  1639. "// 2. 获取当前本地时间\r",
  1640. "const now = new Date();\r",
  1641. "\r",
  1642. "// 3. 解析年、月、日(月份+1,日/月调用补0函数)\r",
  1643. "const year = now.getFullYear(); // 年:4位数字(如2026)\r",
  1644. "const month = addZero(now.getMonth() + 1); // 月:补0后(如01/12)\r",
  1645. "const day = addZero(now.getDate()); // 日:补0后(如05/30)\r",
  1646. "\r",
  1647. "// 4. 拼接成YYYY-MM-DD格式\r",
  1648. "const currentDate = `${year}-${month}-${day}`;\r",
  1649. "\r",
  1650. "// 5. 设置为【环境变量】\r",
  1651. "pm.environment.set(\"t-erp-api-current-date\", currentDate);\r",
  1652. "\r",
  1653. "// 可选:打印日志,验证日期是否正确(Postman控制台/Jenkins日志可看)\r",
  1654. "console.log(`✅ 环境变量设置成功:t-erp-api-current-date = ${currentDate}`);"
  1655. ],
  1656. "type": "text/javascript",
  1657. "packages": {},
  1658. "requests": {}
  1659. }
  1660. },
  1661. {
  1662. "listen": "test",
  1663. "script": {
  1664. "exec": [
  1665. "// 1. 解析接口顶层的JSON响应(获取包含Data的原始对象)\r",
  1666. "var resJson = pm.response.json();\r",
  1667. "console.log(\"✅ 接口顶层JSON解析成功\");\r",
  1668. "\r",
  1669. "// 2. 提取Data字段的原始字符串,同时做非空判断\r",
  1670. "var dataRawStr = resJson.Data;\r",
  1671. "if (!dataRawStr) {\r",
  1672. " console.error(\"❌ Data字段为空/不存在,无法解析\");\r",
  1673. " pm.test(\"Data字段非空\", () => pm.expect(dataRawStr).to.not.be.empty);\r",
  1674. " return; // 终止后续脚本\r",
  1675. "}\r",
  1676. "\r",
  1677. "// 3. 核心:解析Data为JSON对象(含异常捕获+清理\\r\\n换行符)\r",
  1678. "var dataJson; // 用于存储解析后的Data JSON对象\r",
  1679. "try {\r",
  1680. " // 清理Data中的\\r\\n(全局替换),可选:可顺带去掉多余空格/\\t\r",
  1681. " var dataCleanStr = dataRawStr.replace(/\\r\\n/g, \"\").replace(/\\s+/g, \" \");\r",
  1682. " // 将清理后的字符串转为JSON对象(核心步骤)\r",
  1683. " dataJson = JSON.parse(dataCleanStr);\r",
  1684. " console.log(\"✅ Data字段成功转为JSON对象\", dataJson);\r",
  1685. "} catch (e) {\r",
  1686. " // 解析失败时打印错误日志+原始Data字符串,方便调试\r",
  1687. " console.error(\"❌ Data解析为JSON失败:\", e.message);\r",
  1688. " console.error(\"❌ Data原始字符串:\", dataRawStr);\r",
  1689. " pm.test(\"Data字段可正常解析为JSON\", () => pm.expect.fail(\"Data格式错误,解析失败\"));\r",
  1690. " return;\r",
  1691. "}\r",
  1692. "\r",
  1693. "// 4. 解析成功后:直接获取Data里的任意字段(按需使用)\r",
  1694. "// 示例:获取你Data中的TF_TABNAME、BIL_NO、BIL_ID等字段\r",
  1695. "var tfTabName = dataJson.TF_TABNAME;\r",
  1696. "var bilNo = dataJson.BIL_NO;\r",
  1697. "var bilId = dataJson.BIL_ID;\r",
  1698. "console.log(`📌 从Data中提取:TF_TABNAME=${tfTabName},BIL_NO=${bilNo},BIL_ID=${bilId}`);\r",
  1699. "\r",
  1700. "// 5. 可选:将解析后的Data JSON对象设置为环境/集合变量,供后续接口使用\r",
  1701. "pm.environment.set(\"t-erp-api-so-bill-no\", bilNo); // 单独存储常用字段(推荐)\r",
  1702. "console.log(\"✅ 解析后的Data字段已存入环境变量\");\r",
  1703. "\r",
  1704. "// 可选:添加测试断言,验证Data中的字段(按需添加)\r",
  1705. "pm.test(\"✅ Data中TF_TABNAME字段存在且正确\", () => {\r",
  1706. " pm.expect(dataJson).to.have.property(\"TF_TABNAME\", \"TF_POS\");\r",
  1707. "});"
  1708. ],
  1709. "type": "text/javascript",
  1710. "packages": {},
  1711. "requests": {}
  1712. }
  1713. }
  1714. ],
  1715. "request": {
  1716. "method": "POST",
  1717. "header": [
  1718. {
  1719. "key": "LoginId",
  1720. "value": "{{t-erp-api-login-id}}",
  1721. "type": "text"
  1722. },
  1723. {
  1724. "key": "sn",
  1725. "value": "{{t-erp-api-sn}}",
  1726. "type": "text"
  1727. }
  1728. ],
  1729. "body": {
  1730. "mode": "raw",
  1731. "raw": "{\n \"HeadData\": { //必须,表头数据\n \"CallId\": \"SO\", //必须,调用的单据识别号,\"PO\":表示采购订单\n \"CusNo\": \"KH0001\", //必须,厂商代号,有来源单或修改时非必须\n \"DepNo\": \"0001\", //非必须,部门代号\n \"SalNo\": \"LS\", //非必须,业务员代号\n \"EstDate\": \"{{t-erp-api-current-date}}\", //非必须,预交日,单据属性控制是否必填,默认必填\n \"Rem\": \"这是销售订单表头备注\" //非必须,备注\n },\n \"BodyData\": [ //必须,表身数据\n {\n \"PrdNo\": \"YL0001\", //必须,货品代号,有来源单或修改时非必须\n \"WhNo\": \"0001\", //非必须,仓库代号\n \"Qty\": 100, //必须,主数量,有来源单或修改时非必须\n \"Up\": 100, //非必须,主单价\n \"Rem\": \"这是销售订单表身摘要\" //非必须,摘要\n }\n ]\n}",
  1732. "options": {
  1733. "raw": {
  1734. "language": "json"
  1735. }
  1736. }
  1737. },
  1738. "url": {
  1739. "raw": "{{t-erp-api-url}}/Bill/SaveBill",
  1740. "host": [
  1741. "{{t-erp-api-url}}"
  1742. ],
  1743. "path": [
  1744. "Bill",
  1745. "SaveBill"
  1746. ]
  1747. },
  1748. "description": "新增销售订单"
  1749. },
  1750. "response": []
  1751. },
  1752. {
  1753. "name": "新增销售出库单",
  1754. "event": [
  1755. {
  1756. "listen": "prerequest",
  1757. "script": {
  1758. "exec": [
  1759. "// 【集合级前置脚本】设置当天日期为集合变量,格式:YYYY-MM-DD\r",
  1760. "// 1. 定义补0函数:日/月不足2位时自动补0(核心)\r",
  1761. "function addZero(num) {\r",
  1762. " return num < 10 ? '0' + num : num;\r",
  1763. "}\r",
  1764. "\r",
  1765. "// 2. 获取当前本地时间\r",
  1766. "const now = new Date();\r",
  1767. "\r",
  1768. "// 3. 解析年、月、日(月份+1,日/月调用补0函数)\r",
  1769. "const year = now.getFullYear(); // 年:4位数字(如2026)\r",
  1770. "const month = addZero(now.getMonth() + 1); // 月:补0后(如01/12)\r",
  1771. "const day = addZero(now.getDate()); // 日:补0后(如05/30)\r",
  1772. "\r",
  1773. "// 4. 拼接成YYYY-MM-DD格式\r",
  1774. "const currentDate = `${year}-${month}-${day}`;\r",
  1775. "\r",
  1776. "// 5. 设置为【环境变量】\r",
  1777. "pm.environment.set(\"t-erp-api-current-date\", currentDate);\r",
  1778. "\r",
  1779. "// 可选:打印日志,验证日期是否正确(Postman控制台/Jenkins日志可看)\r",
  1780. "console.log(`✅ 环境变量设置成功:t-erp-api-current-date = ${currentDate}`);"
  1781. ],
  1782. "type": "text/javascript",
  1783. "packages": {},
  1784. "requests": {}
  1785. }
  1786. },
  1787. {
  1788. "listen": "test",
  1789. "script": {
  1790. "exec": [
  1791. "// 1. 解析接口顶层的JSON响应(获取包含Data的原始对象)\r",
  1792. "var resJson = pm.response.json();\r",
  1793. "console.log(\"✅ 接口顶层JSON解析成功\");\r",
  1794. "\r",
  1795. "// 2. 提取Data字段的原始字符串,同时做非空判断\r",
  1796. "var dataRawStr = resJson.Data;\r",
  1797. "if (!dataRawStr) {\r",
  1798. " console.error(\"❌ Data字段为空/不存在,无法解析\");\r",
  1799. " pm.test(\"Data字段非空\", () => pm.expect(dataRawStr).to.not.be.empty);\r",
  1800. " return; // 终止后续脚本\r",
  1801. "}\r",
  1802. "\r",
  1803. "// 3. 核心:解析Data为JSON对象(含异常捕获+清理\\r\\n换行符)\r",
  1804. "var dataJson; // 用于存储解析后的Data JSON对象\r",
  1805. "try {\r",
  1806. " // 清理Data中的\\r\\n(全局替换),可选:可顺带去掉多余空格/\\t\r",
  1807. " var dataCleanStr = dataRawStr.replace(/\\r\\n/g, \"\").replace(/\\s+/g, \" \");\r",
  1808. " // 将清理后的字符串转为JSON对象(核心步骤)\r",
  1809. " dataJson = JSON.parse(dataCleanStr);\r",
  1810. " console.log(\"✅ Data字段成功转为JSON对象\", dataJson);\r",
  1811. "} catch (e) {\r",
  1812. " // 解析失败时打印错误日志+原始Data字符串,方便调试\r",
  1813. " console.error(\"❌ Data解析为JSON失败:\", e.message);\r",
  1814. " console.error(\"❌ Data原始字符串:\", dataRawStr);\r",
  1815. " pm.test(\"Data字段可正常解析为JSON\", () => pm.expect.fail(\"Data格式错误,解析失败\"));\r",
  1816. " return;\r",
  1817. "}\r",
  1818. "\r",
  1819. "// 4. 解析成功后:直接获取Data里的任意字段(按需使用)\r",
  1820. "// 示例:获取你Data中的TF_TABNAME、BIL_NO、BIL_ID等字段\r",
  1821. "var tfTabName = dataJson.TF_TABNAME;\r",
  1822. "var bilNo = dataJson.BIL_NO;\r",
  1823. "var bilId = dataJson.BIL_ID;\r",
  1824. "console.log(`📌 从Data中提取:TF_TABNAME=${tfTabName},BIL_NO=${bilNo},BIL_ID=${bilId}`);\r",
  1825. "\r",
  1826. "// 5. 可选:将解析后的Data JSON对象设置为环境/集合变量,供后续接口使用\r",
  1827. "pm.environment.set(\"t-erp-api-sa-bill-no\", bilNo); // 单独存储常用字段(推荐)\r",
  1828. "console.log(\"✅ 解析后的Data字段已存入环境变量\");\r",
  1829. "\r",
  1830. "// 可选:添加测试断言,验证Data中的字段(按需添加)\r",
  1831. "pm.test(\"✅ Data中TF_TABNAME字段存在且正确\", () => {\r",
  1832. " pm.expect(dataJson).to.have.property(\"TF_TABNAME\", \"TF_PSS\");\r",
  1833. "});"
  1834. ],
  1835. "type": "text/javascript",
  1836. "packages": {},
  1837. "requests": {}
  1838. }
  1839. }
  1840. ],
  1841. "request": {
  1842. "method": "POST",
  1843. "header": [
  1844. {
  1845. "key": "LoginId",
  1846. "value": "{{t-erp-api-login-id}}",
  1847. "type": "text"
  1848. },
  1849. {
  1850. "key": "sn",
  1851. "value": "{{t-erp-api-sn}}",
  1852. "type": "text"
  1853. }
  1854. ],
  1855. "body": {
  1856. "mode": "raw",
  1857. "raw": "{\n \"HeadData\": { //必须,表头数据\n \"CallId\": \"SA\", //必须,调用的单据识别号,\"SA\":表示销售出库单\n \"SalNo\": \"LS\", //非必须,业务员代号\n \"DepNo\": \"0001\" //非必须,部门代号\n },\n \"BodyData\": [ //必须,表身数据\n {\n \"BilId\": \"SO\", //必须,转入来源单识别号,\"PO\":表示采购订单\n \"BilNo\": \"{{t-erp-api-so-bill-no}}\", //必须,转入来源单单号\n \"BilItm\": 1 //必须,转入来源单项次\n }\n ]\n}",
  1858. "options": {
  1859. "raw": {
  1860. "language": "json"
  1861. }
  1862. }
  1863. },
  1864. "url": {
  1865. "raw": "{{t-erp-api-url}}/Bill/SaveBill",
  1866. "host": [
  1867. "{{t-erp-api-url}}"
  1868. ],
  1869. "path": [
  1870. "Bill",
  1871. "SaveBill"
  1872. ]
  1873. },
  1874. "description": "新增销售出库单"
  1875. },
  1876. "response": []
  1877. },
  1878. {
  1879. "name": "货品库存查询(报表)",
  1880. "request": {
  1881. "method": "GET",
  1882. "header": [
  1883. {
  1884. "key": "LoginId",
  1885. "value": "{{t-erp-api-login-id}}",
  1886. "type": "text"
  1887. },
  1888. {
  1889. "key": "PRD_NO",
  1890. "value": "YL0001",
  1891. "type": "text"
  1892. },
  1893. {
  1894. "key": "WH",
  1895. "value": "",
  1896. "type": "text"
  1897. },
  1898. {
  1899. "key": "PRD_LOC",
  1900. "value": "",
  1901. "type": "text"
  1902. },
  1903. {
  1904. "key": "BAT_NO",
  1905. "value": "",
  1906. "type": "text"
  1907. },
  1908. {
  1909. "key": "PRD_MARK",
  1910. "value": "",
  1911. "type": "text"
  1912. },
  1913. {
  1914. "key": "ISGROUPBYWH",
  1915. "value": "T",
  1916. "type": "text"
  1917. },
  1918. {
  1919. "key": "ISGROUPBYPRD_MARK",
  1920. "value": "",
  1921. "type": "text"
  1922. },
  1923. {
  1924. "key": "ISGROUPBYBAT_NO",
  1925. "value": "",
  1926. "type": "text"
  1927. },
  1928. {
  1929. "key": "ISGROUPBYPRD_LOC",
  1930. "value": "",
  1931. "type": "text"
  1932. }
  1933. ],
  1934. "url": {
  1935. "raw": "{{t-erp-api-url}}/TbrECC/GetPrdStockData",
  1936. "host": [
  1937. "{{t-erp-api-url}}"
  1938. ],
  1939. "path": [
  1940. "TbrECC",
  1941. "GetPrdStockData"
  1942. ]
  1943. },
  1944. "description": "货品库存查询(报表)"
  1945. },
  1946. "response": []
  1947. }
  1948. ],
  1949. "description": "采购订单->采购入库->销售订单->销售出库"
  1950. }
  1951. ],
  1952. "event": [
  1953. {
  1954. "listen": "prerequest",
  1955. "script": {
  1956. "type": "text/javascript",
  1957. "packages": {},
  1958. "requests": {},
  1959. "exec": [
  1960. ""
  1961. ]
  1962. }
  1963. },
  1964. {
  1965. "listen": "test",
  1966. "script": {
  1967. "type": "text/javascript",
  1968. "packages": {},
  1969. "requests": {},
  1970. "exec": [
  1971. ""
  1972. ]
  1973. }
  1974. }
  1975. ]
  1976. }