Beispiel #1
0
        public VoucherBaseResp ExecuteAll(VoucherBaseReq baseReq)
        {
            if (baseReq == null)
            {
                return(VoucherBaseResp.CreateNotValidSignResp());
            }
            var validResp = VoucherBaseResp.CreateErrorResp();

            try
            {
                var requestReqDict = baseReq.ToStringDictionary(true);
                validResp = this.VerifyRequest(requestReqDict);  //验证签名
                if (validResp.isSignValidResp())
                {
                    // 验证通过, 执行方法
                    validResp = this.Execute(baseReq);
                    validResp.SetExecuteSuccess(true);
                }
            }
            catch (Exception e)
            {
                validResp.SetExecuteSuccess(false);
                var message = string.Format("Error occured when executing voucher method, message: {0}, source: {1}",
                                            e.Message, e.Source);
                validResp.SetMsgAndMsgNo(WebServiceLib.SubStr(message, 1000), "99");
                LogHelper.Error(string.Format("Error occured when executing voucher method, message: {0},  source: {1},  stackTrace: {2}", e.Message, e.Source, e.StackTrace));
            }
            validResp.Sign = this.gate.CreateSign(validResp.ToStringDictionary(true)); //生成签名
            return(validResp);
        }
Beispiel #2
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var newObj = baseReq as VoucherCheckReq; // 强制转换
            VoucherCheckResp checkResp   = new VoucherCheckResp();
            string           databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();
                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VoucherCheck", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                               //存储过程名称
                try
                {
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newObj.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value   = newObj.StoreNo;

                    OracleParameter PItemNo = new OracleParameter("V_DISNO", OracleType.VarChar);
                    PItemNo.Direction = ParameterDirection.Output;
                    PItemNo.Size      = 50;
                    oralceComm.Parameters.Add(PItemNo);

                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);

                    PRtnMsg.Direction = ParameterDirection.Output;
                    PRtnMsg.Size      = 100;
                    oralceComm.Parameters.Add(PRtnMsg);

                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);


                    oralceComm.ExecuteNonQuery();

                    checkResp.DisNo = PItemNo.Value.ToString();

                    checkResp.RtnMsg = PRtnMsg.Value.ToString();

                    checkResp.RtnMsgNo = PRTNMSGNO.Value.ToString();
                }
                catch (Exception e)
                {
                    checkResp.RtnMsgNo = "99";
                    checkResp.RtnMsg   = "异常情况:" + e.Message.ToString();
                }
            }
            return(checkResp);
        }
Beispiel #3
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var newObj = baseReq as VoucherObsoleteReq; // 强制转换
            VoucherObsoleteResp resp = new VoucherObsoleteResp();
            string databasedws       = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();

                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHER_OBSOLETE", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                   //存储过程名称
                try
                {
                    oralceComm.Parameters.Clear();
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value  = newObj.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_UPDATEDATE", OracleType.VarChar)).Value = newObj.UpdateDate;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS1", OracleType.VarChar)).Value   = newObj.Remarks1;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS2", OracleType.VarChar)).Value   = newObj.Remarks2;


                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Size      = 100;
                    PRtnMsg.Direction = ParameterDirection.Output;
                    oralceComm.Parameters.Add(PRtnMsg);


                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);

                    oralceComm.ExecuteNonQuery();

                    resp.RtnMsg = PRtnMsg.Value.ToString();

                    resp.RtnMsgNo = PRTNMSGNO.Value.ToString();
                }
                catch (Exception e)
                {
                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();
                }
            }
            return(resp);
        }
Beispiel #4
0
 abstract protected VoucherBaseResp Execute(VoucherBaseReq baseReq);
