示例#1
0
        protected void AssIgPrint(CMSMData.CMSMStruct.CardHardStruct chs, CMSMData.CMSMStruct.ConsItemStruct cis, CommAccess cs, string strSerialok, DataTable dtIgItem, double dTolCharge)
        {
            Exception err;
            string    strEn = cs.GetEnterpriseName(out err);

            if (err != null)
            {
                MessageBox.Show("查询企业名称出错,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                strEn = "道讯收银";
            }

            DataTable dtNewItem = cs.GetNewGoods(out err);

            if (err != null)
            {
                MessageBox.Show("查询推荐新品出错,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                dtNewItem = new DataTable();
            }
            string strTel = cs.GetTel2(out err);

            if (err != null)
            {
                MessageBox.Show("查询服务电话出错,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                strTel = "";
            }
            DataTable dtConsItem = new DataTable();

            CMSM.Print.ConsTicket pBill = new CMSM.Print.ConsTicket(strSerialok, this.GetColCh(cis.strDeptID, "MD"), cis.strCardID, "当前余额",
                                                                    cis.dChargeLast, chs.dCurCharge,
                                                                    dtConsItem, dTolCharge, 0, "积分兑换", dTolCharge, 0, dtNewItem, strTel, dtIgItem, 0, cis.strOperDate);
            Print(strEn, pBill);
        }
        private void sbtnOrgRead_Click(object sender, System.EventArgs e)
        {
            this.txtiSerial.Text     = "";
            this.txtUnionOutIG.Text  = "";
            this.txtUnionOutFee.Text = "";
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,刷卡失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }

            string strresult = "";

            this.txtOrgAssID.Text     = "";
            this.txtOrgCardID.Text    = "";
            this.txtCurOrgCharge.Text = "";
            this.txtCurOrgIG.Text     = "";

            CMSMStruct.CardHardStruct chs = new CMSMData.CMSMStruct.CardHardStruct();
            chs = cs.ReadCardInfo("", out strresult);
            if (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK))
            {
                if (strresult == CardCommon.CardDef.ConstMsg.RFAUTHENTICATION_A_ERR)
                {
                    MessageBox.Show("该卡不属于本系统使用的卡,请检查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                if (strresult.Substring(0, 2) == "RF")
                {
                    MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("刷卡失败,请重试!\n" + strresult, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }

                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行转出撤消!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                DataTable dsout = new DataTable();
                dsout = cs.GetMaterialOut(chs.strCardID, out err);
                if (dsout != null && dsout.Rows.Count > 0)
                {
                    this.DataTableConvert(dsout, "vcDeptID", "MD", "vcCommCode", "vcCommName");
                }
                else
                {
                    this.sbtnUnionOut.Enabled = false;
                }
                this.txtOrgCardID.Text     = chs.strCardID.ToString();
                this.txtCurOrgCharge.Text  = chs.dCurCharge.ToString();
                this.txtCurOrgIG.Text      = chs.iCurIg.ToString();
                this.dataGrid1.CaptionText = "转出错误明细";
                this.dataGrid1.SetDataBinding(dsout, "");
                this.EnToCh("流水号,会员ID,会员卡号,转出金额,转出积分,操作员,门店,操作日期", "110,60,70,70,70,200,120,160", dsout, this.dataGrid1);
            }
        }
        private void sbtnUnionOut_Click(object sender, System.EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = (DataTable)this.dataGrid1.DataSource;
            if (dt == null || dt.Rows.Count <= 0)
            {
                if (this.txtiSerial.Text.Trim() == "" && this.txtUnionOutFee.Text.Trim() == "" && this.txtUnionOutIG.Text.Trim() == "")
                {
                    MessageBox.Show("选择要撤消的行!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
            }

            try
            {
                CMSMStruct.FillFeeStruct ffsDes = new CMSMData.CMSMStruct.FillFeeStruct();
                DateTime dtNow = DateTime.Now;
                ffsDes.iSerial     = Int64.Parse(this.txtiSerial.Text);
                ffsDes.strAssID    = this.txtAssID.Text.Trim();
                ffsDes.strCardID   = this.txtOrgCardID.Text.Trim();
                ffsDes.dFillFee    = Math.Round(double.Parse(this.txtUnionOutFee.Text), 2);
                ffsDes.dFillProm   = 0;
                ffsDes.dFeeLast    = Math.Round(double.Parse(this.txtCurOrgCharge.Text), 2);
                ffsDes.dIGLast     = Math.Round(double.Parse(this.txtCurOrgIG.Text), 2);
                ffsDes.dFillFee    = Math.Round(double.Parse(this.txtUnionOutFee.Text), 2);
                ffsDes.dFeeCur     = ffsDes.dFeeLast + ffsDes.dFillFee;
                ffsDes.dFillProm   = 0;
                ffsDes.dIG         = Math.Round(double.Parse(this.txtUnionOutIG.Text), 2);
                ffsDes.dIGCur      = ffsDes.dIGLast + ffsDes.dIG;
                ffsDes.strComments = "转出撤消,原流水为:" + ffsDes.iSerial + " ";
                ffsDes.strOperName = SysInitial.CurOps.strOperName;
                ffsDes.strDeptID   = SysInitial.LocalDept;
                ffsDes.strType     = "OP019";
                ffsDes.strFillDate = dtNow.ToString();

                string strresult = "";
                CMSMStruct.CardHardStruct chsDes = new CMSMData.CMSMStruct.CardHardStruct();
                chsDes = cs.ReadCardInfo("", out strresult);
                while (chsDes.strCardID != ffsDes.strCardID)
                {
                    MessageBox.Show("目标卡不正确,请将要撤消的目标卡放在读卡器上。", "请放卡", MessageBoxButtons.OK);
                    return;
                }
                err       = null;
                strresult = cs.CardChargeUnionOutRoll(ffsDes, out err);
                if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.IndexOf("CMT", 0) >= 0)
                {
                    finalflag = false;
                    MessageBox.Show("会员卡转出撤消成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    this.ClearText();
                    this.dataGrid1.DataSource  = null;
                    this.sbtnOrgRead.Enabled   = true;
                    this.sbtnUnionOut.Enabled  = false;
                    this.txtUnionOutIG.Enabled = false;
                }
                else
                {
                    MessageBox.Show("会员卡转出撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    this.ClearText();
                    this.dataGrid1.DataSource  = null;
                    this.sbtnOrgRead.Enabled   = true;
                    this.sbtnUnionOut.Enabled  = false;
                    this.txtUnionOutIG.Enabled = false;
                    if (err != null)
                    {
                        clog.WriteLine(err.ToString() + strresult);
                    }
                    else
                    {
                        clog.WriteLine(strresult);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("会员卡转出撤消失败!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(ex);
            }
        }
示例#4
0
        private void RepeatPrint(string strSerial)
        {
            CommAccess cs = new CommAccess(SysInitial.ConString);
            Exception  err;
            DataTable  dtConsItem = cs.GetConsItemBySerial(out err, strSerial);

            if (err != null)
            {
                MessageBox.Show("查询消费明细出错,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                dtConsItem = new DataTable();
            }

            DataTable dtBill = cs.GetBillBySerial(out err, strSerial);

            if (err != null)
            {
                MessageBox.Show("查询小票信息出错,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                dtBill = new DataTable();
            }
            DataRow dr = dtBill.Rows[0];

            CMSMData.CMSMStruct.ConsItemStruct cis = new CMSMData.CMSMStruct.ConsItemStruct();
            cis.strCardID = dr["vcCardId"].ToString();
            string strConsType = dr["vcConsType"].ToString();

            cis.strConsType = strConsType;
            cis.dTRate      = Convert.ToDouble(dr["nTRate"].ToString());
            cis.dFee        = Convert.ToDouble(dr["nFee"].ToString());
            cis.dPay        = Convert.ToDouble(dr["nPay"].ToString());
            cis.dBalance    = Convert.ToDouble(dr["nBalance"].ToString());
            cis.iIgValue    = Convert.ToInt32(dr["iIgValue"].ToString());
            cis.strOperName = dr["vcOperName"].ToString();
            cis.strOperDate = dr["dtConsDate"].ToString();
            cis.strDeptID   = dr["vcDeptId"].ToString();

            CMSMData.CMSMStruct.CardHardStruct chs = new CMSMData.CMSMStruct.CardHardStruct();

            switch (strConsType)
            {
            case "PT001":                    //会员刷卡
                this.AssConsPrint(chs, cis, cs, strSerial, dtConsItem, cis.dFee);
                break;

            case "PT002":                    //支付现金
                this.RetailConsPrint(cis, cs, strSerial, dtConsItem, cis.dFee, cis.dPay, cis.dBalance, cis.dTRate);
                break;

            case "PT003":                    //积分兑换
                dtConsItem.Columns["Price"].ColumnName = "IgValue";
                dtConsItem.Columns["Fee"].ColumnName   = "IgPay";
                this.AssIgPrint(chs, cis, cs, strSerial, dtConsItem, cis.dFee);
                break;

            case "PT004":                    //赠送商品
                this.AssGiftPrint(chs, cis, cs, strSerial, dtConsItem, cis.dFee);
                break;

            case "PT005":
                this.RetailConsPrint(cis, cs, strSerial, dtConsItem, cis.dFee, cis.dPay, cis.dBalance, cis.dTRate);
                break;

            case "PT006":
                this.RetailConsPrint(cis, cs, strSerial, dtConsItem, cis.dFee, cis.dPay, cis.dBalance, cis.dTRate);
                break;

            case "PT007":
                this.RetailConsPrint(cis, cs, strSerial, dtConsItem, cis.dFee, cis.dPay, cis.dBalance, cis.dTRate);
                break;

            case "PT008":
                this.RetailConsPrint(cis, cs, strSerial, dtConsItem, cis.dFee, cis.dPay, cis.dBalance, cis.dTRate);
                break;
            }
        }