storageParams.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. // 定义字段映射
  2. const FieldKeysMap = {
  3. "STK_MISCELLANEOUS": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
  4. "STK_InStock": "FID,FInStockEntry_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FRealQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
  5. "STK_OEMInStock": "FID,FBillEntry_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
  6. "LT_PRD_PMCWorkBench": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FActualQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
  7. "SP_ReturnMtrl": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
  8. "STK_MisDelivery": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
  9. };
  10. export function getStorageSearchParam(condition) {
  11. let FilterString = [{
  12. "Left": "(",
  13. "FieldName": "FDocumentStatus",
  14. "Compare": "105",
  15. "Value": "A",
  16. "Right": "",
  17. "Logic": 1
  18. }, {
  19. "Left": "",
  20. "FieldName": "FDocumentStatus",
  21. "Compare": "105",
  22. "Value": "D",
  23. "Right": ")",
  24. "Logic": 0
  25. }, {
  26. "Left": "",
  27. "FieldName": "FStockDirect",
  28. "Compare": "29",
  29. "Value": "GENERAL",
  30. "Right": "",
  31. "Logic": 0
  32. }, {
  33. "Left": "(",
  34. "FieldName": "FEntryStoreType_LT.FDataValue",
  35. "Compare": "67",
  36. "Value": "自产入库",
  37. "Right": "",
  38. "Logic": 1
  39. }, {
  40. "Left": "",
  41. "FieldName": "FEntryStoreType_LT.FDataValue",
  42. "Compare": "67",
  43. "Value": "衬衣面料内部调入",
  44. "Right": ")",
  45. "Logic": 0
  46. }, {
  47. "Left": "",
  48. "FieldName": "FEnchaseNum_LT",
  49. "Compare": "67",
  50. "Value": condition.FEnchaseNum_LT,
  51. "Right": "",
  52. "Logic": 0
  53. }]
  54. if (condition.FormId == "STK_InStock" || condition.FormId == "STK_OEMInStock"||condition.FormId == "SP_ReturnMtrl") {
  55. FilterString = [{
  56. "Left": "(",
  57. "FieldName": "FDocumentStatus",
  58. "Compare": "105",
  59. "Value": "A",
  60. "Right": "",
  61. "Logic": 1
  62. }, {
  63. "Left": "",
  64. "FieldName": "FDocumentStatus",
  65. "Compare": "105",
  66. "Value": "D",
  67. "Right": ")",
  68. "Logic": 0
  69. }, {
  70. "Left": "",
  71. "FieldName": "FEnchaseNum_LT",
  72. "Compare": "67",
  73. "Value": condition.FEnchaseNum_LT,
  74. "Right": "",
  75. "Logic": 0
  76. }]
  77. }
  78. if (condition.FormId == "LT_PRD_PMCWorkBench") { //
  79. FilterString = [{
  80. "Left": "(",
  81. "FieldName": "FDocumentStatus",
  82. "Compare": "105",
  83. "Value": "A",
  84. "Right": "",
  85. "Logic": 1
  86. }, {
  87. "Left": "",
  88. "FieldName": "FDocumentStatus",
  89. "Compare": "105",
  90. "Value": "D",
  91. "Right": ")",
  92. "Logic": 0
  93. }, {
  94. "Left": "",
  95. "FieldName": "FEnchaseNum_LT",
  96. "Compare": "67",
  97. "Value": condition.FEnchaseNum_LT,
  98. "Right": "",
  99. "Logic": 0
  100. },
  101. {
  102. "Left": "",
  103. "FieldName": "FStockId.FName",
  104. "Compare": "17",
  105. "Value": "面料",
  106. "Right": "",
  107. "Logic": 0
  108. },
  109. {
  110. "Left": "",
  111. "FieldName": "FBillType",
  112. "Compare": "105",
  113. "Value": "d43d7e5b9def82fd11e3e603ca986cd9",
  114. "Right": "",
  115. "Logic": 0
  116. }
  117. ]
  118. }
  119. if (condition.FormId == "STK_MisDelivery") { //
  120. FilterString = [{
  121. "Left": "(",
  122. "FieldName": "FDocumentStatus",
  123. "Compare": "105",
  124. "Value": "A",
  125. "Right": "",
  126. "Logic": 1
  127. }, {
  128. "Left": "",
  129. "FieldName": "FDocumentStatus",
  130. "Compare": "105",
  131. "Value": "D",
  132. "Right": ")",
  133. "Logic": 0
  134. }, {
  135. "Left": "",
  136. "FieldName": "FEnchaseNum_LT",
  137. "Compare": "67",
  138. "Value": condition.FEnchaseNum_LT,
  139. "Right": "",
  140. "Logic": 0
  141. },
  142. {
  143. "Left": "",
  144. "FieldName": "FStockId.FName",
  145. "Compare": "17",
  146. "Value": "面料",
  147. "Right": "",
  148. "Logic": 0
  149. },
  150. {
  151. "Left": "",
  152. "FieldName": "FStockDirect",
  153. "Compare": "29",
  154. "Value": "RETURN",
  155. "Right": "",
  156. "Logic": 0
  157. }
  158. ]
  159. }
  160. return {
  161. "parameters": [{
  162. "FormId": condition.FormId,
  163. "FieldKeys": FieldKeysMap[condition.FormId],
  164. "FilterString": FilterString,
  165. }]
  166. }
  167. }
  168. export function getStorageByBillNoParam(condition) {
  169. return {
  170. "parameters": [{
  171. "FormId": condition.FormId,
  172. "FieldKeys": FieldKeysMap[condition.FormId],
  173. "FilterString": [{
  174. "Left": "",
  175. "FieldName": "FBillNo",
  176. "Compare": "338",
  177. "Value": condition.FBillNo,
  178. "Right": "",
  179. "Logic": 0
  180. }],
  181. }]
  182. }
  183. }
  184. function createEntityObject(item, FEntryIDKey) {
  185. return {
  186. "FEntryID": item[FEntryIDKey+".FEntryID"],
  187. // "FInventoryQty": item["FInventoryQty"],
  188. // "FAuxPropId": {
  189. // "FAUXPROPID__FF101501": {
  190. // "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
  191. // }
  192. // },
  193. "FStockLocId": {
  194. "FSTOCKLOCID__FF102029": {
  195. "Fnumber": item["FStockLocId.FF102029.FNumber"]
  196. }
  197. },
  198. // "FLot": {
  199. // "FNumber": item["Flot.FNumber"]
  200. // },
  201. // "FENCHASENUM_LT": item["FENCHASENUM.LT"],
  202. // [actualQtyKey]: item[actualQtyKey] // 使用动态键名
  203. };
  204. }
  205. function getFEntryIDKey(FormId) {
  206. const keyMap = {
  207. 'STK_MISCELLANEOUS': 'FEntity',
  208. 'STK_InStock': 'FInStockEntry',
  209. 'STK_OEMInStock': 'FBillEntry',
  210. 'LT_PRD_PMCWorkBench': 'FEntity',
  211. 'SP_ReturnMtrl': 'FEntity',
  212. 'STK_MisDelivery': 'FEntity',
  213. };
  214. return keyMap[FormId];
  215. }
  216. export function getSaveParam(FormId, data, indexList) {
  217. const targetFID = data;
  218. const FEntryIDKey = getFEntryIDKey(FormId);
  219. const FEntityObjects = indexList
  220. .filter(item => item.FID === targetFID)
  221. .map(item => createEntityObject(item,FEntryIDKey));
  222. const needUpdateFields = [
  223. // "FInventoryQty",
  224. // "FAuxPropId",
  225. "FStockLocId",
  226. "FIsScanFabric",
  227. // "FLot",
  228. // "FENCHASENUM_LT",
  229. // actualQtyKey // 直接添加到数组中
  230. ];
  231. return {
  232. "parameters": [
  233. FormId,
  234. {
  235. "NeedUpDateFields": needUpdateFields,
  236. "NeedReturnFields": ["FID"],
  237. "IsDeleteEntry": "true",
  238. "SubSystemId": "",
  239. "IsVerifyBaseDataField": "false",
  240. "IsEntryBatchFill": "true",
  241. "ValidateFlag": "true",
  242. "NumberSearch": "true",
  243. "IsAutoAdjustField": "false",
  244. "InterationFlags": "",
  245. "IgnoreInterationFlag": "",
  246. "IsControlPrecision": "false",
  247. "ValidateRepeatJson": "false",
  248. "Model": {
  249. "FID": targetFID,
  250. "FIsScanFabric": true,
  251. [FEntryIDKey]: FEntityObjects
  252. }
  253. }
  254. ]
  255. };
  256. }
  257. export function getSubmitParam(FormId, data) {
  258. const params = {
  259. "parameters": [
  260. FormId,
  261. {
  262. "CreateOrgId": 0,
  263. "Numbers": [],
  264. "Ids": data.toString(),
  265. "SelectedPostId": 0,
  266. "UseOrgId": 0,
  267. "NetworkCtrl": "",
  268. "IgnoreInterationFlag": ""
  269. }
  270. ]
  271. };
  272. console.log(params);
  273. return params;
  274. }
  275. export function getAuditParam(FormId, data) {
  276. const params = {
  277. "parameters": [
  278. FormId,
  279. {
  280. "CreateOrgId": 0,
  281. "Numbers": [],
  282. "Ids": data.toString(),
  283. "InterationFlags": "",
  284. "UseOrgId": 0,
  285. "NetworkCtrl": "",
  286. "IsVerifyProcInst": "true",
  287. "IgnoreInterationFlag": "",
  288. "UseBatControlTimes": "false"
  289. }
  290. ]
  291. }
  292. console.log(params)
  293. return params
  294. }