Beispiel #5
0
        //public WebRequestGateway gate = new WebRequestGateway(HttpContext.Current.Request.Headers.Get("version"));
        //public VoucherBaseReq o_excute(IDictionary reqData)
        //{
        //    VoucherCodeSyncResp resp = new VoucherCodeSyncResp();
        //    var sign = "";
        //    foreach (DictionaryEntry item in reqData)
        //    {
        //        if (item.Key.ToString().Equals("sign"))
        //        {
        //            if (item.Value != null)
        //            {
        //                sign = Convert.ToString(item.Value);
        //            }
        //        }
        //    }


        //}
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var newObj = baseReq as VoucherCodeSyncReq; // 强制转换
            VoucherCodeSyncResp resp = new VoucherCodeSyncResp();
            string databasedws       = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();

                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERCODE_SYNCHRONIZE2", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                           //存储过程名称
                try
                {
                    int qty = 0;
                    int.TryParse(newObj.VoucherQty, out qty);

                    oralceComm.Parameters.Clear();
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNAME", OracleType.VarChar)).Value = newObj.VoucherName;
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value   = newObj.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_QTY", OracleType.Int32)).Value           = qty;
                    oralceComm.Parameters.Add(new OracleParameter("P_BARCODEUNIT", OracleType.VarChar)).Value = newObj.BarcodeUnit;
                    oralceComm.Parameters.Add(new OracleParameter("P_STARTDATE", OracleType.VarChar)).Value   = newObj.StartDate;
                    oralceComm.Parameters.Add(new OracleParameter("P_EXPIREDDATE", OracleType.VarChar)).Value = newObj.ExpiredDate;
                    oralceComm.Parameters.Add(new OracleParameter("P_UPDATEDATE", OracleType.VarChar)).Value  = newObj.UpdateDate;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS1", OracleType.VarChar)).Value    = newObj.Remarks1;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS2", OracleType.VarChar)).Value    = newObj.Remarks2;


                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Size      = 100;
                    PRtnMsg.Direction = ParameterDirection.Output;
                    oralceComm.Parameters.Add(PRtnMsg);


                    OracleParameter PRtnMsgNo = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRtnMsgNo.Direction = ParameterDirection.Output;
                    PRtnMsgNo.Size      = 50;
                    oralceComm.Parameters.Add(PRtnMsgNo);



                    //// 返回礼券名称
                    //OracleParameter PRVoucherName = new OracleParameter("V_VOUCHERNAME",
                    //    OracleType.VarChar, 200, ParameterDirection.Output, "", DataRowVersion.Default, false, "");
                    //oralceComm.Parameters.Add(PRVoucherName);

                    //// 返回礼券编码
                    //OracleParameter PRVoucherNo = new OracleParameter("V_VOUCHERNO", OracleType.VarChar);
                    //PRVoucherNo.Direction = ParameterDirection.Output;
                    //PRVoucherNo.Size = 200;
                    //oralceComm.Parameters.Add(PRVoucherNo);

                    //// 礼券条码返回
                    //OracleParameter PRVoucherBcd = new OracleParameter("V_VOUCHERBARCODE", OracleType.VarChar);
                    //PRVoucherBcd.Direction = ParameterDirection.Output;
                    //PRVoucherBcd.Size = 500;
                    //oralceComm.Parameters.Add(PRVoucherBcd);

                    // 返回礼券文档号
                    OracleParameter PRVoucherDocNo = new OracleParameter("V_DOC_NO", OracleType.VarChar);
                    PRVoucherDocNo.Direction = ParameterDirection.Output;
                    PRVoucherDocNo.Size      = 50;
                    oralceComm.Parameters.Add(PRVoucherDocNo);

                    oralceComm.ExecuteNonQuery();

                    resp.RtnMsg = PRtnMsg.Value.ToString();

                    resp.RtnMsgNo = PRtnMsgNo.Value.ToString();

                    resp.VoucherDocNo = PRVoucherDocNo.Value.ToString();
                }
                catch (Exception e)
                {
                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();
                }
            }
            return(resp);
        }
