newparams.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. // 定义字段映射
  2. const FieldKeysMap = {
  3. "STK_MisDelivery": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId.fname,FDate,FEntryNote,FPickingPeople_LT.fname,FSTOCKERID.fname,FWorkDeptId_LT.fname",
  4. "SP_PickMtrl": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId.fname,FEntrtyMemo,FDate,FPickerId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname",
  5. "LT_PRD_PMCWorkBench": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FEWorkCenterId_LT.fname,FEntrtyMemo,FDate,FApplicantId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname",
  6. "PUR_MRB": "FID,FPURMRBENTRY_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FInventoryQty,FENCHASENUM_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FDate,FSTOCKERID.fname,FStockId.FNumber,FRMREALQTY,FFabricOrderNo,FPURCHASERID.fname"
  7. };
  8. export function getSearchParam(condition) {
  9. let FilterString = [{ //其他出库
  10. "Left": "(",
  11. "FieldName": "FDocumentStatus",
  12. "Compare": "105",
  13. "Value": "A",
  14. "Right": "",
  15. "Logic": 1
  16. },
  17. // {//审核中
  18. // "Left": "",
  19. // "FieldName": "FDocumentStatus",
  20. // "Compare": "105",
  21. // "Value": "B",
  22. // "Right": "",
  23. // "Logic": 1
  24. // },
  25. {
  26. "Left": "",
  27. "FieldName": "FDocumentStatus",
  28. "Compare": "105",
  29. "Value": "D",
  30. "Right": ")",
  31. "Logic": 0
  32. }, {
  33. "Left": "",
  34. "FieldName": "FStockOrgId.FNumber",
  35. "Compare": "67",
  36. "Value": condition.FStockOrgId,
  37. "Right": "",
  38. "Logic": 0
  39. },
  40. {
  41. "FieldName": "FBillNo",
  42. "Compare": "17",
  43. "Value": condition.billNo,
  44. "Left": "",
  45. "Right": "",
  46. "Logic": 0
  47. },
  48. {
  49. "Left": "",
  50. "FieldName": "FStockId.FName",
  51. "Compare": "17",
  52. "Value": "面料",
  53. "Right": "",
  54. "Logic": 0
  55. },
  56. {
  57. "FieldName": "FDate",
  58. "Compare": "39",
  59. "Value": condition.range[0],
  60. "Left": "(",
  61. "Right": "",
  62. "Logic": "0"
  63. },
  64. {
  65. "FieldName": "FDate",
  66. "Compare": "16",
  67. "Value": condition.range[1],
  68. "Left": "",
  69. "Right": ")",
  70. "Logic": "0"
  71. }
  72. ]
  73. let FieldKeys =
  74. "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId"
  75. console.log(condition.FBillType)
  76. if (condition.FBillType != null) { //领料
  77. FilterString.push({
  78. "Left": "",
  79. "FieldName": "FBillType",
  80. "Compare": "105",
  81. "Value": condition.FBillType,
  82. "Right": "",
  83. "Logic": 0
  84. });
  85. console.log('aaaa')
  86. FieldKeys =
  87. "FID,FWorkCenterId_LT.fname,FApplicantId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId"
  88. }
  89. if (condition.FormId == "STK_MisDelivery") { //其他出库
  90. FilterString.push({
  91. "Left": "",
  92. "FieldName": "FStockDirect",
  93. "Compare": "29",
  94. "Value": "GENERAL",
  95. "Right": "",
  96. "Logic": 0
  97. });
  98. FieldKeys =
  99. "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId"
  100. }
  101. if (condition.FormId == "SP_PickMtrl") { //简单生产领料单
  102. FieldKeys =
  103. "FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId"
  104. }
  105. if (condition.FormId == "PUR_MRB") { //采购退料单
  106. FieldKeys =
  107. "FID,FSupplierID.fname,FPURCHASERID.fname,FPURCHASEDEPTID.fname,FSTOCKERID.fname,FBillNo,FDate,FStockOrgId"
  108. }
  109. console.log(FieldKeys)
  110. return {
  111. "parameters": [{
  112. "FormId": condition.FormId,
  113. "FieldKeys": FieldKeys,
  114. "FilterString": FilterString
  115. }]
  116. }
  117. }
  118. export function getBillDetailListParam(condition) {
  119. console.log(condition)
  120. // let FieldKeys = ""; // 在外部定义
  121. // if (condition.FormId == "STK_MisDelivery") { //其他出库
  122. // FieldKeys =
  123. // "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId.fname,FDate,FEntryNote,FPickingPeople_LT.fname,FSTOCKERID.fname,FWorkDeptId_LT.fname"
  124. // }
  125. // if (condition.FormId == "SP_PickMtrl") { //简单生产领料单
  126. // FieldKeys =
  127. // "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId.fname,FEntrtyMemo,FDate,FPickerId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname"
  128. // }
  129. // if (condition.FormId == "LT_PRD_PMCWorkBench") { //生产领料料管平台
  130. // FieldKeys =
  131. // "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FEWorkCenterId_LT.fname,FEntrtyMemo,FDate,FApplicantId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname"
  132. // }
  133. //"FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FEWorkCenterId_LT.fname,FEntrtyMemo,FDate,FApplicantId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname"
  134. return {
  135. "parameters": [{
  136. "FormId": condition.FormId,
  137. "FieldKeys": FieldKeysMap[condition.FormId],
  138. "FilterString": [{
  139. "Left": "",
  140. "FieldName": "FID",
  141. "Compare": "338",
  142. "Value": condition.selectedFID,
  143. "Right": "",
  144. "Logic": 0
  145. }],
  146. }]
  147. }
  148. }
  149. // 定义一个函数来创建库存查询请求数据
  150. export function createInventoryQueryRequest(value) {
  151. return {
  152. parameters: [{
  153. FormId: "STK_Inventory",
  154. FieldKeys: "fID",
  155. FilterString: [{
  156. Left: "",
  157. FieldName: "FStockLocId.FF102029.FName",
  158. Compare: "67",
  159. Value: value,
  160. Right: "",
  161. Logic: 0
  162. },
  163. {
  164. Left: "",
  165. FieldName: "FBaseQty",
  166. Compare: "21",
  167. Value: "0",
  168. Right: "",
  169. Logic: 0
  170. }
  171. ]
  172. }]
  173. };
  174. }
  175. function getActualQtyKey(FormId) {
  176. const keyMap = {
  177. 'LT_PRD_PMCWorkBench': 'FActualQty',
  178. 'SP_PickMtrl': 'FActualQty',
  179. 'STK_MisDelivery': 'FQty',
  180. 'PUR_MRB': 'FRMREALQTY'
  181. };
  182. return keyMap[FormId] || 'FQty';
  183. }
  184. function createEntityObject(item, actualQtyKey) {
  185. return {
  186. "FEntryID": item["FEntity.FEntryID"],
  187. "FInventoryQty": item["FInventoryQty"],
  188. "FAuxPropId": {
  189. "FAUXPROPID__FF101501": {
  190. "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
  191. }
  192. },
  193. "FStockLocId": {
  194. "FSTOCKLOCID__FF102029": {
  195. "Fname": item["FStockLocId.FF102029.fname"]
  196. }
  197. },
  198. "FLot": {
  199. "FNumber": item["Flot.FNumber"]
  200. },
  201. "FENCHASENUM_LT": item["FENCHASENUM.LT"],
  202. [actualQtyKey]: item[actualQtyKey] // 使用动态键名
  203. };
  204. }
  205. export function getSaveParam(FormId, data, indexList) {
  206. const targetFID = data;
  207. const actualQtyKey = getActualQtyKey(FormId);
  208. const FEntityObjects = indexList
  209. .filter(item => item.FID === targetFID)
  210. .map(item => createEntityObject(item, actualQtyKey));
  211. const needUpdateFields = [
  212. "FInventoryQty",
  213. "FAuxPropId",
  214. "FStockLocId",
  215. "FIsScanFabric",
  216. "FLot",
  217. "FENCHASENUM_LT",
  218. actualQtyKey // 直接添加到数组中
  219. ];
  220. return {
  221. "parameters": [
  222. FormId,
  223. {
  224. "NeedUpDateFields": needUpdateFields,
  225. "NeedReturnFields": ["FID"],
  226. "IsDeleteEntry": "true",
  227. "SubSystemId": "",
  228. "IsVerifyBaseDataField": "false",
  229. "IsEntryBatchFill": "true",
  230. "ValidateFlag": "true",
  231. "NumberSearch": "true",
  232. "IsAutoAdjustField": "false",
  233. "InterationFlags": "",
  234. "IgnoreInterationFlag": "",
  235. "IsControlPrecision": "false",
  236. "ValidateRepeatJson": "false",
  237. "Model": {
  238. "FID": targetFID,
  239. "FIsScanFabric": true,
  240. "FEntity": FEntityObjects
  241. }
  242. }
  243. ]
  244. };
  245. }
  246. export function getSubmitParam(FormId, data) {
  247. const params = {
  248. "parameters": [
  249. FormId,
  250. {
  251. "CreateOrgId": 0,
  252. "Numbers": [],
  253. "Ids": data.toString(),
  254. "SelectedPostId": 0,
  255. "UseOrgId": 0,
  256. "NetworkCtrl": "",
  257. "IgnoreInterationFlag": ""
  258. }
  259. ]
  260. };
  261. console.log(params);
  262. return params;
  263. }
  264. export function getAuditParam(FormId, data) {
  265. const params = {
  266. "parameters": [
  267. FormId,
  268. {
  269. "CreateOrgId": 0,
  270. "Numbers": [],
  271. "Ids": data.toString(),
  272. "InterationFlags": "",
  273. "UseOrgId": 0,
  274. "NetworkCtrl": "",
  275. "IsVerifyProcInst": "true",
  276. "IgnoreInterationFlag": "",
  277. "UseBatControlTimes": "false"
  278. }
  279. ]
  280. }
  281. console.log(params)
  282. return params
  283. }