Esempio n. 1
0
        public bool FillParseLine(string strValue, string strSplit, out CMSMStruct.FillFeeStruct ffs, out Exception err)
        {
            int i = 0;

            ffs = new CMSMData.CMSMStruct.FillFeeStruct();
            err = null;
            try
            {
                string[] strFields = strValue.Split(strSplit.ToCharArray());
                ffs.strSerial   = strFields[i++];
                ffs.strAssID    = strFields[i++];
                ffs.strCardID   = strFields[i++];
                ffs.dFillFee    = double.Parse(strFields[i++]);
                ffs.dFillProm   = double.Parse(strFields[i++]);
                ffs.dFeeLast    = double.Parse(strFields[i++]);
                ffs.dFeeCur     = double.Parse(strFields[i++]);
                ffs.strFillDate = strFields[i++];
                ffs.strComments = strFields[i++];
                ffs.strOperName = strFields[i++];
                ffs.strDeptID   = strFields[i++];
            }
            catch (Exception e)
            {
                err = e;
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            //zhh 20100311 print
            //this.dataGrid1[this.dataGrid1.CurrentRowIndex,0].ToString();
            string strAssName     = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 1].ToString();
            string strCardID      = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 3].ToString();
            string strlastBalance = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 6].ToString();
            string strBalance     = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 7].ToString();
            string strPrepay      = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 4].ToString();
            string strDonate      = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 5].ToString();
            string strOperDate    = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 8].ToString();
            string strOperName    = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 9].ToString();
            string strDeptName    = this.dataGrid1[this.dataGrid1.CurrentRowIndex, 10].ToString();

//			CMSM.Print.PrintedBill pBill = new CMSM.Print.PrintedBill();
//			pBill.cnvcBillType = "充值";
//			pBill.cnvcMemberCardNo = strCardID;
//			pBill.cnvcMemberName = strAssName;
//			pBill.cnnLastBalance = Convert.ToDecimal(strlastBalance);
//			pBill.cnnBalance = Convert.ToDecimal(strBalance);
//			pBill.cnnPrepay = Convert.ToDecimal(strPrepay);
//			pBill.cnnDonate = Convert.ToDecimal(strDonate);
//			pBill.cnvcOperName = strOperName;
//			pBill.cndOperDate = Convert.ToDateTime(strOperDate);
//
//			CMSM.Print.PrintEngine printEngine = new CMSM.Print.PrintEngine(SysInitial.CP);
//			printEngine.AddPrintObject(pBill);
//			printEngine.Print();
            //zhh 20100311
            CMSMData.CMSMStruct.FillFeeStruct ffs = new CMSMData.CMSMStruct.FillFeeStruct();
            ffs.strCardID   = strCardID;
            ffs.dFillFee    = Convert.ToDouble(strPrepay);
            ffs.dFillProm   = Math.Round(Double.Parse(strDonate.Trim()), 2);
            ffs.dFeeLast    = Convert.ToDouble(strlastBalance);
            ffs.dFeeCur     = Convert.ToDouble(strBalance);
            ffs.strFillDate = strOperDate;

            this.FillFeePrint(ffs, cs, strAssName, strOperName, strDeptName);
        }
Esempio n. 3
0
        protected void FillFeePrint(CMSMData.CMSMStruct.FillFeeStruct ffs, CommAccess cs, string strAssName, string strOperName, string strDeptName)
        {
            Exception err;

            CMSM.Print.PrintedBill pBill = new CMSM.Print.PrintedBill();
            pBill.cnvcBillType     = "充值";
            pBill.cnvcMemberCardNo = ffs.strCardID;
            pBill.cnvcMemberName   = strAssName;
            pBill.cnnLastBalance   = Convert.ToDecimal(ffs.dFeeLast);
            pBill.cnnBalance       = Convert.ToDecimal(ffs.dFeeCur);
            pBill.cnnPrepay        = Convert.ToDecimal(ffs.dFillFee);
            pBill.cnnDonate        = Convert.ToDecimal(ffs.dFillProm);

            pBill.cnvcOperName = strOperName;
            pBill.cndOperDate  = Convert.ToDateTime(ffs.strFillDate);
            pBill.cnvcDeptName = strDeptName;
            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 = "道讯收银";
            }

            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 = "";
            }
            pBill.cnvcTel = strTel;
            Print(strEn, pBill);
        }