Beispiel #6
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var    newReq      = baseReq as VoucherTransRefundReq;
            var    resp        = new VoucherTransRefundResp();
            string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                //  OracleConnection dbConn = new OracleConnection(databasedws);
                dbConn.Open();
                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERTRANSACTION_RETREAT2", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                              //存储过程名称
                try
                {
                    //string[] vous = VoucherNo.Split(',');

                    //for (int i = 0; i < vous.Length; i++)
                    //{

                    //    if (vous[i].Trim() != "")
                    //    {

                    oralceComm.Parameters.Clear();
                    oralceComm.Parameters.Add(new OracleParameter("P_TRANSNO", OracleType.VarChar)).Value   = newReq.TransNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value   = newReq.StoreNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_TILLNO", OracleType.VarChar)).Value    = newReq.TillNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_SALEID", OracleType.Int32)).Value      = newReq.SaleId;
                    oralceComm.Parameters.Add(new OracleParameter("P_SALEDATE", OracleType.VarChar)).Value  = newReq.SaleDate;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS1", OracleType.VarChar)).Value  = newReq.Remarks1;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS2", OracleType.VarChar)).Value  = newReq.Remarks2;


                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Size      = 100;
                    PRtnMsg.Direction = ParameterDirection.Output;
                    oralceComm.Parameters.Add(PRtnMsg);


                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);

                    oralceComm.ExecuteNonQuery();

                    resp.RtnMsg = PRtnMsg.Value.ToString();

                    resp.RtnMsgNo = PRTNMSGNO.Value.ToString();

                    //    }
                    //}
                }
                catch (Exception e)
                {
                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();
                }
            }

            return(resp);
        }
Beispiel #7
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var    newReq      = baseReq as VoucherQueryNewReq;
            var    resp        = new VoucherQueryNewResp();
            string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();

                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERQUERY_NEW", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                   //存储过程名称
                try
                {
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo;

                    OracleParameter PVoucherType = new OracleParameter("V_VOUCHERTYPE", OracleType.VarChar);
                    PVoucherType.Direction = ParameterDirection.Output;
                    PVoucherType.Size      = 500;
                    oralceComm.Parameters.Add(PVoucherType);
                    OracleParameter PVoucherItemNo = new OracleParameter("V_VOUCHERITEMNO", OracleType.VarChar);
                    PVoucherItemNo.Direction = ParameterDirection.Output;
                    PVoucherItemNo.Size      = 500;
                    oralceComm.Parameters.Add(PVoucherItemNo);
                    OracleParameter PVoucherNos = new OracleParameter("V_VOUCHERNO", OracleType.VarChar);
                    PVoucherNos.Direction = ParameterDirection.Output;
                    PVoucherNos.Size      = 500;
                    oralceComm.Parameters.Add(PVoucherNos);
                    OracleParameter PVoucherStatus = new OracleParameter("V_VOUCHERSTATUS", OracleType.VarChar);
                    PVoucherStatus.Direction = ParameterDirection.Output;
                    PVoucherStatus.Size      = 500;
                    oralceComm.Parameters.Add(PVoucherStatus);
                    OracleParameter PStoreNo = new OracleParameter("V_STORENO", OracleType.VarChar);
                    PStoreNo.Direction = ParameterDirection.Output;
                    PStoreNo.Size      = 500;
                    oralceComm.Parameters.Add(PStoreNo);
                    OracleParameter PActivedTime = new OracleParameter("V_ACTIVEDTIME", OracleType.VarChar);
                    PActivedTime.Direction = ParameterDirection.Output;
                    PActivedTime.Size      = 500;
                    oralceComm.Parameters.Add(PActivedTime);
                    OracleParameter PCertificatedTime = new OracleParameter("V_CERTIFICATEDTIME", OracleType.VarChar);
                    PCertificatedTime.Direction = ParameterDirection.Output;
                    PCertificatedTime.Size      = 500;
                    oralceComm.Parameters.Add(PCertificatedTime);


                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Direction = ParameterDirection.Output;
                    PRtnMsg.Size      = 500;
                    oralceComm.Parameters.Add(PRtnMsg);

                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Size      = 100;
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    oralceComm.Parameters.Add(PRTNMSGNO);

                    oralceComm.ExecuteNonQuery();


                    resp.VoucherType      = PVoucherType.Value.ToString();
                    resp.VoucherItemNo    = PVoucherItemNo.Value.ToString();
                    resp.VoucherNos       = PVoucherNos.Value.ToString();
                    resp.VoucherStatus    = PVoucherStatus.Value.ToString();
                    resp.StoreNo          = PStoreNo.Value.ToString();
                    resp.ActivedTime      = PActivedTime.Value.ToString();
                    resp.CertificatedTime = PCertificatedTime.Value.ToString();

                    resp.RtnMsg = PRtnMsg.Value.ToString();
                    //RtnMsg = RtnMsg.Replace("~", "\r\n");
                    resp.RtnMsgNo = PRTNMSGNO.Value.ToString();
                    //    dbConn.Close();
                    //result = RtnMsgNo;
                    //return RtnMsgNo;
                }
                catch (Exception e)
                {
                    // dbConn.Close();
                    resp.RtnMsgNo = "0";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();
                    //result = RtnMsgNo;
                }
                finally
                {
                    resp.RtnMsg = WebServiceLib.NewLineString(resp.RtnMsg);
                }
            }
            return(resp);
        }
