记录时间:2024-02-29
一、useSystemService模块实现
service/system-service/useTerminalService.ts
import hydate from '@/utils/date-format' import { LogInfo } from '@/framework/utils/log-local' import { Device } from '@/types/device' import { Receipt } from '@/types/receipt' import { useSystemStore } from '@/store/useSystemStore'const systemStore = useSystemStore()
const getServiceStatus = (terminalIp: string) => { console.log('getServiceStatus:', terminalIp) }
const getServiceTime = (terminalGroupId: string, terminalNo: string) => { console.log('getServcieTime:', terminalGroupId, terminalNo) }
const getServiceTimeSpan = ( AMStartTime: string, AMEndTime: string, PMStartTime: string, PMEndTime: string, NightStartTime: string, NightEndTime: string ) => { console.log( 'getServcieTimeSpan:', AMStartTime, AMEndTime, PMStartTime, PMEndTime, NightStartTime, NightEndTime ) }
const getServiceTimeConfig = (serviceTimeConfig: string) => { console.log('getServcieTimeConfig:', serviceTimeConfig) }
const getDeviceStatusDescription = (deviceName: string, statusId: string) => { console.log('getDeviceStatusDescription:', deviceName, statusId) }
const checkDeviceStatus = (deviceList: Array<Device>) => { console.log('checkDeviceStatus:', deviceList) }
const getMenus = (terminalGroupId: string, parentMenuId: string) => { console.log('getMenus:', terminalGroupId, parentMenuId) }
const receiptPrintRawData = ( terminalIp: string, terminalNo: string, businessTrace: string, receiptPageName: string, customCardNo: string, customName: string, formName: string, values: string, index: string ) => { console.log( 'receiptPrintRawData:', terminalIp, terminalNo, businessTrace, receiptPageName, customCardNo, customName, formName, values, index ) }
const receiptPrintRawDataHtml = ( terminalIp: string, terminalNo: string, businessTrace: string, receiptPageName: string, customCardNo: string, customName: string, formName: string, values: string, index: string ) => { console.log( 'receiptPrintRawDataHtml:', terminalIp, terminalNo, businessTrace, receiptPageName, customCardNo, customName, formName, values, index ) }
// 添加凭条数据 const addReceiptData = (formName: string, jsonPrint: object) => { const jsonPrintStr = JSON.stringify(jsonPrint) const receipt = {} as Receipt receipt.formName = formName receipt.jsonPrint = jsonPrintStr receipt.pageName = window.location.href
systemStore.addToDictReceiptList(receipt)
const now = new Date() const folder = `D:\\LogInfo\\LogReceiptData\\${hydate(now).format('YYYY-MM')}\\` const fileName = `${folder}LogReceipt${hydate(now).format('YYYY-MM-DD')}.txt` LogInfo(folder, fileName, eval("'" + jsonPrintStr + "'") + ',') }
export { getServiceStatus, getServiceTime, getServiceTimeSpan, getServiceTimeConfig, getDeviceStatusDescription, checkDeviceStatus, getMenus, receiptPrintRawData, receiptPrintRawDataHtml, addReceiptData }
service/system-service/useLogService.ts
import hydate from '@/utils/date-format' import { LogInfo } from '@/framework/utils/log-local' import { serveWebApi } from '@/service' import { useSystemStore } from '@/store/useSystemStore'const systemStore = useSystemStore()
// 记录业务流水日志 const logBusinessTrace = function ( businessTrace: string, businessName: string, terminalIp: string, orgId: string, terminalNo: string, iDCardNo: string, customCardNo: string, bankCardNo: string, customId: string, customName: string, telephone: string ) { serveWebApi( '/api/System/AddLogBusinessTrace', JSON.stringify({ businessTrace: businessTrace, businessName: businessName, terminalIp: terminalIp, orgId: orgId, terminalNo: terminalNo, iDCardNo: iDCardNo, customCardNo: customCardNo, bankCardNo: bankCardNo, customId: customId, customName: customName, telephone: telephone }) ) }
// 记录业务流水结果 const logBusinessResult = function ( businessTrace: string, terminalNo: string, patientName: string, trace: string, tradeAmt: string, tradeResult: string, tradeResultMsg: string, flag: string, handleInfo: string ) { const tradeInfo = `${patientName},${systemStore.dictFlowKey},${2}` const tradePageInfo = window.location.href
serveWebApi( '/api/System/AddLogBusinessResult', JSON.stringify({ businessTrace: businessTrace, terminalNo: terminalNo, trace: trace, tradeAmt: tradeAmt, tradeInfo: tradeInfo, tradeResult: tradeResult, tradeResultMsg: tradeResultMsg, tradePageInfo: tradePageInfo, flag: flag, handleInfo: handleInfo }) ) }
// 记录业务消息 const logBusinessMsg = function ( businessTrace: string, msgValue: string, msgInfo: string ) { const msgPageName = systemStore.dict.currentPage.value const msgScope = ''
serveWebApi( '/api/System/AddLogBusinessMsg', JSON.stringify({ businessTrace: businessTrace, msgPageName: msgPageName, msgScope: msgScope, msgValue: msgValue, msgInfo: msgInfo }) ) }
// 记录卡片明细 const logCardDetail = function ( terminalNo: string, businessTrace: string, changeCount: string, idCardNo: string, customName: string, telephone: string, customCardNo: string, description: string ) { const jsonStr = JSON.stringify({ terminalNo: terminalNo, businessTrace: businessTrace, changeCount: changeCount, idCardNo: idCardNo, customName: customName, telephone: telephone, customCardNo: customCardNo, description: description })
const now = new Date() const folder = `D:\\LogInfo\\LogCardDetail\\${hydate(now).format('YYYY-MM')}\\` const fileName = `LogCardDetail${hydate(now).format('YYYY-MM-DD')}.txt'` LogInfo(folder, fileName, eval("'" + jsonStr + "'") + ',')
serveWebApi('/api/System/AddCardDetail', jsonStr) }
// 记录现金明细 const logCashDetail = function ( terminalNo: string, businessTrace: string, trace: string, denomination: string, idCardNo: string, customName: string, telephone: string, customCardNo: string, customId: string ) { const jsonStr = JSON.stringify({ terminalNo: terminalNo, businessTrace: businessTrace, trace: trace, denomination: denomination, idCardNo: idCardNo, customName: customName, telephone: telephone, customCardNo: customCardNo, customId: customId })
const now = new Date() const folder = `D:\\LogInfo\\LogCashDetail\\${hydate(now).format('YYYY-MM')}\\` const fileName = `LogCashDetail${hydate(now).format('YYYY-MM-DD')}.txt` LogInfo(folder, fileName, eval("'" + jsonStr + "'") + ',')
serveWebApi('/api/System/AddCashDetail', jsonStr) }
// 记录账户明细 const logAccountDetail = function ( businessTrace: string, terminalNo: string, trace: string, modeType: string, tradeType: string, iSEmpNo: string, tradeAmt: string, customCardNo: string, customId: string, customName: string, bankPosId: string, bankCardNo: string, bankTrace: string, bankReferenceNo: string, bankDate: string, bankTime: string, bankTradeDate: string ) { const jsonStr = JSON.stringify({ businessTrace: businessTrace, terminalNo: terminalNo, trace: trace, modeType: modeType, tradeType: tradeType, iSEmpNo: iSEmpNo, tradeAmt: tradeAmt, customCardNo: customCardNo, customId: customId, customName: customName, bankPosId: bankPosId, bankCardNo: bankCardNo, bankTrace: bankTrace, bankReferenceNo: bankReferenceNo, bankDate: bankDate, bankTime: bankTime, bankTradeDate: bankTradeDate })
const now = new Date() const folder = `D:\\LogInfo\\LogAccountDetail\\${hydate(now).format('YYYY-MM')}\\` const fileName = `LogAccountDetail${hydate(now).format('YYYY-MM-DD')}.txt` LogInfo(folder, fileName, eval("'" + jsonStr + "'") + ',')
serveWebApi('/api/System/AddAccountDetail', jsonStr) }
// 记录账户明细结果 const logAccountDetailResult = function ( trace: string, tradeResult: string, iSTrace: string, iSTradeDate: string ) { serveWebApi( '/api/System/AddAccountDetailResult', JSON.stringify({ trace: trace, tradeResult: tradeResult, iSTrace: iSTrace, iSTradeDate: iSTradeDate }) ) }
export { logBusinessTrace, logBusinessResult, logBusinessMsg, logCardDetail, logCashDetail, logAccountDetail, logAccountDetailResult }
service/system-service/useTradeServcie.ts
import { serveWebApi } from '@/service'// 添加/更新交易信息日志 const addOrUpdateTradeInfo = async function ( TradeID: string, TerminalNo: string, TerminalIP: string, TellerNo: string, PatientCardID: string, PatientID: string, PatientName: string, TradeState: string, IdCardNo: string, CurrentMoney: string, TradeMoney: string, TradeTypeID: string, TradeNameID: string, ProcessKey: string, TradeType: string, ApiState: string, Hospital_No: string, BusinessOrderNo: string, ProcessId: string ) { const ret = await serveWebApi( '/api/Trade/AddOrUpdateTradeInfo', JSON.stringify({ TradeID: TradeID, TerminalNo: TerminalNo, TerminalIP: TerminalIP, TellerNo: TellerNo, PatientCardID: PatientCardID, PatientID: PatientID, PatientName: PatientName, TradeState: TradeState, IdCardNo: IdCardNo, CurrentMoney: CurrentMoney, TradeMoney: TradeMoney, TradeTypeID: TradeTypeID, TradeNameID: TradeNameID, ProcessKey: ProcessKey, TradeType: TradeType, ApiState: ApiState, Hospital_No: Hospital_No, BusinessOrderNo: BusinessOrderNo, ProcessId: ProcessId }) ) return ret }
// 更新交易信息日志 const updateTradeInfo = async function ( TradeID: string, TradeState: string, TradeMoney: string, BusinessOrderNo: string ) { const ret = await serveWebApi( '/api/Trade/UpdateTradeInfo', JSON.stringify({ TradeID: TradeID, TradeState: TradeState, TradeMoney: TradeMoney, BusinessOrderNo: BusinessOrderNo }) ) return ret }
// 更新交易信息状态日志 const updateTradeInfoStatus = async function ( TradeID: string, TradeState: string ) { const ret = await serveWebApi( '/api/Trade/UpdateTradeInfoStatus', JSON.stringify({ TradeID: TradeID, TradeState: TradeState }) ) return ret }
// 添加交易明细日志 const addTradeDetail = async function ( InterfaceTypeID: string, InterfaceNameID: string, TraceNo: string, TerminalNo: string, TradeState: string, pageName: string, CurrentMoney: string, TradeMoney: string, TradeID: string, ApiState: string, ProcessIdDetails: string ) { const ret = await serveWebApi( '/api/Trade/AddTradeDetail', JSON.stringify({ InterfaceTypeID: InterfaceTypeID, InterfaceNameID: InterfaceNameID, TraceNo: TraceNo, TerminalNo: TerminalNo, TradeState: TradeState, pageName: pageName, CurrentMoney: CurrentMoney, TradeMoney: TradeMoney, TradeID: TradeID, ApiState: ApiState, ProcessIdDetails: ProcessIdDetails }) ) return ret } // 更新交易明细日志 const updateTradeDetail = async function ( TradeDetailID: string, TradeState: string ) { const ret = await serveWebApi( '/api/Trade/UpdateTradeDetail', JSON.stringify({ TradeDetailID: TradeDetailID, TradeState: TradeState }) ) return ret }
// 添加交易接口日志 const addLogTrade = async function ( TradeDetailID: string, TradeCode: string, TradeName: string, TradeMsg: string, MsgType: string, LogType: string ) { const ret = await serveWebApi( '/api/Trade/AddLogTrade', JSON.stringify({ TradeDetailID: TradeDetailID, TradeCode: TradeCode, TradeName: TradeName, TradeMsg: TradeMsg, MsgType: MsgType, LogType: LogType }) ) return ret }
// 添加交易订单日志 const addTradeOrder = async function ( Order_NO: string, Order_Name: string, Order_Amt: string, Order_Desc: string, Order_State: string, Order_Creator: string, Order_Plat: string, Order_CreatorID: string, Pay_OrderNO: string, His_NO: string, Account_ID: string, Field1: string, Field2: string ) { const ret = await serveWebApi( '/api/Trade/AddTradeOrder', JSON.stringify({ Order_NO: Order_NO, Order_Name: Order_Name, Order_Amt: Order_Amt, Order_Desc: Order_Desc, Order_State: Order_State, Order_Creator: Order_Creator, Order_Plat: Order_Plat, Order_CreatorID: Order_CreatorID, Pay_OrderNO: Pay_OrderNO, His_NO: His_NO, Account_ID: Account_ID, Field1: Field1, Field2: Field2 }) ) return ret }
// 更新交易订单日志 const updateTradeOrder = async function ( Order_NO: string, Order_State: string, Pay_OrderNO: string, His_NO: string, Field1: string, Field2: string ) { const ret = await serveWebApi( '/api/Trade/UpdateTradeOrder', JSON.stringify({ Order_NO: Order_NO, Order_State: Order_State, Pay_OrderNO: Pay_OrderNO, His_NO: His_NO, Field1: Field1, Field2: Field2 }) ) return ret } // 添加交易记录日志 const addTradeRecord = async function ( Trade_NO: string, Business_OrderNO: string, Pay_OrderNO: string, His_NO: string, Trade_IP: string, Trade_TerminalNO: string, Trade_Amt: string, Trade_Type: string, Trade_Status: string, Trade_GoodsType: string, Trade_GoodsName: string, App_ID: string, Payment_ID: string, Payment_TypeName: string, Trade_Plat: string, Trade_Code: string ) { const ret = await serveWebApi( '/api/Trade/AddTradeRecord', JSON.stringify({ Trade_NO: Trade_NO, Business_OrderNO: Business_OrderNO, Pay_OrderNO: Pay_OrderNO, His_NO: His_NO, Trade_IP: Trade_IP, Trade_TerminalNO: Trade_TerminalNO, Trade_Amt: Trade_Amt, Trade_Type: Trade_Type, Trade_Status: Trade_Status, Trade_GoodsType: Trade_GoodsType, Trade_GoodsName: Trade_GoodsName, App_ID: App_ID, Payment_ID: Payment_ID, Payment_TypeName: Payment_TypeName, Trade_Plat: Trade_Plat, Trade_Code: Trade_Code }) ) return ret }
// 更新交易记录日志 const updateTradeRecord = async function ( Trade_NO: string, His_NO: string, Trade_Status: string ) { const ret = await serveWebApi( '/api/Trade/UpdateTradeRecord', JSON.stringify({ Trade_NO: Trade_NO, His_NO: His_NO, Trade_Status: Trade_Status }) ) return ret }
// 添加退费记录日志 const addRefundRecord = async function ( Pay_OrderNO: string, Refund_NO: string, Business_OrderNO: string, Refund_Amt: string, Refund_Status: string, Refund_Desc: string, Trade_NO: string, App_ID: string ) { const ret = await serveWebApi( '/api/Trade/AddRefundRecord', JSON.stringify({ Pay_OrderNO: Pay_OrderNO, Refund_NO: Refund_NO, Business_OrderNO: Business_OrderNO, Refund_Amt: Refund_Amt, Refund_Status: Refund_Status, Refund_Desc: Refund_Desc, Trade_NO: Trade_NO, App_ID: App_ID }) ) return ret } // 更新退费记录日志 const updateRefundRecord = async function ( Refund_NO: string, Refund_Status: string ) { const ret = await serveWebApi( '/api/Trade/UpdateRefundRecord', JSON.stringify({ Refund_NO: Refund_NO, Refund_Status: Refund_Status }) ) return ret }
export { addOrUpdateTradeInfo, updateTradeInfo, updateTradeInfoStatus, addTradeDetail, updateTradeDetail, addLogTrade, addTradeOrder, updateTradeOrder, addTradeRecord, updateTradeRecord, addRefundRecord, updateRefundRecord }
service/system-service/useManageServcie.ts
import { serveWebApi } from '@/service' import { useSystemStore } from '@/store/useSystemStore'const systemStore = useSystemStore()
// 获取前台管理菜单 const getManageMenus = async function (xmlFile: string) { return await serveWebApi( '/api/System/getManageMenus', JSON.stringify({ xmlFile: xmlFile }) ) } // 更新终端状态 const updateTerminalStatus = async function ( status: string, id: string, operUserId: string ) { const ret = await serveWebApi( '/api/Terminal/UpdateTerminalStatus', JSON.stringify({ status: status, id: id, operUserId: operUserId }) ).then((res) => { if (res == true) { systemStore.syncDictTerminal('Status', status) } })
return ret }
// 更新物料用量当前数量 const changeSuppliesUsageCurrentCount = async function ( suppliesName: string, terminalNo: string, changeCount: string ) { const ret = await serveWebApi( '/api/Terminal/ChangeSuppliesUsageCurrentCount', JSON.stringify({ suppliesName: suppliesName, terminalNo: terminalNo, changeCount: changeCount }) )
return ret } // 获取在用物料用量信息 const getSuppliesUsageInUse = async function ( suppliesName: string, terminalNo: string ) { const ret = await serveWebApi( '/api/Terminal/GetSuppliesUsageInUse', JSON.stringify({ suppliesName: suppliesName, terminalNo: terminalNo }) )
return ret } // 更新物料用量信息 const changeSuppliesUsage = async function ( suppliesName: string, terminalNo: string, currentCount: string, warningThreshold: string, userId: string ) { const ret = await serveWebApi( '/api/Terminal/ChangeSuppliesUsage', JSON.stringify({ suppliesName: suppliesName, terminalNo: terminalNo, currentCount: currentCount, warningThreshold: warningThreshold, userId: userId }) )
return ret } // 获取数据库数据 const getDBData = async function ( Tables: string, PrimaryKey: string, Fields: string, Filter: string, Group: string, Sort: string ) { const ret = await serveWebApi( '/api/DB/GetData', JSON.stringify({ Tables: Tables, PrimaryKey: PrimaryKey, Fields: Fields, Filter: Filter, Group: Group, Sort: Sort }) )
return ret } // 获取数据库分页数据 const getDBPagingData = async function ( jsonSelectConfig: object, pageSize: string, pageIndex: string ) { const ret = await serveWebApi( '/api/DB/GetPagingData', JSON.stringify({ jsonSelectConfig: jsonSelectConfig, pageSize: pageSize, pageIndex: pageIndex }) )
return ret } // 检查现金批次 const checkCashBatch = async function (terminalNo: string) { const ret = await serveWebApi( '/api/System/CheckCashBatch', JSON.stringify({ terminalNo: terminalNo }) )
return ret } // 现金清理 const cashClean = async function ( terminalNo: string, userId: string, batchId: string ) { const ret = await serveWebApi( '/api/System/CashClean', JSON.stringify({ terminalNo: terminalNo, userId: userId, batchId: batchId }) )
return ret } // 现金结账 const cashSettle = async function (terminalNo: string, userId: string) { const ret = await serveWebApi( '/api/System/CashSettle', JSON.stringify({ terminalNo: terminalNo, userId: userId }) )
return ret } // 更新业务数据处理信息 const updateLogBusinessHandleInfo = async function ( trace: string, handleUserId: string, handleInfo: string ) { const ret = await serveWebApi( '/api/System/UpdateLogBusinessHandleInfo', JSON.stringify({ trace: trace, handleUserId: handleUserId, handleInfo: handleInfo }) )
return ret }
// ******用户查询操作(前台管理)****** // 验证用户名和密码 const checkUserNameAndPassword = async function ( userName: string, password: string ) { // / <summary> // / 验证用户名和密码 // / </summary> // / <returns></returns>
return await serveWebApi( '/api/System/CheckUserNameAndPassword', JSON.stringify({ userName: userName, password: password }) ) } // 通过用户名获取用户信息 const getUserByUserName = async function (userName: string) { return await serveWebApi( '/api/System/GetUserByUserName', JSON.stringify({ userName: userName, loginCardNo: '' }) ) } // 验证登录卡号 const checkUserLoginCardNo = async function (loginCardNo: string) { // / <summary> // / 验证登录卡号 // / </summary> // / <returns></returns>
return await serveWebApi( '/api/System/CheckUserLoginCardNo', JSON.stringify({ userName: '', loginCardNo: loginCardNo }) ) } // 通过登录卡号获取用户信息 const getUserByLoginCardNo = async function (loginCardNo: string) { return await serveWebApi( '/api/System/GetUserByLoginCardNo', JSON.stringify({ userName: '', loginCardNo: loginCardNo }) ) }
export { getManageMenus, updateTerminalStatus, changeSuppliesUsageCurrentCount, getSuppliesUsageInUse, changeSuppliesUsage, getDBData, getDBPagingData, checkCashBatch, cashClean, cashSettle, updateLogBusinessHandleInfo, checkUserNameAndPassword, getUserByUserName, checkUserLoginCardNo, getUserByLoginCardNo }
service/system-service/useOtherService.ts
import { serveWebApi } from '@/service'// 获取文件内容 const getFileContent = async function (filePath: string) { const ret = await serveWebApi( '/api/System/GetFileContent', JSON.stringify({ strPath: filePath }) ) return ret }
// 银行前置服务 const bankTvm = async function (IP: string, Port: string, _inStr: string) { const ret = await serveWebApi( '/api/System/BankTvm', JSON.stringify({ IP: IP, Port: Port, _inStr: _inStr }) ) return ret }
// 记录服务器日志 const writeSSTSLog = async function ( terminalIp: string, prefix: string, subDir: string, log: string ) { const ret = await serveWebApi( '/api/System/WriteSSTSLog', JSON.stringify({ terminalIp: terminalIp, prefix: prefix, subDir: subDir, log: log }) ) return ret }
export { getFileContent, bankTvm, writeSSTSLog }
二、调用示例
无
三、运行测试
无
翻译
搜索
复制
<iframe></iframe> 标签:serveWebApi,web,const,string,ssts,hospital,ret,Trade,terminalNo From: https://www.cnblogs.com/lizhigang/p/18044654