newparams.js 10 KB

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