Beispiel #8
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var    newReq      = baseReq as VoucherQueryReq;
            var    resp        = new VoucherQueryResp();
            string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                //  OracleConnection dbConn = new OracleConnection(databasedws);
                dbConn.Open();

                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERQUERY", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                               //存储过程名称
                try
                {
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value   = newReq.StoreNo;
                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Direction = ParameterDirection.Output;
                    PRtnMsg.Size      = 500;
                    oralceComm.Parameters.Add(PRtnMsg);

                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Size      = 100;
                    PRTNMSGNO.Direction = ParameterDirection.Output;


                    oralceComm.Parameters.Add(PRTNMSGNO);

                    oralceComm.ExecuteNonQuery();



                    resp.RtnMsg = PRtnMsg.Value.ToString();


                    //RtnMsg = RtnMsg.Replace("~", "\r\n");
                    //  RtnMsg = RtnMsg + "\r\n sdsaddsa";

                    resp.RtnMsgNo = PRTNMSGNO.Value.ToString();

                    //    dbConn.Close();

                    //result = RtnMsgNo;
                    //return RtnMsgNo;
                }
                catch (Exception e)
                {
                    // dbConn.Close();
                    resp.RtnMsg = "异常情况:" + e.Message.ToString();
                    //Sign = this.serviceCommon.CreateSign(string.Format("rtnMsg={0}&rtnMsgNo={1}", RtnMsg, RtnMsgNo));
                    resp.RtnMsgNo = "0";
                    //result = RtnMsgNo;
                }

                finally
                {
                    resp.RtnMsg = WebServiceLib.NewLineString(resp.RtnMsg);
                }
            }
            return(resp);
        }
Beispiel #9
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var    newReq      = baseReq as VoucherCheckReq;
            var    resp        = new VoucherCheckNewResp();
            string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();

                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERCHECK_NEW", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                   //存储过程名称
                try
                {
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value   = newReq.StoreNo;

                    OracleParameter PItemNo = new OracleParameter("V_VOUCHERITEMNO", OracleType.VarChar);
                    PItemNo.Direction = ParameterDirection.Output;
                    PItemNo.Size      = 50;
                    oralceComm.Parameters.Add(PItemNo);

                    OracleParameter Pdisc = new OracleParameter("V_DISNO", OracleType.VarChar);
                    Pdisc.Direction = ParameterDirection.Output;
                    Pdisc.Size      = 50;
                    oralceComm.Parameters.Add(Pdisc);


                    OracleParameter PnetAmt = new OracleParameter("V_NETAMT", OracleType.VarChar);
                    PnetAmt.Direction = ParameterDirection.Output;
                    PnetAmt.Size      = 50;
                    oralceComm.Parameters.Add(PnetAmt);

                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);

                    PRtnMsg.Direction = ParameterDirection.Output;
                    PRtnMsg.Size      = 100;
                    oralceComm.Parameters.Add(PRtnMsg);

                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);


                    oralceComm.ExecuteNonQuery();


                    resp.VoucherItemNo = PItemNo.Value.ToString();
                    resp.DisNo         = Pdisc.Value.ToString();
                    resp.NetAmt        = PnetAmt.Value.ToString();
                    resp.RtnMsg        = PRtnMsg.Value.ToString();
                    resp.RtnMsgNo      = PRTNMSGNO.Value.ToString();

                    // dbConn.Close();


                    //if (DisNo == "")
                    //{
                    //    result = "";
                    //}
                    //else
                    //{
                    //    result = "1";
                    //}
                }
                catch (Exception e)
                {
                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();
                }
            }

            return(resp);
        }
