/// <summary>
 /// 核心记账(多贷一借,多借一贷)
 /// </summary>
 /// <param name="orgno">机构号</param>
 /// <param name="tellerno">柜员号</param>
 /// <param name="tradedate">发生日期</param>
 /// <param name="followno">资金业务系统流水号</param>
 /// <param name="multiLend">是否多借一贷</param>
 /// <param name="billlist">记账分录</param>
 /// <param name="result">返回记账成功后的会计分录</param>
 /// <param name="outmsg">记账失败时的信息</param>
 /// <returns></returns>
 public static bool CoreAcctRecordMulti2One(String orgno, String tellerno, DateTime tradedate, String followno, bool multiLend, List<CoreBillRecord> billlist, out CoreAcctResult result, out String outmsg)
 {
     result = ClientSyncHelper.OnRecordAcctMulti2One(tellerno, orgno, tradedate, followno, multiLend, billlist, out outmsg);
     if (result != null)
     {
         return true;
     }
     outmsg = string.Format("{0}{1}", MsgHandlerEntry.Info_Return_Core, outmsg);
     return false;
 }
        internal static CoreAcctResult OnRecordAcctMulti2One(String tellerno, String orgno, DateTime tradedate, String followcode, bool isMultiLend, List<CoreBillRecord> bills,  out String outmsg)
        {
            outmsg = "";
            CoreAcctResult result = null;
            byte[] codemsg = null;
            bool sent = false;
            string dbexception = "";
            MessageData reqdata = null;
            MessageData recdata = null;
            Guid msgid = Guid.Empty;
            try
            {
                msgid = Guid.Empty;
                if (isMultiLend)
                {
                    msgid = MsgTransferUtility.AcctRecordMultiLendOneLoan(tellerno, orgno, tradedate, followcode, bills, ref codemsg);
                }
                else
                {
                    msgid = MsgTransferUtility.AcctRecordMultiLoanOneLend(tellerno, orgno, tradedate, followcode, bills, ref codemsg);
                }
                if (msgid == Guid.Empty && !string.IsNullOrEmpty(outmsg))
                {
                    return result;
                }
                reqdata = MsgHandlerEntry.CreateMessageData(msgid, PlatformType.Core, tellerno, orgno, isMultiLend ? (int)MessageBizType.CoreAcctMultiLend : (int)MessageBizType.CoreAcctMultiLoan, codemsg, followcode);
                
#if MQSYNC
                recdata = MQMsgHandlerEntry.DeliverMessage(reqdata, codemsg, out sent);
#else
                recdata = MsgHandlerEntry.DeliverMessage(MsgHandlerEntry.CreateMessageData(msgid, PlatformType.Core, codemsg));
#endif
                AcctRecordMulti2OneData recddata = MsgTransfer.DecodeMsg(recdata.MessageID, recdata.CurrentRespPackage.PackageMessage) as AcctRecordMulti2OneData;
                if (recddata != null)
                {
                    if (!String.IsNullOrEmpty(recddata.SyserrHandler.Message))
                    {
                        outmsg = recddata.SyserrHandler.Message;
                    }
                    else if (recddata.OmsgHandler.NUM_ENT > 0)
                    {
                        outmsg = MsgHandlerEntry.ExtractOMsg(recddata);
                    }
                    else
                    {
                        result = new CoreAcctResult();
                        if (recddata.OData.OdataItemList != null && recddata.OData.OdataItemList.Count > 0)
                        {
                            foreach (AcctRecordMulti2OneODATA_Item itemdata in recddata.OData.OdataItemList)
                            {
                                CoreAcctEntry entry = new CoreAcctEntry();
                                entry.AccountNO = CommonDataHelper.StrTrimer(itemdata.ACCT, null);
                                entry.CheckCode = CommonDataHelper.StrTrimer(itemdata.GL_NO, null);
                                entry.Amount = CommonDataHelper.StrTrimer(itemdata.AMT, null);
                                entry.Currency = CommonDataHelper.StrTrimer(itemdata.CCY, null);
                                entry.Option = CommonDataHelper.StrTrimer(itemdata.CD_IND, null);
                                entry.InnerSN = CommonDataHelper.StrTrimer(itemdata.GL_SEQ, null);
                                result.AcctEntryList.Add(entry);
                            }
                        }

                        if (recddata.OData.OdataPendingList != null && recddata.OData.OdataPendingList.Count > 0)
                        {
                            foreach (AcctRecordMulti2OneODATA_PendingItem itemdata in recddata.OData.OdataPendingList)
                            {
                                CorePendingAcctEntry entry = new CorePendingAcctEntry();
                                entry.InnerSN = CommonDataHelper.StrTrimer(itemdata.FlowNO, null);
                                entry.InnerSN = CommonDataHelper.StrTrimer(itemdata.InnerSN, null);
                                entry.PendingAccount = CommonDataHelper.StrTrimer(itemdata.PendingAccount, null);
                                entry.PendingSN = CommonDataHelper.StrTrimer(itemdata.PendingSN, null);
                                entry.PendingAmount = CommonDataHelper.StrTrimer(itemdata.PendingAmount, null);
                                result.PendingAcctList.Add(entry);
                            }
                        }
                        string coreSN = recddata.RPhdrHandler.SEQ_NO.TrimStart().TrimEnd();
                        OnUpdateDBLog(recdata, coreSN, outmsg, MsgLogState.RecvSucceed, out dbexception);
                        //MQMsgCommonHelper.UpdateMQLog(recdata, coreSN, outmsg, MsgLogState.RecvSucceed, out dbexception);
                        return result;
                    }
                }
                else
                {
                    outmsg = MsgHandlerEntry.Type_Convert_Error;
                }
                OnUpdateDBLog(recdata.MessageID, outmsg, MsgLogState.RecvFailed, out dbexception);
                return result;
            }
            catch (Exception ex)
            {
                outmsg = ex.Message;
                OnException(sent, reqdata, recdata, msgid, ex, outmsg);
                return result;
            }
        }
