transferparams.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. // 定义字段映射
  2. const FieldKeysMap = {
  3. "STK_TransferDirect": "FID,FSrcStockLocId.FF102029.FName,FSrcStockId.FName,FDestStockId.FName,FMaterialId.FNumber,FBOXNO_LT,FQty,FENCHASENUM_LT,FAuxPropId.FF101501.FDataValue,FLot.FNumber,FNoteEntry,FBillNo,FStockerId.FName,FDate,FDestStockId.FNumber"
  4. };
  5. export function getSearchParam(condition) {
  6. let FilterString = [{
  7. "FieldName": "FDocumentStatus",
  8. "Compare": "105",
  9. "Value": "A",
  10. "Left": "(",
  11. "Right": "",
  12. "Logic": 1
  13. },
  14. {
  15. "FieldName": "FDocumentStatus",
  16. "Compare": "105",
  17. "Value": "D",
  18. "Left": "",
  19. "Right": ")",
  20. "Logic": 0
  21. },
  22. {
  23. "FieldName": "FSrcStockId.FName",
  24. "Compare": "17",
  25. "Value": "面料",
  26. "Left": "",
  27. "Right": "",
  28. "Logic": 0
  29. },
  30. {
  31. "FieldName": "FBillNo",
  32. "Compare": "17",
  33. "Value": condition.billNo,
  34. "Left": "",
  35. "Right": "",
  36. "Logic": 0
  37. },
  38. {
  39. "FieldName": "FTransferDirect",
  40. "Compare": "29",
  41. "Value": "GENERAL",
  42. "Left": "",
  43. "Right": "",
  44. "Logic": 0
  45. },
  46. {
  47. "FieldName": "FScanType.FDataValue",
  48. "Compare": "67",
  49. "Value": "调拨入库扫描",
  50. "Left": "(",
  51. "Right": "",
  52. "Logic": 1
  53. },
  54. {
  55. "FieldName": "FScanType.FDataValue",
  56. "Compare": "67",
  57. "Value": "调拨出库扫描",
  58. "Left": "",
  59. "Right": ")",
  60. "Logic": 0
  61. },
  62. {
  63. "FieldName": "FDate",
  64. "Compare": "39",
  65. "Value": condition.range[0],
  66. "Left": "(",
  67. "Right": "",
  68. "Logic": "0"
  69. },
  70. {
  71. "FieldName": "FDate",
  72. "Compare": "16",
  73. "Value": condition.range[1],
  74. "Left": "",
  75. "Right": ")",
  76. "Logic": "0"
  77. }
  78. ]
  79. let FieldKeys =
  80. "FID,FSrcStockLocId.FF102029.FName,FSrcStockId.FName,FDestStockId.FName,FMaterialId.FNumber,FBOXNO_LT,FQty,FENCHASENUM_LT,FAuxPropId.FF101501.FDataValue,FLot.FNumber,FNoteEntry,FBillNo,FStockerId.FName,FDate,FDestStockId.FNumber"
  81. console.log(condition.FBillType)
  82. console.log(FieldKeys)
  83. return {
  84. "parameters": [{
  85. "FormId": condition.FormId,
  86. "FieldKeys": FieldKeys,
  87. "FilterString": FilterString
  88. }]
  89. }
  90. }
  91. export function getBillDetailListParam(condition) {
  92. console.log(condition)
  93. return {
  94. "parameters": [{
  95. "FormId": condition.FormId,
  96. "FieldKeys": FieldKeysMap[condition.FormId],
  97. "FilterString": [{
  98. "Left": "",
  99. "FieldName": "FID",
  100. "Compare": "338",
  101. "Value": condition.selectedFID,
  102. "Right": "",
  103. "Logic": 0
  104. }],
  105. }]
  106. }
  107. }
  108. // 定义一个函数来创建库存查询请求数据
  109. export function createInventoryQueryRequest(value) {
  110. return {
  111. parameters: [{
  112. FormId: "STK_TransferDirect",
  113. FieldKeys: "fID",
  114. FilterString: [{
  115. Left: "",
  116. FieldName: "FSrcStockLocId.FF102029.FName",
  117. Compare: "67",
  118. Value: value,
  119. Right: "",
  120. Logic: 0
  121. },
  122. // {
  123. // Left: "",
  124. // FieldName: "FBaseQty",
  125. // Compare: "21",
  126. // Value: "0",
  127. // Right: "",
  128. // Logic: 0
  129. // }
  130. ]
  131. }]
  132. };
  133. }
  134. function getActualQtyKey(FormId) {
  135. const keyMap = {
  136. 'LT_PRD_PMCWorkBench': 'FActualQty',
  137. 'SP_PickMtrl': 'FActualQty',
  138. 'STK_MisDelivery': 'FQty',
  139. 'PUR_MRB': 'FRMREALQTY'
  140. };
  141. return keyMap[FormId] || 'FQty';
  142. }
  143. function createEntityObject(item, actualQtyKey) {
  144. return {
  145. "FEntryID": item["FEntity.FEntryID"],
  146. "FInventoryQty": item["FInventoryQty"],
  147. "FAuxPropId": {
  148. "FAUXPROPID__FF101501": {
  149. "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
  150. }
  151. },
  152. "FStockLocId": {
  153. "FSTOCKLOCID__FF102029": {
  154. "Fname": item["FStockLocId.FF102029.fname"]
  155. }
  156. },
  157. "FLot": {
  158. "FNumber": item["Flot.FNumber"]
  159. },
  160. "FENCHASENUM_LT": item["FENCHASENUM.LT"],
  161. [actualQtyKey]: item[actualQtyKey] // 使用动态键名
  162. };
  163. }
  164. export function getSaveParam(FormId, data, indexList) {
  165. const targetFID = data;
  166. const actualQtyKey = getActualQtyKey(FormId);
  167. const FEntityObjects = indexList
  168. .filter(item => item.FID === targetFID)
  169. .map(item => createEntityObject(item, actualQtyKey));
  170. const needUpdateFields = [
  171. "FInventoryQty",
  172. "FAuxPropId",
  173. "FStockLocId",
  174. "FIsScanFabric",
  175. "FLot",
  176. "FENCHASENUM_LT",
  177. actualQtyKey // 直接添加到数组中
  178. ];
  179. return {
  180. "parameters": [
  181. FormId,
  182. {
  183. "NeedUpDateFields": needUpdateFields,
  184. "NeedReturnFields": ["FID"],
  185. "IsDeleteEntry": "true",
  186. "SubSystemId": "",
  187. "IsVerifyBaseDataField": "false",
  188. "IsEntryBatchFill": "true",
  189. "ValidateFlag": "true",
  190. "NumberSearch": "true",
  191. "IsAutoAdjustField": "false",
  192. "InterationFlags": "",
  193. "IgnoreInterationFlag": "",
  194. "IsControlPrecision": "false",
  195. "ValidateRepeatJson": "false",
  196. "Model": {
  197. "FID": targetFID,
  198. "FIsScanFabric": true,
  199. "FEntity": FEntityObjects
  200. }
  201. }
  202. ]
  203. };
  204. }
  205. export function getSubmitParam(FormId, data) {
  206. const params = {
  207. "parameters": [
  208. FormId,
  209. {
  210. "CreateOrgId": 0,
  211. "Numbers": [],
  212. "Ids": data.toString(),
  213. "SelectedPostId": 0,
  214. "UseOrgId": 0,
  215. "NetworkCtrl": "",
  216. "IgnoreInterationFlag": ""
  217. }
  218. ]
  219. };
  220. console.log(params);
  221. return params;
  222. }
  223. export function getAuditParam(FormId, data) {
  224. const params = {
  225. "parameters": [
  226. FormId,
  227. {
  228. "CreateOrgId": 0,
  229. "Numbers": [],
  230. "Ids": data.toString(),
  231. "InterationFlags": "",
  232. "UseOrgId": 0,
  233. "NetworkCtrl": "",
  234. "IsVerifyProcInst": "true",
  235. "IgnoreInterationFlag": "",
  236. "UseBatControlTimes": "false"
  237. }
  238. ]
  239. }
  240. console.log(params)
  241. return params
  242. }