前端转vue

TradeAPIsHelper.ts 47KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. import SystemFunction from "@/views/front/develop/Library.Ext/Function/SystemFunction"
  2. import { PageBase } from "@/views/front/develop/Constract/ContractBase/PageBase";
  3. import Message from "../../Communication/Message";
  4. import { TradeManagerHandle } from "../../ServiceProxy.Ext/ServiceHelper/TradeManagerHandle";
  5. import LoginUserInfo from "@/views/front/platfrom/common/RunningParameters/LoginUserInfo";
  6. import { TradePowerManager } from "../../Library.Ext/TradeExtension/TradeMenu/TradePowerManager";
  7. import { LoginAuthentication } from "../../Library.Ext/TradeExtension/SSO/LoginAuthentication";
  8. import { CheckConditionElements } from "../Function/TradeCheck/CheckConditionElements";
  9. import { AuthConditionElement } from "../Function/TradeAuth/AuthConditionElement";
  10. import { CheckDataHelper } from "../Function/TradeCheck/CheckDataHelper";
  11. import { AuthDataHelper } from "../Function/TradeAuth/AuthDataHelper";
  12. import { WorkFlowHandle } from "@/views/front/platfrom/serviceproxy/ServiceHelper/WorkFlowHandle";
  13. import { AsksuperResultType, CheckManager } from "../Function/TradeCheck/CheckManager";
  14. import { TransitType } from "../../Communication/MessageHelper/TransitType";
  15. import { NotifyMessage } from "../../Library.Ext/Variables/NotifyMessage";
  16. import TransitErrorCodeMap from "../../Communication/MessageHelper/TransitErrorCodeMap";
  17. import Result from "../../Library.Ext/Variables/Result";
  18. //import { Selector } from "@/views/front/platfrom/controls/ControlsHelper/ItemsControlHelper";
  19. import { SelectionManager } from "../../Library.Ext/TradeExtension/SelectionManager";
  20. import UserFunction from "../../Library.Ext/Function/UserFunction";
  21. import { TradeBusData } from "../../Library.Ext/TradeExtension/TradeInfo/TradeBusData";
  22. import TradeHandle from "../../ServiceProxy.Ext/ServiceHelper/TradeHandle";
  23. import { TradeInfoData } from "../../Library.Ext/TradeExtension/TradeInfo/TradeInfoData";
  24. class TradeAPIsHelper {
  25. // ctor & Property
  26. public Page: PageBase;
  27. constructor(page: PageBase) {
  28. this.Page = page;
  29. }
  30. // 封装交易API函数
  31. // Message操作
  32. public InitFd(message: Message): void {
  33. SystemFunction.InitFd(message);
  34. }
  35. public CommSend(message: Message): void {
  36. SystemFunction.CommSend(this.Page, message);
  37. }
  38. public CommSend96(message: Message): void {
  39. SystemFunction.CommSend(this.Page, message);
  40. }
  41. public CallServer(message: Message): boolean {
  42. return SystemFunction.CallServer(message);
  43. }
  44. public CallAgn(message: Message): boolean {
  45. return SystemFunction.CallAgn(message);
  46. }
  47. public CallAgnTips(message: Message): boolean {
  48. return SystemFunction.CallAgnTips(message);
  49. }
  50. public CallAgnRun(message: Message): boolean {
  51. return SystemFunction.CallAgnRun(message);
  52. }
  53. public CallMobileBanking(message: Message): boolean {
  54. return SystemFunction.DoTransit(message, "TransitType.CallMobileBanking");
  55. }
  56. public CallAgnCIS(message: Message): boolean {
  57. return SystemFunction.DoTransit(message, "TransitType.CallAgnCIS");
  58. }
  59. public CallAgnCard(message: Message): boolean {
  60. return SystemFunction.DoTransit(message, "TransitType.CallAgnCard");
  61. }
  62. public CallAgnHeat01(message: Message): boolean {
  63. return SystemFunction.DoTransit(message, "ransitType.CallAgnHeat01");
  64. }
  65. public CallAgnHeat02(message: Message): boolean {
  66. return SystemFunction.DoTransit(message, "TransitType.CallAgnHeat02");
  67. }
  68. public CallAgnHeat03(message: Message): boolean {
  69. return SystemFunction.DoTransit(message, "TransitType.CallAgnHeat03");
  70. }
  71. public CallAgnIDC(message: Message): boolean {
  72. return SystemFunction.DoTransit(message, "TransitType.CallAgnIDC");
  73. }
  74. public CallAgnIBPS(message: Message): boolean {
  75. return SystemFunction.DoTransit(message, "TransitType.CallAgnIBPS");
  76. }
  77. public CallAgnSHCZ(message: Message): boolean {
  78. return SystemFunction.DoTransit(message, "TransitType.CallAgnSHCZ");
  79. }
  80. public CallAgnIBDW(message: Message): boolean {
  81. return SystemFunction.DoTransit(message, "TransitType.CallAgnIBDW");
  82. }
  83. public CallAgnNew(message: Message): boolean {
  84. return SystemFunction.DoTransit(message, "TransitType.CallAgnNew");
  85. }
  86. public CallAgnCardEx(message: Message): boolean {
  87. return SystemFunction.DoTransit(message, "TransitType.CallAgnCardEx");
  88. }
  89. public CallAgnCartoon(message: Message): boolean {
  90. return SystemFunction.DoTransit(message, "TransitType.CallAgnCartoon");
  91. }
  92. public CallAgnHPF(message: Message): boolean {
  93. return SystemFunction.DoTransit(message, "TransitType.CallAgnHPF");
  94. }
  95. public CallAgnTV(message: Message): boolean {
  96. return SystemFunction.DoTransit(message, "TransitType.CallAgnTV");
  97. }
  98. public CallAgnFSSR(message: Message): boolean {
  99. return SystemFunction.DoTransit(message, "TransitType.CallAgnFSSR");
  100. }
  101. public CallAgnCLFJG(message: Message): boolean {
  102. return SystemFunction.DoTransit(message, "TransitType.CallAgnCLFJG");
  103. }
  104. public CallAgnHontax(message: Message): boolean {
  105. return SystemFunction.DoTransit(message, "TransitType.CallAgnHontax");
  106. }
  107. public CallAgnOrder(message: Message): boolean {
  108. return SystemFunction.DoTransit(message, "TransitType.CallAgnOrder");
  109. }
  110. public CallAgnMIS(message: Message): boolean {
  111. return SystemFunction.DoTransit(message, "TransitType.CallAgnMIS");
  112. }
  113. public CallAgnWXJJ_LP(message: Message): boolean {
  114. return SystemFunction.DoTransit(message, "TransitType.CallAgnWXJJ_LP");
  115. }
  116. public CallAgnWXJJ_CDX(message: Message): boolean {
  117. return SystemFunction.DoTransit(message, "TransitType.CallAgnWXJJ_CDX");
  118. }
  119. public CallAgnNetBank(message: Message): boolean {
  120. return SystemFunction.DoTransit(message, "TransitType.CallAgnNetBank");
  121. }
  122. public CallAgnMF01(message: Message): boolean {
  123. return SystemFunction.DoTransit(message, "TransitType.CallAgnMF01");
  124. }
  125. public CallAgnMF02(message: Message): boolean {
  126. return SystemFunction.DoTransit(message, "TransitType.CallAgnMF02");
  127. }
  128. public CallAgnWater(message: Message): boolean {
  129. return SystemFunction.DoTransit(message, "TransitType.CallAgnWater");
  130. }
  131. public CallAgnCnaps2(message: Message): boolean {
  132. return SystemFunction.DoTransit(message, "TransitType.CallAgnCnaps2");
  133. }
  134. public CallAgn_CZYYSW(message: Message): boolean {
  135. return SystemFunction.DoTransit(message, "TransitType.CallAgn_CZYYSW");
  136. }
  137. public CallAgn_EasyPay(message: Message): boolean {
  138. return SystemFunction.DoTransit(message, "TransitType.CallAgn_EasyPay");
  139. }
  140. public CallAgn_Ebill(message: Message): boolean {
  141. return SystemFunction.DoTransit(message, "TransitType.CallAgn_Ebill");
  142. }
  143. public CallAgn_SDYCT(message: Message): boolean {
  144. return SystemFunction.DoTransit(message, "TransitType.CallAgn_SDYCT");
  145. }
  146. public CallAgn_GasFee(message: Message): boolean {
  147. return SystemFunction.DoTransit(message, "TransitType.CallAgn_GasFee");
  148. }
  149. public CallAgn_NJT(message: Message): boolean {
  150. return SystemFunction.DoTransit(message, "TransitType.CallAgn_NJT");
  151. }
  152. public CallNoFileSys(message: Message): boolean {
  153. return SystemFunction.DoTransit(message, "TransitType.CallNoFileSys");
  154. }
  155. public CallAgn_FGJWQ(message: Message): boolean {
  156. return SystemFunction.DoTransit(message, "TransitType.CallAgn_FGJWQ");
  157. }
  158. public CallAgnNew_WL(message: Message): boolean {
  159. return SystemFunction.DoTransit(message, "TransitType.CallAgnNew_WL");
  160. }
  161. public CallAgn_GGJ(message: Message): boolean {
  162. return SystemFunction.DoTransit(message, "TransitType.CallAgn_GGJ");
  163. }
  164. public CallAgn_FGJWQ_HH(message: Message): boolean {
  165. return SystemFunction.DoTransit(message, "TransitType.CallAgn_FGJWQ_HH");
  166. }
  167. public CallAgn_DF(message: Message): boolean {
  168. return SystemFunction.DoTransit(message, "TransitType.CallAgn_DF");
  169. }
  170. public CallAgn_CW(message: Message): boolean {
  171. return SystemFunction.DoTransit(message, "TransitType.CallAgn_CW");
  172. }
  173. public CallAgn_ZJJG(message: Message): boolean {
  174. return SystemFunction.DoTransit(message, "TransitType.CallAgn_ZJJG");
  175. }
  176. public CallAgn_CKXT(message: Message): boolean {
  177. return SystemFunction.DoTransit(message, "TransitType.CallAgn_CKXT");
  178. }
  179. public CustomizeTransit(msg: Message, func: (x: any) => boolean | null): void {
  180. // 取消自定义处理
  181. if (func === null) {
  182. msg.CustomizeTransitEntry = null;
  183. return;
  184. }
  185. // msg.CustomizeTransitEntry = (x: any) => {
  186. // try {
  187. // return func(x);
  188. // } catch (ex) {
  189. // console.error('TradeAPIsHelper.CustomizeTransit:执行异常!', ex);
  190. // x.Error = (ex as Error).message;
  191. // return false;
  192. // }
  193. // };
  194. }
  195. // 控件辅助操作
  196. // public AddItemOfSelecteAll(element: ComboBox, value: string = ''): boolean {
  197. // return SystemFunction.AddItemOfSelecteAll(this.Page, element, value);
  198. // }
  199. // public RemoveItemOfSelecteAll(element: ComboBox): boolean {
  200. // return SystemFunction.RemoveItemOfSelecteAll(this.Page, element);
  201. // }
  202. //hulei-s combobox 控件没用
  203. public GetError(msg: Message): string {
  204. return SystemFunction.GetError("");
  205. }
  206. public GetNotifyMessage(notify: string | NotifyMessage): string {
  207. if (typeof notify === 'string') {
  208. return TransitErrorCodeMap.GetInstance().GetErrorMessage(notify, 'notify');
  209. } else {
  210. return this.GetNotifyMessage(notify.toString());
  211. }
  212. }
  213. public CallComboBoxData(message: Message, formatString: string, defalutCombox: string = "Null"): Result {
  214. return SystemFunction.CallComboBoxData(message, formatString, defalutCombox);
  215. //hulei-r vue中不能有pagebase的属性 所以方法中去掉
  216. }
  217. //hulei-/获取下拉框的值
  218. public CallComboBoxDataSelector(code: string, tmp?: { [key: string]: string }): boolean {//hulei-r 替换成tmp // arguments selector: Selector,是微软自带的
  219. // if (selector === null) return false;
  220. // selector.items.clear();
  221. let dict: any;
  222. if (this.Page.TradeInfo.MainCode === undefined || this.Page.TradeInfo.MainCode === '') {
  223. dict = SelectionManager.Instance.PullSelection(code, tmp);
  224. } else {
  225. dict = SelectionManager.Instance.PullSelection(code, tmp, this.Page.TradeInfo.MainCode);
  226. }
  227. if (dict === null) return false;
  228. // selector.SetItems(dict);
  229. return true;
  230. }
  231. public SetAssertNotEmpty(flag: boolean): void {//element: FrameworkElement,hulei-s windows自带框架 这里是设置必须输入属性 可以先注销
  232. //SystemFunction.SetAssertNotEmpty(this.Page, element, flag);
  233. }
  234. public GetSelectedValue(): string {//hulei-/获取下拉框的值 combo: ComboBox
  235. //下拉框的值
  236. const combo = "";
  237. return UserFunction.GetSelectedValue(combo);
  238. }
  239. public SetSelectedValue(val: any): void {//combo: ComboBox, //hulei-/获取下拉框的值 combo: ComboBox
  240. const combo = "";
  241. UserFunction.SetSelectedValue(combo, val);
  242. }
  243. public SetSelectedKey(key: string): void {//combo: ComboBox, //hulei-/获取下拉框的值 combo: ComboBox,
  244. const combo = "";
  245. UserFunction.SetSelectedKey(combo, key);
  246. }
  247. public ToDecimal(src: string): number {
  248. return UserFunction.ToDecimal(src);
  249. }
  250. public ToDateTime(src: string): Date {
  251. return UserFunction.ToDateTime(src);
  252. }
  253. public DateToBig(date: string): string[] {
  254. return UserFunction.DateToBig("", date);
  255. }
  256. // 字符串数字处理类
  257. // 转换字符串为数字 atoi(string)
  258. public Atoi(number: string): number {
  259. return SystemFunction.Atoi(number);
  260. }
  261. // 转换数字为字符串 itoa(number,string)
  262. public Itoa(number: number, format: string): string {
  263. return SystemFunction.Itoa(this.Page, number, format);
  264. }
  265. // 截取一个子串 substr(string,number,number)
  266. public SubStr(sourceData: string, start: number, length: number): string {
  267. return SystemFunction.SubStr(this.Page, sourceData, start, length);
  268. }
  269. // 得到字符串的长度 len(string)
  270. public Len(sourceData: string): number {
  271. return SystemFunction.Len(sourceData);
  272. }
  273. // 把指定的ascii码值转换为字符串 chr(number)
  274. public Chr(number: number): string {
  275. return SystemFunction.Chr(number);//hulei-/不要page参数
  276. }
  277. // 求两个整数的余 mod(number1,number)
  278. public Mod(number1: number, number2: number): number {
  279. return SystemFunction.Mod(number1, number2);
  280. }
  281. // 把一个数字型字符串转换为','分割的形式 comma(string,[number])
  282. public Comma(sourceData: string, length: number): string {
  283. return SystemFunction.Comma(this.Page, sourceData, length);
  284. }
  285. // 得到数字字符串对应的数值 val(string,[number])
  286. public Val(sourceData: string, weight: number): number {
  287. return SystemFunction.Val(this.Page, sourceData, weight);
  288. }
  289. // 去掉尾部空格 rtrim(string)
  290. public RTrim(sourceData: string): string {
  291. return SystemFunction.RTrim(this.Page, sourceData);
  292. }
  293. // 去掉左边空格 ltrim(string)
  294. public LTrim(sourceData: string): string {
  295. return SystemFunction.RTrim(this.Page, sourceData);
  296. }
  297. // 去掉所有空格,包括字符串中间的空格 delspace(string)
  298. public Delspace(sourceData: string): string {
  299. return SystemFunction.Delspace(this.Page, sourceData);
  300. }
  301. // 左补齐参数字符 PadLeft(string,int,char)
  302. public PadLeft(sourcedata: string, length: number, varChar: string = ' '): string {
  303. return SystemFunction.PadLeft(this.Page, sourcedata, length, varChar);
  304. }
  305. // 右补齐参数字符 PadRight(string,length,var)
  306. public PadRight(sourcedata: string, length: number, varChar: string = ' '): string {
  307. return SystemFunction.PadRight(this.Page, sourcedata, length, varChar);
  308. }
  309. // 以某个字符构建某长度的字符串 Space(lenth,char)
  310. public Space(lenght: number, c: string = ' '): string {
  311. return SystemFunction.Space(this.Page, lenght, c);
  312. }
  313. // 计算两个日期直接的绝对差值(天数)
  314. public Func(fDate: string, sDate: string): number {
  315. const startDate = new Date(
  316. parseInt(fDate.substring(0, 4)),
  317. parseInt(fDate.substring(4, 6)) - 1,
  318. parseInt(fDate.substring(6))
  319. );
  320. const endDate = new Date(
  321. parseInt(sDate.substring(0, 4)),
  322. parseInt(sDate.substring(4, 6)) - 1,
  323. parseInt(sDate.substring(6))
  324. );
  325. const timeSpan = endDate.getTime() - startDate.getTime();
  326. return Math.floor(timeSpan / (1000 * 60 * 60 * 24));
  327. }
  328. // 将数字类型转换成大写金额字符串 ChangeToCNY(decimal)
  329. public ChangeToCNY(num: number): string {
  330. return SystemFunction.ChangeToCNY(this.Page, num);
  331. }
  332. // 按格式解析返回字串,给combox添加项
  333. public SetSel(fileData: string, formatString: string): boolean {//hulei-/comboBox: ComboBox,
  334. return SystemFunction.SetSel(fileData, formatString);
  335. }
  336. // 非法汉字字符检查
  337. public CheckHalf(str: string): boolean {
  338. return true;
  339. }
  340. // 格式化金额数值:千分位、去空格(左对齐)
  341. public FormatAMT(amtVal: number): string {
  342. return this.Delspace(this.Comma(amtVal.toString(), 17));
  343. }
  344. // 将数字转换成中文
  345. private static unit: string[] = ["", "十", "百", "千", "万", "十万", "百万", "千万", "亿", "十亿", "百亿", "千亿", "万亿"];
  346. private static unit_T: string[] = ["", "拾", "佰", "仟", "萬", "拾萬", "佰萬", "仟萬", "亿", "拾亿", "佰亿", "仟亿", "萬亿"];
  347. public ChangeToCI(value: number, isSimple: boolean = true, hasUnit: boolean = false): string {
  348. let ret = '';
  349. const data = Math.abs(value).toString();
  350. for (let i = 0; i < data.length; i++) {
  351. const item = data[i];
  352. let c = '';
  353. switch (item) {
  354. case '0':
  355. c = isSimple ? "零" : "零";
  356. break;
  357. case '1':
  358. c = isSimple ? "一" : "壹";
  359. break;
  360. case '2':
  361. c = isSimple ? "二" : "贰";
  362. break;
  363. case '3':
  364. c = isSimple ? "三" : "叁";
  365. break;
  366. case '4':
  367. c = isSimple ? "四" : "肆";
  368. break;
  369. case '5':
  370. c = isSimple ? "五" : "伍";
  371. break;
  372. case '6':
  373. c = isSimple ? "六" : "陆";
  374. break;
  375. case '7':
  376. c = isSimple ? "七" : "柒";
  377. break;
  378. case '8':
  379. c = isSimple ? "八" : "捌";
  380. break;
  381. case '9':
  382. c = isSimple ? "九" : "玖";
  383. break;
  384. default:
  385. throw new Error("ChangeToCI:参数异常!");
  386. }
  387. ret += c;
  388. if (hasUnit) {
  389. // 加载单位
  390. ret += isSimple ? TradeAPIsHelper.unit[data.length - i - 1] : TradeAPIsHelper.unit_T[data.length - i - 1];
  391. }
  392. }
  393. return ret;
  394. }
  395. // 将汉字(零,一 ……十二转换为阿拉伯数字1至12)
  396. public ChangeToNum(value: string): number {
  397. let c = -1;
  398. switch (value) {
  399. case "零":
  400. c = 0;
  401. break;
  402. case "一":
  403. c = 1;
  404. break;
  405. case "二":
  406. c = 2;
  407. break;
  408. case "三":
  409. c = 3;
  410. break;
  411. case "四":
  412. c = 4;
  413. break;
  414. case "五":
  415. c = 5;
  416. break;
  417. case "六":
  418. c = 6;
  419. break;
  420. case "七":
  421. c = 7;
  422. break;
  423. case "八":
  424. c = 8;
  425. break;
  426. case "九":
  427. c = 9;
  428. break;
  429. case "十":
  430. c = 10;
  431. break;
  432. case "十一":
  433. c = 11;
  434. break;
  435. case "十二":
  436. c = 12;
  437. break;
  438. default:
  439. break;
  440. }
  441. return c;
  442. }
  443. // 转换证件类型
  444. private static _LicKindList_: { [key: string]: string } | null = null;
  445. public ChgLicKind(kind: string): string {
  446. if (TradeAPIsHelper._LicKindList_ === null) {
  447. TradeAPIsHelper._LicKindList_ = SelectionManager.Instance.PullSelection("C004", null);
  448. const c003Data = SelectionManager.Instance.PullSelection("C003", null);
  449. Object.entries(c003Data).forEach(([key, value]) => {
  450. TradeAPIsHelper._LicKindList_[key] = value;
  451. });
  452. }
  453. if (TradeAPIsHelper._LicKindList_.hasOwnProperty(kind)) {
  454. return TradeAPIsHelper._LicKindList_[kind];
  455. }
  456. const item = Object.entries(TradeAPIsHelper._LicKindList_).find(([_, value]) => value === kind);
  457. return item ? item[0] : kind;
  458. }
  459. // 解析文本文件、excel文件、DataTable文件//hulei-s在vue中要用到组件库
  460. public AnalyzeTxtData(txt_RowSplit: string[], txt_ColumnSlit: string, txt_EnCode: string, isColumnHeader: boolean = true) {
  461. return SystemFunction.AnalyzeTxtData(txt_RowSplit, txt_ColumnSlit, txt_EnCode, isColumnHeader);
  462. }
  463. public AnalyseExcelData(RowCount: number = 0, columnCount: number = 0) {
  464. return SystemFunction.AnalyseExcelData(RowCount, columnCount);
  465. }
  466. public AnalyseDataTable(txt_RowSplit: string, txt_ColumnSlit: string): string {
  467. return this.AnalyseDataTable(txt_RowSplit, txt_ColumnSlit);
  468. }
  469. // 文件操作相关
  470. public Shell(cmd: string): boolean {
  471. return TradeHandle.ExcuteShell(cmd);
  472. }
  473. public Getfiletxt(fileName: string): string {
  474. return SystemFunction.Getfiletxt(fileName);
  475. }
  476. public Savefiletxt(fileName: string, fileContent: string, append: boolean): boolean {
  477. return SystemFunction.Savefiletxt(fileName, fileContent, append);
  478. }
  479. // MessageBox-弹出消息框
  480. // 消息提示默认值
  481. private static readonly IsCoverAll = true;
  482. private static readonly IsReverse = true;
  483. private static readonly Direction = 3;
  484. private static readonly AnimationEnable = false;
  485. // 输入信息提示
  486. public ShowTip(message: string): boolean {
  487. // const current: FrameworkElement = this.Page;
  488. // const flag = this.Page.GetEnableFocusControl();
  489. // let fm: any;
  490. // if (flag) {
  491. // fm = this.Page.GetManagerInstance();
  492. // if (fm !== null) {
  493. // current = fm.CurrentFocusedElement;
  494. // }
  495. // }//hulei-s 没有page这个概念
  496. return true;//this.ShowTipElement(current, message);
  497. }
  498. // public ShowTipElement(target: UIElement, message: string): boolean {
  499. // return target.ShowTip(message);
  500. // }
  501. // public ShowTipPlacement(target: UIElement, message: string, placement: any = 'Bottom'): boolean {
  502. // return target.ShowTip(placement, message);
  503. // }
  504. // 功能选择消息提示
  505. public ShowComfirmBox(message: string, comfirm: string[], defaultfocus: string | null = null): string {
  506. let def = 1;
  507. if (comfirm.includes(defaultfocus as string)) {
  508. def = comfirm.indexOf(defaultfocus as string) + 1;
  509. }
  510. const ret = "";//UserFunction.ShowComfirmBox(message, comfirm, def); //hulei-s 消息弹窗
  511. return comfirm[ret];
  512. }
  513. // public ShowComfirmBoxKey(message: string, comfirm: { [key: string]: string }, defaultfocus: string = 'None'): string {
  514. // return this.Page.ShowPageMessageBoxExt(message, comfirm, defaultfocus);
  515. // }
  516. // public ShowComfirmBoxParams(message: string, ...comfirm: string[]): number {
  517. // return this.Page.ShowComfirmBox(message, comfirm);
  518. // }
  519. // 推送消息提示
  520. public ShowPopueMessageBox(content: any, caption: string = "提示信息"): void {
  521. // 原函数体为空
  522. }
  523. // 默认选择提示
  524. // public ShowQuestionMessageBox(content: any, caption: string = "询问信息", focuResult: string = "Yes", results: string[] = ["Yes", "No"]): string {
  525. // const result = this.Page.ShowPageMessageBoxMetro(
  526. // content,
  527. // caption,
  528. // null,
  529. // this.ConvertMessageBoxResultToStr(focuResult),
  530. // TradeAPIsHelper.Direction,
  531. // TradeAPIsHelper.IsReverse,
  532. // TradeAPIsHelper.IsCoverAll,
  533. // TradeAPIsHelper.AnimationEnable,
  534. // this.ConvertMessageBoxButton(results)
  535. // );
  536. // return this.ConvertStrToMessageBoxResult(result);
  537. // }
  538. // public ShowQuestionMessageBoxCustom(content: any, results: string[], defaultIndex: number, caption: string = "询问信息"): string {
  539. // const defaultValue = results.length > defaultIndex ? results[defaultIndex] : results[0];
  540. // return this.Page.ShowPageMessageBoxMetro(
  541. // content,
  542. // caption,
  543. // null,
  544. // defaultValue,
  545. // TradeAPIsHelper.Direction,
  546. // TradeAPIsHelper.IsReverse,
  547. // TradeAPIsHelper.IsCoverAll,
  548. // TradeAPIsHelper.AnimationEnable,
  549. // results
  550. // );
  551. // }
  552. // // 场景信息提醒提示
  553. // public ShowSuccessMessageBox(content: any | null = null, caption: string = "业务办理成功"): string {
  554. // const image = this.Page.GetResource("MessageBoxMetroSuccess");
  555. // const result = this.Page.ShowPageMessageBoxMetro(
  556. // content,
  557. // caption,
  558. // image,
  559. // this.ConvertMessageBoxResultToStr("OK"),
  560. // TradeAPIsHelper.Direction,
  561. // TradeAPIsHelper.IsReverse,
  562. // TradeAPIsHelper.IsCoverAll,
  563. // TradeAPIsHelper.AnimationEnable,
  564. // this.ConvertMessageBoxButton(["OK"])
  565. // );
  566. // return this.ConvertStrToMessageBoxResult(result);
  567. // }
  568. // public ShowInfoMessageBox(content: any | null = null, caption: string = "提示信息"): string {
  569. // const image = this.Page.GetResource("MessageBoxMetroInfo");
  570. // const result = this.Page.ShowPageMessageBoxMetro(
  571. // content,
  572. // caption,
  573. // image,
  574. // this.ConvertMessageBoxResultToStr("OK"),
  575. // TradeAPIsHelper.Direction,
  576. // TradeAPIsHelper.IsReverse,
  577. // TradeAPIsHelper.IsCoverAll,
  578. // TradeAPIsHelper.AnimationEnable,
  579. // this.ConvertMessageBoxButton(["OK"])
  580. // );
  581. // return this.ConvertStrToMessageBoxResult(result);
  582. // }
  583. // public ShowErrorMessageBox(content: any | null = null, caption: string = "错误信息"): string {
  584. // const image = this.Page.GetResource("MessageBoxMetroError");
  585. // const result = this.Page.ShowPageMessageBoxMetro(
  586. // content,
  587. // caption,
  588. // image,
  589. // this.ConvertMessageBoxResultToStr("OK"),
  590. // TradeAPIsHelper.Direction,
  591. // TradeAPIsHelper.IsReverse,
  592. // TradeAPIsHelper.IsCoverAll,
  593. // TradeAPIsHelper.AnimationEnable,
  594. // this.ConvertMessageBoxButton(["OK"])
  595. // );
  596. // return this.ConvertStrToMessageBoxResult(result);
  597. // }
  598. // public ShowWarnMessageBox(content: any | null = null, caption: string = "警告信息"): string {
  599. // const image = this.Page.GetResource("MessageBoxMetroWarn");
  600. // const result = this.Page.ShowPageMessageBoxMetro(
  601. // content,
  602. // caption,
  603. // image,
  604. // this.ConvertMessageBoxResultToStr("OK"),
  605. // TradeAPIsHelper.Direction,
  606. // TradeAPIsHelper.IsReverse,
  607. // TradeAPIsHelper.IsCoverAll,
  608. // TradeAPIsHelper.AnimationEnable,
  609. // this.ConvertMessageBoxButton(["OK"])
  610. // );
  611. // return this.ConvertStrToMessageBoxResult(result);
  612. // }
  613. // 转换方法
  614. private ConvertStrToMessageBoxResult(str: string | null): string {
  615. str = str || '';
  616. switch (str.trim()) {
  617. case "取消":
  618. return "Cancel";
  619. case "否":
  620. return "No";
  621. case "确定":
  622. return "OK";
  623. case "是":
  624. return "Yes";
  625. default:
  626. return "None";
  627. }
  628. }
  629. private ConvertMessageBoxResultToStr(result: string): string {
  630. switch (result) {
  631. case "Cancel":
  632. return "取消";
  633. case "No":
  634. return "否";
  635. case "OK":
  636. return "确定";
  637. case "Yes":
  638. return "是";
  639. default:
  640. return "未知";
  641. }
  642. }
  643. private ConvertMessageBoxButton(msg: string[]): string[] {
  644. return msg;
  645. }
  646. // DataBox相关函数
  647. // public InitDataBox(databox: DataBox): void {
  648. // databox.InitDataBox();
  649. // }
  650. // public GetDataForDataTable(databox: DataBox): DataTable {
  651. // return databox.GetDataForDataTable();
  652. // }
  653. // public GetDataForString(databox: DataBox): string {
  654. // return databox.GetDataForString();
  655. // }
  656. // public BindDataTable(databox: DataBox, dtSource: DataTable): void {
  657. // databox.BindDataTable(dtSource);
  658. // }
  659. // public DataBinding(databox: DataBox, fileData: string, ...columnName: string[]): void {
  660. // databox.DataBinding(fileData, columnName);
  661. // }
  662. // public DataBindingXML(databox: DataBox, fileData: string, nodeName: string, ...columnName: string[]): void {
  663. // const str = databox.AnalyzeXMLtoStr(fileData, nodeName);
  664. // databox.DataBinding(str || fileData, columnName);
  665. // }
  666. // public DataBindingLevel(databox: DataBox, fileData: string, level: any, ...columnNames: string[]): void {
  667. // databox.DataBinding(fileData, level, columnNames);
  668. // }
  669. // public SetColumnsHeader(databox: DataBox, columnIndex: number, header: string): void {
  670. // databox.SetColumnsHeader(columnIndex, header);
  671. // }
  672. // public SetColumnsWidth(databox: DataBox, columnIndex: number, width: number): void {
  673. // databox.SetColumnsWidth(columnIndex, width);
  674. // }
  675. // public SetColumnsVisible(databox: DataBox, columnIndex: number, visible: boolean): void {
  676. // databox.SetColumnsVisible(columnIndex, visible);
  677. // }
  678. // public SetColumnsFormat(databox: DataBox, columnIndex: number, format: string): void {
  679. // databox.SetColumnsFormat(columnIndex, format);
  680. // }
  681. // public SetColumnsAlign(databox: DataBox, columnIndex: number, align: string): void {
  682. // databox.SetColumnsAlign(columnIndex, align);
  683. // }
  684. // public GetSelectMultiRows(databox: DataBox): any[] {
  685. // return databox.GetSelectMultiRows();
  686. // }
  687. // public GetSelectSingleRow(databox: DataBox): any {
  688. // return databox.GetSelectSingleRow();
  689. // }
  690. // public GetSelectRowValue(databox: DataBox, hasRowIndex: boolean = true): string[] {
  691. // let ret = databox.GetSelectRowValue();
  692. // if (!hasRowIndex && ret && ret.length > 1) {
  693. // ret = ret.slice(1);
  694. // }
  695. // return ret;
  696. // }
  697. // public SetSelDataBox(databox: DataBox, colName: string, dic: { [key: string]: string }): void {
  698. // databox.SetSel(colName, dic);
  699. // }
  700. // public AddColumn(databox: DataBox, column: any): void {
  701. // databox.AddColumn(column);
  702. // }
  703. // public AddHyperlinkColumn(databox: DataBox, colName: string, click: (event: any) => void, hotkey: string = 'None'): void {
  704. // databox.AddHyperlinkColumn(colName, click, hotkey);
  705. // }
  706. // public AddRowDataBox(databox: DataBox, newRow: any): boolean {
  707. // return databox.AddRow(newRow);
  708. // }
  709. // public AddRowValues(databox: DataBox, ...values: any[]): boolean {
  710. // return databox.AddRow(values);
  711. // }
  712. // public UpdateRow(databox: DataBox, ...values: any[]): boolean {
  713. // return databox.UpdateRow(values);
  714. // }
  715. // public DeleteSelectRows(databox: DataBox): boolean {
  716. // return databox.DeleteSelectRows();
  717. // }
  718. // // Combobox控件相关
  719. // public AddItems(target: any, items: any[]): void {
  720. // target.AddItems(items);
  721. // }
  722. // public SetItems(target: any, items: any[]): void {
  723. // target.SetItems(items);
  724. // }
  725. // public GetSelectedKey(target: any): string {
  726. // return target.GetSelectedKey();
  727. // }
  728. // // 设置焦点相关
  729. // public SetFocus(element: FrameworkElement | null = null): void {
  730. // this.Page.SetFocus(element);
  731. // }
  732. // 检查账号是否是卡
  733. // public CheckCardBin(acno: string): boolean {
  734. // return this.Page.CheckCardBin(acno);
  735. // }
  736. // 打印相关
  737. // public CreateSpecialMarkPrint(pt: PrintTypes, left: number, top: number, markText: string): PrintContainer {
  738. // const tb = new TemplateBase();
  739. // tb.PrintType = pt;
  740. // tb.DrawingSpecialMark(left, top, markText);
  741. // return tb;
  742. // }
  743. // public CreateSpecialMarkPrintElement(pt: PrintTypes, left: number, top: number, element: UIElement): PrintContainer {
  744. // const tb = new TemplateBase();
  745. // tb.PrintType = pt;
  746. // tb.DrawingSpecialMarkWithElement(left, top, element);
  747. // return tb;
  748. // }
  749. // public PrintCertificate(authForms: PrintContainer[]): void {
  750. // this.Page.PrintCertificate(authForms);
  751. // // add by chuhai 清空前端流水,避免交易不关闭导致流水重复。
  752. // this.Page.ClearSerialNumber();
  753. // }
  754. // public PrintAcdtl_1(message: Message): string {
  755. // return '';
  756. // }
  757. // public PrintAcdtl_hst(message: Message): string {
  758. // return '';
  759. // }
  760. // public PrintAcdtl_h(message: Message): string {
  761. // return '';
  762. // }
  763. // public Print_Sq(message: Message): string {
  764. // return '';
  765. // }
  766. // public PrintReport(formatMessage: string, reportURI: string, paraDic: { [key: string]: string } | null): void {
  767. // let sb = formatMessage;
  768. // if (paraDic) {
  769. // sb += '\n[parameters]\n';
  770. // for (const [key, value] of Object.entries(paraDic)) {
  771. // sb += `${key}=${value}\n`;
  772. // }
  773. // sb += ';';
  774. // }
  775. // const re = new ReportEntity(reportURI);
  776. // // 补偿PrintAttributes给ReportEntity
  777. // let pa = PrintContainerExt.GetPrintElement(this.Page);
  778. // if (!pa) pa = this.Page.GetPrintAttributes();
  779. // PrintContainerExt.SetPrintElement(re, pa);
  780. // re.Analyze(sb);
  781. // re.Print();
  782. // }
  783. // 查找上层Ipage
  784. private FindAncestor<T>(element: any): T | null {
  785. let obj: any = null;
  786. // for (obj = this.Page.VisualTreeHelper.GetParent(element); !(obj instanceof T); obj = this.Page.VisualTreeHelper.GetParent(obj)) {
  787. // if (obj === null) break;
  788. // }
  789. return obj as T;
  790. }
  791. // 授权/复核
  792. // public RestoreTradePage(serialid: string, busData: TradeBusData): void {
  793. // this.Page.ShowTradeTab(serialid, (page: IPage) => {
  794. // this.Page.Dispatcher.BeginInvoke(() => {
  795. // const resultKey = busData.hasOwnProperty('SuperFlag') ? 'SuperFlag' : 'AuthFlag';
  796. // let resultflag = false;
  797. // if (busData[resultKey]) {
  798. // resultflag = busData[resultKey] === 'true';
  799. // }
  800. // // 没有找到page,说明已经关闭过前端软件
  801. // if (page === null) {
  802. // // target.ShowErrorMessageBox("此任务的交易已丢失!");
  803. // // 如果target是消息推送过来的,用target.ShowErrorMessageBox会报错,暂时用这个代替
  804. // this.ShowInfoMessageBox("此任务的交易已丢失,请重新做该交易");
  805. // // MessageBox.Show("此任务的交易已丢失,请重新做该交易", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
  806. // let deletereason = '';
  807. // if (resultKey === 'SuperFlag') {
  808. // deletereason = 'SuperFaild';
  809. // } else if (resultKey === 'AuthFlag') {
  810. // deletereason = 'AuthFaild';
  811. // } else {
  812. // deletereason = 'TellerDelete';
  813. // }
  814. // // 如果失败,不管是找没找到能还原的界面,因为工作流配置为不非环形流程,都需要删除流程,tradepage的流水号serialid也不用更新,
  815. // // 如果还原了界面,客户还可以使用原来的流水号再提交申请,这个由服务端做了处理。
  816. // WorkFlowHandle.deleteProcessInsById(busData['ProcessId'], deletereason); // TellerDelete只是做为删除流程实例原因的描述
  817. // } else {
  818. // // TabItem item = page.GetCurrentTabItem();
  819. // page.GetTradeInfoData().SetTradeBus(busData); // .SetTradeData(data);
  820. // // CheckManager c = item as CheckManager;
  821. // // AuthManager a = item as AuthManager;
  822. // let t: AsksuperResultType = 'Failed';
  823. // if (resultflag) {
  824. // if (busData.hasOwnProperty('WorkItemId')) {
  825. // WorkFlowHandle.CompleteTaskById(busData['WorkItemId']); // 提交任务
  826. // }
  827. // t = 'Success';
  828. // } else {
  829. // let deletereason = '';
  830. // let processid = '';
  831. // if (resultKey === 'SuperFlag') {
  832. // const checkdata = new CheckDataHelper(page);
  833. // deletereason = 'SuperFaild';
  834. // processid = checkdata.ProcessId;
  835. // checkdata.ClearCheckData();
  836. // } else if (resultKey === 'AuthFlag') {
  837. // const authdata = new AuthDataHelper(page);
  838. // deletereason = 'AuthFaild';
  839. // processid = authdata.ProcessId;
  840. // authdata.ClearAuthData();
  841. // }
  842. // /* 如果失败,不管是找没找到能还原的界面,因为工作流配置为不非环形流程,都需要删除流程,tradepage的流水号serialid也不用更新,
  843. // 如果还原了界面,客户还可以使用原来的流水号再提交申请,这个由服务端做了处理。
  844. // TellerDelete只是做为删除流程实例原因的描述 */
  845. // WorkFlowHandle.deleteProcessInsById(processid, deletereason);
  846. // t = 'Failed';
  847. // }
  848. // // if (c != null)
  849. // // c.Result(t, busData);
  850. // // else
  851. // const c = CheckManager.GetCheckManager(page);
  852. // const a = AuthManager.GetAuthManager(page);
  853. // if (c && resultKey === 'SuperFlag') {
  854. // c.Result(t, busData);
  855. // } else if (a && resultKey === 'AuthFlag') {
  856. // a.Result(t, busData);
  857. // }
  858. // }
  859. // }, 'Loaded');
  860. // });
  861. // }
  862. public GetAuthElement(oepnBranch: string, DeAccount: string = '', CrAccount: string = '', SinAmt: string = '', CTSigns: string = '', OperationType: string = '', DeAccountSeqn: string = ''): AuthConditionElement | null {
  863. oepnBranch = '';
  864. let result: AuthConditionElement | null = null;
  865. const message: Message = null;
  866. this.InitFd(message);
  867. this.CommSend(message);
  868. message.Fd16 = '8980';
  869. message.Fd30 = DeAccount;
  870. message.Fd31 = CrAccount;
  871. message.Fd100_1 = SinAmt;
  872. message.Fd34 = DeAccountSeqn;
  873. if (!this.CallServer(message)) {
  874. //通讯先注hulei-/
  875. // this.ShowErrorMessageBox(this.GetError(message));
  876. return null;
  877. }
  878. if (message.Fd12 !== '0000') {
  879. // this.ShowErrorMessageBox(this.GetError(message));
  880. return null;
  881. } else {
  882. result = {
  883. OperationType: OperationType ? OperationType.trim() : '',
  884. Txcode: TradeInfoData.GetTradeInfo(this.Page).TradeCode,
  885. CTSigns: CTSigns ? CTSigns.trim() : '',
  886. SinAmt: SinAmt ? SinAmt.trim() : '',
  887. } as AuthConditionElement;
  888. const fd125 = Feild8583.SetAuthFd125(message.Fd125);
  889. fd125.CTSigns = CTSigns;
  890. fd125.SinAmt = SinAmt;
  891. oepnBranch = DeAccount ? Feild8583.GetStrBytes(message.Fd125, 176, 5) : Feild8583.GetStrBytes(message.Fd125, 181, 5);
  892. result.DeAccountType = fd125.DeAccountType.trim();
  893. result.CrAccountType = fd125.CrAccountType.trim();
  894. result.DeAccountPro = fd125.DeAccountPro.trim();
  895. result.CrAccountPro = fd125.CrAccountPro.trim();
  896. result.DeIsOwn = fd125.DeIsOwn === 'Y' ? 'true' : 'false';
  897. result.CrIsOwn = fd125.CrIsOwn === 'Y' ? 'true' : 'false';
  898. result.DCIsSameCus = fd125.DCIsSameCus === 'Y' ? 'true' : 'false';
  899. result.DeCaAddAmt = fd125.DeCaAddAmt.trim();
  900. if (!SinAmt.trim()) SinAmt = '0.0';
  901. result.DeCaAddAmt = (parseFloat(fd125.DeCaAddAmt.trim()) + parseFloat(SinAmt)).toString();
  902. result.CrTrAddAmt = (parseFloat(fd125.CrTrAddAmt.trim()) + parseFloat(SinAmt)).toString();
  903. result.DeTrAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt)).toString();
  904. result.SumAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt) + parseFloat(fd125.DeCaAddAmt.trim())).toString();
  905. result.LossMarked = fd125.LossMarked === 'Y' ? 'true' : fd125.LossMarked === 'N' ? 'false' : '';
  906. result.DocumentType = fd125.DocumentType.trim();
  907. result.DeductMarked = fd125.DeductMarked.trim();
  908. result.LongOrShort = fd125.LongOrShort === 'Y' ? 'true' : fd125.LongOrShort === 'N' ? 'false' : '';
  909. result.LegalPerson = LoginAuthentication.Instance.GroupKinbrNo;
  910. }
  911. return result;
  912. }
  913. public GetCheckElement(args: any): CheckConditionElements | null {
  914. let SinAmt = args.SinAmt.toString();
  915. let result: CheckConditionElements | null = null;
  916. const message: Message = {};
  917. this.InitFd(message);
  918. this.CommSend(message);
  919. message.Fd16 = '8980';
  920. message.Fd30 = args.DeAccount;
  921. message.Fd31 = args.CrAccount;
  922. message.Fd100_1 = SinAmt;
  923. message.Fd34 = args.DeAccountSeqn;
  924. if (!this.CallServer(message)) {
  925. this.ShowErrorMessageBox(this.GetError(message));
  926. return null;
  927. }
  928. if (message.Fd12 !== '0000') {
  929. this.ShowErrorMessageBox(this.GetError(message));
  930. return null;
  931. } else {
  932. result = {
  933. Account: args.Account,
  934. Money: args.Amt,
  935. OperationType: args.OperationType ? args.OperationType.trim() : '',
  936. Txcode: this.Page.TradeInfoData.GetTradeInfo(this.Page).TradeCode,
  937. CTSigns: args.CTSigns ? args.CTSigns.trim() : '',
  938. SinAmt: args.Amt.toString() && args.Amt !== 0 ? args.Amt.toString() : SinAmt,
  939. } as CheckConditionElements;
  940. const fd125 = Feild8583.SetAuthFd125(message.Fd125);
  941. fd125.CTSigns = args.CTSigns;
  942. fd125.SinAmt = SinAmt;
  943. result.DeAccountType = fd125.DeAccountType.trim();
  944. result.CrAccountType = fd125.CrAccountType.trim();
  945. result.DeAccountPro = fd125.DeAccountPro.trim();
  946. result.CrAccountPro = fd125.CrAccountPro.trim();
  947. result.DeIsOwn = fd125.DeIsOwn === 'Y' ? 'true' : 'false';
  948. result.CrIsOwn = fd125.CrIsOwn === 'Y' ? 'true' : 'false';
  949. result.DCIsSameCus = fd125.DCIsSameCus === 'Y' ? 'true' : 'false';
  950. result.DeCaAddAmt = fd125.DeCaAddAmt.trim();
  951. if (!SinAmt.trim()) SinAmt = '0.0';
  952. result.DeCaAddAmt = (parseFloat(fd125.DeCaAddAmt.trim()) + parseFloat(SinAmt)).toString();
  953. result.CrTrAddAmt = (parseFloat(fd125.CrTrAddAmt.trim()) + parseFloat(SinAmt)).toString();
  954. result.DeTrAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt)).toString();
  955. result.SumAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt) + parseFloat(fd125.DeCaAddAmt.trim())).toString();
  956. result.LossMarked = fd125.LossMarked === 'Y' ? 'true' : fd125.LossMarked === 'N' ? 'false' : '';
  957. result.DocumentType = fd125.DocumentType.trim();
  958. result.DeductMarked = fd125.DeductMarked.trim();
  959. result.LongOrShort = fd125.LongOrShort === 'Y' ? 'true' : fd125.LongOrShort === 'N' ? 'false' : '';
  960. result.LegalPerson = LoginAuthentication.Instance.GroupKinbrNo;
  961. }
  962. return result;
  963. }
  964. public SetAuthCheckTitle(element: FrameworkElement, str: string): void {
  965. CheckManager.SetAuthCheckTitle(element, str);
  966. }
  967. // 获取菜单属性
  968. public GetTradeMetadata(name: string): string {
  969. const model = this.Page.TradeModel;
  970. if (!model || !model.Metadata.hasOwnProperty(name)) return '';
  971. return model.Metadata[name];
  972. }
  973. public CheckTradePower(powerCode: string): boolean {
  974. if (!TradePowerManager.Instance.IsPowerCheckByUser) return true;
  975. const list = TradePowerManager.Instance.GetTradePowerByCode(this.Page.TradeInfo.TradeCode);
  976. if (!list || list.length === 0) return false;
  977. return list.some((x: any) => x.RuleNo === powerCode);
  978. }
  979. private static _SignInStateList_: string[] = [
  980. "TellerTransfer",
  981. "TellerChecking",
  982. "TellerChecked",
  983. "TellerSignOut",
  984. ];
  985. public CheckWorkState(defV: boolean | null = null): boolean {
  986. const FLAG = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("2ea3a7e6cfa04f89a335bf1e363295de");
  987. if (FLAG === "V24") {
  988. // 若给定了默认值,则需要检查当前交易菜单配置
  989. if (defV !== null) {
  990. let flag = false;
  991. if (!Boolean(this.GetTradeMetadata("isCheckWorkState"))) {
  992. flag = defV;
  993. }
  994. if (!flag) return true;
  995. }
  996. const TSGY = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("TSGY");
  997. if (TSGY.includes(LoginUserInfo.TellerNo)) {
  998. return true;
  999. }
  1000. const status = LoginUserInfo.GetUserInfo("WorkState");
  1001. if (TradeAPIsHelper._SignInStateList_.includes(status)) return true;
  1002. this.ShowWarnMessageBox("当前柜员非签到状态,请先签到...");
  1003. return false;
  1004. } else {
  1005. return true;
  1006. }
  1007. }
  1008. public CheckDFState(defV: boolean | null = null): boolean {
  1009. const FLAG = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("2ea3a7e6cfa04f89a335bf1e363295de");
  1010. if (FLAG === "V0" && TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("TGJC") !== "true") {
  1011. // 若给定了默认值,则需要检查当前交易菜单配置
  1012. if (defV !== null) {
  1013. let flag = false;
  1014. if (!Boolean(this.GetTradeMetadata("isCheckDFState"))) {
  1015. flag = defV;
  1016. }
  1017. if (!flag) return true;
  1018. }
  1019. const msg: Message = {};
  1020. this.InitFd(msg);
  1021. this.CommSend(msg);
  1022. msg.Fd16 = "K119";
  1023. msg.Fd92 = LoginUserInfo.TellerNo;
  1024. if (!this.CallServer(msg)) {
  1025. // 处理调用失败情况
  1026. }
  1027. // 后续逻辑需要根据实际业务补充
  1028. return true;
  1029. } else {
  1030. return true;
  1031. }
  1032. }
  1033. }
  1034. export default TradeAPIsHelper;