Esempio n. 4
0
 protected void FillFeePrint(CMSMData.CMSMStruct.FillFeeStruct ffs, CommAccess cs, string strAssName)
 {
     FillFeePrint(ffs, cs, strAssName, SysInitial.CurOps.strOperName, this.GetColCh(ffs.strDeptID, "MD"));
 }
Esempio n. 5
0
        private void sbtnFill_Click(object sender, System.EventArgs e)
        {
            string strCardID = txtCardID.Text.Trim();

            if (strCardID == "")
            {
                MessageBox.Show("会员卡号不可为空且小于10位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            if (txtFillFee.Text.Trim() == "")
            {
                MessageBox.Show("充值金额不可为空,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            double dFee = Double.Parse(txtFillFee.Text.Trim());

            if (dFee <= 0)
            {
                MessageBox.Show("充值金额应大于0,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定充值" + dFee.ToString() + "元?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes))
                {
                    err = null;
                    double dFeeLast = Double.Parse(txtCharge.Text.Trim());
                    CMSMStruct.FillFeeStruct ffs = new CMSMData.CMSMStruct.FillFeeStruct();
                    ffs.strAssID  = txtAssID.Text.Trim();
                    ffs.strCardID = strCardID;
                    ffs.dFillFee  = dFee;
                    string promrate = "0";
                    ffs.dFillProm = (double.Parse(txtFillFee.Text.Trim()) * (double.Parse(promrate)) / 100);
                    ffs.dFeeLast  = dFeeLast;
                    ffs.dFeeCur   = System.Math.Round((dFee + ffs.dFillProm + dFeeLast), 2);
                    ffs.strDeptID = SysInitial.CurOps.strDeptID;
                    DateTime dtNow = DateTime.Now;
                    ffs.iSerial     = Int64.Parse(dtNow.ToString("yyyyMMddHHmmss"));
                    ffs.strFillDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString();
                    double dChargeBak = Double.Parse(txtCharge.Text.Trim()) + Double.Parse(txtFillFee.Text.Trim()) + Double.Parse(txtPromFee.Text.Trim());
                    if (ffs.dFeeCur != dChargeBak)
                    {
                        MessageBox.Show("充值失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        clog.WriteLine("充值备份值与计算值不等:备份值-" + dChargeBak.ToString() + " 计算值" + ffs.dFeeCur.ToString());
                        return;
                    }

                    string strresult = cs.FillFeeError(ffs, chs.iCurIg, dChargeBak, out err);
                    if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT")
                    {
                        MessageBox.Show("充值成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                        clog.WriteLine(strresult);
                    }
                    else
                    {
                        MessageBox.Show("充值失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        lblerr.Text    = "充值失败,本次充值无效,请检查余额是否正确!";
                        lblerr.Visible = true;
                        clog.WriteLine(err);
                        clog.WriteLine(strresult);
                    }
                    this.ClearText();
                    txtCardID.ReadOnly    = true;
                    this.sbtnFill.Enabled = false;
                    this.sbtnRead.Enabled = true;
                }
            }
        }
Esempio n. 6
0
        private void btnRemove_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

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

            string strresult = "";

            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 != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", 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;
            }

            if (chs.strCardID != txtCardID.Text.Trim())
            {
                MessageBox.Show("消费撤消卡与首次刷卡不是同一张卡,消费撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                this.ClearText();
                btnRead.Enabled = true;
                return;
            }
            else
            {
                #region 开始消费撤消
                if (this.txtBillNo.Text.Trim() == "")
                {
                    MessageBox.Show("没有任何可以进行撤消的消费记录!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    return;
                }

                CMSMData.CMSMStruct.FillFeeStruct refill = new CMSMData.CMSMStruct.FillFeeStruct();
                refill.strAssID  = this.txtAssID.Text.Trim();
                refill.strCardID = this.txtCardID.Text.Trim();
                refill.dFillFee  = Math.Round(double.Parse(this.txtConsFee.Text.Trim()), 2);
                refill.dFillProm = 0;
                refill.dFeeLast  = Math.Round(double.Parse(this.txtCurCharge.Text.Trim()), 2);
                refill.dFeeCur   = refill.dFillFee + refill.dFeeLast;
                DateTime dtNow = DateTime.Now;
                refill.iSerial     = Int64.Parse(dtNow.ToString("yyyyMMddHHmmss"));
                refill.strFillDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString();
                refill.strComments = "消费撤消,原小票号:" + this.txtBillNo.Text.Trim();
                refill.strOperName = SysInitial.CurOps.strOperName;
                refill.strDeptID   = SysInitial.LocalDept;


                chs.dCurCharge = refill.dFeeCur;
                double dCurChargeBak = System.Math.Round((double.Parse(txtConsFee.Text.Trim()) + double.Parse(txtCurCharge.Text.Trim())), 2);

                if (chs.dCurCharge != dCurChargeBak)
                {
                    MessageBox.Show("消费撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine("消费撤消备份值与计算值不等:备份值-" + dCurChargeBak.ToString() + " 计算值" + chs.dCurCharge.ToString());
                    return;
                }

                err       = null;
                strresult = "";
                strresult = cs.AssConsRemove(this.txtBillNo.Text.Trim(), refill, chs.iCurIg, dCurChargeBak, out err);
                if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT")
                {
                    MessageBox.Show("消费撤消成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    clog.WriteLine(strresult);
                }
                else
                {
                    MessageBox.Show("消费撤消失败,本次消费撤消无效,请检查余额是否正确!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine(err + "\n" + strresult);
                }
                this.ClearText();
                btnRead.Enabled        = true;
                this.btnRemove.Enabled = false;
                DataTable dtConsItem = new DataTable();
                dtConsItem.Columns.Add("GoodsID");
                dtConsItem.Columns.Add("GoodsName");
                dtConsItem.Columns.Add("Price");
                dtConsItem.Columns.Add("Count");
                dtConsItem.Columns.Add("Rate");
                dtConsItem.Columns.Add("Fee");
                dtConsItem.Columns.Add("Comments");
                dtConsItem.Columns["Comments"].DefaultValue = "";
                this.dataGrid1.SetDataBinding(dtConsItem, "");
                this.EnToCh("商品编号,商品名称,单价,数量,折扣金额,应收金额", "80,130,70,50,60,70", dtConsItem, this.dataGrid1);
                #endregion
            }
        }
Esempio n. 7
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            this.progressBarControl1.Position = 0;
            this.listBox1.Items.Clear();
            string filePath = @"E:\\BreadWorksDataBak\\UpLoad\\";
            string UpFileName;

            if (!System.IO.Directory.Exists(filePath))
            {
                System.IO.Directory.CreateDirectory(filePath);
                MessageBox.Show("没有需要上传的资料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string[] fileall = Directory.GetFiles(filePath);
            if (fileall.Length == 0)
            {
                MessageBox.Show("没有需要上传的资料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataTable dtmd = SysInitial.dsSys.Tables["MD"];
            string    strZZ;
            bool      fileflag = false;

            for (int i = 0; i < dtmd.Rows.Count; i++)
            {
                if (dtmd.Rows[i]["vcCommCode"].ToString() != SysInitial.LocalDept)
                {
                    fileflag = false;
                    strZZ    = dtmd.Rows[i]["vcCommCode"].ToString() + ".L00$";
                    Regex regExpr = new Regex(strZZ.ToLower());
                    foreach (string _strFileName in fileall)
                    {
                        FileInfo fileInfo = new FileInfo(_strFileName);

                        if (regExpr.IsMatch(fileInfo.Name.ToLower(), 0))
                        {
                            fileflag = true;
                            break;
                        }
                    }
                }
                if (fileflag)
                {
                    break;
                }
            }
            if (!fileflag)
            {
                MessageBox.Show("没有需要上传的资料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            for (int i = 0; i < dtmd.Rows.Count; i++)
            {
                if (dtmd.Rows[i]["vcCommCode"].ToString() != SysInitial.LocalDept)
                {
                    fileflag = false;
                    strZZ    = dtmd.Rows[i]["vcCommCode"].ToString() + ".L00$";
                    Regex regExpr = new Regex(strZZ.ToLower());
                    foreach (string _strFileName in fileall)
                    {
                        FileInfo fileInfo = new FileInfo(_strFileName);

                        if (regExpr.IsMatch(fileInfo.Name.ToLower(), 0))
                        {
                            fileflag = true;
                            break;
                        }
                    }
                    if (!fileflag)
                    {
                        continue;
                    }

                    this.listBox1.Items.Add("开始上传" + dtmd.Rows[i]["vcCommName"].ToString() + "的数据:");
                    this.listBox1.Items.Add("---------------------------");
                    this.Refresh();
                    UpFileName = "down" + dtmd.Rows[i]["vcCommCode"].ToString() + ".L00";
                    if (System.IO.File.Exists(filePath + UpFileName + ".tmp"))
                    {
                        System.IO.File.Delete(filePath + UpFileName + ".tmp");
                    }
                    ArrayList alUp = new ArrayList();

                    StreamReader fReader;
                    string       strLine;
                    string       strTitle = "";
                    string       strUpFlag;
                    string       strFlag = "NO";
//					int upcount=0;
//					int reTolCount=0;
//					int unitcount=0;
//					int curcount=0;

                    if (System.IO.File.Exists(filePath + UpFileName))
                    {
                        //解密
                        DESEncryptor dese = new DESEncryptor();
                        dese.InputFilePath = filePath + UpFileName;
                        dese.OutFilePath   = filePath + UpFileName + ".tmp";
                        dese.DecryptKey    = "cmsmyykx";
                        dese.FileDesDecrypt();
                        if (dese.NoteMessage != null)
                        {
                            MessageBox.Show("上传文件处理出错,请重试!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.clog.WriteLine(dese.NoteMessage);
                            return;
                        }
                        dese = null;

                        err = null;
                        ca.TruncateDataTmp(out err);

                        fReader = new StreamReader(filePath + UpFileName + ".tmp");
                        while ((strLine = fReader.ReadLine()) != null)
                        {
                            strUpFlag = "";
                            strFlag   = "NO";
                            if (strLine.Trim().Length <= 0)
                            {
                                continue;
                            }

                            //是否单表结束
                            strUpFlag = strLine.Substring(0, 3);
                            if (strUpFlag == "END")
                            {
//								switch(strTitle)
//								{
//									case "USERTOL":
//										this.listBox1.Items.Add("会员资料上传完成,本次上传会员数:" + upcount.ToString());
//										break;
//									case "ALTETOL":
//										this.listBox1.Items.Add("会员资料变更记录上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "CONSTOL":
//										this.listBox1.Items.Add("消费明细上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "INVOTOL":
//										this.listBox1.Items.Add("小票数据上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "INTGTOL":
//										this.listBox1.Items.Add("积分日志上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "FILLTOL":
//										this.listBox1.Items.Add("充值日志上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "BUSSTOL":
//										this.listBox1.Items.Add("营业日志上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									default:
//										break;
//								}
                                if (strTitle == "USERTOL" && !SysInitial.MainDept)
                                {
                                    break;
                                }
                                strTitle = "";
//								upcount=0;
//								curcount=0;
                                continue;
                            }

                            //是否单表开始
                            strUpFlag = strLine.Substring(4, 3);
                            if (strUpFlag == "TOL")
                            {
                                strTitle = strLine.Substring(0, 7);
//								reTolCount=int.Parse(strLine.Substring(8,strLine.Length-8));
//								this.progressBarControl1.Position=0;
//								unitcount=reTolCount/40;
                                continue;
                            }

                            //根据上传表名进行上传
                            switch (strTitle)
                            {
                            case "USERTOL":
                                #region   会员资料
                                CMSMStruct.AssociatorStruct ass = new CMSMData.CMSMStruct.AssociatorStruct();
                                err = null;
                                if (!sts.UserParseLine(strLine, ",", out ass, out err))
                                {
                                    MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    if (err != null)
                                    {
                                        clog.WriteLine(err);
                                    }
                                    continue;
                                }
                                err = null;
                                if (!ca.UpAssData(ass, out strFlag, out err))
                                {
                                    MessageBox.Show("上传数据出错,卡号:" + ass.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    if (err != null)
                                    {
                                        clog.WriteLine(err);
                                    }
                                    continue;
                                }
//									if(strFlag=="YES")
//										upcount++;
//									curcount++;
//									if(curcount<reTolCount)
//									{
//										if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//										{
//											this.progressBarControl1.Position++;
//											this.Refresh();
//										}
//									}
//									else
//									{
//										this.progressBarControl1.Position=40;
//										this.Refresh();
//									}
                                #endregion
                                break;

                            case "ALTETOL":
//									#region 上传会员资料变更记录
//									CMSMStruct.AssChangeStruct asschange=new CMSMData.CMSMStruct.AssChangeStruct();
//									err=null;
//									if(!sts.UserAlterParseLine(strLine,",",out asschange,out err))
//									{
//										MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!","系统提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
//										if(err!=null)
//										{
//											clog.WriteLine(err);
//										}
//										continue;
//									}
//									err=null;
//									if(!ca.UpAssAlterData(asschange,out strFlag,out err))
//									{
//										MessageBox.Show("上传数据出错,卡号:" + asschange.strCardID + " !","系统提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
//										if(err!=null)
//										{
//											clog.WriteLine(err);
//										}
//										continue;
//									}
//									if(strFlag=="YES")
//										upcount++;
//									curcount++;
//									if(curcount<reTolCount)
//									{
//										if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//										{
//											this.progressBarControl1.Position++;
//											this.Refresh();
//										}
//									}
//									else
//									{
//										this.progressBarControl1.Position=40;
//										this.Refresh();
//									}
//									#endregion
                                break;

                            case "CONSTOL":
                                #region   消费明细
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.ConsDownStruct consd = new CMSMData.CMSMStruct.ConsDownStruct();
                                    err = null;
                                    if (!sts.ConsParseLine(strLine, ",", out consd, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpConsData(consd, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + consd.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "INVOTOL":
                                #region   小票数据
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.BillStruct bis = new CMSMData.CMSMStruct.BillStruct();
                                    err = null;
                                    if (!sts.BillParseLine(strLine, ",", out bis, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpBillData(bis, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + bis.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "INTGTOL":
                                #region   积分日志数据
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.IntegralStruct its = new CMSMData.CMSMStruct.IntegralStruct();
                                    err = null;
                                    if (!sts.IntegralParseLine(strLine, ",", out its, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpIntegralData(its, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + its.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "FILLTOL":
                                #region   充值日志数据
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.FillFeeStruct ffs = new CMSMData.CMSMStruct.FillFeeStruct();
                                    err = null;
                                    if (!sts.FillParseLine(strLine, ",", out ffs, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpFillData(ffs, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + ffs.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "BUSSTOL":
                                #region   营业日志
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.BusiLogStruct blogs = new CMSMData.CMSMStruct.BusiLogStruct();
                                    err = null;
                                    if (!sts.BusiLogParseLine(strLine, ",", out blogs, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpBusiLogData(blogs, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + blogs.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;
                            }
                        }
                        fReader.Close();

                        err = null;
                        if (SysInitial.MainDept)
                        {
                            //在总店上传分店数据,包括会员资料,消费,营业日志等等
                            ca.UpAllData(filePath, UpFileName, out err);
                        }
                        else
                        {
                            //在分店上传其它店数据,只上传会员资料
                            ca.UpOtherDeptData(filePath, UpFileName, out err);
                        }

                        System.IO.File.Delete(filePath + UpFileName + ".tmp");
                    }
                    if (err != null)
                    {
                        this.listBox1.Items.Add("上传数据失败,请重试!");
                        this.listBox1.Items.Add(err.ToString());
                        return;
                    }

                    if (System.IO.File.Exists(filePath + UpFileName))
                    {
                        System.IO.File.Delete(filePath + UpFileName);
                    }
                    this.listBox1.Items.Add("\n");
                    this.listBox1.Items.Add("上传数据完成!");
                    this.listBox1.Items.Add("\n");
                    this.listBox1.Items.Add("\n");
                    this.Refresh();
                }
            }
        }
Esempio n. 8
0
        private void sbtnFill_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,充值失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                this.ClearText();
                txtCardID.ReadOnly       = true;
                this.txtFillFee.ReadOnly = true;
                this.sbtnFill.Enabled    = false;
                this.sbtnRead.Enabled    = true;
                this.chkIsBank.Checked   = false;
                return;
            }

            string strCardID = txtCardID.Text.Trim();

            if (strCardID == "")
            {
                MessageBox.Show("会员卡号不可为空且小于10位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            if (txtFillFee.Text.Trim() == "")
            {
                MessageBox.Show("充值金额不可为空,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            double dFee = Double.Parse(txtFillFee.Text.Trim());

            if (dFee <= 0)
            {
                MessageBox.Show("充值金额应大于0,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定充值" + dFee.ToString() + "元?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes))
                {
                    err = null;
                    double dFeeLast = double.Parse(txtCharge.Text.Trim());
                    int    iIgLast  = int.Parse(this.txtIg.Text.Trim());
                    CMSMStruct.FillFeeStruct ffs = new CMSMData.CMSMStruct.FillFeeStruct();
                    ffs.strAssID  = txtAssID.Text.Trim();
                    ffs.strCardID = strCardID;
                    ffs.dFillFee  = dFee;
                    string strAssType = this.txtAssType.Text.Trim();
                    string promrate   = "0";
                    promrate = this.GetPromrate(ffs.dFillFee).ToString();

                    int cc = (int)decimal.Parse(txtFillFee.Text.Trim());
                    int dd = ((int)decimal.Parse(txtFillFee.Text.Trim()) * (int.Parse(promrate)) / 100);
                    ffs.dFillProm = ((int)decimal.Parse(txtFillFee.Text.Trim()) * (int.Parse(promrate)) / 100);
                    ffs.dFeeLast  = dFeeLast;
                    ffs.dFeeCur   = System.Math.Round((dFee + dFeeLast), 2) + System.Math.Round((ffs.dFillProm), 0);
                    double bb = System.Math.Round((ffs.dFillProm), 0);
                    double aa = ffs.dFeeCur;
                    ffs.strDeptID = SysInitial.CurOps.strDeptID;
                    DateTime dtNow = DateTime.Now;
                    ffs.strFillDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString();
                    ffs.iSerial     = Int64.Parse(dtNow.ToString("yyyyMMddHHmmss"));
                    //ffs.iSerial = Int64.Parse(ffs.strFillDate.Substring(0, 4) + ffs.strFillDate.Substring(5, 2) + ffs.strFillDate.Substring(8, 2) + ffs.strFillDate.Substring(11, 2) + ffs.strFillDate.Substring(14, 2) + ffs.strFillDate.Substring(17, 2));
                    if (chkIsBank.Checked)
                    {
                        ffs.strComments = "银行卡";
                    }
                    else
                    {
                        ffs.strComments = "";
                    }

                    double dChargeBak = System.Math.Round((Double.Parse(txtCharge.Text.Trim()) + Double.Parse(txtFillFee.Text.Trim()) + Double.Parse(txtPromFee.Text.Trim())), 2);
                    if (ffs.dFeeCur != dChargeBak)
                    {
                        MessageBox.Show("充值失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        clog.WriteLine("充值备份值与计算值不等:备份值-" + dChargeBak.ToString() + " 计算值" + ffs.dFeeCur.ToString());
                        return;
                    }

                    string strresult = cs.FillFee(ffs, int.Parse(this.txtIg.Text.Trim()), dChargeBak, this.txtZeroFlag.Text.Trim(), out err);
                    if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT")
                    {
                        System.Windows.Forms.DialogResult diaRes1 = MessageBox.Show("充值成功!是否打印?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                        if (diaRes1.Equals(System.Windows.Forms.DialogResult.Yes))
                        {
                            this.FillFeePrint(ffs, cs, this.txtAssName.Text);
                            this.OpenDrawer();
                        }

                        //zhh 20100311
                        clog.WriteLine(strresult);
                    }
                    else
                    {
                        MessageBox.Show("充值失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        lblerr.Text    = "充值失败,本次充值无效,请检查余额是否正确!";
                        lblerr.Visible = true;
                        clog.WriteLine(err);
                        clog.WriteLine(strresult);
                    }
                    this.ClearText();
                    txtCardID.ReadOnly       = true;
                    this.txtFillFee.ReadOnly = true;
                    this.sbtnFill.Enabled    = false;
                    this.sbtnRead.Enabled    = true;
                    this.chkIsBank.Checked   = false;
                }
            }
        }
        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);
            }
        }
Esempio n. 10
0
        private void btnRemove_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

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

            string strresult = "";

            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 != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", 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;
            }

            if (chs.strCardID != txtCardID.Text.Trim())
            {
                MessageBox.Show("充值撤消卡与首次刷卡不是同一张卡,充值撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                this.ClearText();
                btnRead.Enabled = true;
                return;
            }
            else
            {
                #region 开始充值撤消
                if (this.txtFillSerial.Text.Trim() == "")
                {
                    MessageBox.Show("没有任何可以进行撤消的充值记录!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    return;
                }

                CMSMData.CMSMStruct.FillFeeStruct refill = new CMSMData.CMSMStruct.FillFeeStruct();
                refill.strAssID    = this.txtAssID.Text.Trim();
                refill.strCardID   = this.txtCardID.Text.Trim();
                refill.dFillFee    = Math.Round(-double.Parse(this.txtFillFee.Text.Trim()), 2);
                refill.dFillProm   = Math.Round(-double.Parse(this.txtPromFee.Text.Trim()), 2);
                refill.dFeeLast    = Math.Round(double.Parse(this.txtCurCharge.Text.Trim()), 2);
                refill.dFeeCur     = refill.dFillFee + refill.dFeeLast + refill.dFillProm;
                refill.strFillDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();
                refill.strComments = "充值撤消,原流水号:" + this.txtFillSerial.Text.Trim();
                refill.strOperName = SysInitial.CurOps.strOperName;
                refill.strDeptID   = SysInitial.LocalDept;
                refill.strSerial   = this.txtFillSerial.Text.Trim();
                if (refill.dFeeCur < 0)
                {
                    MessageBox.Show("撤消后余额已经小于0,充值撤消失败,请检查是否已经有消费,再重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }

                chs.dCurCharge = refill.dFeeCur;
                double dCurChargeBak = System.Math.Round(double.Parse(txtCurCharge.Text.Trim()) - double.Parse(this.txtFillFee.Text.Trim()) - double.Parse(this.txtPromFee.Text.Trim()), 2);

                if (chs.dCurCharge != dCurChargeBak)
                {
                    MessageBox.Show("充值撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine("充值撤消备份值与计算值不等:备份值-- " + dCurChargeBak.ToString() + " 计算值-- " + chs.dCurCharge.ToString());
                    return;
                }

                err       = null;
                strresult = "";
                strresult = cs.AssFillRemove(refill, chs.iCurIg, dCurChargeBak, strOldDate, out err);
                if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT")
                {
                    MessageBox.Show("充值撤消成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    clog.WriteLine(strresult);
                }
                else
                {
                    MessageBox.Show("充值撤消失败,本次充值撤消无效,请检查余额是否正确!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine(err + "\n" + strresult);
                }
                this.ClearText();
                btnRead.Enabled        = true;
                this.btnRemove.Enabled = false;
                #endregion
            }
        }