transferparams.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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"] || item["FAuxPropId.FF101501.FDataValue"]
  150. }
  151. },
  152. "FStockLocId": {
  153. "FSTOCKLOCID__FF102029": {
  154. "Fname": item["FStockLocId.FF102029.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 getCreateSaveParam(FormId, username, indexList) {
  165. const actualQtyKey = getActualQtyKey(FormId);
  166. const FEntityObjects = indexList
  167. .map(item => createEntityObject(item, actualQtyKey));
  168. const datetime = new Date().toISOString();
  169. const entry = indexList.map(getEntityParam);
  170. return {
  171. "parameters": [
  172. FormId,
  173. {
  174. "NeedUpDateFields": [],
  175. "NeedReturnFields": [],
  176. "IsDeleteEntry": "true",
  177. "SubSystemId": "",
  178. "IsVerifyBaseDataField": "false",
  179. "IsEntryBatchFill": "true",
  180. "ValidateFlag": "true",
  181. "NumberSearch": "true",
  182. "IsAutoAdjustField": "false",
  183. "InterationFlags": "",
  184. "IgnoreInterationFlag": "",
  185. "IsControlPrecision": "false",
  186. "ValidateRepeatJson": "false",
  187. "Model": {
  188. "FBillTypeID": {
  189. "FNUMBER": "ZJDB01_SYS"
  190. },
  191. "FBizType": "NORMAL",
  192. "FTransferDirect": "GENERAL",
  193. "FTransferBizType": "InnerOrgTransfer",
  194. "FStockOutOrgId": {
  195. "FNumber": "100"
  196. },
  197. "FOwnerTypeOutIdHead": "BD_OwnerOrg",
  198. "FOwnerOutIdHead": {
  199. "FNumber": "100"
  200. },
  201. "FStockOrgId": {
  202. "FNumber": "100"
  203. },
  204. "FIsIncludedTax": true,
  205. "FIsPriceExcludeTax": true,
  206. "FExchangeTypeId": {
  207. "FNUMBER": "HLTX01_SYS"
  208. },
  209. "FOwnerTypeIdHead": "BD_OwnerOrg",
  210. "FSETTLECURRID": {
  211. "FNUMBER": "PRE001"
  212. },
  213. "FExchangeRate": 1.0,
  214. "FOwnerIdHead": {
  215. "FNumber": "100"
  216. },
  217. "FStockerId": {
  218. "FNumber": username
  219. },
  220. "FDate": datetime,
  221. "FBaseCurrId": {
  222. "FNumber": "PRE001"
  223. },
  224. "FPrintNum_LT": 0,
  225. "FScanType": {
  226. "FNumber": "TransferInStockScan"
  227. },
  228. "FExtTransType_LT": {
  229. "FNumber": "ZCFX"
  230. },
  231. "FCreatorId": {
  232. "FName": username
  233. },
  234. "FCreateDate": datetime,
  235. "FWriteOffConsign": false,
  236. "FBillEntry": entry
  237. }
  238. }
  239. ]
  240. };
  241. }
  242. function getEntityParam(item) {
  243. return {
  244. "FENCHASENUM_LT": item.FCMKBarCode,
  245. "FRowType": "Standard",
  246. "FMaterialId": {
  247. "FNumber": item["FMaterialId.FNumber"]
  248. },
  249. "FCMKBarCode": item.FCMKBarCode,
  250. "FAuxPropId": {
  251. "FAUXPROPID__FF101501": {
  252. "FNumber": item["FAuxPropId.FF101501.FDataValue"]
  253. }
  254. },
  255. "FSrcStockId": {
  256. "FNumber": item["FStockId.FNumber"]
  257. },
  258. "FSrcStockLocId": {
  259. "FSRCSTOCKLOCID__FF102029": {
  260. "FNumber": item["FStockLocId.FF102029.FNumber"]
  261. }
  262. },
  263. "FDestStockId": {
  264. "FNumber": item["FDestStockId.FNumber"]
  265. },
  266. "FDestStockLocId": {
  267. "FDESTSTOCKLOCID__FF102029": {
  268. "FNumber": item["FDestStockLocId.FF102029.FNumber"]
  269. }
  270. },
  271. "FLot": {
  272. "FNumber": item["FLot.FNumber"]
  273. },
  274. "FUnitID": {
  275. "FNumber": item["FUnitID.FNumber"] || item["FBaseUnitId.FNumber"]
  276. },
  277. "FDestLot": {
  278. "FNumber": item["FLot.FNumber"]
  279. },
  280. "FQty": item.FQty || item.FBaseQty,
  281. "FKeeperTypeOutId": item.FKeeperTypeId,
  282. "FOwnerTypeId": item.FOwnerTypeId,
  283. "FKeeperOutId": {
  284. "FNumber": item["FKeeperId.FNumber"]
  285. },
  286. "FOwnerTypeOutId": item.FOwnerTypeId,
  287. "FISFREE": false,
  288. "FOwnerId": {
  289. "FNumber": item["FOwnerId.FNumber"]
  290. },
  291. "FOwnerOutId": {
  292. "FNumber": item["FOwnerId.FNumber"]
  293. },
  294. "FBaseUnitId": {
  295. "FNumber": item["FBaseUnitId.FNumber"]
  296. },
  297. "FSrcStockStatusId": {
  298. "FNumber": "KCZT01_SYS"
  299. },
  300. "FDestStockStatusId": {
  301. "FNumber": "KCZT01_SYS"
  302. },
  303. "FBaseQty": item.FBaseQty,
  304. "FKeeperTypeId": item.FKeeperTypeId,
  305. "FKeeperId": {
  306. "FNumber": item["FKeeperId.FNumber"]
  307. }
  308. };
  309. }
  310. export function getCreateSubmitParam(FormId, data) {
  311. const params = {
  312. "parameters": [
  313. FormId,
  314. {
  315. "CreateOrgId": 0,
  316. "Numbers": [],
  317. "Ids": data.toString(),
  318. "SelectedPostId": 0,
  319. "UseOrgId": 0,
  320. "NetworkCtrl": "",
  321. "IgnoreInterationFlag": ""
  322. }
  323. ]
  324. };
  325. console.log(params);
  326. return params;
  327. }
  328. export function getAuditParam(FormId, data) {
  329. const params = {
  330. "parameters": [
  331. FormId,
  332. {
  333. "CreateOrgId": 0,
  334. "Numbers": [],
  335. "Ids": data.toString(),
  336. "InterationFlags": "",
  337. "UseOrgId": 0,
  338. "NetworkCtrl": "",
  339. "IsVerifyProcInst": "true",
  340. "IgnoreInterationFlag": "",
  341. "UseBatControlTimes": "false"
  342. }
  343. ]
  344. }
  345. console.log(params)
  346. return params
  347. }
  348. //根据条形码查编号批号
  349. export function getFLotFNumber(lotCode) {
  350. return {
  351. parameters: [{
  352. FormId: "LT_BD_MtlLotCodeMap",
  353. FieldKeys: "FID,FNumber,FMaterialId.FNumber,FBPMaterialName,FLot.FNumber,FStockId.FName,FStockLocId.FF102029.FNumber",
  354. FilterString: [{
  355. "Left": "",
  356. "FieldName": "FNumber",
  357. "Compare": "67",
  358. "Value": lotCode,
  359. "Right": "",
  360. "Logic": 0
  361. },
  362. ]
  363. }]
  364. };
  365. }
  366. //根据编号批号查即时库存
  367. export function getInventory(lot, material) {
  368. return {
  369. parameters: [{
  370. FormId: "STK_Inventory",
  371. FieldKeys: "FStockLocId.FF102029.FNumber,FStockLocId.FF102029.FName,FStockName,FStockId.FNumber,FKeeperId.FNumber,FKeeperTypeId,FMaterialName,FBaseQty,FOwnerName,FOwnerId.FNumber,FOwnerTypeId,FAuxPropId.FF101501.FDataValue,FModel,FBaseUnitId.FNumber",
  372. FilterString: [{
  373. "Left": "",
  374. "FieldName": "FLot.FNumber",
  375. "Compare": "67",
  376. "Value": lot,
  377. "Right": "",
  378. "Logic": 0
  379. },
  380. {
  381. "Left": "",
  382. "FieldName": "FMaterialId.FNumber",
  383. "Compare": "67",
  384. "Value": material,
  385. "Right": "",
  386. "Logic": 0
  387. },
  388. {
  389. "Left": "",
  390. "FieldName": "FBaseQty",
  391. "Compare": "70",
  392. "Value": "0",
  393. "Right": "",
  394. "Logic": 0
  395. }
  396. ]
  397. }]
  398. };
  399. }