⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handle.cpre

📁 商业银行前置系统
💻 CPRE
📖 第 1 页 / 共 4 页
字号:
    char szBal[AP_LEN_BAL + 1];    char szAvailBal[AP_LEN_BAL + 1];    memset(&depacceptstru, '0', sizeof(depacceptstru));    memset(&deprejectstru, '0', sizeof(deprejectstru));    memset(&xmlstruReq, 0, sizeof(xmlstruReq));    memset(&xmlstruResp, 0, sizeof(xmlstruResp));    bufclr(szReqId);    bufclr(szReqDate);    bufclr(szReqTime);    bufclr(szReqSeqNo);    bufclr(szAccNo);    bufclr(szAtmAccNo);    bufclr(szExpDate);    bufclr(szTrack2);    bufclr(szTrack3);    bufclr(szAmt);    bufclr(szTransAmt);    bufclr(szRespCode);    bufclr(szRespSeqNo);    bufclr(szRespDate);    bufclr(szRespTime);    bufclr(szDateTimeDays);    bufclr(szBal);    bufclr(szAvailBal);    pxmlstruReq = &xmlstruReq;    pxmlstruResp = &xmlstruResp;    /*     * Convert string to xml.     */    pdepstru = (PDEPSTRU)cMsg;        memcpy(szReqId, atmstru.szAtmNo, AP_LEN_ID);	SetAtmReqSeqNo(szReqSeqNo, pdepstru->cReqSeqNo);    memcpy(szAtmAccNo, pdepstru->cAccNo, SIZE_ACCNO);    memcpy(szTrack2, pdepstru->cTrack2, AP_LEN_TRACK2);    memcpy(szTrack3, pdepstru->cTrack3, AP_LEN_TRACK3);    strcpy(szAccNo, szAtmAccNo);    EncryptTrack2(szTrack2, -1);    EncryptTrack3(szTrack3, -1);    ASSURE_NORMAL(GetExpDate(szTrack2, szExpDate))    memcpy(szTransAmt, pdepstru->cTransAmt, SIZE_TRANSAMT);    sprintf(szAmt, "%19.2lf", atof(szTransAmt) / 100);    GetAtmDate(szReqDate);    GetAtmTime(szReqTime);    ASSURE_NORMAL(CreateXml(pxmlstruReq, FALSE, AP_PATH_ROOT, NULL))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_MSGTYPE, AP_MSGTYPE_SUBMITREQ))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRANSCODE, AP_TRANSCODE_CS_DEPOSIT))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_REQDATE, szReqDate))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_REQTIME, szReqTime))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_REQID, szReqId))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_REQSEQNO, szReqSeqNo))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_ACCNO, FormatAccNo(szAccNo)))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_EXPDATE, szExpDate))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRACK2, szTrack2))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRACK3, szTrack3))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_TRACKVERIFY, "Y"))    ASSURE_NORMAL(AP_INSERT_EXT(AP_PATH_AMT, szAmt))    ASSURE_NORMAL(ApCaSubmit(pxmlstruReq, pxmlstruResp))    /*     * Convert xml to string.     */    memset(cMsg, 0, SIZE_MSG_ATM);        AP_DEMAND_EXT(AP_PATH_RESPCODE, szRespCode);    AP_DEMAND_EXT(AP_PATH_RESPDATE, szRespDate);    AP_DEMAND_EXT(AP_PATH_RESPTIME, szRespTime);    SetDateTimeDays(szRespDate, szRespTime, szDateTimeDays);    if (strcmp(szRespCode, AP_RESPCODE_ACCEPT) != 0)    {        if (strcmp(szRespCode, AP_RESPCODE_EXCEPTION) == 0)        {            DeleteXml(&xmlstruReq);            DeleteXml(&xmlstruResp);            return EXCEPTION;        }                deprejectstru.cTfc = 'A';        deprejectstru.cTpc = 'G';        deprejectstru.cOperateMode = 'P';        deprejectstru.cLimitFlag = '1';        memcpy(deprejectstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);        memcpy(deprejectstru.cRejectCode, szRespCode, SIZE_REJECTCODE);        memcpy(deprejectstru.cReqSeqNo, szReqSeqNo + 6, SIZE_REQSEQNO);        VERIFY_NORMAL(ApCaRecord(&deprejectstru, sizeof(deprejectstru),                                 "atm", TRUE));        memcpy(cMsg, &deprejectstru, sizeof(deprejectstru));	    sprintf(szMsgLen, "%6d", sizeof(deprejectstru));    }    else    {        VERIFY_NORMAL(AP_DEMAND_EXT(AP_PATH_AVAILBAL, szAvailBal));        VERIFY_NORMAL(AP_DEMAND_EXT(AP_PATH_RESPSEQNO, szRespSeqNo));        sprintf(szAvailBal, "%-6.2lf", atof(szAvailBal));        depacceptstru.cTfc = 'A';        depacceptstru.cTpc = 'Q';        depacceptstru.cOperateMode = 'P';        depacceptstru.cAccepted = '1';        depacceptstru.cLimitFlag = '1';        memcpy(depacceptstru.cAccNo, szAtmAccNo, SIZE_ACCNO);        memcpy(depacceptstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);        memcpy(depacceptstru.cAvailFund, szAvailBal, SIZE_AVAILFUND);        memcpy(depacceptstru.cTransAmt, szTransAmt, SIZE_TRANSAMT);        memcpy(depacceptstru.cRespSeqNo, szRespSeqNo, SIZE_RESPSEQNO);        memcpy(depacceptstru.cReqSeqNo, szReqSeqNo + 6, SIZE_REQSEQNO);        VERIFY_NORMAL(ApCaRecord(&depacceptstru, sizeof(depacceptstru),                                 "atm", TRUE));        memcpy(cMsg, &depacceptstru, sizeof(depacceptstru));	    sprintf(szMsgLen, "%6d", sizeof(depacceptstru));    }    DeleteXml(&xmlstruReq);    DeleteXml(&xmlstruResp);    return NORMAL;}RESULT HandleAex(char cMsg[SIZE_MSG_ATM], char szMsgLen[6 + 1], ATMSTRU atmstru){    char szDateTimeDays[SIZE_DATETIMEDAYS + 1];    AEXRESPSTRU aexrespstru;        aexrespstru.cTfc = 'A';    aexrespstru.cTpc = 'A';    aexrespstru.cOperateMode = 'P';    memset(szDateTimeDays, 0, sizeof(szDateTimeDays));    GetDateTimeDays(szDateTimeDays);    memcpy(aexrespstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);    memcpy(aexrespstru.cReqSeqNo, cMsg + (sizeof(AEXSTRU) - SIZE_REQSEQNO),           SIZE_REQSEQNO);    VERIFY_NORMAL(ApCaRecord(&aexrespstru, sizeof(aexrespstru), "atm", TRUE));    memset(cMsg, 0, SIZE_MSG_ATM);    memcpy(cMsg, &aexrespstru, sizeof(aexrespstru));	sprintf(szMsgLen, "%6d", sizeof(aexrespstru));    return NORMAL;}RESULT HandleOex(char cMsg[SIZE_MSG_ATM], char szMsgLen[6 + 1], ATMSTRU atmstru){    char szDateTimeDays[SIZE_DATETIMEDAYS + 1];    OEXRESPSTRU oexrespstru;        oexrespstru.cTfc = 'A';    oexrespstru.cTpc = 'A';    oexrespstru.cOperateMode = 'P';    memset(szDateTimeDays, 0, sizeof(szDateTimeDays));    GetDateTimeDays(szDateTimeDays);    memcpy(oexrespstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);    memcpy(oexrespstru.cReqSeqNo, cMsg + (sizeof(OEXSTRU) - SIZE_REQSEQNO),           SIZE_REQSEQNO);    VERIFY_NORMAL(ApCaRecord(&oexrespstru, sizeof(oexrespstru), "atm", TRUE));    memset(cMsg, 0, SIZE_MSG_ATM);    memcpy(cMsg, &oexrespstru, sizeof(oexrespstru));	sprintf(szMsgLen, "%6d", sizeof(oexrespstru));    return NORMAL;}RESULT HandleMsr(char cMsg[SIZE_MSG_ATM], char szMsgLen[6 + 1], ATMSTRU atmstru){    char szDateTimeDays[SIZE_DATETIMEDAYS + 1];    MSRRESPSTRU msrrespstru;    PMSRSTRU pmsrstru;    ASMSTRU asmstru;    bufclr(asmstru.szAtmNo);    bufclr(asmstru.szDenom1Status);    bufclr(asmstru.szDenom2Status);    bufclr(asmstru.szDenom3Status);    bufclr(asmstru.szDenom4Status);    bufclr(asmstru.szDenom1Remain);    bufclr(asmstru.szDenom2Remain);    bufclr(asmstru.szDenom3Remain);    bufclr(asmstru.szDenom4Remain);    bufclr(asmstru.szJournalStatus);    bufclr(asmstru.szReceiptStatus);    bufclr(asmstru.szDepositStatus);    bufclr(asmstru.szAtmStatus);    pmsrstru = (PMSRSTRU)cMsg;    memcpy(asmstru.szAtmNo, atmstru.szAtmNo, LEN_ATMNO);    memcpy(asmstru.szDenom1Status, &(pmsrstru->cDenom1Status), 1);    memcpy(asmstru.szDenom2Status, &(pmsrstru->cDenom2Status), 1);    memcpy(asmstru.szDenom3Status, &(pmsrstru->cDenom3Status), 1);    memcpy(asmstru.szDenom4Status, &(pmsrstru->cDenom4Status), 1);    memcpy(asmstru.szDenom1Remain, pmsrstru->cDenom1Remain, SIZE_DENOMREMAIN);    memcpy(asmstru.szDenom2Remain, pmsrstru->cDenom2Remain, SIZE_DENOMREMAIN);    memcpy(asmstru.szDenom3Remain, pmsrstru->cDenom3Remain, SIZE_DENOMREMAIN);    memcpy(asmstru.szDenom4Remain, pmsrstru->cDenom4Remain, SIZE_DENOMREMAIN);    memcpy(asmstru.szJournalStatus, &(pmsrstru->cJournalStatus), 1);    memcpy(asmstru.szReceiptStatus, &(pmsrstru->cReceiptStatus), 1);    memcpy(asmstru.szDepositStatus, &(pmsrstru->cDepositStatus), 1);    memcpy(asmstru.szAtmStatus, &(pmsrstru->cAtmStatus), 1);    VERIFY_NORMAL(SendAsmToMonitor(&asmstru));        memset(cMsg, 0, SIZE_MSG_ATM);        msrrespstru.cTfc = 'A';    msrrespstru.cTpc = 'A';    msrrespstru.cOperateMode = 'P';    memset(szDateTimeDays, 0, sizeof(szDateTimeDays));    GetDateTimeDays(szDateTimeDays);    memcpy(msrrespstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);    VERIFY_NORMAL(ApCaRecord(&msrrespstru, sizeof(msrrespstru), "atm", TRUE));    memcpy(cMsg, &msrrespstru, sizeof(msrrespstru));	sprintf(szMsgLen, "%6d", sizeof(msrrespstru));    return NORMAL;}RESULT HandleRfm(char cMsg[SIZE_MSG_ATM], char szMsgLen[6 + 1], ATMSTRU atmstru){    UINT nSize;    UINT nFitCnt = 0;    UINT n = 0;    UINT nReqNum;    char *pcFit;    char szFitCnt[SIZE_FITCNT + 1];    char szFit[SIZE_FIT + 1 + 1];    char szReqNum[SIZE_REQNUM + 1];    char szDateTimeDays[SIZE_DATETIMEDAYS + 1];    char szPath[64 + 1];    char szFileName[64 + 1];        FILE *pfile;    RFMRESPSTRU rfmrespstru;    bufclr(szFit);    bufclr(szReqNum);    memset(&rfmrespstru, '0', sizeof(rfmrespstru));       memcpy(szReqNum, cMsg + (sizeof(RFMSTRU) - SIZE_REQSEQNO - SIZE_REQNUM),           SIZE_REQNUM);    nReqNum = atoi(szReqNum);    nReqNum = nReqNum * CNT_FIT + 1;        rfmrespstru.cTfc = 'A';    rfmrespstru.cTpc = 'I';    rfmrespstru.cOperateMode = 'P';    memset(szDateTimeDays, 0, sizeof(szDateTimeDays));    GetDateTimeDays(szDateTimeDays);    memcpy(rfmrespstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);    pcFit = rfmrespstru.cFitArea;    nSize = 0;    AP_DEMAND_CFG(AP_PATH_CFG_INSTALLPATH, szPath);    sprintf(szFileName, "%s/bin/%s", szPath, "fit.txt");                    ASSERT_NULL(pfile = fopen(szFileName, "r"));    while (fgets(szFit, sizeof(szFit), pfile) != NULL)    {        n++;        if (n < nReqNum)            continue;        else        {            nFitCnt++;            if (nFitCnt <= CNT_FIT)            {                memcpy(pcFit + nSize, szFit, SIZE_FIT);                nSize += SIZE_FIT;            }            else                break;        }    }    if (nFitCnt > CNT_FIT)    {        rfmrespstru.cEndFlag = '1';        sprintf(szFitCnt, "%-8ld", nFitCnt - 1);    }    else    {        rfmrespstru.cEndFlag = '0';        sprintf(szFitCnt, "%-8ld", nFitCnt);    }    memcpy(rfmrespstru.cFitCnt, szFitCnt, SIZE_FITCNT);    memcpy(rfmrespstru.cReqSeqNo, cMsg + (sizeof(RFMSTRU) - SIZE_REQSEQNO),           SIZE_REQSEQNO);    fclose(pfile);    VERIFY_NORMAL(ApCaRecord(&rfmrespstru, sizeof(rfmrespstru), "atm", TRUE));    memset(cMsg, 0, SIZE_MSG_ATM);    memcpy(cMsg, &rfmrespstru, sizeof(rfmrespstru));	sprintf(szMsgLen, "%6d", sizeof(rfmrespstru));    return NORMAL;}RESULT HandleRqf(char cMsg[SIZE_MSG_ATM], char szMsgLen[6 + 1], ATMSTRU atmstru){    UINT nSize;    UINT nFitCnt = 0;    char *pcFit;    char szFitCnt[SIZE_FITCNT + 1];    char szFit[SIZE_FIT + 1 + 1];    char szDateTimeDays[SIZE_DATETIMEDAYS + 1];    char szPath[64 + 1];    char szFileName[64 + 1];    FILE *pfile;    RQFRESPSTRU rqfrespstru;        bufclr(szFit);    memset(&rqfrespstru, '0', sizeof(rqfrespstru));        rqfrespstru.cTfc = 'A';    rqfrespstru.cTpc = 'I';    rqfrespstru.cOperateMode = 'P';    memset(szDateTimeDays, 0, sizeof(szDateTimeDays));    GetDateTimeDays(szDateTimeDays);    memcpy(rqfrespstru.cDateTime, szDateTimeDays, SIZE_DATETIMEDAYS);    nSize = 0;    pcFit = rqfrespstru.cFitArea;        AP_DEMAND_CFG(AP_PATH_CFG_INSTALLPATH, szPath);    sprintf(szFileName, "%s/bin/%s", szPath, "fit.txt");        ASSERT_NULL(pfile = fopen(szFileName, "r"));    while (fgets(szFit, sizeof(szFit), pfile) != NULL)    {        memcpy(pcFit + nSize, szFit, SIZE_FIT);        nSize += SIZE_FIT;        nFitCnt++;    }        sprintf(szFitCnt, "%-8ld", nFitCnt);    memcpy(rqfrespstru.cFitCnt, szFitCnt, SIZE_FITCNT);        memcpy(rqfrespstru.cReqSeqNo, cMsg + (sizeof(RQFSTRU) - SIZE_REQSEQNO),            SIZE_REQSEQNO);    fclose(pfile);        VERIFY_NORMAL(ApCaRecord(&rqfrespstru, sizeof(rqfrespstru), "atm", TRUE));    memset(cMsg, 0, SIZE_MSG_ATM);    memcpy(cMsg, &rqfrespstru, sizeof(rqfrespstru));	sprintf(szMsgLen, "%6d", sizeof(rqfrespstru));    return NORMAL;}RESULT SendAsmToMonitor(PASMSTRU pasmstru){    char szArea[AP_LEN_AREA + 1];    char cBuf[1 + sizeof(ASMSTRU)];    bufclr(szArea);    ASSERT_NORMAL(ApGetArea(pasmstru->szAtmNo, szArea));    cBuf[0] = '1';    memcpy(cBuf + 1, pasmstru, sizeof(ASMSTRU));    ASSERT_NORMAL(SendToMonitor(cBuf, 1 + sizeof(ASMSTRU), szArea,                                0x0002));    return NORMAL;}/* End of this file */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -