transferparams.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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 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 datetime = new Date().toISOString();
  171. return {
  172. "parameters": [
  173. FormId,
  174. {
  175. "NeedUpDateFields": [],
  176. "NeedReturnFields": [],
  177. "IsDeleteEntry": "true",
  178. "SubSystemId": "",
  179. "IsVerifyBaseDataField": "false",
  180. "IsEntryBatchFill": "true",
  181. "ValidateFlag": "true",
  182. "NumberSearch": "true",
  183. "IsAutoAdjustField": "false",
  184. "InterationFlags": "",
  185. "IgnoreInterationFlag": "",
  186. "IsControlPrecision": "false",
  187. "ValidateRepeatJson": "false",
  188. "Model": {
  189. "FID": 0,
  190. "FBillTypeID": {
  191. "FNUMBER": "ZJDB01_SYS"
  192. },
  193. "FBizType": "NORMAL",
  194. "FTransferDirect": "GENERAL",
  195. "FTransferBizType": "InnerOrgTransfer",
  196. "FStockOutOrgId": {
  197. "FNumber": "100"
  198. },
  199. "FOwnerTypeOutIdHead": "BD_OwnerOrg",
  200. "FOwnerOutIdHead": {
  201. "FNumber": "100"
  202. },
  203. "FStockOrgId": {
  204. "FNumber": "100"
  205. },
  206. "FIsIncludedTax": true,
  207. "FIsPriceExcludeTax": true,
  208. "FExchangeTypeId": {
  209. "FNUMBER": "HLTX01_SYS"
  210. },
  211. "FOwnerTypeIdHead": "BD_OwnerOrg",
  212. "FSETTLECURRID": {
  213. "FNUMBER": "PRE001"
  214. },
  215. "FExchangeRate": 1.0,
  216. "FOwnerIdHead": {
  217. "FNumber": "100"
  218. },
  219. "FStockerId": {
  220. "FNumber": username
  221. },
  222. "FDate": datetime,
  223. "FBaseCurrId": {
  224. "FNumber": "PRE001"
  225. },
  226. "FPrintNum_LT": 0,
  227. "FScanType": {
  228. "FNumber": "TransferInStockScan"
  229. },
  230. "FExtTransType_LT": {
  231. "FNumber": "ZCFX"
  232. },
  233. "FWriteOffConsign": false,
  234. "FBillEntry": FEntityObjects
  235. }
  236. }
  237. ]
  238. };
  239. }
  240. export function getCreateSubmitParam(FormId, data) {
  241. const params = {
  242. "parameters": [
  243. FormId,
  244. {
  245. "CreateOrgId": 0,
  246. "Numbers": [],
  247. "Ids": data.toString(),
  248. "SelectedPostId": 0,
  249. "UseOrgId": 0,
  250. "NetworkCtrl": "",
  251. "IgnoreInterationFlag": ""
  252. }
  253. ]
  254. };
  255. console.log(params);
  256. return params;
  257. }
  258. export function getAuditParam(FormId, data) {
  259. const params = {
  260. "parameters": [
  261. FormId,
  262. {
  263. "CreateOrgId": 0,
  264. "Numbers": [],
  265. "Ids": data.toString(),
  266. "InterationFlags": "",
  267. "UseOrgId": 0,
  268. "NetworkCtrl": "",
  269. "IsVerifyProcInst": "true",
  270. "IgnoreInterationFlag": "",
  271. "UseBatControlTimes": "false"
  272. }
  273. ]
  274. }
  275. console.log(params)
  276. return params
  277. }
  278. //根据条形码查编号批号
  279. export function getFLotFNumber(lotCode) {
  280. return {
  281. parameters: [{
  282. FormId: "LT_BD_MtlLotCodeMap",
  283. FieldKeys: "FID,FNumber,FMaterialId.FNumber,FBPMaterialName,FLot.FNumber,FStockId.FName,FStockLocId.FF102029.FNumber",
  284. FilterString: [{
  285. "Left": "",
  286. "FieldName": "FNumber",
  287. "Compare": "67",
  288. "Value": lotCode,
  289. "Right": "",
  290. "Logic": 0
  291. },
  292. ]
  293. }]
  294. };
  295. }
  296. //根据编号批号查即时库存
  297. export function getInventory(lot, material) {
  298. return {
  299. parameters: [{
  300. FormId: "STK_Inventory",
  301. FieldKeys: "FStockLocId.FF102029.FNumber,FStockLocId.FF102029.FName,FStockName,FMaterialName,FBaseQty,FOwnerName,FOwnerTypeId,FAuxPropId.FF101501.FDataValue,FModel",
  302. FilterString: [{
  303. "Left": "",
  304. "FieldName": "FLot.FNumber",
  305. "Compare": "67",
  306. "Value": lot,
  307. "Right": "",
  308. "Logic": 0
  309. },
  310. {
  311. "Left": "",
  312. "FieldName": "FMaterialId.FNumber",
  313. "Compare": "67",
  314. "Value": material,
  315. "Right": "",
  316. "Logic": 0
  317. },
  318. {
  319. "Left": "",
  320. "FieldName": "FBaseQty",
  321. "Compare": "70",
  322. "Value": "0",
  323. "Right": "",
  324. "Logic": 0
  325. }
  326. ]
  327. }]
  328. };
  329. }