Beispiel #10
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var    newReq      = baseReq as VoucherCheckReq;
            var    resp        = new VoucherCheckRetrunResp();
            string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            //  string databasedws = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStr"].ToString();

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();
                string        step       = "";
                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERCHECK_RETURN", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                      //存储过程名称
                try
                {
                    step = "123";

                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value   = newReq.StoreNo;

                    OracleParameter Pdisc = new OracleParameter("V_DISNO", OracleType.VarChar);
                    Pdisc.Direction = ParameterDirection.Output;
                    Pdisc.Size      = 50;
                    oralceComm.Parameters.Add(Pdisc);


                    OracleParameter PNetAmt = new OracleParameter("V_AMT", OracleType.Int32);
                    PNetAmt.Direction = ParameterDirection.Output;
                    PNetAmt.Size      = 50;
                    oralceComm.Parameters.Add(PNetAmt);

                    OracleParameter PItemNo = new OracleParameter("V_ITEM", OracleType.VarChar);
                    PItemNo.Direction = ParameterDirection.Output;
                    PItemNo.Size      = 50;
                    oralceComm.Parameters.Add(PItemNo);


                    OracleParameter Ptender = new OracleParameter("V_TENDERNO", OracleType.VarChar);
                    Ptender.Direction = ParameterDirection.Output;
                    Ptender.Size      = 50;
                    oralceComm.Parameters.Add(Ptender);

                    step = "457";

                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);

                    PRtnMsg.Direction = ParameterDirection.Output;
                    PRtnMsg.Size      = 100;
                    oralceComm.Parameters.Add(PRtnMsg);

                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);

                    step = "666";
                    oralceComm.ExecuteNonQuery();

                    resp.DisNo = Pdisc.Value.ToString();

                    resp.NetAmt   = PNetAmt.Value.ToString();
                    resp.TenderNo = Ptender.Value.ToString();
                    resp.ItemNo   = PItemNo.Value.ToString();

                    resp.RtnMsg = PRtnMsg.Value.ToString();

                    resp.RtnMsgNo = PRTNMSGNO.Value.ToString();

                    step = "777";
                }
                catch (Exception e)
                {
                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString() + step;
                }
            }
            return(resp);
        }
