newparams.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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,FDeptId.FName,FPickerId.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,FPickingPeople_LT.FName",
  5. "LT_PRD_PMCWorkBench": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId_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. "STK_MISCELLANEOUS": "FID,FEntity_FEntryID,FEnchaseNum_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber"
  8. };
  9. export function getSearchParam(condition) {
  10. let FilterString = [{ //其他出库
  11. "Left": "(",
  12. "FieldName": "FDocumentStatus",
  13. "Compare": "105",
  14. "Value": "A",
  15. "Right": "",
  16. "Logic": 1
  17. },
  18. // {//审核中
  19. // "Left": "",
  20. // "FieldName": "FDocumentStatus",
  21. // "Compare": "105",
  22. // "Value": "B",
  23. // "Right": "",
  24. // "Logic": 1
  25. // },
  26. {
  27. "Left": "",
  28. "FieldName": "FDocumentStatus",
  29. "Compare": "105",
  30. "Value": "D",
  31. "Right": ")",
  32. "Logic": 0
  33. }, {
  34. "Left": "",
  35. "FieldName": "FStockOrgId.FNumber",
  36. "Compare": "67",
  37. "Value": condition.FStockOrgId,
  38. "Right": "",
  39. "Logic": 0
  40. },
  41. {
  42. "FieldName": "FBillNo",
  43. "Compare": "17",
  44. "Value": condition.billNo,
  45. "Left": "",
  46. "Right": "",
  47. "Logic": 0
  48. },
  49. {
  50. "Left": "",
  51. "FieldName": "FStockId.FName",
  52. "Compare": "17",
  53. "Value": "面料",
  54. "Right": "",
  55. "Logic": 0
  56. },
  57. {
  58. "FieldName": "FDate",
  59. "Compare": "39",
  60. "Value": condition.range[0],
  61. "Left": "(",
  62. "Right": "",
  63. "Logic": "0"
  64. },
  65. {
  66. "FieldName": "FDate",
  67. "Compare": "16",
  68. "Value": condition.range[1],
  69. "Left": "",
  70. "Right": ")",
  71. "Logic": "0"
  72. }
  73. ]
  74. let FieldKeys =
  75. "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId"
  76. console.log(condition.FBillType)
  77. if (condition.FBillType != null) { //领料
  78. FilterString.push({
  79. "Left": "",
  80. "FieldName": "FBillType",
  81. "Compare": "105",
  82. "Value": condition.FBillType,
  83. "Right": "",
  84. "Logic": 0
  85. });
  86. console.log('aaaa')
  87. FieldKeys =
  88. "FID,FWorkCenterId_LT.fname,FApplicantId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId"
  89. }
  90. if (condition.FormId == "STK_MisDelivery") { //其他出库
  91. FilterString.push({
  92. "Left": "",
  93. "FieldName": "FStockDirect",
  94. "Compare": "29",
  95. "Value": "GENERAL",
  96. "Right": "",
  97. "Logic": 0
  98. });
  99. FieldKeys =
  100. "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId,FDeptId.FName,FPickerId.FName"
  101. }
  102. if (condition.FormId == "SP_PickMtrl") { //简单生产领料单
  103. FieldKeys =
  104. "FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName"
  105. }
  106. if (condition.FormId == "PUR_MRB") { //采购退料单
  107. FieldKeys =
  108. "FID,FSupplierID.fname,FPURCHASERID.fname,FPURCHASEDEPTID.fname,FSTOCKERID.fname,FBillNo,FDate,FStockOrgId"
  109. }
  110. console.log(FieldKeys)
  111. return {
  112. "parameters": [{
  113. "FormId": condition.FormId,
  114. "FieldKeys": FieldKeys,
  115. "FilterString": FilterString
  116. }]
  117. }
  118. }
  119. export function getStorageSearchParam(condition) {
  120. let 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": "FStockDirect",
  137. "Compare": "29",
  138. "Value": "GENERAL",
  139. "Right": "",
  140. "Logic": 0
  141. }, {
  142. "Left": "(",
  143. "FieldName": "FEntryStoreType_LT.FDataValue",
  144. "Compare": "67",
  145. "Value": "自产入库",
  146. "Right": "",
  147. "Logic": 1
  148. }, {
  149. "Left": "",
  150. "FieldName": "FEntryStoreType_LT.FDataValue",
  151. "Compare": "67",
  152. "Value": "衬衣面料内部调入",
  153. "Right": ")",
  154. "Logic": 0
  155. }, {
  156. "Left": "",
  157. "FieldName": "FEnchaseNum_LT",
  158. "Compare": "67",
  159. "Value": condition.FEnchaseNum_LT,
  160. "Right": "",
  161. "Logic": 0
  162. }]
  163. return {
  164. "parameters": [{
  165. "FormId": condition.FormId,
  166. "FieldKeys": FieldKeysMap[condition.FormId],
  167. "FilterString": FilterString,
  168. }]
  169. }
  170. }
  171. export function getStorageByBillNoParam(condition) {
  172. return {
  173. "parameters": [{
  174. "FormId": condition.FormId,
  175. "FieldKeys": FieldKeysMap[condition.FormId],
  176. "FilterString": [{
  177. "Left": "",
  178. "FieldName": "FBillNo",
  179. "Compare": "338",
  180. "Value": condition.FBillNo,
  181. "Right": "",
  182. "Logic": 0
  183. }],
  184. }]
  185. }
  186. }
  187. export function getBillDetailListParam(condition) {
  188. console.log(condition)
  189. return {
  190. "parameters": [{
  191. "FormId": condition.FormId,
  192. "FieldKeys": FieldKeysMap[condition.FormId],
  193. "FilterString": [{
  194. "Left": "",
  195. "FieldName": "FID",
  196. "Compare": "338",
  197. "Value": condition.selectedFID,
  198. "Right": "",
  199. "Logic": 0
  200. }],
  201. }]
  202. }
  203. }
  204. // 定义一个函数来创建库存查询请求数据
  205. export function createInventoryQueryRequest(value) {
  206. return {
  207. parameters: [{
  208. FormId: "STK_Inventory",
  209. FieldKeys: "fID",
  210. FilterString: [{
  211. Left: "",
  212. FieldName: "FStockLocId.FF102029.FName",
  213. Compare: "67",
  214. Value: value,
  215. Right: "",
  216. Logic: 0
  217. },
  218. {
  219. Left: "",
  220. FieldName: "FBaseQty",
  221. Compare: "21",
  222. Value: "0",
  223. Right: "",
  224. Logic: 0
  225. }
  226. ]
  227. }]
  228. };
  229. }
  230. function getActualQtyKey(FormId) {
  231. const keyMap = {
  232. 'LT_PRD_PMCWorkBench': 'FActualQty',
  233. 'SP_PickMtrl': 'FActualQty',
  234. 'STK_MisDelivery': 'FQty',
  235. 'PUR_MRB': 'FRMREALQTY'
  236. };
  237. return keyMap[FormId] || 'FQty';
  238. }
  239. function createEntityObject(item, actualQtyKey) {
  240. return {
  241. "FEntryID": item["FEntity.FEntryID"],
  242. "FInventoryQty": item["FInventoryQty"],
  243. "FAuxPropId": {
  244. "FAUXPROPID__FF101501": {
  245. "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
  246. }
  247. },
  248. "FStockLocId": {
  249. "FSTOCKLOCID__FF102029": {
  250. "Fname": item["FStockLocId.FF102029.fname"]
  251. }
  252. },
  253. "FLot": {
  254. "FNumber": item["Flot.FNumber"]
  255. },
  256. "FENCHASENUM_LT": item["FENCHASENUM.LT"],
  257. [actualQtyKey]: item[actualQtyKey] // 使用动态键名
  258. };
  259. }
  260. export function getSaveParam(FormId, data, indexList) {
  261. const targetFID = data;
  262. const actualQtyKey = getActualQtyKey(FormId);
  263. const FEntityObjects = indexList
  264. .filter(item => item.FID === targetFID)
  265. .map(item => createEntityObject(item, actualQtyKey));
  266. const needUpdateFields = [
  267. "FInventoryQty",
  268. "FAuxPropId",
  269. "FStockLocId",
  270. "FIsScanFabric",
  271. "FLot",
  272. "FENCHASENUM_LT",
  273. actualQtyKey // 直接添加到数组中
  274. ];
  275. return {
  276. "parameters": [
  277. FormId,
  278. {
  279. "NeedUpDateFields": needUpdateFields,
  280. "NeedReturnFields": ["FID"],
  281. "IsDeleteEntry": "true",
  282. "SubSystemId": "",
  283. "IsVerifyBaseDataField": "false",
  284. "IsEntryBatchFill": "true",
  285. "ValidateFlag": "true",
  286. "NumberSearch": "true",
  287. "IsAutoAdjustField": "false",
  288. "InterationFlags": "",
  289. "IgnoreInterationFlag": "",
  290. "IsControlPrecision": "false",
  291. "ValidateRepeatJson": "false",
  292. "Model": {
  293. "FID": targetFID,
  294. "FIsScanFabric": true,
  295. "FEntity": FEntityObjects
  296. }
  297. }
  298. ]
  299. };
  300. }
  301. export function getSubmitParam(FormId, data) {
  302. const params = {
  303. "parameters": [
  304. FormId,
  305. {
  306. "CreateOrgId": 0,
  307. "Numbers": [],
  308. "Ids": data.toString(),
  309. "SelectedPostId": 0,
  310. "UseOrgId": 0,
  311. "NetworkCtrl": "",
  312. "IgnoreInterationFlag": ""
  313. }
  314. ]
  315. };
  316. console.log(params);
  317. return params;
  318. }
  319. export function getAuditParam(FormId, data) {
  320. const params = {
  321. "parameters": [
  322. FormId,
  323. {
  324. "CreateOrgId": 0,
  325. "Numbers": [],
  326. "Ids": data.toString(),
  327. "InterationFlags": "",
  328. "UseOrgId": 0,
  329. "NetworkCtrl": "",
  330. "IsVerifyProcInst": "true",
  331. "IgnoreInterationFlag": "",
  332. "UseBatControlTimes": "false"
  333. }
  334. ]
  335. }
  336. console.log(params)
  337. return params
  338. }