import SystemFunction from "@/views/front/develop/Library.Ext/Function/SystemFunction" import { PageBase } from "@/views/front/develop/Constract/ContractBase/PageBase"; import Message from "../../Communication/Message"; import { TradeManagerHandle } from "../../ServiceProxy.Ext/ServiceHelper/TradeManagerHandle"; import LoginUserInfo from "@/views/front/platfrom/common/RunningParameters/LoginUserInfo"; import { TradePowerManager } from "../../Library.Ext/TradeExtension/TradeMenu/TradePowerManager"; import { LoginAuthentication } from "../../Library.Ext/TradeExtension/SSO/LoginAuthentication"; import { CheckConditionElements } from "../Function/TradeCheck/CheckConditionElements"; import { AuthConditionElement } from "../Function/TradeAuth/AuthConditionElement"; import { CheckDataHelper } from "../Function/TradeCheck/CheckDataHelper"; import { AuthDataHelper } from "../Function/TradeAuth/AuthDataHelper"; import { WorkFlowHandle } from "@/views/front/platfrom/serviceproxy/ServiceHelper/WorkFlowHandle"; import { AsksuperResultType, CheckManager } from "../Function/TradeCheck/CheckManager"; import { TransitType } from "../../Communication/MessageHelper/TransitType"; import { NotifyMessage } from "../../Library.Ext/Variables/NotifyMessage"; import TransitErrorCodeMap from "../../Communication/MessageHelper/TransitErrorCodeMap"; import Result from "../../Library.Ext/Variables/Result"; //import { Selector } from "@/views/front/platfrom/controls/ControlsHelper/ItemsControlHelper"; import { SelectionManager } from "../../Library.Ext/TradeExtension/SelectionManager"; import UserFunction from "../../Library.Ext/Function/UserFunction"; import { TradeBusData } from "../../Library.Ext/TradeExtension/TradeInfo/TradeBusData"; import TradeHandle from "../../ServiceProxy.Ext/ServiceHelper/TradeHandle"; import { TradeInfoData } from "../../Library.Ext/TradeExtension/TradeInfo/TradeInfoData"; class TradeAPIsHelper { // ctor & Property public Page: PageBase; constructor(page: PageBase) { this.Page = page; } // 封装交易API函数 // Message操作 public InitFd(message: Message): void { SystemFunction.InitFd(message); } public CommSend(message: Message): void { SystemFunction.CommSend(this.Page, message); } public CommSend96(message: Message): void { SystemFunction.CommSend(this.Page, message); } public CallServer(message: Message): boolean { return SystemFunction.CallServer(message); } public CallAgn(message: Message): boolean { return SystemFunction.CallAgn(message); } public CallAgnTips(message: Message): boolean { return SystemFunction.CallAgnTips(message); } public CallAgnRun(message: Message): boolean { return SystemFunction.CallAgnRun(message); } public CallMobileBanking(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallMobileBanking"); } public CallAgnCIS(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnCIS"); } public CallAgnCard(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnCard"); } public CallAgnHeat01(message: Message): boolean { return SystemFunction.DoTransit(message, "ransitType.CallAgnHeat01"); } public CallAgnHeat02(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnHeat02"); } public CallAgnHeat03(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnHeat03"); } public CallAgnIDC(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnIDC"); } public CallAgnIBPS(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnIBPS"); } public CallAgnSHCZ(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnSHCZ"); } public CallAgnIBDW(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnIBDW"); } public CallAgnNew(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnNew"); } public CallAgnCardEx(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnCardEx"); } public CallAgnCartoon(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnCartoon"); } public CallAgnHPF(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnHPF"); } public CallAgnTV(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnTV"); } public CallAgnFSSR(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnFSSR"); } public CallAgnCLFJG(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnCLFJG"); } public CallAgnHontax(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnHontax"); } public CallAgnOrder(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnOrder"); } public CallAgnMIS(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnMIS"); } public CallAgnWXJJ_LP(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnWXJJ_LP"); } public CallAgnWXJJ_CDX(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnWXJJ_CDX"); } public CallAgnNetBank(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnNetBank"); } public CallAgnMF01(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnMF01"); } public CallAgnMF02(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnMF02"); } public CallAgnWater(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnWater"); } public CallAgnCnaps2(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnCnaps2"); } public CallAgn_CZYYSW(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_CZYYSW"); } public CallAgn_EasyPay(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_EasyPay"); } public CallAgn_Ebill(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_Ebill"); } public CallAgn_SDYCT(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_SDYCT"); } public CallAgn_GasFee(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_GasFee"); } public CallAgn_NJT(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_NJT"); } public CallNoFileSys(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallNoFileSys"); } public CallAgn_FGJWQ(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_FGJWQ"); } public CallAgnNew_WL(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgnNew_WL"); } public CallAgn_GGJ(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_GGJ"); } public CallAgn_FGJWQ_HH(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_FGJWQ_HH"); } public CallAgn_DF(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_DF"); } public CallAgn_CW(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_CW"); } public CallAgn_ZJJG(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_ZJJG"); } public CallAgn_CKXT(message: Message): boolean { return SystemFunction.DoTransit(message, "TransitType.CallAgn_CKXT"); } public CustomizeTransit(msg: Message, func: (x: any) => boolean | null): void { // 取消自定义处理 if (func === null) { msg.CustomizeTransitEntry = null; return; } // msg.CustomizeTransitEntry = (x: any) => { // try { // return func(x); // } catch (ex) { // console.error('TradeAPIsHelper.CustomizeTransit:执行异常!', ex); // x.Error = (ex as Error).message; // return false; // } // }; } // 控件辅助操作 // public AddItemOfSelecteAll(element: ComboBox, value: string = ''): boolean { // return SystemFunction.AddItemOfSelecteAll(this.Page, element, value); // } // public RemoveItemOfSelecteAll(element: ComboBox): boolean { // return SystemFunction.RemoveItemOfSelecteAll(this.Page, element); // } //hulei-s combobox 控件没用 public GetError(msg: Message): string { return SystemFunction.GetError(""); } public GetNotifyMessage(notify: string | NotifyMessage): string { if (typeof notify === 'string') { return TransitErrorCodeMap.GetInstance().GetErrorMessage(notify, 'notify'); } else { return this.GetNotifyMessage(notify.toString()); } } public CallComboBoxData(message: Message, formatString: string, defalutCombox: string = "Null"): Result { return SystemFunction.CallComboBoxData(message, formatString, defalutCombox); //hulei-r vue中不能有pagebase的属性 所以方法中去掉 } //hulei-/获取下拉框的值 public CallComboBoxDataSelector(code: string, tmp?: { [key: string]: string }): boolean {//hulei-r 替换成tmp // arguments selector: Selector,是微软自带的 // if (selector === null) return false; // selector.items.clear(); let dict: any; if (this.Page.TradeInfo.MainCode === undefined || this.Page.TradeInfo.MainCode === '') { dict = SelectionManager.Instance.PullSelection(code, tmp); } else { dict = SelectionManager.Instance.PullSelection(code, tmp, this.Page.TradeInfo.MainCode); } if (dict === null) return false; // selector.SetItems(dict); return true; } public SetAssertNotEmpty(flag: boolean): void {//element: FrameworkElement,hulei-s windows自带框架 这里是设置必须输入属性 可以先注销 //SystemFunction.SetAssertNotEmpty(this.Page, element, flag); } public GetSelectedValue(): string {//hulei-/获取下拉框的值 combo: ComboBox //下拉框的值 const combo = ""; return UserFunction.GetSelectedValue(combo); } public SetSelectedValue(val: any): void {//combo: ComboBox, //hulei-/获取下拉框的值 combo: ComboBox const combo = ""; UserFunction.SetSelectedValue(combo, val); } public SetSelectedKey(key: string): void {//combo: ComboBox, //hulei-/获取下拉框的值 combo: ComboBox, const combo = ""; UserFunction.SetSelectedKey(combo, key); } public ToDecimal(src: string): number { return UserFunction.ToDecimal(src); } public ToDateTime(src: string): Date { return UserFunction.ToDateTime(src); } public DateToBig(date: string): string[] { return UserFunction.DateToBig("", date); } // 字符串数字处理类 // 转换字符串为数字 atoi(string) public Atoi(number: string): number { return SystemFunction.Atoi(number); } // 转换数字为字符串 itoa(number,string) public Itoa(number: number, format: string): string { return SystemFunction.Itoa(this.Page, number, format); } // 截取一个子串 substr(string,number,number) public SubStr(sourceData: string, start: number, length: number): string { return SystemFunction.SubStr(this.Page, sourceData, start, length); } // 得到字符串的长度 len(string) public Len(sourceData: string): number { return SystemFunction.Len(sourceData); } // 把指定的ascii码值转换为字符串 chr(number) public Chr(number: number): string { return SystemFunction.Chr(number);//hulei-/不要page参数 } // 求两个整数的余 mod(number1,number) public Mod(number1: number, number2: number): number { return SystemFunction.Mod(number1, number2); } // 把一个数字型字符串转换为','分割的形式 comma(string,[number]) public Comma(sourceData: string, length: number): string { return SystemFunction.Comma(this.Page, sourceData, length); } // 得到数字字符串对应的数值 val(string,[number]) public Val(sourceData: string, weight: number): number { return SystemFunction.Val(this.Page, sourceData, weight); } // 去掉尾部空格 rtrim(string) public RTrim(sourceData: string): string { return SystemFunction.RTrim(this.Page, sourceData); } // 去掉左边空格 ltrim(string) public LTrim(sourceData: string): string { return SystemFunction.RTrim(this.Page, sourceData); } // 去掉所有空格,包括字符串中间的空格 delspace(string) public Delspace(sourceData: string): string { return SystemFunction.Delspace(this.Page, sourceData); } // 左补齐参数字符 PadLeft(string,int,char) public PadLeft(sourcedata: string, length: number, varChar: string = ' '): string { return SystemFunction.PadLeft(this.Page, sourcedata, length, varChar); } // 右补齐参数字符 PadRight(string,length,var) public PadRight(sourcedata: string, length: number, varChar: string = ' '): string { return SystemFunction.PadRight(this.Page, sourcedata, length, varChar); } // 以某个字符构建某长度的字符串 Space(lenth,char) public Space(lenght: number, c: string = ' '): string { return SystemFunction.Space(this.Page, lenght, c); } // 计算两个日期直接的绝对差值(天数) public Func(fDate: string, sDate: string): number { const startDate = new Date( parseInt(fDate.substring(0, 4)), parseInt(fDate.substring(4, 6)) - 1, parseInt(fDate.substring(6)) ); const endDate = new Date( parseInt(sDate.substring(0, 4)), parseInt(sDate.substring(4, 6)) - 1, parseInt(sDate.substring(6)) ); const timeSpan = endDate.getTime() - startDate.getTime(); return Math.floor(timeSpan / (1000 * 60 * 60 * 24)); } // 将数字类型转换成大写金额字符串 ChangeToCNY(decimal) public ChangeToCNY(num: number): string { return SystemFunction.ChangeToCNY(this.Page, num); } // 按格式解析返回字串,给combox添加项 public SetSel(fileData: string, formatString: string): boolean {//hulei-/comboBox: ComboBox, return SystemFunction.SetSel(fileData, formatString); } // 非法汉字字符检查 public CheckHalf(str: string): boolean { return true; } // 格式化金额数值:千分位、去空格(左对齐) public FormatAMT(amtVal: number): string { return this.Delspace(this.Comma(amtVal.toString(), 17)); } // 将数字转换成中文 private static unit: string[] = ["", "十", "百", "千", "万", "十万", "百万", "千万", "亿", "十亿", "百亿", "千亿", "万亿"]; private static unit_T: string[] = ["", "拾", "佰", "仟", "萬", "拾萬", "佰萬", "仟萬", "亿", "拾亿", "佰亿", "仟亿", "萬亿"]; public ChangeToCI(value: number, isSimple: boolean = true, hasUnit: boolean = false): string { let ret = ''; const data = Math.abs(value).toString(); for (let i = 0; i < data.length; i++) { const item = data[i]; let c = ''; switch (item) { case '0': c = isSimple ? "零" : "零"; break; case '1': c = isSimple ? "一" : "壹"; break; case '2': c = isSimple ? "二" : "贰"; break; case '3': c = isSimple ? "三" : "叁"; break; case '4': c = isSimple ? "四" : "肆"; break; case '5': c = isSimple ? "五" : "伍"; break; case '6': c = isSimple ? "六" : "陆"; break; case '7': c = isSimple ? "七" : "柒"; break; case '8': c = isSimple ? "八" : "捌"; break; case '9': c = isSimple ? "九" : "玖"; break; default: throw new Error("ChangeToCI:参数异常!"); } ret += c; if (hasUnit) { // 加载单位 ret += isSimple ? TradeAPIsHelper.unit[data.length - i - 1] : TradeAPIsHelper.unit_T[data.length - i - 1]; } } return ret; } // 将汉字(零,一 ……十二转换为阿拉伯数字1至12) public ChangeToNum(value: string): number { let c = -1; switch (value) { case "零": c = 0; break; case "一": c = 1; break; case "二": c = 2; break; case "三": c = 3; break; case "四": c = 4; break; case "五": c = 5; break; case "六": c = 6; break; case "七": c = 7; break; case "八": c = 8; break; case "九": c = 9; break; case "十": c = 10; break; case "十一": c = 11; break; case "十二": c = 12; break; default: break; } return c; } // 转换证件类型 private static _LicKindList_: { [key: string]: string } | null = null; public ChgLicKind(kind: string): string { if (TradeAPIsHelper._LicKindList_ === null) { TradeAPIsHelper._LicKindList_ = SelectionManager.Instance.PullSelection("C004", null); const c003Data = SelectionManager.Instance.PullSelection("C003", null); Object.entries(c003Data).forEach(([key, value]) => { TradeAPIsHelper._LicKindList_[key] = value; }); } if (TradeAPIsHelper._LicKindList_.hasOwnProperty(kind)) { return TradeAPIsHelper._LicKindList_[kind]; } const item = Object.entries(TradeAPIsHelper._LicKindList_).find(([_, value]) => value === kind); return item ? item[0] : kind; } // 解析文本文件、excel文件、DataTable文件//hulei-s在vue中要用到组件库 public AnalyzeTxtData(txt_RowSplit: string[], txt_ColumnSlit: string, txt_EnCode: string, isColumnHeader: boolean = true) { return SystemFunction.AnalyzeTxtData(txt_RowSplit, txt_ColumnSlit, txt_EnCode, isColumnHeader); } public AnalyseExcelData(RowCount: number = 0, columnCount: number = 0) { return SystemFunction.AnalyseExcelData(RowCount, columnCount); } public AnalyseDataTable(txt_RowSplit: string, txt_ColumnSlit: string): string { return this.AnalyseDataTable(txt_RowSplit, txt_ColumnSlit); } // 文件操作相关 public Shell(cmd: string): boolean { return TradeHandle.ExcuteShell(cmd); } public Getfiletxt(fileName: string): string { return SystemFunction.Getfiletxt(fileName); } public Savefiletxt(fileName: string, fileContent: string, append: boolean): boolean { return SystemFunction.Savefiletxt(fileName, fileContent, append); } // MessageBox-弹出消息框 // 消息提示默认值 private static readonly IsCoverAll = true; private static readonly IsReverse = true; private static readonly Direction = 3; private static readonly AnimationEnable = false; // 输入信息提示 public ShowTip(message: string): boolean { // const current: FrameworkElement = this.Page; // const flag = this.Page.GetEnableFocusControl(); // let fm: any; // if (flag) { // fm = this.Page.GetManagerInstance(); // if (fm !== null) { // current = fm.CurrentFocusedElement; // } // }//hulei-s 没有page这个概念 return true;//this.ShowTipElement(current, message); } // public ShowTipElement(target: UIElement, message: string): boolean { // return target.ShowTip(message); // } // public ShowTipPlacement(target: UIElement, message: string, placement: any = 'Bottom'): boolean { // return target.ShowTip(placement, message); // } // 功能选择消息提示 public ShowComfirmBox(message: string, comfirm: string[], defaultfocus: string | null = null): string { let def = 1; if (comfirm.includes(defaultfocus as string)) { def = comfirm.indexOf(defaultfocus as string) + 1; } const ret = "";//UserFunction.ShowComfirmBox(message, comfirm, def); //hulei-s 消息弹窗 return comfirm[ret]; } // public ShowComfirmBoxKey(message: string, comfirm: { [key: string]: string }, defaultfocus: string = 'None'): string { // return this.Page.ShowPageMessageBoxExt(message, comfirm, defaultfocus); // } // public ShowComfirmBoxParams(message: string, ...comfirm: string[]): number { // return this.Page.ShowComfirmBox(message, comfirm); // } // 推送消息提示 public ShowPopueMessageBox(content: any, caption: string = "提示信息"): void { // 原函数体为空 } // 默认选择提示 // public ShowQuestionMessageBox(content: any, caption: string = "询问信息", focuResult: string = "Yes", results: string[] = ["Yes", "No"]): string { // const result = this.Page.ShowPageMessageBoxMetro( // content, // caption, // null, // this.ConvertMessageBoxResultToStr(focuResult), // TradeAPIsHelper.Direction, // TradeAPIsHelper.IsReverse, // TradeAPIsHelper.IsCoverAll, // TradeAPIsHelper.AnimationEnable, // this.ConvertMessageBoxButton(results) // ); // return this.ConvertStrToMessageBoxResult(result); // } // public ShowQuestionMessageBoxCustom(content: any, results: string[], defaultIndex: number, caption: string = "询问信息"): string { // const defaultValue = results.length > defaultIndex ? results[defaultIndex] : results[0]; // return this.Page.ShowPageMessageBoxMetro( // content, // caption, // null, // defaultValue, // TradeAPIsHelper.Direction, // TradeAPIsHelper.IsReverse, // TradeAPIsHelper.IsCoverAll, // TradeAPIsHelper.AnimationEnable, // results // ); // } // // 场景信息提醒提示 // public ShowSuccessMessageBox(content: any | null = null, caption: string = "业务办理成功"): string { // const image = this.Page.GetResource("MessageBoxMetroSuccess"); // const result = this.Page.ShowPageMessageBoxMetro( // content, // caption, // image, // this.ConvertMessageBoxResultToStr("OK"), // TradeAPIsHelper.Direction, // TradeAPIsHelper.IsReverse, // TradeAPIsHelper.IsCoverAll, // TradeAPIsHelper.AnimationEnable, // this.ConvertMessageBoxButton(["OK"]) // ); // return this.ConvertStrToMessageBoxResult(result); // } // public ShowInfoMessageBox(content: any | null = null, caption: string = "提示信息"): string { // const image = this.Page.GetResource("MessageBoxMetroInfo"); // const result = this.Page.ShowPageMessageBoxMetro( // content, // caption, // image, // this.ConvertMessageBoxResultToStr("OK"), // TradeAPIsHelper.Direction, // TradeAPIsHelper.IsReverse, // TradeAPIsHelper.IsCoverAll, // TradeAPIsHelper.AnimationEnable, // this.ConvertMessageBoxButton(["OK"]) // ); // return this.ConvertStrToMessageBoxResult(result); // } // public ShowErrorMessageBox(content: any | null = null, caption: string = "错误信息"): string { // const image = this.Page.GetResource("MessageBoxMetroError"); // const result = this.Page.ShowPageMessageBoxMetro( // content, // caption, // image, // this.ConvertMessageBoxResultToStr("OK"), // TradeAPIsHelper.Direction, // TradeAPIsHelper.IsReverse, // TradeAPIsHelper.IsCoverAll, // TradeAPIsHelper.AnimationEnable, // this.ConvertMessageBoxButton(["OK"]) // ); // return this.ConvertStrToMessageBoxResult(result); // } // public ShowWarnMessageBox(content: any | null = null, caption: string = "警告信息"): string { // const image = this.Page.GetResource("MessageBoxMetroWarn"); // const result = this.Page.ShowPageMessageBoxMetro( // content, // caption, // image, // this.ConvertMessageBoxResultToStr("OK"), // TradeAPIsHelper.Direction, // TradeAPIsHelper.IsReverse, // TradeAPIsHelper.IsCoverAll, // TradeAPIsHelper.AnimationEnable, // this.ConvertMessageBoxButton(["OK"]) // ); // return this.ConvertStrToMessageBoxResult(result); // } // 转换方法 private ConvertStrToMessageBoxResult(str: string | null): string { str = str || ''; switch (str.trim()) { case "取消": return "Cancel"; case "否": return "No"; case "确定": return "OK"; case "是": return "Yes"; default: return "None"; } } private ConvertMessageBoxResultToStr(result: string): string { switch (result) { case "Cancel": return "取消"; case "No": return "否"; case "OK": return "确定"; case "Yes": return "是"; default: return "未知"; } } private ConvertMessageBoxButton(msg: string[]): string[] { return msg; } // DataBox相关函数 // public InitDataBox(databox: DataBox): void { // databox.InitDataBox(); // } // public GetDataForDataTable(databox: DataBox): DataTable { // return databox.GetDataForDataTable(); // } // public GetDataForString(databox: DataBox): string { // return databox.GetDataForString(); // } // public BindDataTable(databox: DataBox, dtSource: DataTable): void { // databox.BindDataTable(dtSource); // } // public DataBinding(databox: DataBox, fileData: string, ...columnName: string[]): void { // databox.DataBinding(fileData, columnName); // } // public DataBindingXML(databox: DataBox, fileData: string, nodeName: string, ...columnName: string[]): void { // const str = databox.AnalyzeXMLtoStr(fileData, nodeName); // databox.DataBinding(str || fileData, columnName); // } // public DataBindingLevel(databox: DataBox, fileData: string, level: any, ...columnNames: string[]): void { // databox.DataBinding(fileData, level, columnNames); // } // public SetColumnsHeader(databox: DataBox, columnIndex: number, header: string): void { // databox.SetColumnsHeader(columnIndex, header); // } // public SetColumnsWidth(databox: DataBox, columnIndex: number, width: number): void { // databox.SetColumnsWidth(columnIndex, width); // } // public SetColumnsVisible(databox: DataBox, columnIndex: number, visible: boolean): void { // databox.SetColumnsVisible(columnIndex, visible); // } // public SetColumnsFormat(databox: DataBox, columnIndex: number, format: string): void { // databox.SetColumnsFormat(columnIndex, format); // } // public SetColumnsAlign(databox: DataBox, columnIndex: number, align: string): void { // databox.SetColumnsAlign(columnIndex, align); // } // public GetSelectMultiRows(databox: DataBox): any[] { // return databox.GetSelectMultiRows(); // } // public GetSelectSingleRow(databox: DataBox): any { // return databox.GetSelectSingleRow(); // } // public GetSelectRowValue(databox: DataBox, hasRowIndex: boolean = true): string[] { // let ret = databox.GetSelectRowValue(); // if (!hasRowIndex && ret && ret.length > 1) { // ret = ret.slice(1); // } // return ret; // } // public SetSelDataBox(databox: DataBox, colName: string, dic: { [key: string]: string }): void { // databox.SetSel(colName, dic); // } // public AddColumn(databox: DataBox, column: any): void { // databox.AddColumn(column); // } // public AddHyperlinkColumn(databox: DataBox, colName: string, click: (event: any) => void, hotkey: string = 'None'): void { // databox.AddHyperlinkColumn(colName, click, hotkey); // } // public AddRowDataBox(databox: DataBox, newRow: any): boolean { // return databox.AddRow(newRow); // } // public AddRowValues(databox: DataBox, ...values: any[]): boolean { // return databox.AddRow(values); // } // public UpdateRow(databox: DataBox, ...values: any[]): boolean { // return databox.UpdateRow(values); // } // public DeleteSelectRows(databox: DataBox): boolean { // return databox.DeleteSelectRows(); // } // // Combobox控件相关 // public AddItems(target: any, items: any[]): void { // target.AddItems(items); // } // public SetItems(target: any, items: any[]): void { // target.SetItems(items); // } // public GetSelectedKey(target: any): string { // return target.GetSelectedKey(); // } // // 设置焦点相关 // public SetFocus(element: FrameworkElement | null = null): void { // this.Page.SetFocus(element); // } // 检查账号是否是卡 // public CheckCardBin(acno: string): boolean { // return this.Page.CheckCardBin(acno); // } // 打印相关 // public CreateSpecialMarkPrint(pt: PrintTypes, left: number, top: number, markText: string): PrintContainer { // const tb = new TemplateBase(); // tb.PrintType = pt; // tb.DrawingSpecialMark(left, top, markText); // return tb; // } // public CreateSpecialMarkPrintElement(pt: PrintTypes, left: number, top: number, element: UIElement): PrintContainer { // const tb = new TemplateBase(); // tb.PrintType = pt; // tb.DrawingSpecialMarkWithElement(left, top, element); // return tb; // } // public PrintCertificate(authForms: PrintContainer[]): void { // this.Page.PrintCertificate(authForms); // // add by chuhai 清空前端流水,避免交易不关闭导致流水重复。 // this.Page.ClearSerialNumber(); // } // public PrintAcdtl_1(message: Message): string { // return ''; // } // public PrintAcdtl_hst(message: Message): string { // return ''; // } // public PrintAcdtl_h(message: Message): string { // return ''; // } // public Print_Sq(message: Message): string { // return ''; // } // public PrintReport(formatMessage: string, reportURI: string, paraDic: { [key: string]: string } | null): void { // let sb = formatMessage; // if (paraDic) { // sb += '\n[parameters]\n'; // for (const [key, value] of Object.entries(paraDic)) { // sb += `${key}=${value}\n`; // } // sb += ';'; // } // const re = new ReportEntity(reportURI); // // 补偿PrintAttributes给ReportEntity // let pa = PrintContainerExt.GetPrintElement(this.Page); // if (!pa) pa = this.Page.GetPrintAttributes(); // PrintContainerExt.SetPrintElement(re, pa); // re.Analyze(sb); // re.Print(); // } // 查找上层Ipage private FindAncestor(element: any): T | null { let obj: any = null; // for (obj = this.Page.VisualTreeHelper.GetParent(element); !(obj instanceof T); obj = this.Page.VisualTreeHelper.GetParent(obj)) { // if (obj === null) break; // } return obj as T; } // 授权/复核 // public RestoreTradePage(serialid: string, busData: TradeBusData): void { // this.Page.ShowTradeTab(serialid, (page: IPage) => { // this.Page.Dispatcher.BeginInvoke(() => { // const resultKey = busData.hasOwnProperty('SuperFlag') ? 'SuperFlag' : 'AuthFlag'; // let resultflag = false; // if (busData[resultKey]) { // resultflag = busData[resultKey] === 'true'; // } // // 没有找到page,说明已经关闭过前端软件 // if (page === null) { // // target.ShowErrorMessageBox("此任务的交易已丢失!"); // // 如果target是消息推送过来的,用target.ShowErrorMessageBox会报错,暂时用这个代替 // this.ShowInfoMessageBox("此任务的交易已丢失,请重新做该交易"); // // MessageBox.Show("此任务的交易已丢失,请重新做该交易", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); // let deletereason = ''; // if (resultKey === 'SuperFlag') { // deletereason = 'SuperFaild'; // } else if (resultKey === 'AuthFlag') { // deletereason = 'AuthFaild'; // } else { // deletereason = 'TellerDelete'; // } // // 如果失败,不管是找没找到能还原的界面,因为工作流配置为不非环形流程,都需要删除流程,tradepage的流水号serialid也不用更新, // // 如果还原了界面,客户还可以使用原来的流水号再提交申请,这个由服务端做了处理。 // WorkFlowHandle.deleteProcessInsById(busData['ProcessId'], deletereason); // TellerDelete只是做为删除流程实例原因的描述 // } else { // // TabItem item = page.GetCurrentTabItem(); // page.GetTradeInfoData().SetTradeBus(busData); // .SetTradeData(data); // // CheckManager c = item as CheckManager; // // AuthManager a = item as AuthManager; // let t: AsksuperResultType = 'Failed'; // if (resultflag) { // if (busData.hasOwnProperty('WorkItemId')) { // WorkFlowHandle.CompleteTaskById(busData['WorkItemId']); // 提交任务 // } // t = 'Success'; // } else { // let deletereason = ''; // let processid = ''; // if (resultKey === 'SuperFlag') { // const checkdata = new CheckDataHelper(page); // deletereason = 'SuperFaild'; // processid = checkdata.ProcessId; // checkdata.ClearCheckData(); // } else if (resultKey === 'AuthFlag') { // const authdata = new AuthDataHelper(page); // deletereason = 'AuthFaild'; // processid = authdata.ProcessId; // authdata.ClearAuthData(); // } // /* 如果失败,不管是找没找到能还原的界面,因为工作流配置为不非环形流程,都需要删除流程,tradepage的流水号serialid也不用更新, // 如果还原了界面,客户还可以使用原来的流水号再提交申请,这个由服务端做了处理。 // TellerDelete只是做为删除流程实例原因的描述 */ // WorkFlowHandle.deleteProcessInsById(processid, deletereason); // t = 'Failed'; // } // // if (c != null) // // c.Result(t, busData); // // else // const c = CheckManager.GetCheckManager(page); // const a = AuthManager.GetAuthManager(page); // if (c && resultKey === 'SuperFlag') { // c.Result(t, busData); // } else if (a && resultKey === 'AuthFlag') { // a.Result(t, busData); // } // } // }, 'Loaded'); // }); // } public GetAuthElement(oepnBranch: string, DeAccount: string = '', CrAccount: string = '', SinAmt: string = '', CTSigns: string = '', OperationType: string = '', DeAccountSeqn: string = ''): AuthConditionElement | null { oepnBranch = ''; let result: AuthConditionElement | null = null; const message: Message = null; this.InitFd(message); this.CommSend(message); message.Fd16 = '8980'; message.Fd30 = DeAccount; message.Fd31 = CrAccount; message.Fd100_1 = SinAmt; message.Fd34 = DeAccountSeqn; if (!this.CallServer(message)) { //通讯先注hulei-/ // this.ShowErrorMessageBox(this.GetError(message)); return null; } if (message.Fd12 !== '0000') { // this.ShowErrorMessageBox(this.GetError(message)); return null; } else { result = { OperationType: OperationType ? OperationType.trim() : '', Txcode: TradeInfoData.GetTradeInfo(this.Page).TradeCode, CTSigns: CTSigns ? CTSigns.trim() : '', SinAmt: SinAmt ? SinAmt.trim() : '', } as AuthConditionElement; const fd125 = Feild8583.SetAuthFd125(message.Fd125); fd125.CTSigns = CTSigns; fd125.SinAmt = SinAmt; oepnBranch = DeAccount ? Feild8583.GetStrBytes(message.Fd125, 176, 5) : Feild8583.GetStrBytes(message.Fd125, 181, 5); result.DeAccountType = fd125.DeAccountType.trim(); result.CrAccountType = fd125.CrAccountType.trim(); result.DeAccountPro = fd125.DeAccountPro.trim(); result.CrAccountPro = fd125.CrAccountPro.trim(); result.DeIsOwn = fd125.DeIsOwn === 'Y' ? 'true' : 'false'; result.CrIsOwn = fd125.CrIsOwn === 'Y' ? 'true' : 'false'; result.DCIsSameCus = fd125.DCIsSameCus === 'Y' ? 'true' : 'false'; result.DeCaAddAmt = fd125.DeCaAddAmt.trim(); if (!SinAmt.trim()) SinAmt = '0.0'; result.DeCaAddAmt = (parseFloat(fd125.DeCaAddAmt.trim()) + parseFloat(SinAmt)).toString(); result.CrTrAddAmt = (parseFloat(fd125.CrTrAddAmt.trim()) + parseFloat(SinAmt)).toString(); result.DeTrAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt)).toString(); result.SumAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt) + parseFloat(fd125.DeCaAddAmt.trim())).toString(); result.LossMarked = fd125.LossMarked === 'Y' ? 'true' : fd125.LossMarked === 'N' ? 'false' : ''; result.DocumentType = fd125.DocumentType.trim(); result.DeductMarked = fd125.DeductMarked.trim(); result.LongOrShort = fd125.LongOrShort === 'Y' ? 'true' : fd125.LongOrShort === 'N' ? 'false' : ''; result.LegalPerson = LoginAuthentication.Instance.GroupKinbrNo; } return result; } public GetCheckElement(args: any): CheckConditionElements | null { let SinAmt = args.SinAmt.toString(); let result: CheckConditionElements | null = null; const message: Message = {}; this.InitFd(message); this.CommSend(message); message.Fd16 = '8980'; message.Fd30 = args.DeAccount; message.Fd31 = args.CrAccount; message.Fd100_1 = SinAmt; message.Fd34 = args.DeAccountSeqn; if (!this.CallServer(message)) { this.ShowErrorMessageBox(this.GetError(message)); return null; } if (message.Fd12 !== '0000') { this.ShowErrorMessageBox(this.GetError(message)); return null; } else { result = { Account: args.Account, Money: args.Amt, OperationType: args.OperationType ? args.OperationType.trim() : '', Txcode: this.Page.TradeInfoData.GetTradeInfo(this.Page).TradeCode, CTSigns: args.CTSigns ? args.CTSigns.trim() : '', SinAmt: args.Amt.toString() && args.Amt !== 0 ? args.Amt.toString() : SinAmt, } as CheckConditionElements; const fd125 = Feild8583.SetAuthFd125(message.Fd125); fd125.CTSigns = args.CTSigns; fd125.SinAmt = SinAmt; result.DeAccountType = fd125.DeAccountType.trim(); result.CrAccountType = fd125.CrAccountType.trim(); result.DeAccountPro = fd125.DeAccountPro.trim(); result.CrAccountPro = fd125.CrAccountPro.trim(); result.DeIsOwn = fd125.DeIsOwn === 'Y' ? 'true' : 'false'; result.CrIsOwn = fd125.CrIsOwn === 'Y' ? 'true' : 'false'; result.DCIsSameCus = fd125.DCIsSameCus === 'Y' ? 'true' : 'false'; result.DeCaAddAmt = fd125.DeCaAddAmt.trim(); if (!SinAmt.trim()) SinAmt = '0.0'; result.DeCaAddAmt = (parseFloat(fd125.DeCaAddAmt.trim()) + parseFloat(SinAmt)).toString(); result.CrTrAddAmt = (parseFloat(fd125.CrTrAddAmt.trim()) + parseFloat(SinAmt)).toString(); result.DeTrAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt)).toString(); result.SumAddAmt = (parseFloat(fd125.DeTrAddAmt.trim()) + parseFloat(SinAmt) + parseFloat(fd125.DeCaAddAmt.trim())).toString(); result.LossMarked = fd125.LossMarked === 'Y' ? 'true' : fd125.LossMarked === 'N' ? 'false' : ''; result.DocumentType = fd125.DocumentType.trim(); result.DeductMarked = fd125.DeductMarked.trim(); result.LongOrShort = fd125.LongOrShort === 'Y' ? 'true' : fd125.LongOrShort === 'N' ? 'false' : ''; result.LegalPerson = LoginAuthentication.Instance.GroupKinbrNo; } return result; } public SetAuthCheckTitle(element: FrameworkElement, str: string): void { CheckManager.SetAuthCheckTitle(element, str); } // 获取菜单属性 public GetTradeMetadata(name: string): string { const model = this.Page.TradeModel; if (!model || !model.Metadata.hasOwnProperty(name)) return ''; return model.Metadata[name]; } public CheckTradePower(powerCode: string): boolean { if (!TradePowerManager.Instance.IsPowerCheckByUser) return true; const list = TradePowerManager.Instance.GetTradePowerByCode(this.Page.TradeInfo.TradeCode); if (!list || list.length === 0) return false; return list.some((x: any) => x.RuleNo === powerCode); } private static _SignInStateList_: string[] = [ "TellerTransfer", "TellerChecking", "TellerChecked", "TellerSignOut", ]; public CheckWorkState(defV: boolean | null = null): boolean { const FLAG = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("2ea3a7e6cfa04f89a335bf1e363295de"); if (FLAG === "V24") { // 若给定了默认值,则需要检查当前交易菜单配置 if (defV !== null) { let flag = false; if (!Boolean(this.GetTradeMetadata("isCheckWorkState"))) { flag = defV; } if (!flag) return true; } const TSGY = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("TSGY"); if (TSGY.includes(LoginUserInfo.TellerNo)) { return true; } const status = LoginUserInfo.GetUserInfo("WorkState"); if (TradeAPIsHelper._SignInStateList_.includes(status)) return true; this.ShowWarnMessageBox("当前柜员非签到状态,请先签到..."); return false; } else { return true; } } public CheckDFState(defV: boolean | null = null): boolean { const FLAG = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("2ea3a7e6cfa04f89a335bf1e363295de"); if (FLAG === "V0" && TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("TGJC") !== "true") { // 若给定了默认值,则需要检查当前交易菜单配置 if (defV !== null) { let flag = false; if (!Boolean(this.GetTradeMetadata("isCheckDFState"))) { flag = defV; } if (!flag) return true; } const msg: Message = {}; this.InitFd(msg); this.CommSend(msg); msg.Fd16 = "K119"; msg.Fd92 = LoginUserInfo.TellerNo; if (!this.CallServer(msg)) { // 处理调用失败情况 } // 后续逻辑需要根据实际业务补充 return true; } else { return true; } } } export default TradeAPIsHelper;