Beispiel #11
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var newObj = baseReq as VoucherStoreSyncReq; // 强制转换
            VoucherStoreSyncResp resp = new VoucherStoreSyncResp();
            string databasedws        = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();

                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_STOREINFO_SYNCHRONIZE", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                        //存储过程名称
                try
                {
                    oralceComm.Parameters.Clear();
                    oralceComm.Parameters.Add(new OracleParameter("P_PROVINCE", OracleType.VarChar)).Value    = newObj.Province;
                    oralceComm.Parameters.Add(new OracleParameter("P_CITY", OracleType.VarChar)).Value        = newObj.City;
                    oralceComm.Parameters.Add(new OracleParameter("P_COMPANY", OracleType.VarChar)).Value     = newObj.Company;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value     = newObj.StoreNo;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORENAME", OracleType.VarChar)).Value   = newObj.StoreName;
                    oralceComm.Parameters.Add(new OracleParameter("P_STOREADDR", OracleType.VarChar)).Value   = newObj.StoreAddr;
                    oralceComm.Parameters.Add(new OracleParameter("P_STOREEMAIL", OracleType.VarChar)).Value  = newObj.StoreEmail;
                    oralceComm.Parameters.Add(new OracleParameter("P_STORETEL", OracleType.VarChar)).Value    = newObj.StoreTel;
                    oralceComm.Parameters.Add(new OracleParameter("P_STOREPOSNUM", OracleType.VarChar)).Value = newObj.StorePosNum;
                    oralceComm.Parameters.Add(new OracleParameter("P_OPERATETYPE", OracleType.VarChar)).Value = newObj.OperateType;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS1", OracleType.VarChar)).Value    = newObj.Remarks1;
                    oralceComm.Parameters.Add(new OracleParameter("P_REMARKS2", OracleType.VarChar)).Value    = newObj.Remarks2;


                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Size      = 100;
                    PRtnMsg.Direction = ParameterDirection.Output;
                    oralceComm.Parameters.Add(PRtnMsg);


                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);

                    oralceComm.ExecuteNonQuery();

                    resp.RtnMsg = PRtnMsg.Value.ToString();

                    resp.RtnMsgNo = PRTNMSGNO.Value.ToString();

                    //dbConn.Close();

                    //result = "1";
                }
                catch (Exception e)
                {
                    //dbConn.Close();

                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();
                    //result = "0";
                }
            }
            return(resp);
        }
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var    newReq      = baseReq as VoucherTransactionNewReq;
            var    resp        = new VoucherQueryResp();
            string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                //  OracleConnection dbConn = new OracleConnection(databasedws);
                dbConn.Open();



                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERTRANSACTION_NEW", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                         //存储过程名称
                try
                {
                    string[] vous = newReq.VoucherNo.Split(',');
                    string[] amt  = newReq.NetAmt.Split(',');
                    string[] disc = newReq.Distcount.Split(',');


                    for (int i = 0; i < vous.Length; i++)
                    {
                        if (vous[i].Trim() != "")
                        {
                            oralceComm.Parameters.Clear();
                            oralceComm.Parameters.Add(new OracleParameter("P_ISSALE", OracleType.Int32)).Value      = newReq.IsSale;
                            oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = vous[i].Trim();
                            oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value   = newReq.StoreNo;
                            oralceComm.Parameters.Add(new OracleParameter("P_TILLNO", OracleType.VarChar)).Value    = newReq.TillNo;
                            oralceComm.Parameters.Add(new OracleParameter("P_SALEID", OracleType.Int32)).Value      = newReq.SaleId;


                            oralceComm.Parameters.Add(new OracleParameter("P_USERCODE", OracleType.VarChar)).Value = newReq.UserCode;
                            oralceComm.Parameters.Add(new OracleParameter("P_SALEDATE", OracleType.VarChar)).Value = newReq.SaleDate;


                            oralceComm.Parameters.Add(new OracleParameter("P_NEAMT", OracleType.Double)).Value      = System.Convert.ToDecimal(amt[i].ToString());
                            oralceComm.Parameters.Add(new OracleParameter("P_DISTCOUNT", OracleType.VarChar)).Value = disc[i].Trim();;
                            oralceComm.Parameters.Add(new OracleParameter("P_TENDER", OracleType.VarChar)).Value    = newReq.Tender;
                            oralceComm.Parameters.Add(new OracleParameter("P_TRANSNO", OracleType.VarChar)).Value   = newReq.TtransNo;


                            OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                            PRtnMsg.Size      = 100;
                            PRtnMsg.Direction = ParameterDirection.Output;
                            oralceComm.Parameters.Add(PRtnMsg);

                            OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                            PRTNMSGNO.Direction = ParameterDirection.Output;
                            PRTNMSGNO.Size      = 50;
                            oralceComm.Parameters.Add(PRTNMSGNO);


                            oralceComm.ExecuteNonQuery();
                            resp.RtnMsg   = PRtnMsg.Value.ToString();
                            resp.RtnMsgNo = PRTNMSGNO.Value.ToString();
                        }
                    }

                    //result = "1";
                }
                catch (Exception e)
                {
                    resp.RtnMsgNo = "99";
                    resp.RtnMsg   = "异常情况:" + e.Message.ToString();

                    //result = "0";
                }
                //finally
                //{

                //    Sign = requestGateway.CreateSign(string.Format("rtnMsg={0}&rtnMsgNo={1}", RtnMsg, RtnMsgNo));
                //}
            }
            return(resp);
        }
