checkParams.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. // 定义字段映射
  2. const FieldKeysMap = {
  3. "LT_STK_StockCount": "FID,FEntity_FEntryID,FBillNo,FIsCheck,FCheckTag,FStockId.fnumber,FStockId.FName,FStockLocId.FF102029.fname,FMaterialId.fnumber,FEnchaseNo,FBoxNo,FCheckNum,FAccountNum"
  4. };
  5. export function getSearchParam(condition) {
  6. let FilterString = [{ //其他出库
  7. "Left": "(",
  8. "FieldName": "FDocumentStatus",
  9. "Compare": "105",
  10. "Value": "A",
  11. "Right": "",
  12. "Logic": 1
  13. },
  14. // {//审核中
  15. // "Left": "",
  16. // "FieldName": "FDocumentStatus",
  17. // "Compare": "105",
  18. // "Value": "B",
  19. // "Right": "",
  20. // "Logic": 1
  21. // },
  22. {
  23. "Left": "",
  24. "FieldName": "FDocumentStatus",
  25. "Compare": "105",
  26. "Value": "D",
  27. "Right": ")",
  28. "Logic": 0
  29. }, {
  30. "Left": "",
  31. "FieldName": "FStockOrgId.FNumber",
  32. "Compare": "67",
  33. "Value": condition.FStockOrgId,
  34. "Right": "",
  35. "Logic": 0
  36. },
  37. {
  38. "FieldName": "FBillNo",
  39. "Compare": "17",
  40. "Value": condition.billNo,
  41. "Left": "",
  42. "Right": "",
  43. "Logic": 0
  44. },
  45. {
  46. "Left": "",
  47. "FieldName": "FStockId.FName",
  48. "Compare": "17",
  49. "Value": "面料",
  50. "Right": "",
  51. "Logic": 0
  52. },
  53. {
  54. "FieldName": "FDate",
  55. "Compare": "39",
  56. "Value": condition.range[0],
  57. "Left": "(",
  58. "Right": "",
  59. "Logic": "0"
  60. },
  61. {
  62. "FieldName": "FDate",
  63. "Compare": "16",
  64. "Value": condition.range[1],
  65. "Left": "",
  66. "Right": ")",
  67. "Logic": "0"
  68. }
  69. ]
  70. let FieldKeys =
  71. "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId"
  72. console.log(condition.FBillType)
  73. if (condition.FBillType == "d43d7e5b9def82fc11e3e582178e4360") { //领料
  74. FilterString.push({
  75. "Left": "",
  76. "FieldName": "FBillType",
  77. "Compare": "105",
  78. "Value": condition.FBillType,
  79. "Right": "",
  80. "Logic": 0
  81. });
  82. console.log('aaaa')
  83. FieldKeys =
  84. "FID,FWorkCenterId_LT.fname,FApplicantId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId"
  85. }
  86. if (condition.FormId == "STK_MisDelivery") { //其他出库
  87. FilterString.push({
  88. "Left": "",
  89. "FieldName": "FStockDirect",
  90. "Compare": "29",
  91. "Value": "GENERAL",
  92. "Right": "",
  93. "Logic": 0
  94. });
  95. FieldKeys =
  96. "FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId,FDeptId.FName,FPickerId.FName"
  97. }
  98. if (condition.FormId == "SP_PickMtrl" && condition.FBillType !== 'B') { //简单生产领料单
  99. FilterString.push({
  100. "Left": "",
  101. "FieldName": "FCollectStatus_LT",
  102. "Compare": "106",
  103. "Value": "B",
  104. "Right": "",
  105. "Logic": 0
  106. });
  107. FieldKeys =
  108. "FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName,FCollectStatus_LT"
  109. }
  110. if (condition.FormId == "SP_PickMtrl" && condition.FBillType == 'B') { //简单生产领料单(智能)
  111. FilterString.push({
  112. "Left": "",
  113. "FieldName": "FCollectStatus_LT",
  114. "Compare": "105",
  115. "Value": "B",
  116. "Right": "",
  117. "Logic": 0
  118. });
  119. FieldKeys =
  120. "FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName,FCollectStatus_LT"
  121. }
  122. if (condition.FormId == "PUR_MRB") { //采购退料单
  123. FieldKeys =
  124. "FID,FSupplierID.fname,FPURCHASERID.fname,FPURCHASEDEPTID.fname,FSTOCKERID.fname,FBillNo,FDate,FStockOrgId"
  125. }
  126. if (condition.FormId == "STK_OEMInStockRETURN") {
  127. FieldKeys =
  128. "FID,FCustId.FName,FDeptId_LT.FName,FBillNo,FSTOCKERID.fname,FDate,FNote,FStockOrgId"
  129. }
  130. if (condition.FormId == "SAL_OUTSTOCK") { //销售出库
  131. FieldKeys =
  132. "FID,FBillNo,FCustomerID.FName,FSalesManID.FName,FSaleDeptID.FName,FSTOCKERID.fname,FDate"
  133. }
  134. if (condition.FormId == "LT_STK_StockCount" && condition.FBillType == "6764c6f5bb0056") { //仓位盘点
  135. FilterString.push({
  136. "Left": "",
  137. "FieldName": "FBillTypeID",
  138. "Compare": "105",
  139. "Value": condition.FBillType,
  140. "Right": "",
  141. "Logic": 0
  142. });
  143. FieldKeys =
  144. // "FID,FBillNo,FCustomerID.FName,FSalesManID.FName,FSaleDeptID.FName,FSTOCKERID.fname,FDate"
  145. "FID,FBillNo,FDate,FCreatorId.FName"
  146. }
  147. console.log(FieldKeys)
  148. console.log(FilterString)
  149. return {
  150. "parameters": [{
  151. "FormId": condition.FormId,
  152. "FieldKeys": FieldKeys,
  153. "FilterString": FilterString
  154. }]
  155. }
  156. }
  157. export function getBillDetailListParam(condition) {
  158. console.log(condition)
  159. let FieldKeys = FieldKeysMap[condition.FormId]
  160. if (condition.FormId == "SP_PickMtrl" && condition.FBillType == 'B') {
  161. FieldKeys =
  162. "FID,FSumEntity_FEntryID,FBillNo,FSTOCKERID.fname,FSumStockLocId.FF102029.fname,FSumMaterialId.fnumber,FSumBoxNo_LT,FSumActualQty,FSumEnchaseNum_LT,FSumAuxPropId.FF101501.FNumber,FSumLot.FNumber,FWorkCenterId.fname,FDate,FPickerId.fname,FWorkShopId.fname,FPickingPeople_LT.FName"
  163. }
  164. return {
  165. "parameters": [{
  166. "FormId": condition.FormId,
  167. "FieldKeys": FieldKeys,
  168. "FilterString": [{
  169. "Left": "",
  170. "FieldName": "FID",
  171. "Compare": "338",
  172. "Value": condition.selectedFID,
  173. "Right": "",
  174. "Logic": 0
  175. }],
  176. }]
  177. }
  178. }
  179. // 定义一个函数来创建库存查询请求数据
  180. export function createInventoryQueryRequest(value) {
  181. return {
  182. parameters: [{
  183. FormId: "STK_Inventory",
  184. FieldKeys: "fID",
  185. FilterString: [{
  186. Left: "",
  187. FieldName: "FStockLocId.FF102029.FName",
  188. Compare: "67",
  189. Value: value,
  190. Right: "",
  191. Logic: 0
  192. },
  193. {
  194. Left: "",
  195. FieldName: "FBaseQty",
  196. Compare: "21",
  197. Value: "0",
  198. Right: "",
  199. Logic: 0
  200. }
  201. ]
  202. }]
  203. };
  204. }
  205. function createEntityObject(item) {
  206. return {
  207. "FEntryID": item["FEntity.FEntryID"],
  208. "FStockId": {
  209. "FNumber": item["FStockId.fnumber"]
  210. },
  211. "FStockLocId": {
  212. "FSTOCKLOCID__FF102029": {
  213. "FNumber": item["FStockLocId.FF102029.fname"]
  214. }
  215. },
  216. "FMaterialId": {
  217. "FNumber": item["FMaterialId.fnumber"]
  218. },
  219. "FEnchaseNo": item["FEnchaseNo"],
  220. "FAuxPropId": {
  221. "FAUXPROPID__FF101501": {
  222. "FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
  223. },
  224. },
  225. "FLot": {
  226. "FNumber": item["FLot.FNumber"]
  227. },
  228. "FAccountNum": item["FAccountNum"],
  229. "FCheckTag": item["FCheckTag"],
  230. "FCheckNum":item["FCheckNum"],
  231. "FBoxNo":item["FBoxNo"]
  232. // [actualQtyKey]: item[actualQtyKey] // 使用动态键名
  233. };
  234. }
  235. // function createEntityObject2(item) {
  236. // return {
  237. // "FEntryID": item["FSumEntity.FEntryID"],
  238. // "FSumAuxPropId": {
  239. // "FSUMAUXPROPID__FF101501": {
  240. // "FNumber": item["FSumAuxPropId.FF101501.FDATAVALUE"]
  241. // }
  242. // },
  243. // "FSumStockLocId": {
  244. // "FSUMSTOCKLOCID__FF102029": {
  245. // "FNumber": item["FSumStockLocId.FF102029.fname"]
  246. // }
  247. // },
  248. // "FSumLot": {
  249. // "FNumber": item["FSumLot.FNumber"]
  250. // },
  251. // "FSumEnchaseNum_LT": item["FSumEnchaseNum.LT"],
  252. // "FSumActualQty": item["FSumActualQty"]
  253. // };
  254. // }
  255. export function getSaveParam(FormId, targetFID, indexList) {
  256. // const targetFID = data;
  257. // const actualQtyKey = getActualQtyKey(FormId);
  258. // const InventoryQtyKey = getFInventoryQtyKey(FormId);
  259. // const entityKey = getEntityKey(FormId);
  260. // const StockLocIdKey = getStockLocIdKey(FormId);
  261. const FEntityObjects = indexList
  262. .filter(item => item.FID === targetFID)
  263. .map(item => createEntityObject(item));
  264. const needUpdateFields = [
  265. // InventoryQtyKey,
  266. // "FAuxPropId",
  267. "FIsCheck",
  268. "FStockId",
  269. "FStockLocId",
  270. "FMaterialId",
  271. "FEnchaseNo",
  272. "FAuxPropId", //等级
  273. "FLot", //批号
  274. "FAccountNum",
  275. "FCheckTag",
  276. "FCheckNum",
  277. "FBoxNo"
  278. ];
  279. return {
  280. "parameters": [
  281. FormId,
  282. {
  283. "NeedUpDateFields": needUpdateFields,
  284. "NeedReturnFields": ["FID"],
  285. "IsDeleteEntry": "true",
  286. "SubSystemId": "",
  287. "IsVerifyBaseDataField": "false",
  288. "IsEntryBatchFill": "true",
  289. "ValidateFlag": "true",
  290. "NumberSearch": "true",
  291. "IsAutoAdjustField": "false",
  292. "InterationFlags": "",
  293. "IgnoreInterationFlag": "",
  294. "IsControlPrecision": "false",
  295. "ValidateRepeatJson": "false",
  296. "Model": {
  297. "FID": targetFID,
  298. "FIsCheck": indexList[0]["FIsCheck"],
  299. // "FIsScanFabric": true,
  300. "FEntity": FEntityObjects
  301. }
  302. }
  303. ]
  304. };
  305. }
  306. export function createSubmitCondition() {
  307. return {
  308. FormId: uni.getStorageSync('formId'),
  309. selectedFID: this.selected,
  310. FBillType: uni.getStorageSync('fbillType')
  311. };
  312. }
  313. export function getCreateParam(FormId) {
  314. // const FEntityObjects = indexList
  315. // .filter(item => item.FID === targetFID)
  316. // .map(item => createEntityObject(item));
  317. // const needUpdateFields = [
  318. // "FStockId",
  319. // "FStockLocId",
  320. // "FMaterialId",
  321. // "FEnchaseNo",
  322. // "FAuxPropId", //等级
  323. // "FLot", //批号
  324. // "FAccountNum"
  325. // ];
  326. return {
  327. "parameters": [
  328. FormId,
  329. {
  330. "NeedUpDateFields": [],
  331. "NeedReturnFields": [],
  332. "IsDeleteEntry": "true",
  333. "SubSystemId": "",
  334. "IsVerifyBaseDataField": "false",
  335. "IsEntryBatchFill": "true",
  336. "ValidateFlag": "true",
  337. "NumberSearch": "true",
  338. "IsAutoAdjustField": "false",
  339. "InterationFlags": "",
  340. "IgnoreInterationFlag": "",
  341. "IsControlPrecision": "false",
  342. "ValidateRepeatJson": "false",
  343. "Model": {
  344. "FID": 0,
  345. "FBillTypeID": {
  346. "FNUMBER": "CWPD"
  347. },
  348. "FStockOrgId": {
  349. "FNumber": uni.getStorageSync('FStockOrgId')
  350. },
  351. "FIsCheck": "A"
  352. }
  353. }
  354. ]
  355. };
  356. }
  357. export function getSubmitParam(FormId, data) {
  358. const params = {
  359. "parameters": [
  360. FormId,
  361. {
  362. "CreateOrgId": 0,
  363. "Numbers": [],
  364. "Ids": data.toString(),
  365. "SelectedPostId": 0,
  366. "UseOrgId": 0,
  367. "NetworkCtrl": "",
  368. "IgnoreInterationFlag": ""
  369. }
  370. ]
  371. };
  372. console.log(params);
  373. return params;
  374. }
  375. export function getQueryStockParam(Id, selectedFID) {
  376. const params = {
  377. usertoken: "99302b4923aa42298c5922b7b68bcff9",
  378. billId: Id,
  379. queryType: "StockQuery",
  380. stockLocs: selectedFID,
  381. date: ''
  382. }
  383. console.log(params);
  384. return params;
  385. }
  386. export function getAuditParam(FormId, data) {
  387. const params = {
  388. "parameters": [
  389. FormId,
  390. {
  391. "CreateOrgId": 0,
  392. "Numbers": [],
  393. "Ids": data.toString(),
  394. "InterationFlags": "",
  395. "UseOrgId": 0,
  396. "NetworkCtrl": "",
  397. "IsVerifyProcInst": "true",
  398. "IgnoreInterationFlag": "",
  399. "UseBatControlTimes": "false"
  400. }
  401. ]
  402. }
  403. console.log(params)
  404. return params
  405. }
  406. // export function getAuditParam(FormId, data) {
  407. // const params = {
  408. // "parameters": [
  409. // FormId,
  410. // {
  411. // "CreateOrgId": 0,
  412. // "Numbers": [],
  413. // "Ids": data.toString(),
  414. // "InterationFlags": "",
  415. // "UseOrgId": 0,
  416. // "NetworkCtrl": "",
  417. // "IsVerifyProcInst": "true",
  418. // "IgnoreInterationFlag": "",
  419. // "UseBatControlTimes": "false"
  420. // }
  421. // ]
  422. // }
  423. // console.log(params)
  424. // return params
  425. // }
  426. export function createSearchCondition(range, billNo) {
  427. return {
  428. "FormId": uni.getStorageSync('formId'),
  429. "FBillType": uni.getStorageSync('fbillType'),
  430. "FStockOrgId": uni.getStorageSync('FStockOrgId'),
  431. "billNo": billNo,
  432. "range": range
  433. };
  434. }