Esempio n. 3
0
        private void buttonAcctSync_Click(object sender, EventArgs e)
        {
            string outmsg = "";
            string flowNO = textBoxFlowNO.Text.Trim();
            #region 多借多贷同步

            List<CoreBillRecord> list = new List<CoreBillRecord>();
            CoreAcctResult outresult = new CoreAcctResult();

            CoreBillRecord bill = new CoreBillRecord();
            bill.Currency = "CNY";
            bill.InnerSN = "1";
            bill.InterAcctSN = "0003";
            bill.IsEliminateFlag = "0";
            bill.IsNote = null;
            bill.Opt = "2";
            bill.OptAcct = null;
            bill.OrgNO = "801000";
            bill.PendingAcctSN = null;
            bill.RedBlueFlag = "1";
            bill.Subject = "111299";
            bill.TradeAcctNO = null;
            bill.TradeMoney = "104840.00";
            list.Add(bill);

            CoreBillRecord bill1 = new CoreBillRecord();
            bill1.Currency = "CNY";
            bill1.InnerSN = "2";
            bill1.InterAcctSN = "0001";
            bill1.IsEliminateFlag = "0";
            bill1.IsNote = null;
            bill1.Opt = "1";
            bill1.OptAcct = null;
            bill1.OrgNO = "801000";
            bill1.PendingAcctSN = null;
            bill1.RedBlueFlag = "1";
            bill1.Subject = "143101";
            bill1.TradeAcctNO = null;
            bill1.TradeMoney = "102340.00";
            list.Add(bill1);

            CoreBillRecord bill2 = new CoreBillRecord();
            bill2.Currency = "CNY";
            bill2.InnerSN = "3";
            bill2.InterAcctSN = "0001";
            bill2.IsEliminateFlag = "0";
            bill2.IsNote = null;
            bill2.Opt = "1";
            bill2.OptAcct = null;
            bill2.OrgNO = "801000";
            bill2.PendingAcctSN = null;
            bill2.RedBlueFlag = "1";
            bill2.Subject = "132158";
            bill2.TradeAcctNO = null;
            bill2.TradeMoney = "2500.00";
            list.Add(bill2);

            //CoreBillRecord bill3 = new CoreBillRecord();
            //bill3.Currency = "CNY";
            //bill3.InnerSN = "3";
            //bill3.InterAcctSN = "0001";
            //bill3.IsEliminateFlag = "0";
            //bill3.IsNote = null;
            //bill3.Opt = "1";
            //bill3.OptAcct = null;
            //bill3.OrgNO = "801000";
            //bill3.PendingAcctSN = null;
            //bill3.RedBlueFlag = "1";
            //bill3.Subject = "145103";
            //bill3.TradeAcctNO = null;
            //bill3.TradeMoney = "20000";
            //list.Add(bill3);


            AidSysClientSyncWrapper.CoreAcctRecord("801000", "8010001", DateTime.Now, flowNO, list, out outresult, out outmsg);
            #endregion

        }