Beispiel #13
0
        protected override VoucherBaseResp Execute(VoucherBaseReq baseReq)
        {
            var           newObj      = baseReq as VoucherOOReq; // 强制转换
            VoucherOOResp resp        = new VoucherOOResp();
            string        databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"];

            using (OracleConnection dbConn = new OracleConnection(databasedws))
            {
                dbConn.Open();
                OracleCommand oralceComm = new OracleCommand("PG_VOUCHER_OO.SP_VOUCHER_OO", dbConn); //调用存储过程的方法
                oralceComm.CommandType = CommandType.StoredProcedure;                                //存储过程名称
                try
                {
                    oralceComm.Parameters.Add(new OracleParameter("P_TRANS_TP", OracleType.VarChar)).Value    = newObj.trans_tp;
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHER_NO", OracleType.VarChar)).Value  = newObj.voucher_no;
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHER_QTY", OracleType.VarChar)).Value = newObj.voucher_qty;
                    oralceComm.Parameters.Add(new OracleParameter("P_VOUCHER_BCD", OracleType.VarChar)).Value = newObj.voucher_bcd;
                    try
                    {
                        oralceComm.Parameters.Add(new OracleParameter("P_BIZDT_ORD", OracleType.DateTime)).Value = System.Convert.ToDateTime(newObj.bizdt_ord);
                    }
                    catch
                    {
                        oralceComm.Parameters.Add(new OracleParameter("P_BIZDT_ORD", OracleType.DateTime)).Value = System.DateTime.Now;
                    }

                    //oralceComm.Parameters.Add(new OracleParameter("P_BIZDT_ORD", OracleType.VarChar)).Value = bizdt_ord;
                    oralceComm.Parameters.Add(new OracleParameter("P_NET_NO_ORD", OracleType.VarChar)).Value = newObj.net_no_ord;
                    oralceComm.Parameters.Add(new OracleParameter("P_CUST_NAME", OracleType.VarChar)).Value  = newObj.cust_name;
                    oralceComm.Parameters.Add(new OracleParameter("P_CUST_TEL", OracleType.VarChar)).Value   = newObj.cust_tel;
                    oralceComm.Parameters.Add(new OracleParameter("P_CUST_RMK", OracleType.VarChar)).Value   = newObj.cust_rmk;
                    oralceComm.Parameters.Add(new OracleParameter("P_RMK", OracleType.VarChar)).Value        = newObj.rmk;

                    OracleParameter PRTNtranstp = new OracleParameter("V_TRANS_TP", OracleType.VarChar);
                    PRTNtranstp.Direction = ParameterDirection.Output;
                    PRTNtranstp.Size      = 50;
                    oralceComm.Parameters.Add(PRTNtranstp);
                    OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar);
                    PRtnMsg.Direction = ParameterDirection.Output;
                    PRtnMsg.Size      = 100;
                    oralceComm.Parameters.Add(PRtnMsg);
                    OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar);
                    PRTNMSGNO.Direction = ParameterDirection.Output;
                    PRTNMSGNO.Size      = 50;
                    oralceComm.Parameters.Add(PRTNMSGNO);
                    OracleParameter PRtnVoucherBcd = new OracleParameter("V_VOUCHER_BCD", OracleType.VarChar);
                    PRtnVoucherBcd.Direction = ParameterDirection.Output;
                    PRtnVoucherBcd.Size      = 250;
                    oralceComm.Parameters.Add(PRtnVoucherBcd);
                    OracleParameter PRtnVoucherItem = new OracleParameter("V_VOUCHER_ITEM", OracleType.VarChar);
                    PRtnVoucherItem.Direction = ParameterDirection.Output;
                    PRtnVoucherItem.Size      = 800;
                    oralceComm.Parameters.Add(PRtnVoucherItem);


                    oralceComm.ExecuteNonQuery();

                    resp.RtnTransTp = PRTNtranstp.Value.ToString();
                    resp.RtnMsg     = PRtnMsg.Value.ToString();

                    resp.RtnMsgNo       = PRTNMSGNO.Value.ToString();
                    resp.RtnVoucherBcd  = PRtnVoucherBcd.Value.ToString();
                    resp.RtnVoucherItem = PRtnVoucherItem.Value.ToString();

                    ////成功 存储过程返回 00
                    //if (RtnMsgNo == "1")
                    //{
                    //    //   CheckStatus = "1";
                    //    return "1";
                    //}
                    //else
                    //{
                    //    //  CheckStatus = "0";
                    //    return "0";
                    //}
                }
                catch (Exception e)
                {
                    resp.RtnTransTp = newObj.trans_tp;
                    resp.RtnMsgNo   = "99";
                    // RtnMsg = StoreNo;
                    resp.RtnMsg         = "异常情况:" + e.Message.ToString();
                    resp.RtnVoucherBcd  = "";
                    resp.RtnVoucherItem = "";
                }
            }

            return(resp);
        }